From 2e952232f71eae1bf92590471fc7f5d20a1af873 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 31 七月 2025 11:30:48 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/domain/PatArchiveReq.java                    |    6 +
 smartor/src/main/java/com/smartor/domain/ServiceSubtask.java                   |    2 
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |   51 ++++++++++
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml              |   36 ++++++-
 smartor/src/main/java/com/smartor/domain/ExternalJZInfo.java                   |    3 
 smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java      |    6 
 ruoyi-admin/src/main/resources/application.yml                                 |    5 
 ruoyi-admin/src/main/resources/application-xh.yml                              |    2 
 smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java                    |    7 +
 smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java   |   25 ++++
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java    |   28 +++++
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                 |    9 +
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                   |   31 +++---
 ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java         |   43 ++++---
 ruoyi-admin/src/main/resources/application-ls.yml                              |    1 
 15 files changed, 205 insertions(+), 50 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
index 21b1153..00b0e56 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -16,6 +16,7 @@
 import com.ruoyi.common.utils.http.HttpUtils;
 import com.smartor.common.LSHospTokenUtil;
 import com.smartor.domain.*;
+import com.smartor.mapper.HeLibraryMapper;
 import com.smartor.mapper.PatArchiveMapper;
 import com.smartor.mapper.ServiceSubtaskMapper;
 import com.smartor.mapper.ServiceTaskMapper;
@@ -62,6 +63,9 @@
 
     @Autowired
     private ServiceSubtaskMapper ivrTaskcallMapper;
+
+    @Autowired
+    private HeLibraryMapper heLibraryMapper;
 
     @Autowired
     private ServiceTaskMapper ivrTaskMapper;
@@ -275,16 +279,13 @@
                     subIds.clear();
                     subIds.addAll(lssubIds);
                     lssubIds.clear();
