feat:データ定義に合わせて変更
This commit is contained in:
parent
af2d86899c
commit
d6d0d2ff0d
@ -43,8 +43,8 @@ def search_bio_data(
|
||||
return JSONResponse(content={'status': 'batch_processing'}, status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# 生物由来データと件数を取得
|
||||
bio_sales_lot_data = bio_service.search_bio_data(bio_form)
|
||||
bio_sales_lot_count = bio_service.count_bio_data(bio_form, session)
|
||||
trn_result_data_bio_lot_data = bio_service.search_bio_data(bio_form)
|
||||
trn_result_data_bio_lot_count = bio_service.count_bio_data(bio_form, session)
|
||||
|
||||
# レスポンスデータを加工
|
||||
# 日付型のデータのエンコードエラーを解消するための措置
|
||||
@ -58,7 +58,7 @@ def search_bio_data(
|
||||
return encoded_obj
|
||||
|
||||
data = jsonable_encoder(
|
||||
bio_sales_lot_data,
|
||||
trn_result_data_bio_lot_data,
|
||||
custom_encoder={
|
||||
BioDisplayModel: custom_encode
|
||||
}
|
||||
@ -71,13 +71,13 @@ def search_bio_data(
|
||||
UserSession.record_expiration_time.set(UserSession.new_record_expiration_time()),
|
||||
# 検索結果をキャッシュする
|
||||
UserSession.bio_search_condition.set(bio_form.model_dump()),
|
||||
UserSession.bio_search_count.set(bio_sales_lot_count),
|
||||
UserSession.bio_search_count.set(trn_result_data_bio_lot_count),
|
||||
]
|
||||
)
|
||||
set_session(session)
|
||||
json_response = JSONResponse(content={
|
||||
'data': data,
|
||||
'count': bio_sales_lot_count
|
||||
'count': trn_result_data_bio_lot_count
|
||||
})
|
||||
|
||||
# クッキーも書き換え
|
||||
|
||||
@ -17,7 +17,7 @@ class UserMasterModel(BaseDBModel):
|
||||
auth_flg7: Optional[int]
|
||||
auth_flg8: Optional[int]
|
||||
auth_flg9: Optional[int]
|
||||
bio_sales_inq_auth_flg0: Optional[int]
|
||||
auth_flg10: Optional[int]
|
||||
pwd: Optional[str]
|
||||
enabled_flg: Optional[str]
|
||||
creater: Optional[str]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from src.model.db.bio_sales_lot import BioSalesLotDBModel
|
||||
from src.model.db.trn_result_data_bio_lot import BioSalesLotDBModel
|
||||
from src.util.sanitize import sanitize
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ logger = get_logger('日付テーブル取得')
|
||||
|
||||
|
||||
class HdkeTblRepository(BaseRepository):
|
||||
FETCH_SQL = "SELECT bch_actf, dump_sts_kbn FROM src05.hdke_tbl"
|
||||
FETCH_SQL = "SELECT bch_actf, dump_sts_kbn FROM src07.hdke_tbl"
|
||||
|
||||
def fetch_all(self) -> list[HdkeTblModel]:
|
||||
try:
|
||||
|
||||
@ -10,12 +10,12 @@ class PrefcMasterRepository(BaseRepository):
|
||||
FETCH_SQL = """\
|
||||
SELECT DISTINCT
|
||||
com_inst.prefc_cd AS prefc_cd,
|
||||
mst_prefc.prefc_name AS prefc_name
|
||||
mst_jis_pref.jis_pref_nm_kj AS prefc_name
|
||||
FROM
|
||||
src05.com_inst
|
||||
JOIN src05.mst_prefc ON com_inst.prefc_cd = mst_prefc.prefc_cd
|
||||
JOIN src07.mst_jis_pref ON com_inst.prefc_cd = mst_jis_pref.jis_pref_cd and (select str_to_date(syor_date,'%Y%m%d') from src07.hdke_tbl) between STR_TO_DATE(CONCAT(eff_start_ym, '01'), '%Y%m%d') and LAST_DAY(STR_TO_DATE(CONCAT(eff_end_ym, '01'), '%Y%m%d'))
|
||||
ORDER BY
|
||||
mst_prefc.prefc_cd
|
||||
prefc_cd
|
||||
"""
|
||||
|
||||
def fetch_all(self) -> list[PrefcMasterModel]:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from src.db import sql_condition as condition
|
||||
from src.db.sql_condition import SQLCondition
|
||||
from src.logging.get_logger import get_logger
|
||||
from src.model.db.bio_sales_lot import (BioSalesLotCountDBModel,
|
||||
from src.model.db.trn_result_data_bio_lot import (BioSalesLotCountDBModel,
|
||||
BioSalesLotDBModel)
|
||||
from src.model.request.bio import BioModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
@ -53,7 +53,7 @@ class BioSalesLotRepository(BaseRepository):
|
||||
CAST(v_tran_cd AS CHAR) AS v_tran_cd,
|
||||
iko_flg
|
||||
FROM
|
||||
src05.bio_sales_lot
|
||||
src07.trn_result_data_bio_lot
|
||||
WHERE
|
||||
{where_clause}
|
||||
ORDER BY
|
||||
@ -100,7 +100,7 @@ class BioSalesLotRepository(BaseRepository):
|
||||
FROM
|
||||
(
|
||||
SELECT 1
|
||||
FROM src05.bio_sales_lot
|
||||
FROM src07.trn_result_data_bio_lot
|
||||
WHERE
|
||||
{where_clause}
|
||||
LIMIT {limit}
|
||||
@ -27,11 +27,11 @@ class UltmarcDoctorRepository(BaseRepository):
|
||||
com_alma.alma,
|
||||
com_dr.grad_y,
|
||||
com_dr.use_stop_div,
|
||||
mst_prefc.prefc_name,
|
||||
mst_jis_pref.jis_pref_nm_kj AS prefc_name,
|
||||
com_dr_wrkplace.blng_sec_cd
|
||||
FROM
|
||||
src05.com_dr
|
||||
LEFT JOIN src05.mst_prefc ON com_dr.prefc_cd = mst_prefc.prefc_cd
|
||||
LEFT JOIN src07.mst_jis_pref ON com_dr.prefc_cd = mst_jis_pref.jis_pref_cd and (select str_to_date(syor_date,'%Y%m%d') from src07.hdke_tbl) between STR_TO_DATE(CONCAT(eff_start_ym, '01'), '%Y%m%d') and LAST_DAY(STR_TO_DATE(CONCAT(eff_end_ym, '01'), '%Y%m%d'))
|
||||
LEFT JOIN src05.com_dr_wrkplace ON com_dr.dcf_pcf_dr_cd = com_dr_wrkplace.dcf_pcf_dr_cd
|
||||
LEFT JOIN src05.com_inst ON com_dr_wrkplace.dcf_dsf_inst_cd = com_inst.dcf_dsf_inst_cd
|
||||
LEFT JOIN src05.com_blng_sec ON com_dr_wrkplace.blng_sec_cd = com_blng_sec.blng_sec_cd
|
||||
|
||||
@ -26,9 +26,9 @@ class UltmarcInstRepository(BaseRepository):
|
||||
inst_phone_number,
|
||||
inst_div_name,
|
||||
hp_assrt_name,
|
||||
prefc_name
|
||||
jis_pref_nm_kj AS prefc_name
|
||||
FROM src05.com_inst
|
||||
LEFT JOIN src05.mst_prefc ON com_inst.prefc_cd = mst_prefc.prefc_cd
|
||||
LEFT JOIN src07.mst_jis_pref ON com_inst.prefc_cd = mst_jis_pref.jis_pref_cd and (select str_to_date(syor_date,'%Y%m%d') from src07.hdke_tbl) between STR_TO_DATE(CONCAT(eff_start_ym, '01'), '%Y%m%d') and LAST_DAY(STR_TO_DATE(CONCAT(eff_end_ym, '01'), '%Y%m%d'))
|
||||
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}
|
||||
|
||||
@ -22,7 +22,7 @@ class WholesalerMasterRepository(BaseRepository):
|
||||
v_whs_cd,
|
||||
rec_sts_kbn
|
||||
FROM src05.whs_mst_v
|
||||
WHERE src05.get_syor_date() BETWEEN start_date AND end_date
|
||||
WHERE src07.get_syor_date() BETWEEN start_date AND end_date
|
||||
) v2
|
||||
ON b.v_whs_cd = v2.v_whs_cd
|
||||
AND v2.rec_sts_kbn <> '9'
|
||||
|
||||
@ -14,7 +14,7 @@ from src.model.request.bio import BioModel
|
||||
from src.model.view.bio_disp_model import BioDisplayModel
|
||||
from src.model.view.bio_view_model import BioViewModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.repositories.bio_sales_lot_repository import BioSalesLotRepository
|
||||
from src.repositories.trn_result_data_bio_lot_repository import BioSalesLotRepository
|
||||
from src.repositories.pharmacy_product_master_repository import \
|
||||
PharmacyProductMasterRepository
|
||||
from src.repositories.wholesaler_master_repository import \
|
||||
@ -65,9 +65,9 @@ class BioViewService(BaseService):
|
||||
|
||||
def search_bio_data(self, search_params: BioModel):
|
||||
# 生物由来データを検索
|
||||
bio_sales_lot_data = self.bio_sales_repository.fetch_many(parameter=search_params)
|
||||
trn_result_data_bio_lot_data = self.bio_sales_repository.fetch_many(parameter=search_params)
|
||||
# 画面表示用に加工
|
||||
display_bio_data: list[BioDisplayModel] = [BioDisplayModel(data) for data in bio_sales_lot_data]
|
||||
display_bio_data: list[BioDisplayModel] = [BioDisplayModel(data) for data in trn_result_data_bio_lot_data]
|
||||
|
||||
return display_bio_data
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user