From f6e31c2de04e10373ed4e7aea22bb3f13c8d2cf9 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 24 八月 2026 17:44:49 +0800
Subject: [PATCH] 文件上传

---
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |   59 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 19 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 382ef76..ab13b48 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1,8 +1,6 @@
 package com.smartor.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.json.JSON;
-import cn.hutool.json.JSONUtil;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -10,8 +8,6 @@
 import com.ruoyi.common.core.domain.entity.SysUserDept;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.AesUtils;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DtoConversionUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
@@ -21,8 +17,8 @@
 import com.smartor.service.IPatMedOuthospService;
 import com.smartor.service.IServiceExternalService;
 import lombok.extern.slf4j.Slf4j;
-import netscape.javascript.JSObject;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -30,8 +26,6 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -441,12 +435,6 @@
 
         ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
         ExternalInDeptPatientInfo externalInDeptPatientInfo = BeanUtil.mapToBean(RuKeXX, ExternalInDeptPatientInfo.class, true);
-
-        ExternalInDeptPatientInfo externalJZInfo = BeanUtil.mapToBean(JiuZhenXX, ExternalInDeptPatientInfo.class, true);
-        if(ObjectUtils.isNotEmpty(externalJZInfo)){
-            externalInHospPatientInfo.setJingGuanYSID(externalJZInfo.getJingGuanYSID());
-            externalInHospPatientInfo.setJingGuanYSXM(externalJZInfo.getJingGuanYSXM());
-        }
         externalInHospPatientInfo.setZeRenHSID(externalInDeptPatientInfo.getZeRenHSID());
         externalInHospPatientInfo.setZeRenHSXM(externalInDeptPatientInfo.getZeRenHSXM());
         externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID());
@@ -1217,12 +1205,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;
@@ -1243,6 +1242,11 @@
             }
             i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
 
+        }
+        Date adminDate = externalJZInfo.getJiuZhenRQ();
+        //瀹屾垚鎺ヨ瘖 宸茬粡瀹屾垚浠诲姟鍐嶆闅忚
+        if(ObjectUtils.isNotEmpty(visitTimeNum) && ObjectUtils.isNotEmpty(adminDate)){
+            patMedOuthospService.followUpAgainByPatMedOuthosp(patMedOuthosp, adminDate, visitTimeNum);
         }
 
         if (i > 0) {
@@ -1332,9 +1336,7 @@
         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);
-
 
         //鎵嬫湳淇℃伅鏂板
         Map<String, Object> ssxx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ShouShuSQ") : null;
@@ -1351,8 +1353,6 @@
             externalOperationInfo = BeanUtil.mapToBean(sscx, ExternalOperationInfo.class, true);
         PatMedOperation patMedOperation = new PatMedOperation();
         patMedOperation.setPatid(patArchive.getId());
-        patMedOperation.setPatcode(externalInHospPatientInfo.getBingRenID());
-        patMedOperation.setPaname(externalInHospPatientInfo.getXingMing());
         patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID());
         //鏌ヨ涓�涓嬶紝璇ユ偅鑰呮槸鍚﹀凡缁忔湁杩欎簺鏁版嵁
         List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation);
@@ -1403,9 +1403,17 @@
             //涓芥按鏃犻櫌鍖猴紝榛樿鍊兼槸 1
             patMedOperation.setCampusid("1");
             patMedOperation.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
+            patMedOperation.setInhospstate(externalInHospPatientInfo.getBingRenLXDM());
             patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao());
             patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
             patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
+
+            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.setHospitaldistrictcode(null);
         patMedOperation.setHospitaldistrictname(null);
@@ -1454,7 +1462,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());
@@ -1465,12 +1475,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;
@@ -1970,6 +1985,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