From 529ff531c27c117b0ff80294557c6964da4d0b04 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 16 九月 2025 17:22:00 +0800
Subject: [PATCH] 门诊回诊,取消该患者住院随访功能删除

---
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |   49 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 34 insertions(+), 15 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 8602729..178feb8 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -283,6 +283,8 @@
         externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID());
         externalInHospPatientInfo.setZhuZhiYSXM(externalInDeptPatientInfo.getZhuZhiYSXM());
         externalInHospPatientInfo.setRuYuanSJ(externalInDeptPatientInfo.getRuYuanSJ());
+        externalInHospPatientInfo.setJingGuanYSID(externalInDeptPatientInfo.getJingGuanYSID());
+        externalInHospPatientInfo.setJingGuanYSXM(externalInDeptPatientInfo.getJingGuanYSXM());
         externalInHospPatientInfo.setLianXiDH(ObjectUtils.isNotEmpty(BingRenXX.get("LianXiDH")) ? BingRenXX.get("LianXiDH").toString() : null);
         externalInHospPatientInfo.setDangQianCWID(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWID")) ? BingRenXX.get("DangQianCWID").toString() : null);
         externalInHospPatientInfo.setDangQianCWMC(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWMC")) ? BingRenXX.get("DangQianCWMC").toString() : null);
@@ -889,6 +891,19 @@
         patMedOuthosp.setOuthospno(externalInHospPatientInfo.getBingAnHao());
         patMedOuthosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
         List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
+        for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
+            PatArchive pa = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
+            if (patArchive.getBirthdate() != null) {
+                Map<String, String> map = calculateAge(pa.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now());
+                pa.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null);
+                pa.setAgeUnit(map.get("ageUnit"));
+                pa.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null);
+                pa.setAgeUnit2(map.get("ageUnit2"));
+                patMedOuthosp1.setAge(pa.getAge() + pa.getAgeUnit() + pa.getAge2() + pa.getAgeUnit2());
+                patMedOuthosp1.setTelcode(patArchive.getTelcode());
+                patMedOuthosp1.setIdcardno(patArchive.getIdcardno());
+            }
+        }
 
         patMedOuthosp.setPatid(patArchive.getId());
         patMedOuthosp.setPatno(externalInHospPatientInfo.getBingAnHao());
@@ -900,6 +915,7 @@
         patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ());
         patMedOuthosp.setOrgid(FaSongJGID);
         patMedOuthosp.setHospitalname(FaSongJGMC);
+        patMedOuthosp.setIdcardno(patArchive.getIdcardno());
 
         //杩欎釜闇�瑕佺瓑HIS閭h竟鍛婅瘔鍙栧摢涓瓧娈碉紝鐜板湪杩樻槸涓嶅鐨�
         patMedOuthosp.setFudate(externalJZInfo.getSfrq());
@@ -940,21 +956,22 @@
             i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
         }
 
-        //鍏堥�氳繃韬唤璇佸拰绉戝鏌ヨ璇ユ偅鑰呮槸鍚︽湁闇�瑕侀殢璁跨殑(鏅畞鎻愬嚭鏉ョ殑)
-        if (patMedOuthosp.getOrgid().equals("47255004333112711A1001")) {
-            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
-            serviceSubtaskVO.setSfzh(patMedOuthosp.getIdcardno());
-            serviceSubtaskVO.setDeptcode(patMedOuthosp.getDeptcode());
-            serviceSubtaskVO.setSendstate(2L);
-            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
-            if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
-                for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
-                    serviceSubtask.setSendstate(6L);
-                    serviceSubtask.setRemark("鎮h�呭凡缁忓洖鏉ュ璇�");
-                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
-                }
-            }
-        }
+//        //鍏堥�氳繃韬唤璇佸拰绉戝鏌ヨ璇ユ偅鑰呮槸鍚︽湁闇�瑕侀殢璁跨殑(鏅畞鎻愬嚭鏉ョ殑)
+//        if (patMedOuthosp.getOrgid().equals("47255004333112711A1001") && StringUtils.isNotEmpty(patMedOuthosp.getIdcardno()) && StringUtils.isNotEmpty(patMedOuthosp.getDeptcode())) {
+//            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
+//            serviceSubtaskVO.setSfzh(patMedOuthosp.getIdcardno());
+//            serviceSubtaskVO.setDeptcode(patMedOuthosp.getDeptcode());
+//            serviceSubtaskVO.setSendstate(2L);
+//            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+//            if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
+//                for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+//                    serviceSubtask.setSendstate(6L);
+//                    serviceSubtask.setRemark("鎮h�呭凡缁忓洖鏉ュ璇�");
+//                    serviceSubtask.setUpdateTime(new Date());
+//                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+//                }
+//            }
+//        }
 
         if (i > 0) {
             return true;
@@ -1361,6 +1378,8 @@
             patMedInhosp.setDrcode(externalInHospPatientInfo.getZhuZhiYSID());
             patMedInhosp.setNurseId(externalInHospPatientInfo.getZeRenHSID());
             patMedInhosp.setNurseName(externalInHospPatientInfo.getZeRenHSXM());
+            patMedInhosp.setManagementDoctor(externalInHospPatientInfo.getJingGuanYSXM());
+            patMedInhosp.setManagementDoctorCode(externalInHospPatientInfo.getJingGuanYSID());
         }
         if (ObjectUtils.isNotEmpty(externalInHospPatientDiagnoseInfo)) {
 //            patMedInhosp.setIcd10code(StringUtils.isNotEmpty(patMedInhosp.getIcd10code()) ? patMedInhosp.getIcd10code() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanID() : externalInHospPatientDiagnoseInfo.getZhenDuanID());

--
Gitblit v1.9.3