-                }
-                else if (descByCode.equals("澶氬獟浣�")) {
+                } else if (descByCode.equals("澶氬獟浣�")) {
                     //澶氬獟浣�
                     continue;
-                }
-                else if (descByCode.equals("绾歌川")) {
+                } else if (descByCode.equals("绾歌川")) {
                     //绾歌川
                     continue;
-                }
-                else if (descByCode.equals("鐭俊")) {
+                } else if (descByCode.equals("鐭俊")) {
                     //鐭俊
                     //瀵箄rl涓袱涓弬鏁板姞瀵�
                     RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
@@ -354,7 +355,6 @@
                                 serviceOutPath.setParam1(taskId);
                                 serviceOutPath.setParam2(patid);
                                 serviceOutPath.setParam6(subId);
-//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                 serviceOutPath.setParam3(ivrTask1.getTaskName());
                                 serviceOutPath.setCreateTime(new Date());
                                 iServiceOutPathService.insertServiceOutPath(serviceOutPath);
@@ -362,15 +362,22 @@
                                 serviceOutPath.setRadix(format);
                                 serviceOutPath.setUpdateTime(new Date());
                                 iServiceOutPathService.updateServiceOutPath(serviceOutPath);
-//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
-                                sendMagParam.setPhone(serviceSubtask.getPhone());
-                                sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format);
-                                if (serviceSubtask.getOrgid().equals("47255004333112711A1001")) {
-                                    sendMagParam.setContent("銆愭櫙瀹佺暡鏃忚嚜娌诲幙浜烘皯鍖婚櫌銆戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
-                                } else if (serviceSubtask.getOrgid().equals("47255004333112711A1001")) {
-                                    sendMagParam.setContent("銆愪附姘翠腑鍖婚櫌銆戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
-                                } else
-                                    sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
+                                //闇�瑕侀�氳繃妯℃澘ID鍘诲垽鏂鍙戠殑鍐呭鏄鏁欒繕鏄�氱煡
+                                HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(serviceSubtask.getLibtemplateid());
+                                if (heLibrary.getHetype().equals("1")) {
+                                    sendMagParam.setPhone(serviceSubtask.getPhone());
+                                    sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format);
+                                    if (serviceSubtask.getOrgid().equals("47255004333112711A1001")) {
+                                        sendMagParam.setContent("銆愭櫙瀹佺暡鏃忚嚜娌诲幙浜烘皯鍖婚櫌銆戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
+                                    } else if (serviceSubtask.getOrgid().equals("47255004333112711A1001")) {
+                                        sendMagParam.setContent("銆愪附姘翠腑鍖婚櫌銆戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
+                                    } else
+                                        sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
+                                } else {
+                                    //閫氱煡
+                                    sendMagParam.setPhone(serviceSubtask.getPhone());
+                                    sendMagParam.setContent(heLibrary.getPreachcontent());
+                                }
                             }
                             //鐭俊杩橀渶瑕佹ā鏉�
                             String s = null;
@@ -409,7 +416,6 @@
                             }
                             if (s.equals("true")) {
                                 //鍦ㄥ瓙浠诲姟琛ㄩ噷璁板綍涓�涓�
-                                log.error("serviceSubtask淇濆瓨鎴愬姛浜嗗悧锛燂細{}", s);
                                 String uuid = UUID.randomUUID().toString();
                                 serviceSubtask.setResult("success");
                                 serviceSubtask.setRemark("鐭俊鍙戦�佹垚鍔�");
@@ -457,8 +463,7 @@
                     subIds.clear();
                     subIds.addAll(lssubIds);
                     lssubIds.clear();
-                }
-                else if (descByCode.equals("鍏紬鍙�")) {
+                } else if (descByCode.equals("鍏紬鍙�")) {
                     //鍏紬鍙�
                     RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                     String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
diff --git a/ruoyi-admin/src/main/resources/application-ls.yml b/ruoyi-admin/src/main/resources/application-ls.yml
index c04e756..b4bbab7 100644
--- a/ruoyi-admin/src/main/resources/application-ls.yml
+++ b/ruoyi-admin/src/main/resources/application-ls.yml
@@ -239,3 +239,4 @@
 
 #闅忚鍖婚櫌锛�1鏂板崕   2涓芥按
 visitHosp: 2
+
diff --git a/ruoyi-admin/src/main/resources/application-xh.yml b/ruoyi-admin/src/main/resources/application-xh.yml
index 2e50c44..e03b553 100644
--- a/ruoyi-admin/src/main/resources/application-xh.yml
+++ b/ruoyi-admin/src/main/resources/application-xh.yml
@@ -166,7 +166,7 @@
 
 #鏂板崕鍖婚櫌澶栭摼璇锋眰IP鍜岀鍙e彿
 req_path: 8093
-localIP: https://wx.lihusmart.com
+localIP: https://zzdey.health-y.cn
 
 
 #鑾峰彇鎮h�呬俊鎭疷RL(鍗庡崜鎻愪緵)
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index e942c14..a4507db 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -74,7 +74,7 @@
     # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
     basename: i18n/messages
   profiles:
-    active: hn
+    active: druid
   # 鏂囦欢涓婁紶
   servlet:
     multipart:
@@ -128,3 +128,6 @@
   excludes: /system/notice
   # 鍖归厤閾炬帴
   urlPatterns: /system/*,/monitor/*,/tool/*
+
+#涓嶉渶瑕佽繘琛岄暱鏈熶换鍔$殑鏈烘瀯
+noLongTask: 47231022633110211A2101,
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index 771bf63..4bb1950 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -3,16 +3,12 @@
 import com.alibaba.fastjson2.JSONObject;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.enums.MsgLSEnum;
 import com.ruoyi.common.enums.ServiceFromEnum;
 import com.ruoyi.common.enums.VisitSendStateEnum;
 import com.ruoyi.common.enums.WxGZHEnum;
-import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.HttpUtil;
 import com.ruoyi.common.utils.OkHttpExample;
 import com.ruoyi.common.utils.RSAPublicKeyExample;
@@ -20,6 +16,7 @@
 import com.ruoyi.common.utils.http.HttpUtils;
 import com.smartor.common.LSHospTokenUtil;
 import com.smartor.domain.*;
+import com.smartor.mapper.HeLibraryMapper;
 import com.smartor.mapper.ServiceSubtaskMapper;
 import com.smartor.mapper.ServiceTaskMapper;
 import com.smartor.mapper.SysUserImportMapper;
@@ -30,20 +27,13 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.annotation.Transactional;
 
-import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.lang.reflect.Type;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.security.MessageDigest;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -91,6 +81,9 @@
 
     @Autowired
     private SysUserImportMapper sysUserImportMapper;
+
+    @Autowired
+    private HeLibraryMapper heLibraryMapper;
 
     @Value("${localIP}")
     private String localIP;
@@ -478,7 +471,6 @@
                                     serviceSubtask.setResult("error");
                                     serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                     serviceSubtask.setSendstate(4L);
-//                                    serviceSubtask.setFinishtime(new Date());
                                     iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                     continue;
                                 }
@@ -497,9 +489,18 @@
                                 serviceOutPath.setRadix(format);
                                 serviceOutPath.setUpdateTime(new Date());
                                 iServiceOutPathService.updateServiceOutPath(serviceOutPath);
-                                sendMagParam.setPhone(serviceSubtask.getPhone());
-                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
-                                sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�");
+                                //鍏堝垽鏂竴涓嬪彂鐨勬槸涓嶆槸瀹f暀
+                                if (!"3".equals(serviceSubtask.getType())) {
+                                    sendMagParam.setPhone(serviceSubtask.getPhone());
+                                    sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
+                                    sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�");
+                                } else {
+                                    HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(serviceSubtask.getLibtemplateid());
+                                    if ("2".equals(heLibrary.getHetype())) {
+                                        sendMagParam.setPhone(serviceSubtask.getPhone());
+                                        sendMagParam.setContent(heLibrary.getPreachcontent());
+                                    }
+                                }
                                 String isSuccess = null;
                                 if (visitHosp == 1) {
                                     Map<String, String> req = new HashMap<>();
diff --git a/smartor/src/main/java/com/smartor/domain/ExternalJZInfo.java b/smartor/src/main/java/com/smartor/domain/ExternalJZInfo.java
index 1b52141..0e09cfd 100644
--- a/smartor/src/main/java/com/smartor/domain/ExternalJZInfo.java
+++ b/smartor/src/main/java/com/smartor/domain/ExternalJZInfo.java
@@ -37,4 +37,7 @@
     @ApiModelProperty(value = "鎮h�呭幓鍚戝悕绉�")
     private String HuanZheQXMC;
 
+    @ApiModelProperty(value = "闅忚鏃ユ湡")
+    private Date sfrq;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
index 0b4944a..df59fec 100644
--- a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
+++ b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
@@ -136,6 +136,12 @@
     @ApiModelProperty(value = "鍖荤敓")
     private String drname;
 
+    /**
+     * 鍖婚櫌缂栫爜
+     */
+    @ApiModelProperty(value = "鍖婚櫌缂栫爜")
+    private String drcode;
+
 
     /**
      * 鍖婚櫌鍚嶇О
diff --git a/smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java b/smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java
index be557d9..b3e423a 100644
--- a/smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java
+++ b/smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java
@@ -32,6 +32,9 @@
     @ApiModelProperty(value = "闂ㄨ瘖缂栧彿")
     private String outhospno;
 
+    @ApiModelProperty(value = "闀挎湡浠诲姟闅忚鏍囪瘑锛�0涓嶉渶瑕侊紝1闇�瑕�")
+    private String fuflag;
+
     /**
      * 娴佹按鍙�
      */
@@ -212,6 +215,10 @@
     @ApiModelProperty(value = "缁撴潫灏辫瘖鏃堕棿")
     private Date endTime;
 
+    @ApiModelProperty(value = "鎸囧畾鐨勯殢璁挎棩鏈�")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date fudate;
+
     /**
      * 璇佷欢鍙风爜
      */
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
index f21c3af..9cda916 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -152,7 +152,7 @@
      * 浠诲姟绫诲瀷(闂ㄨ瘖锛屼綇闄紝澶嶈瘖鈥�)
      */
     @Excel(name = "浠诲姟绫诲瀷锛�1锛屾満鍣ㄤ汉璇煶锛堥殢璁匡級  2锛岄棶鍗凤紱3锛岄�氱煡锛堝鏁欙級")
-    @ApiModelProperty(value = "浠诲姟绫诲瀷锛�1锛屾満鍣ㄤ汉璇煶锛堥殢璁匡級  2锛岄棶鍗凤紱3锛岄�氱煡锛堝鏁欙級锛�)")
+    @ApiModelProperty(value = "浠诲姟绫诲瀷锛�1锛屾満鍣ㄤ汉璇煶锛堥殢璁匡級  2锛岄棶鍗凤紱3锛屽鏁欙紱 4.閫氱煡)")
     private String type;
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
index 7f871a5..292224e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -765,20 +765,20 @@
 
         List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>();
         if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 1) {
-            //  鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3
+            //  鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3    鏌ョ湅鍑洪櫌 4
             patArchiveReq.setCry(0);
             List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchiveReq);
             if (CollectionUtils.isNotEmpty(patArchives1)) {
                 patArchiveList.addAll(patArchives1);
             }
         } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) {
-            // 鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3
+            // 鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3 鏌ョ湅鍑洪櫌 4
             List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthospQC(patArchiveReq);
             if (CollectionUtils.isNotEmpty(patArchives2)) {
                 patArchiveList.addAll(patArchives2);
             }
         } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) {
-            //  鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3
+            //  鏌ョ湅浣忛櫌  1  鏌ョ湅闂ㄨ瘖  2   鏌ョ湅浣撴  3 鏌ョ湅鍑洪櫌 4
             List<PatArchiveOthreInfo> patArchives3 = patArchiveMapper.selectPatArchiveInfoByPhysicalQC(patArchiveReq);
             if (CollectionUtils.isNotEmpty(patArchives3)) {
                 patArchiveList.addAll(patArchives3);
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
index 3d84dfb..dbf6662 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -14,6 +14,8 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -697,19 +699,41 @@
         Date newDate = addDays(patMedInhosp1.getEndtime(), serviceTask.getSendDay().intValue());
         serviceSubtask.setLongSendTime(newDate);
         serviceSubtask.setVisitTime(newDate);
+        //濡傛灉鏄�氱煡鐨勮瘽锛岄渶瑕佹彁鍓嶅嚑澶╁皢閫氳繃鐭俊鍙戝嚭鍘伙紙鍏蜂綋鍑犲ぉ锛岃繖涓彲浠ラ厤缃湪sys_conf琛ㄤ腑锛�
+        if ("3".equals(serviceTask.getType())) {
+            serviceSubtask.setVisitTime(minusDay(newDate, 2));
+        }
+
+
         //鎮h�呭彂閫佹椂闂�
         if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) {
-//            log.error("serviceSubtask99999999鐨勫�间负锛歿}",serviceSubtask);
             String remark = patArchive.getNotrequiredreason();
             serviceSubtask.setRemark(remark);
             serviceSubtask.setResult("error");
-//            serviceSubtask.setFinishtime(new Date());
             //涓嶆墽琛�
             serviceSubtask.setSendstate(4L);
         }
         return serviceSubtask;
     }
 
