施設検索画面(実装完了)
This commit is contained in:
parent
91f47d4fa4
commit
227f79932c
@ -7,6 +7,7 @@ from starlette import status
|
||||
from src.depends.services import get_service
|
||||
from src.model.internal.session import UserSession
|
||||
from src.model.request.ultmarc_doctor import UltmarcDoctorModel, UltmarcDoctorInfoModel
|
||||
from src.model.request.ultmarc_inst import UltmarcInstModel
|
||||
from src.router.session_router import AuthenticatedRoute
|
||||
from src.services.batch_status_service import BatchStatusService
|
||||
from src.services.ultmarc_view_service import UltmarcViewService
|
||||
@ -22,6 +23,81 @@ router.route_class = AuthenticatedRoute
|
||||
#########################
|
||||
|
||||
|
||||
@router.get('/instSearch')
|
||||
def ultmarc_inst_view(
|
||||
request: Request,
|
||||
batch_status_service: BatchStatusService = Depends(get_service(BatchStatusService)),
|
||||
ultmarc_service: UltmarcViewService = Depends(get_service(UltmarcViewService))
|
||||
):
|
||||
session: UserSession = request.session
|
||||
# バッチ処理中の場合、機能を利用させない
|
||||
is_batch_processing = batch_status_service.is_batch_processing()
|
||||
|
||||
# if batch_status_service.is_batch_processing():
|
||||
# raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_BATCH_PROCESSING)
|
||||
|
||||
# 検索項目の取得(都道府県・施設区分)
|
||||
ultmarc = ultmarc_service.ultmarc_inst_view(session)
|
||||
ultmarc.is_batch_processing = is_batch_processing
|
||||
|
||||
# セッション書き換え
|
||||
session.update(
|
||||
actions=[
|
||||
UserSession.last_access_time.set(UserSession.new_last_access_time()),
|
||||
UserSession.record_expiration_time.set(UserSession.new_record_expiration_time()),
|
||||
]
|
||||
)
|
||||
session_key = set_session(session)
|
||||
templates_response = templates.TemplateResponse(
|
||||
'instSearch.html', {
|
||||
'request': request,
|
||||
'ultmarc': ultmarc,
|
||||
},
|
||||
headers={'session_key': session_key}
|
||||
)
|
||||
return templates_response
|
||||
|
||||
|
||||
@router.post('/instSearch')
|
||||
def search_inst(
|
||||
request: Request,
|
||||
ultmarc_inst_form: Optional[UltmarcInstModel] = Depends(UltmarcInstModel.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()
|
||||
# if batch_status_service.is_batch_processing():
|
||||
# raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_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.inst_data = ultmarc_inst_data
|
||||
ultmarc.form_data = ultmarc_inst_form
|
||||
|
||||
# セッション書き換え
|
||||
session.update(
|
||||
actions=[
|
||||
UserSession.last_access_time.set(UserSession.new_last_access_time()),
|
||||
UserSession.record_expiration_time.set(UserSession.new_record_expiration_time()),
|
||||
]
|
||||
)
|
||||
session_key = set_session(session)
|
||||
templates_response = templates.TemplateResponse(
|
||||
'instSearch.html', {
|
||||
'request': request,
|
||||
'ultmarc': ultmarc,
|
||||
},
|
||||
headers={'session_key': session_key}
|
||||
)
|
||||
return templates_response
|
||||
|
||||
|
||||
@router.get('/docSearch')
|
||||
def ultmarc_doctor_view(
|
||||
request: Request,
|
||||
@ -35,7 +111,7 @@ def ultmarc_doctor_view(
|
||||
# if batch_status_service.is_batch_processing():
|
||||
# raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_BATCH_PROCESSING)
|
||||
|
||||
# # 検索項目の取得
|
||||
# 検索項目の取得(都道府県)
|
||||
ultmarc = ultmarc_service.prepare_ultmarc_doctor_view(session)
|
||||
ultmarc.is_batch_processing = is_batch_processing
|
||||
|
||||
|
||||
8
ecs/jskult-webapp/src/model/db/inst_div_master.py
Normal file
8
ecs/jskult-webapp/src/model/db/inst_div_master.py
Normal file
@ -0,0 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from src.model.db.base_db_model import BaseDBModel
|
||||
|
||||
|
||||
class InstDivMasterModel(BaseDBModel):
|
||||
inst_div_cd: Optional[str]
|
||||
inst_div_name: Optional[str]
|
||||
18
ecs/jskult-webapp/src/model/db/ultmarc_inst.py
Normal file
18
ecs/jskult-webapp/src/model/db/ultmarc_inst.py
Normal file
@ -0,0 +1,18 @@
|
||||
from typing import Optional
|
||||
|
||||
from src.model.db.base_db_model import BaseDBModel
|
||||
from src.util.sanitize import sanitize
|
||||
|
||||
|
||||
@sanitize
|
||||
class UltmarcInstDBModel(BaseDBModel):
|
||||
dcf_dsf_inst_cd: Optional[str]
|
||||
abolish_ymd: Optional[str]
|
||||
delete_sche_reason_cd: Optional[str]
|
||||
form_inst_name_kanji: Optional[str]
|
||||
inst_addr: Optional[str]
|
||||
postal_number: Optional[str]
|
||||
inst_phone_number: Optional[str]
|
||||
inst_div_name: Optional[str]
|
||||
hp_assrt_name: Optional[str]
|
||||
prefc_name: Optional[str]
|
||||
61
ecs/jskult-webapp/src/model/request/ultmarc_inst.py
Normal file
61
ecs/jskult-webapp/src/model/request/ultmarc_inst.py
Normal file
@ -0,0 +1,61 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import Form
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.util.sanitize import sanitize
|
||||
|
||||
|
||||
@sanitize
|
||||
class UltmarcInstModel(BaseModel):
|
||||
dcf_dsf_inst_cd: Optional[str]
|
||||
inst_div_cd: Optional[str]
|
||||
form_inst_name_kanji: Optional[str]
|
||||
form_inst_name_kana: Optional[str]
|
||||
postal_number: Optional[str]
|
||||
inst_phone_number: Optional[str]
|
||||
prefc_cd: Optional[str]
|
||||
delFlg: Optional[str]
|
||||
inst_addr: Optional[str]
|
||||
|
||||
@classmethod
|
||||
def as_form(
|
||||
cls,
|
||||
ctrl_dcf_dsf_inst_cd: str = Form(None),
|
||||
ctrl_inst_div_cd: str = Form(None),
|
||||
ctrl_form_inst_name_kanji: str = Form(None),
|
||||
ctrl_form_inst_name_kana: str = Form(None),
|
||||
ctrl_postal_number: str = Form(None),
|
||||
ctrl_inst_phone_number: str = Form(None),
|
||||
ctrl_prefc_cd: str = Form(None),
|
||||
ctrl_delFlg: str = Form(None),
|
||||
ctrl_inst_addr: str = Form(None)
|
||||
):
|
||||
return cls(
|
||||
dcf_dsf_inst_cd=ctrl_dcf_dsf_inst_cd,
|
||||
inst_div_cd=ctrl_inst_div_cd,
|
||||
form_inst_name_kanji=ctrl_form_inst_name_kanji,
|
||||
form_inst_name_kana=ctrl_form_inst_name_kana,
|
||||
postal_number=ctrl_postal_number,
|
||||
inst_phone_number=ctrl_inst_phone_number,
|
||||
prefc_cd=ctrl_prefc_cd,
|
||||
delFlg=ctrl_delFlg,
|
||||
inst_addr=ctrl_inst_addr
|
||||
)
|
||||
|
||||
|
||||
class UltmarcInstInfoModel(BaseModel):
|
||||
docId: Optional[str]
|
||||
pageNum: Optional[int]
|
||||
|
||||
@classmethod
|
||||
def as_form(
|
||||
cls,
|
||||
docId: str = Form(None),
|
||||
pageNum: str = Form(None)
|
||||
):
|
||||
|
||||
return cls(
|
||||
docId=docId,
|
||||
pageNum=int(pageNum)
|
||||
)
|
||||
103
ecs/jskult-webapp/src/model/view/ultmarc_inst_view_model.py
Normal file
103
ecs/jskult-webapp/src/model/view/ultmarc_inst_view_model.py
Normal file
@ -0,0 +1,103 @@
|
||||
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.inst_div_master import InstDivMasterModel
|
||||
from src.model.request.ultmarc_inst import UltmarcInstModel
|
||||
from src.model.view.bio_disp_model import BisDisplayModel
|
||||
from src.system_var import environment
|
||||
|
||||
|
||||
class UltmarcInstViewModel(BaseModel):
|
||||
subtitle: str = '施設検索一覧'
|
||||
is_batch_processing: Optional[bool]
|
||||
prefc_models: list[PrefcMasterModel]
|
||||
inst_div_models: list[InstDivMasterModel]
|
||||
inst_data: Optional[list[BisDisplayModel]] = []
|
||||
form_data: Optional[UltmarcInstModel]
|
||||
|
||||
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.inst_data], ensure_ascii=False, default=date_handler)
|
||||
|
||||
# ULT施設コード
|
||||
def is_input_dcf_dsf_inst_cdd(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.dcf_dsf_inst_cd or ''
|
||||
|
||||
# 施設区分
|
||||
def is_selected_inst_div_cd(self, selected_inst_div_cd):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self._selected_value(self.form_data.inst_div_cd, selected_inst_div_cd)
|
||||
|
||||
# ULT施設名(漢字)
|
||||
def is_input_form_inst_name_kanji(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.form_inst_name_kanji or ''
|
||||
|
||||
# ULT施設名(かな・カナ)
|
||||
def is_input_form_inst_name_kana(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.form_inst_name_kana or ''
|
||||
|
||||
# 郵便番号
|
||||
def is_input_postal_number(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.postal_number or ''
|
||||
|
||||
# 電話番号
|
||||
def is_input_inst_phone_number(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.inst_phone_number or ''
|
||||
|
||||
# 削除施設表示
|
||||
def is_checked_delFlg(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self._checked_value(self.form_data.delFlg)
|
||||
|
||||
# ULT施設住所
|
||||
def is_input_inst_addr(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self.form_data.inst_addr or ''
|
||||
|
||||
# 勤務先都道府県
|
||||
def is_selected_prefc_cd(self, selected_prefc_cd):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
return self._selected_value(self.form_data.prefc_cd, selected_prefc_cd)
|
||||
|
||||
def disabled_button(self):
|
||||
return 'disabled' if self.is_data_empty() or self.is_data_overflow_max_length() else ''
|
||||
|
||||
def is_form_submitted(self):
|
||||
return self.form_data is not None
|
||||
|
||||
def is_data_empty(self):
|
||||
return len(self.doctor_data) == 0
|
||||
|
||||
def is_data_overflow_max_length(self):
|
||||
return len(self.doctor_data) >= environment.BIO_SEARCH_RESULT_MAX_COUNT
|
||||
|
||||
def _format_date_string(self, date_string):
|
||||
if date_string is None:
|
||||
return ''
|
||||
date = datetime.strptime(date_string, '%Y%m%d')
|
||||
return date.strftime('%Y/%m/%d')
|
||||
|
||||
def _selected_value(self, form_value: str, current_value: str):
|
||||
return 'selected' if form_value == current_value else ''
|
||||
|
||||
def _checked_value(self, form_value: str):
|
||||
return 'checked' if form_value else ''
|
||||
29
ecs/jskult-webapp/src/repositories/inst_master_repository.py
Normal file
29
ecs/jskult-webapp/src/repositories/inst_master_repository.py
Normal file
@ -0,0 +1,29 @@
|
||||
from src.model.db.inst_div_master import InstDivMasterModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
|
||||
|
||||
class InstDivMasterRepository(BaseRepository):
|
||||
|
||||
FETCH_SQL = """\
|
||||
SELECT
|
||||
DISTINCT com_inst_div.inst_div_cd AS inst_div_cd,
|
||||
com_inst_div.inst_div_name AS inst_div_name
|
||||
FROM src05.com_inst
|
||||
JOIN src05.com_inst_div on com_inst.inst_div_cd = com_inst_div.inst_div_cd
|
||||
ORDER BY com_inst_div.inst_div_cd
|
||||
"""
|
||||
|
||||
def fetch_all(self) -> list[InstDivMasterModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
result = self._database.execute_select(self.FETCH_SQL)
|
||||
result_data = [res for res in result]
|
||||
models = [InstDivMasterModel(**r) for r in result_data]
|
||||
return models
|
||||
except Exception as e:
|
||||
# TODO: ファイルへの書き出しはloggerでやる
|
||||
print(f"[ERROR] getOroshiData DB Error. ")
|
||||
print(f"[ERROR] ErrorMessage: {e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
108
ecs/jskult-webapp/src/repositories/ultmarc_inst_repository.py
Normal file
108
ecs/jskult-webapp/src/repositories/ultmarc_inst_repository.py
Normal file
@ -0,0 +1,108 @@
|
||||
from src.db import sql_condition as condition
|
||||
from src.db.sql_condition import SQLCondition
|
||||
from src.model.db.ultmarc_inst import UltmarcInstDBModel
|
||||
from src.model.request.ultmarc_inst import UltmarcInstModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.util.string_util import is_not_empty
|
||||
|
||||
|
||||
class UltmarcInstRepository(BaseRepository):
|
||||
|
||||
FETCH_SQL = """\
|
||||
SELECT
|
||||
dcf_dsf_inst_cd,
|
||||
abolish_ymd,
|
||||
delete_sche_reason_cd,
|
||||
form_inst_name_kanji,
|
||||
inst_addr,
|
||||
postal_number,
|
||||
inst_phone_number,
|
||||
inst_div_name,
|
||||
hp_assrt_name,
|
||||
prefc_name
|
||||
FROM src05.com_inst
|
||||
LEFT JOIN src05.mst_prefc ON com_inst.prefc_cd = mst_prefc.prefc_cd
|
||||
LEFT JOIN src05.com_inst_div ON com_inst.inst_div_cd = com_inst_div.inst_div_cd
|
||||
LEFT JOIN src05.com_hp_assrt ON com_inst.hp_assrt_cd = com_hp_assrt.hp_assrt_cd
|
||||
WHERE {where_clause}
|
||||
ORDER BY dcf_dsf_inst_cd
|
||||
\
|
||||
"""
|
||||
|
||||
def fetch_many(self, parameter: UltmarcInstModel) -> list[UltmarcInstDBModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
# 文字列の検索を部分一致にするため、モデルをコピー。以降はこのコピーを使用する。
|
||||
clone_parameter = UltmarcInstModel(**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())
|
||||
models = [UltmarcInstDBModel(**r) for r in result]
|
||||
|
||||
return models
|
||||
except Exception as e:
|
||||
# TODO: ファイルへの書き出しはloggerでやる
|
||||
print(f"[ERROR] DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
def __build_condition(self, parameter: UltmarcInstModel):
|
||||
where_clauses: list[SQLCondition] = []
|
||||
|
||||
# ULT施設コード
|
||||
if is_not_empty(parameter.dcf_dsf_inst_cd):
|
||||
# 部分一致検索
|
||||
parameter.dcf_dsf_inst_cd = f'%{parameter.dcf_dsf_inst_cd}%'
|
||||
where_clauses.append(SQLCondition('com_inst.dcf_dsf_inst_cd', condition.LIKE, 'dcf_dsf_inst_cd'))
|
||||
|
||||
# 施設区分
|
||||
if is_not_empty(parameter.inst_div_cd):
|
||||
where_clauses.append(SQLCondition('com_inst.inst_div_cd', condition.EQ, 'inst_div_cd'))
|
||||
|
||||
# ULT施設名(漢字)
|
||||
if is_not_empty(parameter.form_inst_name_kanji):
|
||||
# 部分一致検索
|
||||
parameter.form_inst_name_kanji = f'%{parameter.form_inst_name_kanji}%'
|
||||
where_clauses.append(SQLCondition('form_inst_name_kanji', condition.LIKE, 'form_inst_name_kanji'))
|
||||
|
||||
# ULT施設名(カナ)
|
||||
if is_not_empty(parameter.form_inst_name_kana):
|
||||
# 部分一致検索
|
||||
parameter.form_inst_name_kana = f'%{parameter.form_inst_name_kana}%'
|
||||
where_clauses.append(SQLCondition('form_inst_name_kana', condition.LIKE, 'form_inst_name_kana'))
|
||||
|
||||
# 郵便番号
|
||||
if is_not_empty(parameter.postal_number):
|
||||
# 前方一致検索
|
||||
parameter.postal_number = f'{parameter.postal_number}%'
|
||||
where_clauses.append(SQLCondition('postal_number', condition.LIKE, 'postal_number'))
|
||||
|
||||
# 電話番号
|
||||
if is_not_empty(parameter.inst_phone_number):
|
||||
# 前方一致検索
|
||||
parameter.inst_phone_number = f'{parameter.inst_phone_number}%'
|
||||
where_clauses.append(SQLCondition('inst_phone_number', condition.LIKE, 'inst_phone_number'))
|
||||
|
||||
# 勤務先都道府県
|
||||
if is_not_empty(parameter.prefc_cd):
|
||||
where_clauses.append(SQLCondition('com_inst.prefc_cd', condition.EQ, 'prefc_cd'))
|
||||
|
||||
# ULT施設住所
|
||||
if is_not_empty(parameter.inst_addr):
|
||||
# 部分一致検索
|
||||
parameter.inst_addr = f'%{parameter.inst_addr}%'
|
||||
where_clauses.append(SQLCondition('inst_addr', condition.LIKE, 'inst_addr'))
|
||||
|
||||
# 削除表示フラグ
|
||||
if is_not_empty(parameter.delFlg):
|
||||
# 論理和での検索
|
||||
where_clauses.append(SQLCondition('', '', '(length(abolish_ymd) = 0 OR abolish_ymd IS NULL)', literal=True))
|
||||
|
||||
# 検索条件が入力されていない場合
|
||||
if not where_clauses:
|
||||
where_clauses.append(SQLCondition('', '', '(length(abolish_ymd) = 0 OR abolish_ymd IS NULL)', literal=True))
|
||||
|
||||
where_clauses_str = ' AND '.join([condition.apply() for condition in where_clauses])
|
||||
|
||||
return where_clauses_str
|
||||
@ -8,10 +8,14 @@ from src.aws.aws_api_client import AWSAPIClient
|
||||
from src.aws.s3 import S3Client
|
||||
from src.model.internal.session import UserSession
|
||||
from src.model.request.ultmarc_doctor import UltmarcDoctorModel
|
||||
from src.model.request.ultmarc_inst import UltmarcInstModel
|
||||
from src.model.view.ultmarc_doctor_view_model import UltmarcDoctorViewModel
|
||||
from src.model.view.ultmarc_inst_view_model import UltmarcInstViewModel
|
||||
from src.model.view.ultmarc_doctor_info_view_model import UltmarcDoctorInfoViewModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.repositories.prefc_master_repository import PrefcMasterRepository
|
||||
from src.repositories.inst_master_repository import InstDivMasterRepository
|
||||
from src.repositories.ultmarc_inst_repository import UltmarcInstRepository
|
||||
from src.repositories.ultmarc_doctor_repository import UltmarcDoctorRepository
|
||||
from src.repositories.ultmarc_trt_course_repository import UltmarcTrtCourseRepository
|
||||
from src.repositories.ultmarc_sosiety_repository import UltmarcSosietyRepository
|
||||
@ -26,6 +30,8 @@ class UltmarcViewService(BaseService):
|
||||
REPOSITORIES = {
|
||||
'ultmarc_doctor_repository': UltmarcDoctorRepository,
|
||||
'prefc_repository': PrefcMasterRepository,
|
||||
'inst_div_repository': InstDivMasterRepository,
|
||||
'ultmarc_inst_repository': UltmarcInstRepository,
|
||||
'ultmarc_trt_course_repository': UltmarcTrtCourseRepository,
|
||||
'ultmarc_sosiety_repository': UltmarcSosietyRepository,
|
||||
'ultmarc_doctor_wrkplace_repository': UltmarcDoctorWrkplaceRepository,
|
||||
@ -35,6 +41,8 @@ class UltmarcViewService(BaseService):
|
||||
|
||||
ultmarc_doctor_repository: UltmarcDoctorRepository
|
||||
prefc_repository: PrefcMasterRepository
|
||||
inst_div_repository: InstDivMasterRepository
|
||||
ultmarc_inst_repository: UltmarcInstRepository
|
||||
ultmarc_trt_course_repository: UltmarcTrtCourseRepository
|
||||
ultmarc_sosiety_repository: UltmarcSosietyRepository
|
||||
ultmarc_doctor_wrkplace_repository: UltmarcDoctorWrkplaceRepository
|
||||
@ -45,6 +53,8 @@ class UltmarcViewService(BaseService):
|
||||
super().__init__(repositories, clients)
|
||||
self.ultmarc_doctor_repository = repositories['ultmarc_doctor_repository']
|
||||
self.prefc_repository = repositories['prefc_repository']
|
||||
self.inst_div_repository = repositories['inst_div_repository']
|
||||
self.ultmarc_inst_repository = repositories['ultmarc_inst_repository']
|
||||
self.ultmarc_trt_course_repository = repositories['ultmarc_trt_course_repository']
|
||||
self.ultmarc_sosiety_repository = repositories['ultmarc_sosiety_repository']
|
||||
self.ultmarc_doctor_wrkplace_repository = repositories['ultmarc_doctor_wrkplace_repository']
|
||||
@ -55,7 +65,7 @@ class UltmarcViewService(BaseService):
|
||||
self,
|
||||
session: UserSession
|
||||
) -> UltmarcDoctorViewModel:
|
||||
# # 都道府県リストを取得
|
||||
# 都道府県リストを取得
|
||||
prefcs = self.prefc_repository.fetch_all()
|
||||
|
||||
ultmarc = UltmarcDoctorViewModel(
|
||||
@ -63,6 +73,26 @@ class UltmarcViewService(BaseService):
|
||||
)
|
||||
return ultmarc
|
||||
|
||||
def ultmarc_inst_view(
|
||||
self,
|
||||
session: UserSession
|
||||
) -> UltmarcInstViewModel:
|
||||
# 都道府県リストを取得
|
||||
prefcs = self.prefc_repository.fetch_all()
|
||||
# 施設区分リストを取得
|
||||
inst_div = self.inst_div_repository.fetch_all()
|
||||
|
||||
ultmarc = UltmarcInstViewModel(
|
||||
prefc_models=prefcs,
|
||||
inst_div_models=inst_div
|
||||
)
|
||||
return ultmarc
|
||||
|
||||
def search_inst_data(self, search_params: UltmarcInstModel):
|
||||
# 施設データを検索
|
||||
ultmarc_inst_data = self.ultmarc_inst_repository.fetch_many(parameter=search_params)
|
||||
return ultmarc_inst_data
|
||||
|
||||
def search_doctor_data(self, search_params: UltmarcDoctorModel):
|
||||
# 医師データを検索
|
||||
ultmarc_doctor_data = self.ultmarc_doctor_repository.fetch_many(parameter=search_params)
|
||||
|
||||
@ -134,7 +134,7 @@ table{
|
||||
}
|
||||
|
||||
.instSearchButchMsg{
|
||||
font-size: 80%;
|
||||
/* font-size: 80%; */
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
||||
212
ecs/jskult-webapp/src/templates/instSearch.html
Normal file
212
ecs/jskult-webapp/src/templates/instSearch.html
Normal file
@ -0,0 +1,212 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
{% with subtitle = ultmarc.subtitle %}
|
||||
{% include '_header.html' %}
|
||||
{% endwith %}
|
||||
<link rel="stylesheet" href="/static/css/ultStyle.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
controlCount = 11; // 検索フォームの入力ボックスの数 アルトマーク課題管理表No.2の修正
|
||||
|
||||
window.onload = function(){
|
||||
// 見出し固定初期化
|
||||
FixedMidashi.create();
|
||||
// ボタン、テキストボックス初期化
|
||||
formBtDisabled();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!--検索フォーム-->
|
||||
<body>
|
||||
<!-- タイトルと上部ボタン -->
|
||||
<table class="instSearchHeaderTable">
|
||||
<tr>
|
||||
<td class="instSearchHeaderTd"><h1>施設検索一覧</h1></td>
|
||||
<td class="instSearchHeaderTdCenter instSearchHeaderTdCenter">
|
||||
{% if ultmarc.is_batch_processing %}
|
||||
<div class="docButchMsg">日次バッチ処理中のため、データが正しく表示されない可能性があります</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="instSearchHeaderTd instSearchHeaderTdRight"><button class="instSearchHeader_bt" onclick="backToMenu()">メニューへ</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- 入力フォーム -->
|
||||
<form class="_form" name="search" action="/ultmarc/instSearch" method="POST">
|
||||
<table class="search_table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ULT施設コード:</td>
|
||||
<td class="search_tb leftSearch_tb">
|
||||
<input class="text search_textbox" style="ime-mode:disabled;" type="text" name="ctrl_dcf_dsf_inst_cd"
|
||||
value="{{ultmarc.is_input_dcf_dsf_inst_cdd()}}" oninput="formBtDisabled()">
|
||||
</td>
|
||||
<td>施設区分:</td>
|
||||
<td class="search_tb">
|
||||
<!-- 施設区分のドロップダウン -->
|
||||
<select class="text search_dropdown" name="ctrl_inst_div_cd" onchange="formBtDisabled()">
|
||||
<option value=""></option>
|
||||
{% for inst_div in ultmarc.inst_div_models %}
|
||||
<option value="{{inst_div['inst_div_cd']}}" {{ultmarc.is_selected_inst_div_cd(inst_div['inst_div_cd'])}}>
|
||||
{{inst_div['inst_div_name']}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ULT施設名(漢字):</td>
|
||||
<td class="search_tb">
|
||||
<input class="text search_textbox" type="text" name="ctrl_form_inst_name_kanji"
|
||||
value="{{ultmarc.is_input_form_inst_name_kanji()}}" oninput="formBtDisabled()">
|
||||
</td>
|
||||
<!-- アルトマーク課題管理表No.8の修正 (カナ)⇒(かな・カナ)-->
|
||||
<td>ULT施設名(かな・カナ):</td>
|
||||
<td class="search_tb">
|
||||
<input class="text search_textbox" type="text" name="ctrl_form_inst_name_kana"
|
||||
value="{{ultmarc.is_input_form_inst_name_kana()}}" oninput="formBtDisabled()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>郵便番号:</td>
|
||||
<td class="search_tb"><input class="text search_textbox" style="ime-mode:disabled;" type="text" name="ctrl_postal_number"
|
||||
value="{{ultmarc.is_input_postal_number()}}" oninput="formBtDisabled()">
|
||||
<td>電話番号:</td>
|
||||
<td class="search_tb"><input class="text search_textbox" style="ime-mode:disabled;" type="text" name="ctrl_inst_phone_number"
|
||||
value="{{ultmarc.is_input_inst_phone_number()}}" oninput="formBtDisabled()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>都道府県:</td>
|
||||
<td class="search_tb">
|
||||
<!-- 都道府県のドロップダウン -->
|
||||
<select class="text search_dropdown" name="ctrl_prefc_cd" onchange="formBtDisabled()" onkeyup="formBtDisablead(controlCount)">
|
||||
<!-- 都道府県ドロップダウンの中身を作成 -->
|
||||
<option value=""></option>
|
||||
{% for prefc in ultmarc.prefc_models %}
|
||||
<option
|
||||
value="{{prefc['prefc_cd']}}" {{ultmarc.is_selected_prefc_cd(prefc['prefc_cd'])}}>
|
||||
{{prefc['prefc_name']}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="ctrl_delFlg" value="true"
|
||||
onchange="formBtDisabled()" {{ultmarc.is_checked_delFlg()}}> 削除施設表示
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ULT施設住所:</td>
|
||||
<td class="search_tb">
|
||||
<input class="text search_textbox" type="text" name="ctrl_inst_addr"
|
||||
value="{{ultmarc.is_input_inst_addr()}}" oninput="formBtDisabled()">
|
||||
</td>
|
||||
|
||||
<td class="search_btTd" colspan="2">
|
||||
<input class="text ult_bt search_bt" id="clear" type="button" name="clear_bt" value="クリア" onclick="clr()">
|
||||
<input class="ult_bt search_bt" id="search_bt" name="search_bt" value="検索" type="submit">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--検索結果-->
|
||||
<form class="_form" name="result" action="/ultmarc/instInfo" method="POST" onsubmit="CheckBoxListPocessing()">
|
||||
<input type="button" name="allon" onclick="allOn()" value="全選択" class="ult_bt allOnOffButton">
|
||||
<!-- <?php if ($dtCnt['countNum'] <= 0){ echo "disabled"; } ? -->
|
||||
<input type="button" name="alloff" onclick="allOff()" value="全解除" class="ult_bt allOnOffButton">
|
||||
<!-- <?php if ($dtCnt['countNum'] <= 0){ echo "disabled"; } ?> -->
|
||||
<!--検索件数-->
|
||||
<!--ページネーション-->
|
||||
<div id="light-pagination" class="pagination"></div>
|
||||
<!--検索結果表示テーブル-->
|
||||
<div class="scroll_table">
|
||||
<table class="tablesorter instSearchResult" _fixedhead="rows:1; cols:1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>ULT施設コード</th>
|
||||
<th>削除</th>
|
||||
<th>ULT施設名(漢字)</th>
|
||||
<th>ULT施設住所(漢字)</th>
|
||||
<th>郵便番号</th>
|
||||
<th>施設電話番号</th>
|
||||
<th>施設区分名</th>
|
||||
<th>病院種別</th>
|
||||
<th>都道府県</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="result_data" class="result_data"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--操作ボタン-->
|
||||
<input class="send ult_bt info_bt" type="submit" name="detail" value="施設情報">
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
// <! --ページネーションの作成-- >
|
||||
$(function() {
|
||||
// スピナー出さない場合は以下、エスケープせず埋め込む
|
||||
// {% autoescape False%}
|
||||
let searchResultString = '{{ultmarc.ultmarc_data_json_str()}}'
|
||||
// {% endautoescape%}
|
||||
const searchResultData = JSON.parse(searchResultString)
|
||||
if (searchResultData.length == 0) {
|
||||
return
|
||||
}
|
||||
$(".pagination").pagination({
|
||||
dataSource: function(done) {
|
||||
done(searchResultData)
|
||||
},
|
||||
pageNumber: 1, // 初期ページ番号
|
||||
pageSize: 50, //表示するコンテンツ数
|
||||
pageRange: 2, //選択されているページネーション番号の両隣に表示する個数
|
||||
ellipsisText: '...', //省略文字
|
||||
prevText: 'Prev', //「前へ」の文字。エスケープ文字
|
||||
nextText: 'Next', //「次へ」の文字。エスケープ文字
|
||||
showNavigator: true,
|
||||
formatNavigator: '件数: <%= totalNumber %>件 ページ数: <%= totalPage %>',
|
||||
callback: function(data, pagination) {
|
||||
$('#result_data').html(pagination_content(data))
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function pagination_content(datas) {
|
||||
const display_keys = [
|
||||
'dcf_dsf_inst_cd',
|
||||
'abolish_ymd',
|
||||
'form_inst_name_kanji',
|
||||
'inst_addr',
|
||||
'postal_number',
|
||||
'inst_phone_number',
|
||||
'inst_div_name',
|
||||
'hp_assrt_name',
|
||||
'prefc_name'
|
||||
];
|
||||
return datas.map(function (data) {
|
||||
let td = display_keys.map((key) =>{
|
||||
let inner_content = data[key];
|
||||
if(key=='dcf_dsf_inst_cd')
|
||||
inner_content = `<a href="/ultmarc/instInfo?id=${data['dcf_dsf_inst_cd']}">${data['dcf_dsf_inst_cd'] || ''}</a>`;
|
||||
if(key=='abolish_ymd' && data[key] != null)
|
||||
inner_content = '削除';
|
||||
return `<td>${inner_content || ''}</td>`
|
||||
});
|
||||
return `
|
||||
<tr class="result_data">
|
||||
<td><div class="checkNum">
|
||||
<input type="checkbox" class="checkbox selected" name="data" onclick="resultBtDisablead()"
|
||||
value=${data['dcf_dsf_inst_cd']}>
|
||||
</div></td>
|
||||
${td}
|
||||
</tr>
|
||||
`
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -14,7 +14,7 @@
|
||||
<a href="/ultmarc/docSearch" class="btn btn-primary btn-lg btn_width">Ultmarc照会(医師)</a><br><br>
|
||||
{% endif %}
|
||||
{% if menu.is_available_ult_inst_menu() %}
|
||||
<a href="{{instSearchPath}}" class="btn btn-primary btn-lg btn_width">Ultmarc照会(施設)</a><br><br>
|
||||
<a href="/ultmarc/instSearch" class="btn btn-primary btn-lg btn_width">Ultmarc照会(施設)</a><br><br>
|
||||
{% endif %}
|
||||
{% if menu.is_available_bio_menu() %}
|
||||
{% if not menu.is_batch_processing() %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user