From 4d7b0c1dc2f1a400005feb93a945a09b52e5d101 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 12 三月 2025 09:47:43 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                              |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java  |    1 
 smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java              |    6 +
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java             |   11 +++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java |    1 
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java            |  132 ++++++++++++++++++++++++++-----------------
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                        |    2 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java                            |    5 +
 8 files changed, 105 insertions(+), 55 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
index d5508dd..084de70 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
@@ -80,6 +80,7 @@
     @ApiOperation("360鎮h�呬俊鎭幏鍙�")
     @PostMapping("/query360PatInfo")
     public Map query360PatInfo(@RequestBody ServiceQueryInfo serviceQueryInfo) {
+        log.error("------serviceQueryInfo鐨勫叆鍙備负锛歿}", serviceQueryInfo);
         Map map = null;
         try {
             map = svyTaskSingleService.query360PatInfo(serviceQueryInfo);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
index 6aba903..98cf55e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -156,6 +156,7 @@
     @ApiOperation("淇敼瀛愪换鍔�")
     @PostMapping("/update")
     public AjaxResult update(@RequestBody ServiceSubtask serviceSubtask) {
+        serviceSubtask.setUpdateBy(getLoginUser().getUser().getNickName());
         return toAjax(serviceSubtaskService.updateServiceSubtask(serviceSubtask));
     }
 
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 14fd931..2553e2c 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
@@ -412,6 +412,8 @@
                             ssvo.setCreateStartTime(startOfDayDate);
                             ssvo.setCreateEndTime(endOfDayDate);
                             ssvo.setCreateBy(serviceSubtask.getCreateBy());
+                            ssvo.setSendname(serviceSubtask.getSendname());
+                            ssvo.setSfzh(serviceSubtask.getSfzh());
                             List<ServiceSubtask> serviceSubtaskListByCreateTime = serviceSubtaskMapper.selectServiceSubtaskListByCreateTime(ssvo);
                             if (CollectionUtils.isEmpty(serviceSubtaskListByCreateTime))
                                 serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
index 0eb2256..13a6bb9 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
@@ -637,4 +637,9 @@
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createEndTime;
 
+    /**
+     * 鎺掑簭锛堬級
+     */
+    @ApiModelProperty(value = "鎺掑簭锛�0 鍑洪櫌鏃堕棿    1 鍙戦�佹椂闂�")
+    private Integer sort;
 }
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 10a024a..9b68c57 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -265,37 +265,42 @@
         log.error("ServiceExternalServiceImpl---addOutHospInfo鐨勬柊澧炵殑鍊间负锛歿}", dataMap);
         Map yeWuXX = (Map) dataMap.get("YeWuXX");
         Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX");
-        List<HashMap<String, Object>> epai = (List<HashMap<String, Object>>) yeWuXX.get("DiZhiXXList");
+        List<HashMap<String, Object>> epai = (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList");
         List<HashMap<String, Object>> epli = (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList");
         ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
         ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
         ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
-        List<ExternalInHospPatientAddrInfo> epai2 = epai.stream().map(map -> {
-            ExternalInHospPatientAddrInfo info = new ExternalInHospPatientAddrInfo();
-            info.setDiZhiLX((String) map.get("DiZhiLX")); // 鍋囪瀛楁绫诲瀷鏄� Integer
-            info.setDiZhiXX((String) map.get("DiZhiXX"));
-            info.setShengFenDM((String) map.get("ShengFenDM"));
-            info.setShengFenMC((String) map.get("ShengFenMC"));
-            info.setShiDiQDM((String) map.get("ShiDiQDM"));
-            info.setShiDiQMC((String) map.get("ShiDiQMC"));
-            info.setXianQuDM((String) map.get("XianQuDM"));
-            info.setXianQuMC((String) map.get("XianQuMC"));
-            info.setXiangZhenDM((String) map.get("XiangZhenDM"));
-            info.setXiangZhenMC((String) map.get("XiangZhenMC"));
-            info.setCunJiDM((String) map.get("CunJiDM"));
-            info.setQiTaXX((String) map.get("QiTaXX"));
-            info.setYouBian((String) map.get("YouBian"));
-            return info;
-        }).collect(Collectors.toList());
-
-        List<ExternalInHospPatientLiaisonInfo> epli2 = epli.stream().map(map -> {
-            ExternalInHospPatientLiaisonInfo info = new ExternalInHospPatientLiaisonInfo();
-            info.setLianXiRXM((String) map.get("LianXiRXM"));
-            info.setLianXiRDH((String) map.get("LianXiRDH"));
-            info.setGuanXiDM((String) map.get("GuanXiDM"));
-            info.setGuanXiMC((String) map.get("GuanXiMC"));
-            return info;
-        }).collect(Collectors.toList());
+        List<ExternalInHospPatientAddrInfo> epai2 = null;
+        if (CollectionUtils.isNotEmpty(epai)) {
+            epai2 = epai.stream().map(map -> {
+                ExternalInHospPatientAddrInfo info = new ExternalInHospPatientAddrInfo();
+                info.setDiZhiLX((String) map.get("DiZhiLX")); // 鍋囪瀛楁绫诲瀷鏄� Integer
+                info.setDiZhiXX((String) map.get("DiZhiXX"));
+                info.setShengFenDM((String) map.get("ShengFenDM"));
+                info.setShengFenMC((String) map.get("ShengFenMC"));
+                info.setShiDiQDM((String) map.get("ShiDiQDM"));
+                info.setShiDiQMC((String) map.get("ShiDiQMC"));
+                info.setXianQuDM((String) map.get("XianQuDM"));
+                info.setXianQuMC((String) map.get("XianQuMC"));
+                info.setXiangZhenDM((String) map.get("XiangZhenDM"));
+                info.setXiangZhenMC((String) map.get("XiangZhenMC"));
+                info.setCunJiDM((String) map.get("CunJiDM"));
+                info.setQiTaXX((String) map.get("QiTaXX"));
+                info.setYouBian((String) map.get("YouBian"));
+                return info;
+            }).collect(Collectors.toList());
+        }
+        List<ExternalInHospPatientLiaisonInfo> epli2 = null;
+        if (CollectionUtils.isNotEmpty(epli)) {
+            epli2 = epli.stream().map(map -> {
+                ExternalInHospPatientLiaisonInfo info = new ExternalInHospPatientLiaisonInfo();
+                info.setLianXiRXM((String) map.get("LianXiRXM"));
+                info.setLianXiRDH((String) map.get("LianXiRDH"));
+                info.setGuanXiDM((String) map.get("GuanXiDM"));
+                info.setGuanXiMC((String) map.get("GuanXiMC"));
+                return info;
+            }).collect(Collectors.toList());
+        }
         if (CollectionUtils.isNotEmpty(epai)) externalInHospPatientAddrInfo = epai2.get(0);
         if (CollectionUtils.isNotEmpty(epli)) externalInHospPatientLiaisonInfo = epli2.get(0);
         //鏂板鎮h�呭熀鏈俊鎭柊澧炴垨淇敼
@@ -304,36 +309,57 @@
         PatMedInhosp patMedInhosp = new PatMedInhosp();
         patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
         List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
+
+        Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX");
+        PatMedInhosp patMedInhosp1 = new PatMedInhosp();
+        if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
+        patMedInhosp1.setSchemestatus(2L);
+        try {
+            patMedInhosp1.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(JiuZhenXX.get("ChuYuanSJ").toString()));
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString());
+        patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString());
+        patMedInhosp1.setUpdateTime(new Date());
+        patMedInhosp1.setTelcode(patArchive.getTelcode());
+        patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
+        patMedInhosp1.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
+        patMedInhosp1.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
+        patMedInhosp1.setDeptname(externalInHospPatientInfo.getDangQianKSMC());
+        patMedInhosp1.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
+        patMedInhosp1.setDeptcode(externalInHospPatientInfo.getDangQianKSID());
+        List<HashMap<String, Object>> zhenDuanList = (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList");
+        List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = zhenDuanList.stream().map(map -> {
+            ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
+            info.setZhenDuanID((String) map.get("ZhenDuanID"));
+            info.setZhenDuanMC((String) map.get("ZhenDuanMC"));
+            return info;
+        }).collect(Collectors.toList());
+        patMedInhosp1.setLeaveicd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeaveicd10code()) ? patMedInhosp1.getLeaveicd10code() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanID() : hospPatientDiagnoseInfos2.get(0).getZhenDuanID());
+        patMedInhosp1.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
+        patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
+        patMedInhosp1.setIcd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
+        patMedInhosp1.setInhospstate("1");
         if (CollectionUtils.isNotEmpty(patMedInhospList)) {
-            Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX");
-            PatMedInhosp patMedInhosp1 = patMedInhospList.get(0);
-            patMedInhosp1.setSchemestatus(2L);
-            try {
-                patMedInhosp1.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(JiuZhenXX.get("ChuYuanSJ").toString()));
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString());
-            patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString());
             patMedInhosp1.setUpdateTime(new Date());