+    /**
+     * 鍑忓幓鐩稿簲澶╂暟
+     *
+     * @param originalDate
+     * @param day
+     * @return
+     */
+    public Date minusDay(Date originalDate, Integer day) {
+        // 1. 灏� Date 杞崲涓� Instant
+        Instant instant = originalDate.toInstant();
+
+        // 2. 鍦� Instant 涓婂噺鍘�2澶�
+        Instant twoDaysAgoInstant = instant.minus(2, ChronoUnit.DAYS);
+
+        // 3. 灏嗚绠楀悗鐨� Instant 杞洖 Date
+        return Date.from(twoDaysAgoInstant);
+    }
+
     //澶勭悊鍏ラ櫌淇℃伅
     private void dealInHospInfo(List<PatMedInhosp> patMedInhospList) {
         for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
index 7b26833..dd95a3d 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
@@ -149,12 +149,31 @@
         patMedOuthosp.setDiagcheckFlag("0");
         List<PatMedOuthosp> patMedOuthosps = selectPatMedOuthospList(patMedOuthosp);
         for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
+            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
+
+            //璇ユ偅鑰呮湁鍙兘鎻愬墠鏉ュ璇婁簡锛岄偅浠栧悗闈㈢殑鏈瀹ょ殑閫氱煡灏卞彲浠ヤ笉鐢ㄥ啀鍙戠煭淇′簡
+            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
+            if (StringUtils.isNotEmpty(patMedOuthosp1.getDeptcode())) {
+                serviceSubtaskVO.setDeptcode(patMedOuthosp1.getDeptcode());
+                serviceSubtaskVO.setSfzh(patArchive.getIdcardno());
+                serviceSubtaskVO.setType("3");
+                serviceSubtaskVO.setSendstate(2L);
+                serviceSubtaskVO.setPreachform("4");
+                List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+                if (!CollectionUtils.isEmpty(serviceSubtaskList)) {
+                    for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+                        serviceSubtask.setSendstate(6L);
+                        serviceSubtask.setRemark("宸插洖鏉ュ璇婏紝鏃犻渶鍐嶈繘琛岀煭淇¢�氱煡");
+                        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+                    }
+                }
+            }
+
             // 鏍规嵁鎮h�呯殑鐤剧梾锛岃幏鍙栬鐤剧梾鐨勯暱鏈熶换鍔�
             ServiceTaskdiag serviceTaskdiag = new ServiceTaskdiag();
             serviceTaskdiag.setLongtask(1L);
             serviceTaskdiag.setIcd10code(patMedOuthosp1.getIcd10code());
             List<ServiceTaskdiag> serviceTaskdiags = serviceTaskdiagMapper.selectServiceTaskdiagList(serviceTaskdiag);
