From abae517585ad7ff0038c31339d200712c9684556 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 21 八月 2026 16:07:07 +0800
Subject: [PATCH] 修改市一同步时间范围(实时前1天,补救前5天)

---
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index 66d22d4..343276d 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1204,12 +1204,23 @@
                 patMedOuthosp.setFuflag("1");
             }
         }
+        Integer visitTimeNum = null;
+        String visitTimeUnit = "澶�";
         for (ExternalWZInfo externalWZInfo : ExternalWZInfoList) {
             if (externalWZInfo.getWenZhenLXMC().equals("鐜扮梾鍙�")) {
                 patMedOuthosp.setHpi(externalWZInfo.getNeiRong());
             }
             if (externalWZInfo.getWenZhenLXMC().equals("涓昏瘔")) {
                 patMedOuthosp.setMainsuit(externalWZInfo.getNeiRong());
+            }
+            if (externalWZInfo.getWenZhenLXMC().equals("闅忚澶╂暟")) {
+                String visitTimeNumStr = externalWZInfo.getNeiRong();
+                if(StringUtils.isNotEmpty(visitTimeNumStr) && visitTimeNumStr.matches("^-?\\d+$")){
+                    visitTimeNum = Integer.parseInt(visitTimeNumStr);
+                }
+            }
+            if (externalWZInfo.getWenZhenLXMC().equals("闅忚澶╂暟鍗曚綅")) {
+                visitTimeUnit = externalWZInfo.getNeiRong();
             }
         }
         int i = 0;
@@ -1230,6 +1241,11 @@
             }
             i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
 
+        }
+        Date adminDate = externalJZInfo.getJiuZhenRQ();
+        //瀹屾垚鎺ヨ瘖 宸茬粡瀹屾垚浠诲姟鍐嶆闅忚
+        if(ObjectUtils.isNotEmpty(visitTimeNum) && ObjectUtils.isNotEmpty(adminDate)){
+            patMedOuthospService.followUpAgainByPatMedOuthosp(patMedOuthosp, adminDate, visitTimeNum);
         }
 
         if (i > 0) {
@@ -1319,7 +1335,6 @@
         Map yeWuXX = (Map) dataMap.get("YeWuXX");
         Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
         ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
-
         PatArchive patArchive = addPatArchive(externalInHospPatientInfo, null, null);
 
 
@@ -1340,6 +1355,10 @@
         patMedOperation.setPatid(patArchive.getId());
         patMedOperation.setPatcode(externalInHospPatientInfo.getBingRenID());
         patMedOperation.setPaname(externalInHospPatientInfo.getXingMing());
+        patMedOperation.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
+        patMedOperation.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
+        patMedOperation.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
+        patMedOperation.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
         patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID());
         //鏌ヨ涓�涓嬶紝璇ユ偅鑰呮槸鍚﹀凡缁忔湁杩欎簺鏁版嵁
         List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation);
@@ -1390,6 +1409,7 @@
             //涓芥按鏃犻櫌鍖猴紝榛樿鍊兼槸 1
             patMedOperation.setCampusid("1");
             patMedOperation.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
+            patMedOperation.setInhospstate(externalInHospPatientInfo.getBingRenLXDM());
             patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao());
             patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
             patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
@@ -1441,7 +1461,9 @@
             Boolean addMianTableFalg = true;
             for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) {
                 PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
-                patMedOperationItem.setOpid(patMedOperation.getOpid());
+                if(ObjectUtils.isNotEmpty(patMedOperation.getId())){
+                    patMedOperationItem.setOpid(patMedOperation.getId().toString());
+                }
                 patMedOperationItem.setOpcode(externalOperationDetail.getShouShuMCID());
                 patMedOperationItem.setOpdesc(externalOperationDetail.getShouShuMC());
                 patMedOperationItem.setMainFlag(externalOperationDetail.getZhuShouSBZ());
@@ -1452,12 +1474,17 @@
                 patMedOperationItem.setOpposition(externalOperationDetail.getShouShuBW());
                 patMedOperationItem.setDelFlag("0");
                 patMedOperationItem.setOrgid(patMedOperation.getOrgid());
+                patMedOperationItem.setInhospstate(patMedOperation.getInhospstate());
+                patMedOperationItem.setSerialnum(patMedOperation.getSerialnum());
                 //涓芥按鏃犻櫌鍖猴紝榛樿鍊兼槸 1
                 patMedOperationItem.setCampusid("1");
                 if (externalOperationDetail.getZhuShouSBZ().equals("1") && addMianTableFalg == true) {
                     patMedOperation.setOpcode(externalOperationDetail.getShouShuMCID());
                     patMedOperation.setOpdesc(externalOperationDetail.getShouShuMC());
-//                    patMedOperation.setOpid(externalOperationDetail.getShouShuJBDM());
+                    if(ObjectUtils.isNotEmpty(patMedOperation.getId())){
+                        patMedOperation.setOpid(patMedOperation.getId().toString());
+                    }
+
                     patMedOperation.setUpdateTime(new Date());
                     patMedOperationMapper.updatePatMedOperation(patMedOperation);
                     addMianTableFalg = false;
@@ -1957,6 +1984,12 @@
                 log.info("鎵嬫湳鐢宠鍏ュ弬绫诲瀷涓猴細{}", type);
                 addOperationInfo(dataMap);
                 return true;
+            case "SM_SQ_ShouShuAP":
+                log.info("鎵嬫湳瀹夋帓鍏ュ弬绫诲瀷涓猴細{}", type);
+                return true;
+            case "SM_SQ_CheXiao":
+                log.info("鎵嬫湳鎾ら攢鍏ュ弬绫诲瀷涓猴細{}", type);
+                return true;
             case "TJ_YW_BaoGaoXX":
                 log.info("浣撴鎶ュ憡鍏ュ弬绫诲瀷涓猴細{}", type);
                 return true;

--
Gitblit v1.9.3