-            patMedInhosp1.setUpdateTime(new Date());
-            patMedInhosp1.setTelcode(patArchive.getTelcode());
-            patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
-            patMedInhosp1.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
-            patMedInhosp1.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
-            patMedInhosp1.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
-            List<HashMap<String, Object>> zhenDuanList = (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList");
-            List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = zhenDuanList.stream().map(map -> {
-                ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
-                info.setZhenDuanID((String) map.get("ZhenDuanID"));
-                info.setZhenDuanMC((String) map.get("ZhenDuanMC"));
-                return info;
-            }).collect(Collectors.toList());
-            patMedInhosp1.setLeaveicd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeaveicd10code()) ? patMedInhosp1.getLeaveicd10code() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanID() : hospPatientDiagnoseInfos2.get(0).getZhenDuanID());
-            patMedInhosp1.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
-            patMedInhosp1.setInhospstate("1");
+            patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString());
             int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
             if (i != 1) return false;
+        } else {
+            patMedInhosp1.setHospitalname(BingRenXX.get("ZuZhiJGMC").toString());
+            patMedInhosp1.setHospitalcode(BingRenXX.get("ZuZhiJGID").toString());
+            patMedInhosp1.setLeavehospitaldistrictname(BingRenXX.get("DangQianBQMC").toString());
+            patMedInhosp1.setLeavehospitaldistrictcode(BingRenXX.get("DangQianBQID").toString());
+            patMedInhosp1.setPatid(patArchive.getId());
+            patMedInhosp1.setPatname(patArchive.getName());
+            patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString());
+            patMedInhosp1.setPatno(BingRenXX.get("BingRenID").toString());
+            patMedInhosp1.setInhospno(BingRenXX.get("ZhuYuanHao").toString());
+            patMedInhosp1.setSerialnum(BingRenXX.get("BingAnHao").toString());
+            patMedInhosp1.setCreateTime(new Date());
+            int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
+            if (i != 1) return false;
         }
         return true;
     }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 7a26316..28d8cde 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -257,7 +257,12 @@
     public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
         List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
         //鏍规嵁鍑洪櫌 鏃堕棿鍊掑簭