-            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
             //濡傛灉閮ㄩ棬妯℃澘涓虹┖锛堝皢deptIsNull璁剧疆涓簍rue锛�
             if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTaskdiags) || serviceTaskdiags.size() == 0) {
                 patMedOuthosp1.setDiagcheckFlag("2");
@@ -290,6 +309,10 @@
         //璁剧疆鍙戦�佹椂闂�
         if (serviceTask.getSendDay() == null) serviceTask.setSendDay(1L);
         Date newDate = addDays(patMedOuthosp.getAdmitdate(), serviceTask.getSendDay().intValue());
+        if (patMedOuthosp.getFudate() != null) {
+            //濡傛灉闂ㄨ瘖琛ㄦ湁鎸囧畾闅忚鏃堕棿锛岄偅灏辩敤鎸囧畾鐨�
+            newDate = patMedOuthosp.getFudate();
+        }
         serviceSubtask.setLongSendTime(newDate);
         serviceSubtask.setVisitTime(newDate);
         //鎮h�呭彂閫佹椂闂�
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 e4f500d..b92d0c0 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -71,6 +71,9 @@
     @Value("${defaultPwd}")
     private String defaultPwd;
 
+    @Value("${noLongTask}")
+    private List<String> noLongTask;
+
     public Boolean generalInterface(Map dataMap) {
         Map XiaoXiTou = (Map) dataMap.get("XiaoXiTou");
         String xiaoXiLX = XiaoXiTou.get("XiaoXiLX").toString();
@@ -468,6 +471,10 @@
         if (CollectionUtils.isNotEmpty(patMedInhospList)) {
             patMedInhosp1.setUpdateTime(new Date());
             patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null);
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
+                patMedInhosp1.setFuflag("1");
+            }
             int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
             if (i != 1) return false;
         } else {
@@ -485,6 +492,11 @@
             patMedInhosp1.setPatname(patArchive.getName());
 
             patMedInhosp1.setCreateTime(new Date());
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
+                patMedInhosp1.setFuflag("1");
+            }
+
             int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
             if (i != 1) return false;
         }
