From 10aaa035f5be0312304d20f022bdb714a8f4900a Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 11 十二月 2024 22:16:23 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/yiwudataanalysis/ADT_A03.java |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/yiwudataanalysis/ADT_A03.java b/smartor/src/main/java/com/smartor/yiwudataanalysis/ADT_A03.java
index b7c7acd..51d8522 100644
--- a/smartor/src/main/java/com/smartor/yiwudataanalysis/ADT_A03.java
+++ b/smartor/src/main/java/com/smartor/yiwudataanalysis/ADT_A03.java
@@ -13,6 +13,7 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.smartor.domain.HospitalRecord;
 import com.smartor.domain.HospitalUserinfo;
+import org.apache.commons.lang3.ObjectUtils;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -37,7 +38,7 @@
 
         //鎮h�呯浉鍏� ID^^^鎺堟潈鏈烘瀯
         CX[] pid3_patientIdentifierList = pid.getPid3_PatientIdentifierList();
-        if (pid3_patientIdentifierList != null || pid3_patientIdentifierList.length > 0) {
+        if (pid3_patientIdentifierList != null && pid3_patientIdentifierList.length > 0) {
             for (CX cx : pid3_patientIdentifierList) {
                 //鎮h�呯浉鍏矷D
                 String hzxgID = cx.getID().encode();
@@ -48,7 +49,7 @@
 
         //闂ㄨ瘖涓嶅~锛屼綇闄㈠繀濉�
         CX[] pid4_alternatePatientIDPID = pid.getPid4_AlternatePatientIDPID();
-        if (pid4_alternatePatientIDPID != null || pid4_alternatePatientIDPID.length > 0) {
+        if (pid4_alternatePatientIDPID != null && pid4_alternatePatientIDPID.length > 0) {
             for (CX cx : pid4_alternatePatientIDPID) {
                 //闈炲┐鍎� 0 濠村効 1
                 String s = cx.getID().encode();
@@ -313,18 +314,21 @@
 
         //鍏ョ鏃ユ湡
         DT[] pv125_contractEffectiveDate = pv1.getPv125_ContractEffectiveDate();
-        DT dt = pv125_contractEffectiveDate[0];
-
-        SimpleDateFormat inputFormattt = new SimpleDateFormat("yyyyMMdd"); // 杈撳叆鏃ユ湡鏍煎紡
         Date date22 = null; // 瑙f瀽涓篋ate瀵硅薄
-        try {
-            date22 = inputFormattt.parse(dt.encode());
-        } catch (ParseException e) {
-            e.printStackTrace();
+        if (pv125_contractEffectiveDate != null && pv125_contractEffectiveDate.length > 0) {
+            DT dt = pv125_contractEffectiveDate[0];
+
+            SimpleDateFormat inputFormattt = new SimpleDateFormat("yyyyMMdd"); // 杈撳叆鏃ユ湡鏍煎紡
+
+            try {
+                date22 = inputFormattt.parse(dt.encode());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
         }
         SimpleDateFormat outputFormat2 = new SimpleDateFormat("yyyy-MM-dd"); // 杈撳嚭鏃ユ湡鏍煎紡
-        String rkdate = outputFormat2.format(date22);
-
+        String rkdate = null;
+        if (date22 != null) rkdate = outputFormat2.format(date22);
 
         //璐︽埛鍐荤粨寤鸿
         String pv128_interestCode = pv1.getPv128_InterestCode().encode();
@@ -370,7 +374,10 @@
 
         //鍑洪櫌鏃堕棿  A03 娑堟伅蹇呭~
         TS[] pv145_dischargeDateTime = pv1.getPv145_DischargeDateTime();
-        TS ts = pv145_dischargeDateTime[0];
+        TS ts = null;
+        if (pv145_dischargeDateTime != null && pv145_dischargeDateTime.length > 0) {
+            ts = pv145_dischargeDateTime[0];
+        }
 //        Date date2 = new Date(Long.valueOf(ts.encode()));
 //        SimpleDateFormat sdff = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 //        String dischargeDateTime = sdff.format(date2);
@@ -378,12 +385,13 @@
         SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMddHHmmss"); // 杈撳叆鏃ユ湡鏍煎紡
         Date date2 = null; // 瑙f瀽涓篋ate瀵硅薄
         try {
-            date2 = inputFormat.parse(ts.encode());
+            if (ObjectUtils.isNotEmpty(ts)) date2 = inputFormat.parse(ts.encode());
         } catch (ParseException e) {
             e.printStackTrace();
         }
         SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 杈撳嚭鏃ユ湡鏍煎紡
-        String dischargeDateTime = outputFormat.format(date2);
+        String dischargeDateTime = null;
+        if (date2 != null) dischargeDateTime = outputFormat.format(date2);
 
         //璁块棶鏍囩ず
         String visitIndicator = pv1.getPv151_VisitIndicator().encode();
@@ -422,14 +430,18 @@
         //鏁版嵁鍏ュ簱
         HospitalRecord hospitalRecord = new HospitalRecord();
         hospitalRecord.setCreateTime(new Date());
-        hospitalRecord.setPatientID(patientID);
+//        hospitalRecord.setPatientID(patientID);
+        hospitalRecord.setPatientID(id1);
         hospitalRecord.setOpreationTime(new Date());
         //灏辫瘖鍙�
         hospitalRecord.setOutMedNO(id1);
         //灏辫瘖绫诲瀷鎻忚堪锛堥棬璇娿�佷綇闄�...锛�
         hospitalRecord.setAdmTypeDesc(AdmTypeEnum.getDescByCode(patientClass));
+        //IMP  浣忛櫌
+        hospitalRecord.setAdmTypeCode("IMP");
+        hospitalRecord.setAdmStatus("鎮h�呭嚭闄�");
         //鍏ラ櫌鐘舵�侊紙灏辫瘖涓�佺粨鏉熷氨璇�...锛�
-        hospitalRecord.setAdmStatus(LevelHospEnum.getDescByCode(pv136_dischargeDisposition));
+        hospitalRecord.setEncOuthostype(LevelHospEnum.getDescByCode(pv136_dischargeDisposition));
         hospitalRecord.setAdmDate(dischargeDateTime);
         hospitalRecord.setEncPatName(patientName);
         if (StringUtils.isNotEmpty(xb)) {
@@ -456,7 +468,8 @@
 
         HospitalUserinfo hospitalUserinfo = new HospitalUserinfo();
 //        hospitalUserinfo.setCreateTime(null);
-        hospitalUserinfo.setPatientID(patientID);
+//        hospitalUserinfo.setPatientID(patientID);
+        hospitalUserinfo.setPatientID(id1);
         hospitalUserinfo.setRegDate(rkdate);
         hospitalUserinfo.setIdentityID(SSNNumberPatient);
         hospitalUserinfo.setPatName(patientName);

--
Gitblit v1.9.3