-        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime, Comparator.nullsLast(Comparator.naturalOrder())).reversed()).collect(Collectors.toList());
+        List<ServiceSubtask> sortedServiceSubtaskList = null;
+        if (serviceSubtaskVO.getSort() == null || serviceSubtaskVO.getSort() == 0)
+            sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime, Comparator.nullsLast(Comparator.naturalOrder())).reversed()).collect(Collectors.toList());
+        if (serviceSubtaskVO.getSort() != null && serviceSubtaskVO.getSort() == 1)
+            sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getLongSendTime, Comparator.nullsLast(Comparator.naturalOrder())).reversed()).collect(Collectors.toList());
+
         return sortedServiceSubtaskList;
     }
 
@@ -324,6 +329,8 @@
     @Override
     public Boolean updateServiceSubtask(ServiceSubtask serviceSubtask) {
         serviceSubtask.setUpdateTime(DateUtils.getNowDate());
+        if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 6)
+            serviceSubtask.setFinishtime(new Date());
         return serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
     }
 
@@ -491,6 +498,8 @@
                     serviceSubtask.setEndtime(patTaskRelevance.getEndtime());
                     serviceSubtask.setNurseId(patTaskRelevance.getNurseId());
                     serviceSubtask.setNurseName(patTaskRelevance.getNurseName());
+                    serviceSubtask.setCreateBy(serviceTask.getCreateBy());
+                    serviceSubtask.setUpdateBy(serviceTask.getCreateBy());
                     if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
                         serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
                     serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
diff --git a/smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java
index ff10844..9be55c9 100644
--- a/smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java
@@ -317,11 +317,15 @@
         try {
             String jsonString = objectMapper.writeValueAsString(serviceQueryInfo);
             log.error("token鐨勫�间负锛歿}", token);
-            result = OkHttpExample.sendPostRequest("https://9.0.124.84:13021/mediinfo-grus-fuwuzxwg/api/esb/lyraSyncRun", jsonString, token);
+            result = OkHttpExample.sendPostRequest("https://9.0.124.104:13021/mediinfo-grus-fuwuzxwg/api/esb/lyraSyncRun", jsonString, token);
             map = objectMapper.readValue(result, Map.class);
         } catch (Exception e) {
             e.printStackTrace();
         }
+        Integer code = (Integer) map.get("code");
+        if (code != null && code == 0) {
+            map.put("code", 200);
+        }
 
         return map;
     }
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 924b58a..b629835 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -292,6 +292,8 @@
                 #{createEndTime}
             </if>
             <if test="createBy != null ">and create_by = #{createBy}</if>
+            <if test="sendname != null ">and sendname = #{sendname}</if>
+            <if test="sfzh != null ">and sfzh = #{sfzh}</if>
         </where>
 
     </select>

--
Gitblit v1.9.3