レビュー指摘事項修正

This commit is contained in:
野間 2023-06-15 17:38:29 +09:00
parent dbf7a98e66
commit abe13984a2
16 changed files with 90 additions and 117 deletions

View File

@ -22,6 +22,6 @@ AWS_REGION=ap-northeast-1
AUTHORIZE_ENDPOINT=oauth2/authorize
TOKEN_ENDPOINT=oauth2/token
BIO_SEARCH_RESULT_MAX_COUNT=35000
SEARCH_RESULT_MAX_COUNT=500
UTL_SEARCH_RESULT_MAX_COUNT=500
SESSION_EXPIRE_MINUTE=20
LOG_LEVEL=DEBUG

View File

@ -5,7 +5,7 @@ from fastapi import APIRouter, Depends, Request
from src.depends.services import get_service
from src.model.internal.session import UserSession
from src.model.request.ultmarc_doctor import (UltmarcDoctorInfoModel,
UltmarcDoctorModel)
UltmarcDoctorSearchModel)
from src.model.request.ultmarc_inst import (UltmarcInstInfoModel,
UltmarcInstModel)
from src.router.session_router import AuthenticatedRoute
@ -29,7 +29,7 @@ def ultmarc_inst_view(
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
# 検索項目の取得(都道府県・施設区分)
@ -63,15 +63,15 @@ def search_inst(
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# is_batch_processing = batch_status_service.is_batch_processing()
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
# 施設データを検索
ultmarc_inst_data = ultmarc_service.search_inst_data(ultmarc_inst_form)
# 検索項目の取得(都道府県・施設区分)
ultmarc = ultmarc_service.ultmarc_inst_view(session)
ultmarc.is_batch_processing = batch_status_service.is_batch_processing()
ultmarc.is_batch_processing = is_batch_processing
ultmarc.inst_data = ultmarc_inst_data
ultmarc.form_data = ultmarc_inst_form
@ -101,19 +101,19 @@ def ultmarc_inst_info_view(
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
# 施設情報の取得
ultmarc = ultmarc_service.info_ultmarc_inst_view(id, session)
# バッチ起動判定の取得
ultmarc.is_batch_processing = is_batch_processing
# instId
ultmarc.instId = id
# inst_id
ultmarc.inst_id = id
# ページ総数(件数)
ultmarc.postCnt = 1
ultmarc.post_cnt = 1
# ページ数表示するページNo
ultmarc.pageNum = 0
ultmarc.page_num = 0
# セッション書き換え
session.update(
@ -141,22 +141,22 @@ def ultmarc_inst_info_search(
batch_status_service: BatchStatusService = Depends(get_service(BatchStatusService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
instId = ultmarc_inst_form.instId.split(',')
inst_id = ultmarc_inst_form.inst_id.split(',')
# 施設情報の取得
ultmarc = ultmarc_service.info_ultmarc_inst_view(instId[ultmarc_inst_form.pageNum], session)
ultmarc = ultmarc_service.info_ultmarc_inst_view(inst_id[ultmarc_inst_form.page_num], session)
# バッチ起動判定の取得
ultmarc.is_batch_processing = is_batch_processing
# InstId
ultmarc.instId = ultmarc_inst_form.instId
# inst_id
ultmarc.inst_id = ultmarc_inst_form.inst_id
# ページ総数(件数)
ultmarc.postCnt = len(instId)
ultmarc.post_cnt = len(inst_id)
# ページ数表示するページNo
ultmarc.pageNum = ultmarc_inst_form.pageNum
ultmarc.page_num = ultmarc_inst_form.page_num
# セッション書き換え
session.update(
@ -183,7 +183,7 @@ def ultmarc_doctor_view(
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
# 検索項目の取得(都道府県)
@ -211,13 +211,13 @@ def ultmarc_doctor_view(
@router.post('/docSearch')
def search_doc(
request: Request,
ultmarc_doctor_form: Optional[UltmarcDoctorModel] = Depends(UltmarcDoctorModel.as_form),
ultmarc_doctor_form: Optional[UltmarcDoctorSearchModel] = Depends(UltmarcDoctorSearchModel.as_form),
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService)),
batch_status_service: BatchStatusService = Depends(get_service(BatchStatusService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
# is_batch_processing = batch_status_service.is_batch_processing()
# 医師データを検索
@ -255,19 +255,19 @@ def ultmarc_doctor_info_view(
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
# 医師情報の取得
ultmarc = ultmarc_service.info_ultmarc_doctor_view(id, session)
# バッチ起動判定の取得
ultmarc.is_batch_processing = is_batch_processing
# DocId
ultmarc.DocId = id
# doc_id
ultmarc.doc_id = id
# ページ総数(件数)
ultmarc.postCnt = 1
ultmarc.post_cnt = 1
# ページ数表示するページNo
ultmarc.pageNum = 0
ultmarc.page_num = 0
# セッション書き換え
session.update(
@ -295,21 +295,21 @@ def ultmarc_doctor_info_search(
batch_status_service: BatchStatusService = Depends(get_service(BatchStatusService))
):
session: UserSession = request.session
# バッチ処理中の場合、機能を利用させない
# バッチ処理中ステータスを取得
is_batch_processing = batch_status_service.is_batch_processing()
docId = ultmarc_doctor_form.docId.split(',')
doc_id = ultmarc_doctor_form.doc_id.split(',')
# 医師情報の取得
ultmarc = ultmarc_service.info_ultmarc_doctor_view(docId[ultmarc_doctor_form.pageNum], session)
ultmarc = ultmarc_service.info_ultmarc_doctor_view(doc_id[ultmarc_doctor_form.page_num], session)
# バッチ起動判定の取得
ultmarc.is_batch_processing = is_batch_processing
# DocId
ultmarc.DocId = ultmarc_doctor_form.docId
# doc_id
ultmarc.doc_id = ultmarc_doctor_form.doc_id
# ページ総数(件数)
ultmarc.postCnt = len(docId)
ultmarc.post_cnt = len(doc_id)
# ページ数表示するページNo
ultmarc.pageNum = ultmarc_doctor_form.pageNum
ultmarc.page_num = ultmarc_doctor_form.page_num
# セッション書き換え
session.update(

View File

@ -7,7 +7,7 @@ from src.util.sanitize import sanitize
@sanitize
class UltmarcDoctorModel(BaseModel):
class UltmarcDoctorSearchModel(BaseModel):
dcf_pcf_dr_cd: Optional[str]
dr_name: Optional[str]
dr_name_kana: Optional[str]
@ -52,17 +52,17 @@ class UltmarcDoctorModel(BaseModel):
class UltmarcDoctorInfoModel(BaseModel):
docId: Optional[str]
pageNum: Optional[int]
doc_id: Optional[str]
page_num: Optional[int]
@classmethod
def as_form(
cls,
docId: str = Form(None),
pageNum: str = Form(None)
doc_id: str = Form(None),
page_num: str = Form(None)
):
return cls(
docId=docId,
pageNum=int(pageNum)
doc_id=doc_id,
page_num=int(page_num)
)

View File

@ -45,17 +45,17 @@ class UltmarcInstModel(BaseModel):
class UltmarcInstInfoModel(BaseModel):
instId: Optional[str]
pageNum: Optional[int]
inst_id: Optional[str]
page_num: Optional[int]
@classmethod
def as_form(
cls,
instId: str = Form(None),
pageNum: str = Form(None)
inst_id: str = Form(None),
page_num: str = Form(None)
):
return cls(
instId=instId,
pageNum=int(pageNum)
inst_id=inst_id,
page_num=int(page_num)
)

View File

@ -23,9 +23,9 @@ class UltmarcDoctorInfoViewModel(BaseModel):
specialist_license_data: Optional[list[UltmarcSpecialistLicenseDBModel]]
doctor_wrkplace_data: Optional[list[UltmarcDoctorWrkplaceDBModel]]
doctor_wrkplace_his_data: Optional[list[UltmarcDoctorWrkplaceHisDBModel]]
DocId: Optional[str]
postCnt: Optional[int]
pageNum: Optional[int]
doc_id: Optional[str]
post_cnt: Optional[int]
page_num: Optional[int]
# 医師コード
def is_input_dcf_pcf_dr_cd(self):
@ -64,16 +64,16 @@ class UltmarcDoctorInfoViewModel(BaseModel):
return self.doctor_info_data.estab_y or ''
# 現在のページ(表示用)
def is_pageNum_view(self):
return self.pageNum + 1
def is_page_num_view(self):
return self.page_num + 1
# 前ボタン
def is_disabled_prev(self):
return 'disabled' if self.pageNum == 0 else ''
return 'disabled' if self.page_num == 0 else ''
# 次ボタン
def is_disabled_next(self):
if self.pageNum == self.postCnt - 1:
if self.page_num == self.post_cnt - 1:
return 'disabled'
return ''
@ -101,16 +101,10 @@ class UltmarcDoctorInfoViewModel(BaseModel):
return len(self.doctor_data) == 0
def is_data_overflow_max_length(self):
return len(self.doctor_data) >= environment.SEARCH_RESULT_MAX_COUNT
return len(self.doctor_data) >= environment.UTL_SEARCH_RESULT_MAX_COUNT
def _format_date_string(self, date_string):
if date_string is None:
return ''
date_str = datetime.strptime(date_string, '%Y%m%d')
return date_str.strftime('%Y/%m/%d')
def _selected_value(self, form_value: str, current_value: str):
return 'selected' if form_value == current_value else ''
def is_octor_wrkplace_data_count(self):
return len(self.doctor_wrkplace_data)

View File

@ -1,12 +1,11 @@
import json
from datetime import datetime
from typing import Optional
from pydantic import BaseModel
from src.model.db.prefc_master import PrefcMasterModel
from src.model.db.ultmarc_doctor import UltmarcDoctorDBModel
from src.model.request.ultmarc_doctor import UltmarcDoctorModel
from src.model.request.ultmarc_doctor import UltmarcDoctorSearchModel
from src.system_var import environment
@ -15,7 +14,7 @@ class UltmarcDoctorViewModel(BaseModel):
is_batch_processing: Optional[bool]
prefc_models: list[PrefcMasterModel]
doctor_data: Optional[list[UltmarcDoctorDBModel]] = []
form_data: Optional[UltmarcDoctorModel]
form_data: Optional[UltmarcDoctorSearchModel]
def ultmarc_data_json_str(self):
def date_handler(obj):
@ -103,13 +102,7 @@ class UltmarcDoctorViewModel(BaseModel):
return len(self.doctor_data) == 0
def is_data_overflow_max_length(self):
return len(self.doctor_data) >= environment.SEARCH_RESULT_MAX_COUNT
def _format_date_string(self, date_string):
if date_string is None:
return ''
date_str = datetime.strptime(date_string, '%Y%m%d')
return date_str.strftime('%Y/%m/%d')
return len(self.doctor_data) >= environment.UTL_SEARCH_RESULT_MAX_COUNT
def _selected_value(self, form_value: str, current_value: str):
return 'selected' if form_value == current_value else ''

View File

@ -13,14 +13,9 @@ class UltmarcInstInfoViewModel(BaseModel):
inst_info_data: Optional[UltmarcInstInfoDBModel]
inst_trt_coursed_data: Optional[list[UltmarcInstTrtCourseDBModel]]
doctor_wrkplace_count: Optional[int]
instId: Optional[str]
postCnt: Optional[int]
pageNum: Optional[int]
# def ultmarc_data_json_str(self):
# def date_handler(obj):
# return obj.isoformat() if hasattr(obj, 'isoformat') else obj
# return json.dumps([model.dict() for model in self.doctor_data], ensure_ascii=False, default=date_handler)
inst_id: Optional[str]
post_cnt: Optional[int]
page_num: Optional[int]
# 施設コード
def is_input_dcf_dsf_inst_cd(self):
@ -225,16 +220,16 @@ class UltmarcInstInfoViewModel(BaseModel):
return 'disabled' if self.doctor_wrkplace_count == 0 else ''
# 現在のページ(表示用)
def is_pageNum_view(self):
return self.pageNum + 1
def is_page_num_view(self):
return self.page_num + 1
# 前ボタン
def is_disabled_prev(self):
return 'disabled' if self.pageNum == 0 else ''
return 'disabled' if self.page_num == 0 else ''
# 次ボタン
def is_disabled_next(self):
if self.pageNum == self.postCnt - 1:
if self.page_num == self.post_cnt - 1:
return 'disabled'
return ''
@ -257,4 +252,4 @@ class UltmarcInstInfoViewModel(BaseModel):
return len(self.doctor_data) == 0
def is_data_overflow_max_length(self):
return len(self.doctor_data) >= environment.SEARCH_RESULT_MAX_COUNT
return len(self.doctor_data) >= environment.UTL_SEARCH_RESULT_MAX_COUNT

View File

@ -1,5 +1,4 @@
import json
from datetime import datetime
from typing import Optional
from pydantic import BaseModel
@ -103,13 +102,7 @@ class UltmarcInstViewModel(BaseModel):
return len(self.inst_data) == 0
def is_data_overflow_max_length(self):
return len(self.inst_data) >= environment.SEARCH_RESULT_MAX_COUNT
def _format_date_string(self, date_string):
if date_string is None:
return ''
date_str = datetime.strptime(date_string, '%Y%m%d')
return date_str.strftime('%Y/%m/%d')
return len(self.inst_data) >= environment.UTL_SEARCH_RESULT_MAX_COUNT
def _selected_value(self, form_value: str, current_value: str):
return 'selected' if form_value == current_value else ''

View File

@ -2,7 +2,7 @@ from src.db import sql_condition as condition
from src.db.sql_condition import SQLCondition
from src.model.db.ultmarc_doctor import UltmarcDoctorDBModel
from src.model.db.ultmarc_doctor_info import UltmarcDoctorInfoDBModel
from src.model.request.ultmarc_doctor import UltmarcDoctorModel
from src.model.request.ultmarc_doctor import UltmarcDoctorSearchModel
from src.repositories.base_repository import BaseRepository
from src.util.string_util import is_not_empty
@ -43,11 +43,11 @@ class UltmarcDoctorRepository(BaseRepository):
\
"""
def fetch_many(self, parameter: UltmarcDoctorModel) -> list[UltmarcDoctorDBModel]:
def fetch_many(self, parameter: UltmarcDoctorSearchModel) -> list[UltmarcDoctorDBModel]:
try:
self._database.connect()
# 文字列の検索を部分一致にするため、モデルをコピー。以降はこのコピーを使用する。
clone_parameter = UltmarcDoctorModel(**parameter.dict())
clone_parameter = UltmarcDoctorSearchModel(**parameter.dict())
where_clause = self.__build_condition(clone_parameter)
query = self.FETCH_SQL.format(where_clause=where_clause)
result = self._database.execute_select(query, clone_parameter.dict())
@ -61,7 +61,7 @@ class UltmarcDoctorRepository(BaseRepository):
finally:
self._database.disconnect()
def __build_condition(self, parameter: UltmarcDoctorModel):
def __build_condition(self, parameter: UltmarcDoctorSearchModel):
where_clauses: list[SQLCondition] = []
# 医師コード

View File

@ -1,6 +1,6 @@
from src.aws.aws_api_client import AWSAPIClient
from src.model.internal.session import UserSession
from src.model.request.ultmarc_doctor import UltmarcDoctorModel
from src.model.request.ultmarc_doctor import UltmarcDoctorSearchModel
from src.model.request.ultmarc_inst import UltmarcInstModel
from src.model.view.ultmarc_doctor_info_view_model import \
UltmarcDoctorInfoViewModel
@ -119,7 +119,7 @@ class UltmarcViewService(BaseService):
)
return ultmarc
def search_doctor_data(self, search_params: UltmarcDoctorModel):
def search_doctor_data(self, search_params: UltmarcDoctorSearchModel):
# 医師データを検索
ultmarc_doctor_data = self.ultmarc_doctor_repository.fetch_many(parameter=search_params)
return ultmarc_doctor_data

View File

@ -19,7 +19,7 @@ DB_PASSWORD = os.environ['DB_PASSWORD']
DB_SCHEMA = os.environ['DB_SCHEMA']
BIO_SEARCH_RESULT_MAX_COUNT = int(os.environ['BIO_SEARCH_RESULT_MAX_COUNT'])
SEARCH_RESULT_MAX_COUNT = int(os.environ['SEARCH_RESULT_MAX_COUNT'])
UTL_SEARCH_RESULT_MAX_COUNT = int(os.environ['UTL_SEARCH_RESULT_MAX_COUNT'])
SESSION_EXPIRE_MINUTE = int(os.environ['SESSION_EXPIRE_MINUTE'])
LOG_LEVEL = os.environ.get('LOG_LEVEL', 'INFO')

View File

@ -18,12 +18,12 @@
$(function(){
// 前ページ遷移処理
$('#prev').click(function(){
$('#pageNum').val(Number($('#pageNum').val()) - 1);
$('#page_num').val(Number($('#page_num').val()) - 1);
$('#instInfo').submit();
});
// 次ページ遷移処理
$('#next').click(function(){
$('#pageNum').val(Number($('#pageNum').val()) + 1);
$('#page_num').val(Number($('#page_num').val()) + 1);
$('#instInfo').submit();
});
});
@ -47,13 +47,13 @@
<table class="instHeaderTable">
<tr>
<form id="instInfo" name="instInfo" method="post" action="/ultmarc/docInfo">
<input type="hidden" name="docId" value="{{ultmarc.DocId}}">
<input type="hidden" name="pageNum" id="pageNum" value="{{ultmarc.pageNum}}">
<input type="hidden" name="doc_id" value="{{ultmarc.doc_id}}">
<input type="hidden" name="page_num" id="page_num" value="{{ultmarc.page_num}}">
<td class="instHeaderTd">
<input type="button" name="prev" id="prev" value="前" class="transitionBt" {{ultmarc.is_disabled_prev()}}>
</td>
<td class="instHeaderTd">
{{ultmarc.is_pageNum_view()}}{{ultmarc.postCnt}}
{{ultmarc.is_page_num_view()}}{{ultmarc.post_cnt}}
</td>
<td class="instHeaderTd">
<input type="button" name="next" id="next" value="次" class="transitionBt" {{ultmarc.is_disabled_next()}}>
@ -209,7 +209,6 @@
</tr>
{% endif %}
{% endfor %}
<!-- if ultmarc.is_octor_wrkplace_data_count == 0 -->
{% for doctor_wrkplace_his_data in ultmarc.doctor_wrkplace_his_data %}
{% if ultmarc.is_data_string_empty_fromat(doctor_wrkplace_his_data.dcf_dsf_inst_cd) != ''%}
<tr>
@ -225,7 +224,6 @@
</tr>
{% endif %}
{% endfor %}
<!-- endif -->
</tbody>
</table>
</div>

View File

@ -114,8 +114,8 @@
<form id="doctor_info" class="_form" name="result" action="/ultmarc/docInfo" method="POST" onsubmit="CheckBoxListPocessing()">
<input type="button" name="allon" onclick="allOn()" value="全選択" class="ult_bt allOnOffButton" />
<input type="button" name="alloff" onclick="allOff()" value="全解除" class="ult_bt allOnOffButton" />
<input type="hidden" name="docId" id="docId" value="">
<input type="hidden" name="pageNum" value="0">
<input type="hidden" name="doc_id" id="doc_id" value="">
<input type="hidden" name="page_num" value="0">
<!--検索件数-->
<!--ページネーション-->
<div id="light-pagination" class="pagination"></div>
@ -242,7 +242,7 @@
$('input[name="data"]:checked').each(function() {
vals.push( $(this).val() ); // 配列に値を追加
});
$("#docId").val(vals.join(','));
$("#doc_id").val(vals.join(','));
}
</script>
</body>

View File

@ -18,12 +18,12 @@
$(function(){
// 前ページ遷移処理
$('#prev').click(function(){
$('#pageNum').val(Number($('#pageNum').val()) - 1);
$('#page_num').val(Number($('#page_num').val()) - 1);
$('#instInfo').submit();
});
// 次ページ遷移処理
$('#next').click(function(){
$('#pageNum').val(Number($('#pageNum').val()) + 1);
$('#page_num').val(Number($('#page_num').val()) + 1);
$('#instInfo').submit();
});
});
@ -48,13 +48,13 @@
</td>
</form>
<form id="instInfo" name="instInfo" method="post" action="/ultmarc/instInfo">
<input type="hidden" name="instId" value="{{ultmarc.instId}}">
<input type="hidden" name="pageNum" id="pageNum" value="{{ultmarc.pageNum}}">
<input type="hidden" name="inst_id" value="{{ultmarc.inst_id}}">
<input type="hidden" name="page_num" id="page_num" value="{{ultmarc.page_num}}">
<td class="instHeaderTd">
<input type="button" name="prev" id="prev" value="前" class="transitionBt" {{ultmarc.is_disabled_prev()}}>
</td>
<td class="instHeaderTd">
{{ultmarc.is_pageNum_view()}}{{ultmarc.postCnt}}
{{ultmarc.is_page_num_view()}}{{ultmarc.post_cnt}}
</td>
<td class="instHeaderTd">
<input type="button" name="next" id="next" value="次" class="transitionBt" {{ultmarc.is_disabled_next()}}>

View File

@ -114,8 +114,8 @@
<form class="_form" name="result" action="/ultmarc/instInfo" method="POST" onsubmit="CheckBoxListPocessing()">
<input type="button" name="allon" onclick="allOn()" value="全選択" class="ult_bt allOnOffButton">
<input type="button" name="alloff" onclick="allOff()" value="全解除" class="ult_bt allOnOffButton">
<input type="hidden" name="instId" id="instId" value="">
<input type="hidden" name="pageNum" value="0">
<input type="hidden" name="inst_id" id="inst_id" value="">
<input type="hidden" name="page_num" value="0">
<!--検索件数-->
<!--ページネーション-->
<div id="light-pagination" class="pagination"></div>
@ -236,7 +236,7 @@
$('input[name="data"]:checked').each(function() {
vals.push( $(this).val() ); // 配列に値を追加
});
$("#instId").val(vals.join(','));
$("#inst_id").val(vals.join(','));
}
</script>
</body>

View File

@ -4,4 +4,4 @@ AUTHORIZE_ENDPOINT=oauth2/authorize
TOKEN_ENDPOINT=oauth2/token
BIO_SEARCH_RESULT_MAX_COUNT=35000
SESSION_EXPIRE_MINUTE=20
SEARCH_RESULT_MAX_COUNT=500
UTL_SEARCH_RESULT_MAX_COUNT=500