@@ -601,6 +613,10 @@
         if (CollectionUtils.isNotEmpty(patMedInhospList)) {
             patMedInhosp1.setUpdateTime(new Date());
             patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null);
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
+                patMedInhosp1.setFuflag("1");
+            }
             int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
             if (i != 1) return false;
         } else {
@@ -618,6 +634,10 @@
             patMedInhosp1.setPatname(patArchive.getName());
 
             patMedInhosp1.setCreateTime(new Date());
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedInhosp1.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
+                patMedInhosp1.setFuflag("1");
+            }
             int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
             if (i != 1) return false;
         }
@@ -883,12 +903,16 @@
         patMedOuthosp.setOrgid(FaSongJGID);
         patMedOuthosp.setHospitalname(FaSongJGMC);
 
+        //杩欎釜闇�瑕佺瓑HIS閭h竟鍛婅瘔鍙栧摢涓瓧娈碉紝鐜板湪杩樻槸涓嶅鐨�
+        patMedOuthosp.setFudate(externalJZInfo.getSfrq());
+
         for (ExternalDiagnosisInfo externalDiagnosisInfo : externalDiagnosisInfoList) {
             if (externalDiagnosisInfo.getZhenDuanLBMC().equals("涓昏瘖鏂�")) {
                 patMedOuthosp.setDiagname(externalDiagnosisInfo.getZhenDuanMC());
                 patMedOuthosp.setDrcode(externalDiagnosisInfo.getZhenDuanYSID());
                 patMedOuthosp.setDrname(externalDiagnosisInfo.getZhenDuanYSXM());
                 patMedOuthosp.setIcd10code(externalDiagnosisInfo.getIcd10());
+                patMedOuthosp.setFuflag("0");
             }
         }
         for (ExternalWZInfo externalWZInfo : ExternalWZInfoList) {
@@ -903,12 +927,37 @@
         if (CollectionUtils.isNotEmpty(patMedOuthosps)) {
             patMedOuthosp.setId(patMedOuthosps.get(0).getId());
             patMedOuthosp.setUpdateTime(new Date());
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedOuthosp.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁匡紝鐢卞尰鐢熻嚜宸卞幓闅忚锛堜附姘翠腑鍖婚櫌棣栨鎻愬嚭锛�
+                patMedOuthosp.setFuflag("1");
+            }
             i = patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
         } else {
             patMedOuthosp.setCreateTime(new Date());
             patMedOuthosp.setUpdateTime(new Date());
+            if (CollectionUtils.isNotEmpty(noLongTask) && noLongTask.contains(patMedOuthosp.getOrgid())) {
+                //涓嶉渶瑕侀暱鏈熶换鍔¢殢璁�
+                patMedOuthosp.setFuflag("1");
+            }
             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 (i > 0) {
             return true;
         }
@@ -1662,7 +1711,7 @@
                 log.info("鑽搧浜у湴浠锋牸鍏ュ弬绫诲瀷涓猴細{}", type);
                 return true;
             case "JZ_MZ_WanChengJZ":
-                log.info("瀹屾垚鎺ヨ瘖鍏ュ弬绫诲瀷涓猴細{}", type);
+                log.info("锛堥棬鎬ヨ瘖锛夊畬鎴愭帴璇婂叆鍙傜被鍨嬩负锛歿}", type);
                 return addFinshJZInfo(dataMap);
             case "JZ_ZY_RuYuanDJ":
                 log.info("鍏ラ櫌鐧昏鍏ュ弬绫诲瀷涓猴細{}", type);
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 1ea6f47..1dc9730 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -928,6 +928,12 @@
             <if test="endtime != null">
                 AND d.endtime = #{endtime}
             </if>
+            <if test="drname != null and drname != ''">
+                AND d.drname LIKE concat('%',#{drname}, '%')
+            </if>
+            <if test="drcode != null">
+                AND d.drcode = #{drcode}
+            </if>
             <if test="cry != null and cry == 0 ">and d.endtime is null</if>
             <if test="cry != null and cry == 1 ">and d.endtime is not null</if>
             <if test="visitno != null and visitno != ''">
@@ -1059,6 +1065,9 @@
             <if test="drname != null and drname != ''">
                 AND d.drname LIKE concat('%',#{drname}, '%')
             </if>
+            <if test="drcode != null">
+                AND d.drcode = #{drcode}
+            </if>
             <if test="pids != null">
                 AND a.id NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 50f29e7..c7c7b9d 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -7,6 +7,7 @@
     <resultMap type="com.smartor.domain.PatMedOuthosp" id="PatMedOuthospResult">
         <result property="id" column="id"/>
         <result property="serialnum" column="serialnum"/>
+        <result property="fuflag" column="fuflag"/>
         <result property="patid" column="patid"/>
         <result property="hospitalname" column="hospitalname"/>
         <result property="hospitalcode" column="hospitalcode"/>
@@ -37,6 +38,7 @@
         <result property="diagcheckFlag" column="diagcheck_flag"/>
         <result property="idcardno" column="idcardno"/>
         <result property="remark" column="remark"/>
+        <result property="fudate" column="fudate"/>
     </resultMap>
 
     <sql id="selectPatMedOuthospVo">
@@ -45,6 +47,8 @@
                diagcheck_flag,
                patno,
                remark,
+               fudate,
+               fuflag,
                serialnum,
                patid,
                hospitalname,
@@ -79,6 +83,7 @@
         select
         pmo.id,
         pmo.remark,
+        pmo.fudate,
         pmo.outhospno,
         pmo.diagcheck_flag,
         pmo.patno,
@@ -106,6 +111,7 @@
         pmo.deptid,
         pmo.schemetime,
         pmo.hpi,
+        pmo.fuflag,
         pmo.patname,
         CONCAT(pa.age,pa.age_unit,pa.age2,pa.age_unit2) AS age,
         pa.telcode,
@@ -129,6 +135,7 @@
                 date_format(#{endTime},'%y%m%d')
             </if>
             <if test="patid != null ">and pmo.patid = #{patid}</if>
+            <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>
             <if test="patno != null ">and pmo.patno = #{patno}</if>
             <if test="outhospno != null  and outhospno != ''">and pmo.outhospno = #{outhospno}</if>
             <if test="diagcheckFlag != null  and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>
@@ -175,6 +182,8 @@
             <if test="patno != null">patno,</if>
             <if test="diagcheckFlag != null">diagcheck_flag,</if>
             <if test="remark != null">remark,</if>
+            <if test="fuflag != null">fuflag,</if>
+            <if test="fudate != null">fudate,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -207,6 +216,8 @@
             <if test="patno != null">#{patno},</if>
             <if test="diagcheckFlag != null">#{diagcheckFlag},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="fuflag != null">#{fuflag},</if>
+            <if test="fudate != null">#{fudate},</if>
         </trim>
     </insert>
 
@@ -242,6 +253,8 @@
         guid,
         patno,
         diagcheck_flag,
+        fuflag,
+        fudate,
         remark)
         values
         <foreach collection="list" item="item" separator=",">
@@ -269,13 +282,14 @@
             #{item.deptid},
             #{item.schemetime},
             #{item.hpi},
-            #{item.hpi},
             #{item.mainsuit},
             #{item.outhospno},
             #{item.patname},
             #{item.guid},
             #{item.patno},
             #{item.diagcheckFlag},
+            #{item.fuflag},
+            #{item.fudate},
             #{item.remark}
             )
         </foreach>
@@ -315,6 +329,8 @@
             <if test="patno != null">patno = #{patno},</if>
             <if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="fuflag != null">fuflag = #{fuflag},</if>
+            <if test="fudate != null">fudate = #{fudate},</if>
         </trim>
         where id = #{id}
     </update>
@@ -371,11 +387,16 @@
 
     <!-- PatMedOuthospMapper.xml -->
     <select id="countPatMedOuthosp" resultType="int">
-        SELECT COUNT(*) FROM pat_med_outhosp
+        SELECT COUNT(*)
+        FROM pat_med_outhosp
     </select>
 
     <update id="renameTable">
-        RENAME TABLE ${oldName} TO ${newName}
+        RENAME
+        TABLE
+        ${oldName}
+        TO
+        ${newName}
     </update>
 
     <update id="createPatMedOuthosp">
@@ -391,12 +412,15 @@
     </update>
 
     <select id="getAllOuthospTableNames" resultType="String">
-        SELECT table_name FROM information_schema.tables
-        WHERE table_schema = DATABASE() AND table_name LIKE 'pat_med_outhosp%'
+        SELECT table_name
+        FROM information_schema.tables
+        WHERE table_schema = DATABASE()
+          AND table_name LIKE 'pat_med_outhosp%'
     </select>
 
     <select id="getMaxIdFromTable" resultType="Long">
-        SELECT IFNULL(MAX(id), 0) FROM ${tableName}
+        SELECT IFNULL(MAX(id), 0)
+        FROM ${tableName}
     </select>
 
     <update id="createOrReplaceView">

--
Gitblit v1.9.3