From 9bdfdf3461ce3caf303029be3d44bdc77b18d368 Mon Sep 17 00:00:00 2001 From: Nik Afiq Date: Tue, 28 Nov 2023 17:27:26 +0900 Subject: [PATCH] "Med Equipment Fix" --- .../concrete/com_prefc_med_equpment_mapper.py | 8 +++++--- .../ultmarc/utmp_tables/tables/com_prefc_med_equpment.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/table_mapper/concrete/com_prefc_med_equpment_mapper.py b/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/table_mapper/concrete/com_prefc_med_equpment_mapper.py index 4d345900..d48059af 100644 --- a/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/table_mapper/concrete/com_prefc_med_equpment_mapper.py +++ b/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/table_mapper/concrete/com_prefc_med_equpment_mapper.py @@ -89,6 +89,10 @@ class ComPrefcMedEqupmentMapper(UltmarcTableMapper): return def __make_upsert_query(self): + # 修正のレコードだった場合はNULLに変換する + if self.record.bed_num == '@': + self.query_parameter['bed_num'] = None + # レコードの存在確認 record_count = self.db.execute_select(self.RECORD_EXISTS_QUERY, self.query_parameter) # 存在しない場合はInsert @@ -97,9 +101,7 @@ class ComPrefcMedEqupmentMapper(UltmarcTableMapper): # 存在する場合はUpdate # 病床数が空の場合は更新しない - if self.record.bed_num is not None: - if self.record.bed_num == '@': - self.query_parameter['bed_num'] = None + if self.record.is_bed_num_not_empty: return self.UPDATE_QUERY else: return None diff --git a/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/tables/com_prefc_med_equpment.py b/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/tables/com_prefc_med_equpment.py index 491a0a3f..bacc0435 100644 --- a/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/tables/com_prefc_med_equpment.py +++ b/ecs/jskult-batch-daily/src/batch/ultmarc/utmp_tables/tables/com_prefc_med_equpment.py @@ -25,6 +25,7 @@ class ComPrefcMedEqupment(UltmarcTable): # smallint型のカラム値は、空文字で渡ってきた場合はNULLに変換する self.bed_num = self.bed_num if len(self.bed_num) > 0 else None + self.is_bed_num_not_empty = self.bed_num is not None # DCFDSF施設コード self.dcfdsf_inst_code = ''.join([self.dcfhp_id, self.dcfhp_code, self.dcfhp_yobi])