From 74ec634d3ecd024e71188cbdfd9a7118c2c645fe Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 17 六月 2025 18:35:39 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java |  617 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 417 insertions(+), 200 deletions(-)

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 c6eb5c5..74436c8 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
@@ -10,6 +10,7 @@
 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;
@@ -205,31 +206,41 @@
 
 
     /**
-     * 澶勭悊his鏁版嵁
+     * 澶勭悊HIS鏁版嵁閲囬泦
+     * 瀹氭椂浠诲姟锛氶噰闆嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹�
      */
     public void dealHisData() {
-        //灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆�
-        // 鑾峰彇褰撳墠鏃ユ湡鍜屾椂闂�
-        LocalDateTime endTime = LocalDateTime.now();
-        endTime = endTime.with(LocalTime.MIN);
-//        String dateStr = "2024/11/30 00:00:00";
-//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
-//        LocalDateTime endTime = LocalDateTime.parse(dateStr, formatter);
-        // 鑾峰彇鍓嶄竴澶╃殑鏃ユ湡鍜屾椂闂�
-        LocalDateTime startTime = endTime.minusDays(1);
-        startTime = startTime.with(LocalTime.MIN);
-        getInHospInfo("0", startTime, endTime);
-        getInHospInfo("1", startTime, endTime);
-
-        //璋冪敤dealOupHospInfo鏁版嵁澶勭悊鏂规硶锛屽鐞嗗畬鍚庯紝灏嗏�滃嚭闄㈣〃鐨刢heck_flag=1鈥�
-        //鑾峰彇褰撳墠鏃ユ湡 锛堢簿纭埌澶╋級寰�鍓嶆帹鐩稿簲澶╂暟锛堝湪鎸囧畾鐨勫熀纭�妯℃澘涓壘瀵瑰簲鐨勫ぉ鏁帮級锛�
-        //寰幆鎮h�呬俊鎭紝鏍规嵁鎮h��"鍑洪櫌璇婃柇ICD鍊尖�濊幏鍙栧埌鐩稿綋鐨勬ā鏉匡紙鑾峰彇鍙栫浉搴旂殑澶╂暟锛�;
-        //鏍规嵁鏌ヨ鍑烘潵鐨勬ā鏉匡紝鍘诲浐瀹氫换鍔★紙鍥哄畾浠诲姟锛屽凡缁忓皢妯℃澘涔熷浐瀹氫簡锛夊幓鍖归厤妯℃澘
-        //鏍规嵁鍖归厤鍑烘潵鐨勬ā鏉垮拰浠诲姟涓庢偅鑰呬俊鎭紝灏嗘暟鎹彃鍏ュ埌瀛愪换鍔¤〃涓�
+        log.info("銆恉ealHisData銆戝紑濮嬫墽琛孒IS鏁版嵁閲囬泦浠诲姟");
+        long startTime = System.currentTimeMillis();
+        
+        try {
+            // 鑾峰彇鏄ㄥぉ0鐐瑰埌浠婂ぉ0鐐圭殑鏃堕棿鑼冨洿
+            LocalDateTime todayZero = LocalDateTime.now().with(LocalTime.MIN);
+            LocalDateTime yesterdayZero = todayZero.minusDays(1);
+            
+            log.info("銆恉ealHisData銆戦噰闆嗘椂闂磋寖鍥达細{} ~ {}", yesterdayZero, todayZero);
+            
+            // 閲囬泦鍏ラ櫌鏁版嵁
+            log.info("銆恉ealHisData銆戝紑濮嬮噰闆嗗叆闄㈡暟鎹�");
+            getInHospInfo("0", yesterdayZero, todayZero);
+            log.info("銆恉ealHisData銆戝叆闄㈡暟鎹噰闆嗗畬鎴�");
+            
+            // 閲囬泦鍑洪櫌鏁版嵁
+            log.info("銆恉ealHisData銆戝紑濮嬮噰闆嗗嚭闄㈡暟鎹�");
+            getInHospInfo("1", yesterdayZero, todayZero);
+            log.info("銆恉ealHisData銆戝嚭闄㈡暟鎹噰闆嗗畬鎴�");
+            
+            long endTime = System.currentTimeMillis();
+            log.info("銆恉ealHisData銆慔IS鏁版嵁閲囬泦浠诲姟瀹屾垚锛屾�昏�楁椂锛歿}ms", endTime - startTime);
+            
+        } catch (Exception e) {
+            log.error("銆恉ealHisData銆慔IS鏁版嵁閲囬泦寮傚父", e);
+            // 杩欓噷鍙互娣诲姞鍛婅閫氱煡閫昏緫锛屾瘮濡傚彂閫侀偖浠舵垨鐭俊
+        }
     }
 
     public void dealHisData2() {
-        //灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆�
+        //灏嗘偅鑰呬俊鎭�佸嚭鍏ラ櫌鏁版嵁鍏ㄩ儴閲囬泦
         // 鎸囧畾鐨勫紑濮嬫棩鏈�
         LocalDate endDate = LocalDate.of(2025, 3, 3);
         // 褰撳墠鏃ユ湡
@@ -282,7 +293,7 @@
 
 
     /**
-     * 闀挎湡浠诲姟鎵ц锛堢數璇濓級
+     * 闀挎湡浠诲姟鎵ц
      */
     public void longTaskSend() {
         //鑾峰彇浠诲姟淇℃伅
@@ -290,7 +301,7 @@
         st.setDelFlag("0");
         st.setLongTask(1);
         List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st);
-        log.error("serviceTasks杩涙潵浜嗗悧锛焮}", serviceTasks);
+        log.info("銆恖ongTaskSend銆戣幏鍙栧埌{}涓暱鏈熶换鍔�", serviceTasks.size());
         for (ServiceTask serviceTask : serviceTasks) {
             CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ();
             commonTaskcallMQ.setTaskid(serviceTask.getTaskid());
@@ -319,14 +330,14 @@
     }
 
     public void sfHandlle(CommonTaskcallMQ commonTaskcallMQ, String ip) {
-        log.error("sfHandlle杩涙潵浜嗗悧锛焮}", commonTaskcallMQ);
+        log.info("銆恠fHandlle銆戝紑濮嬪鐞嗕换鍔★紝浠诲姟ID锛歿}", commonTaskcallMQ.getTaskid());
         //鍒ゆ柇涓�涓媍ommonTaskcallMQ涓殑stopstate鏄惁涓巌vr_task涓殑涓�鑷达紝涓嶄竴鑷达紝鍒欒鏄庢槸鏆傚仠浜�
         ServiceTask ivrTask1 = serviceTaskMapper.selectServiceTaskByTaskid(commonTaskcallMQ.getTaskid());
 
         if (StringUtils.isNotEmpty(commonTaskcallMQ.getPreachform())) {
             //濡備綍浠诲姟鍙戦�佹柟寮忎笉涓虹┖
             String[] split = commonTaskcallMQ.getPreachform().split(",");
-            log.error("split杩涙潵浜嗗悧锛焮}", split);
+            log.info("銆恠fHandlle銆戜换鍔″彂閫佹柟寮忥細{}", Arrays.toString(split));
             for (String serviceFrom : split) {
                 String descByCode = ServiceFromEnum.getDescByCode(Integer.valueOf(serviceFrom));
                 //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭�
@@ -334,6 +345,15 @@
                 ivrTaskcall.setTaskid(commonTaskcallMQ.getTaskid());
                 ivrTaskcall.setSendstate(2L);
                 List<ServiceSubtask> subtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall);
+                //涓芥按鏈夌殑鍖婚櫌杩樻病娉曞仛闀挎湡浠诲姟闅忚
+                List<ServiceSubtask> subtaskList2 = new ArrayList<>();
+                if (visitHosp == 2) {
+                    for (ServiceSubtask serviceSubtask : subtaskList) {
+                        Boolean b = VisitSendStateEnum.getDescByCode(serviceSubtask.getOrgid());
+                        if (b) subtaskList2.add(serviceSubtask);
+                    }
+                    subtaskList = subtaskList2;
+                }
 
                 // 鎸夌収 endtime 绂诲綋鍓嶆椂闂存渶杩戠殑鎺掑簭
                 List<ServiceSubtask> selectServiceSubtaskList = subtaskList.stream().sorted(Comparator.comparing(subtask -> Math.abs(subtask.getEndtime().getTime() - new Date().getTime()))).collect(Collectors.toList());
@@ -344,14 +364,14 @@
                     for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
                         ServiceTask ivrTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
                         if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) {
-                            //濡備綍浠诲姟琚�滄殏鍋溾�濇垨鈥滅粓姝⑩��
+                            //濡備綍浠诲姟琚�"鏆傚仠"鎴�"缁堟"
                             break;
                         }
                         if (org.apache.commons.lang3.StringUtils.isEmpty(serviceSubtask.getPhone())) {
                             serviceSubtask.setRemark("鎵嬫満鍙蜂负绌�");
                             serviceSubtask.setSendstate(4L);
                             serviceSubtask.setResult("error");
-                            serviceSubtask.setFinishtime(new Date());
+//                            serviceSubtask.setFinishtime(new Date());
                             serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                             continue;
                         }
@@ -383,6 +403,7 @@
                     if (list.size() > 0) {
 //                        redisCache.setCacheListLeft("cache-0", list);
                         redisCache.setCacheListLeftAndDistinct("cache-0", list);
+                        log.info("銆恠fHandlle銆戠數璇濅换鍔″凡鍔犲叆闃熷垪锛屾暟閲忥細{}", list.size());
                     }
                 } else if (descByCode.equals("澶氬獟浣�")) {
                     //澶氬獟浣�
@@ -390,7 +411,7 @@
                     //绾歌川
                 } else if (descByCode.equals("寰俊灏忕▼搴�")) {
                     //寰俊灏忕▼搴�
-                    log.error("ivrTask1鐨勫�间负锛歿}", ivrTask1);
+                    log.info("銆恠fHandlle銆戝鐞嗗井淇″皬绋嬪簭浠诲姟锛屼换鍔′俊鎭細{}", ivrTask1);
                     if (ObjectUtils.isNotEmpty(ivrTask1) && ivrTask1.getPatCycle() == 1) {
                         //璇存槑璇ヤ换鍔$殑鎮h�呮槸寰幆鎵ц鐨�
                         ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
@@ -435,7 +456,7 @@
                     RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                     String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                     for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
-                        log.error("鐭俊闀挎湡浠诲姟鍙戦��---------杩涙潵浜嗗悧锛焮}", serviceSubtask);
+                        log.info("銆恠fHandlle銆戝鐞嗙煭淇¢暱鏈熶换鍔★紝鎮h�匢D锛歿}", serviceSubtask.getPatid());
                         boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
                         if (dateToday) {
                             try {
@@ -446,7 +467,7 @@
                                     serviceSubtask.setResult("error");
                                     serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                     serviceSubtask.setSendstate(4L);
-                                    serviceSubtask.setFinishtime(new Date());
+//                                    serviceSubtask.setFinishtime(new Date());
                                     iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                     continue;
                                 }
@@ -484,13 +505,13 @@
                                         ss.setRemark("鐭俊鍙戦�佸け璐�,璇ユ満鏋勬病鏈夐厤缃煭淇″湴鍧�");
                                         ss.setSendstate(5L);
                                         ss.setId(serviceSubtask.getId());
-                                        ss.setFinishtime(new Date());
+//                                        ss.setFinishtime(new Date());
                                         serviceSubtaskMapper.updateServiceSubtask(ss);
                                         continue;
                                     }
-                                    log.error("---------涓芥按鐭俊鍙戦�佸叆鍙俛ddress锛歿},  sendMagParam:{},  orgid:{}-------", map.get("address"), sendMagParam, serviceSubtask.getOrgid());
+                                    log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫侊紝鍦板潃锛歿}锛屽弬鏁帮細{}锛屾満鏋処D锛歿}", map.get("address"), sendMagParam, serviceSubtask.getOrgid());
                                     String dxCode = getDXCode(map.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), map.get("sendPersonId"), map.get("sendPersonName"), MsgLSEnum.getHeaderByCode(serviceSubtask.getOrgid()), token);
-                                    log.error("---------涓芥按鐭俊鍙戦�佺粨鏋滐細{}-------", dxCode);
+                                    log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫佺粨鏋滐細{}", dxCode);
                                     ObjectMapper objectMapper = new ObjectMapper();
                                     Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class);
                                     String code = textParam.get("Code").toString();
@@ -523,23 +544,23 @@
                                 iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                             } catch (Exception e) {
                                 String guid = UUID.randomUUID().toString();
-                                log.error("闀挎湡浠诲姟锛岀煭淇″彂閫佸け璐ュ師鍥狅細{},{}", e.getMessage(), guid);
+                                log.error("銆恠fHandlle銆戦暱鏈熶换鍔$煭淇″彂閫佸け璐ワ紝鍘熷洜锛歿}锛孏UID锛歿}", e.getMessage(), guid);
                                 serviceSubtask.setResult("error");
                                 serviceSubtask.setRemark("绯荤粺閿欒");
                                 serviceSubtask.setSendstate(5L);
-                                serviceSubtask.setFinishtime(new Date());
+//                                serviceSubtask.setFinishtime(new Date());
                                 serviceSubtask.setGuid(guid);
                                 iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                             }
                         }
                     }
                 } else if (descByCode.equals("鍏紬鍙�")) {
-                    log.error("鍏紬鍙疯繘鏉ヤ簡鍚楋紵{}", descByCode);
+                    log.info("銆恠fHandlle銆戝鐞嗗叕浼楀彿浠诲姟锛屼换鍔′俊鎭細{}", ivrTask1);
                     //鍏紬鍙�
                     RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                     String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                     for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
-                        log.error("serviceSubtask---------杩涙潵浜嗗悧锛焮}", serviceSubtask);
+                        //  log.error("serviceSubtask---------杩涙潵浜嗗悧锛焮}", serviceSubtask);
                         boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
                         if (dateToday) {
                             try {
@@ -550,7 +571,7 @@
                                     serviceSubtask.setResult("error");
                                     serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                     serviceSubtask.setSendstate(4L);
-                                    serviceSubtask.setFinishtime(new Date());
+//                                    serviceSubtask.setFinishtime(new Date());
                                     iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                     continue;
                                 }
@@ -567,7 +588,7 @@
                                     ss.setRemark("璇ユ満鏋勭殑鍏紬鍙烽厤缃俊鎭笉鍏紝鏃犳硶閫氳繃鍏紬鍙峰彂閫�");
                                     ss.setSendstate(5L);
                                     ss.setId(serviceSubtask.getId());
-                                    ss.setFinishtime(new Date());
+//                                    ss.setFinishtime(new Date());
                                     serviceSubtaskMapper.updateServiceSubtask(ss);
                                     continue;
                                 }
@@ -578,7 +599,7 @@
                                     ss.setRemark("鍏紬鍙峰彂閫佸け璐�,his绯荤粺鐨勬偅鑰卛d涓虹┖");
                                     ss.setSendstate(5L);
                                     ss.setId(serviceSubtask.getId());
-                                    ss.setFinishtime(new Date());
+//                                    ss.setFinishtime(new Date());
                                     serviceSubtaskMapper.updateServiceSubtask(ss);
                                     continue;
                                 }
@@ -602,7 +623,7 @@
                                 if ((Boolean) map.get("succ") == true) {
                                     serviceSubtask.setResult("success");
                                 } else {
-                                    log.error("serviceSubtask1231313鐨勫�间负锛歿}", serviceSubtask);
+                                    log.error("銆恠fHandlle銆戝叕浼楀彿鍙戦�佸け璐ワ紝鎮h�呬俊鎭細{}锛岄敊璇俊鎭細{}", serviceSubtask, map.get("msg"));
                                     serviceSubtask.setResult("error");
                                     serviceSubtask.setSendstate(5L);
                                     serviceSubtask.setRemark(map.get("msg").toString());
@@ -610,11 +631,11 @@
                                 iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                             } catch (Exception e) {
                                 String guid = UUID.randomUUID().toString();
-                                log.error("闀挎湡浠诲姟锛屽叕浼楀彿鍙戦�佸け璐ュ師鍥狅細{},{}", e.getMessage(), guid);
+                                log.error("銆恠fHandlle銆戦暱鏈熶换鍔″叕浼楀彿鍙戦�佸け璐ワ紝鍘熷洜锛歿}锛孏UID锛歿}", e.getMessage(), guid);
                                 serviceSubtask.setResult("error");
                                 serviceSubtask.setRemark("绯荤粺閿欒");
                                 serviceSubtask.setSendstate(5L);
-                                serviceSubtask.setFinishtime(new Date());
+//                                serviceSubtask.setFinishtime(new Date());
                                 serviceSubtask.setGuid(guid);
                                 iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                             }
@@ -628,186 +649,382 @@
 
 
     /**
-     * 鑾峰嚭闄㈡偅鑰呬俊鎭�
-     * cry    鍑哄叆闄細 0 鍏ラ櫌   1 鍑洪櫌
+     * 鑾峰彇鎮h�呭嚭鍏ラ櫌淇℃伅
+     * @param cry 鍑哄叆闄㈢被鍨嬶細0-鍏ラ櫌锛�1-鍑洪櫌
+     * @param startTime 寮�濮嬫椂闂�
+     * @param endTime 缁撴潫鏃堕棿
      */
     @Transactional
     public void getInHospInfo(String cry, LocalDateTime startTime, LocalDateTime endTime) {
-        // 瀹氫箟鏃ユ湡鏃堕棿鏍煎紡
+        String typeName = "0".equals(cry) ? "鍏ラ櫌" : "鍑洪櫌";
+        log.info("銆恎etInHospInfo銆戝紑濮嬭幏鍙杮}鎮h�呬俊鎭紝鏃堕棿鑼冨洿锛歿} ~ {}", typeName, startTime, endTime);
+        long startTimeMillis = System.currentTimeMillis();
+        
+        try {
+            // 绗竴姝ワ細鏋勫缓璇锋眰鍙傛暟骞惰皟鐢℉IS鎺ュ彛
+            List<ThiedInhospInfo> thiedInhospInfoList = fetchHisData(cry, startTime, endTime);
+            
+            if (CollectionUtils.isEmpty(thiedInhospInfoList)) {
+                log.info("銆恎etInHospInfo銆憑}鎮h�呬俊鎭负绌猴紝璺宠繃澶勭悊", typeName);
+                return;
+            }
+            
+            log.info("銆恎etInHospInfo銆戣幏鍙栧埌{}鏉}鎮h�呬俊鎭�", thiedInhospInfoList.size(), typeName);
+            
+            // 绗簩姝ワ細淇濆瓨鍘熷鏁版嵁鍒版枃浠讹紙鐢ㄤ簬澶囦唤锛�
+            saveRawDataToFile(cry, thiedInhospInfoList);
+            
+            // 绗笁姝ワ細澶勭悊鎮h�呮暟鎹�
+            processPatientData(thiedInhospInfoList, cry);
+            
+            long endTimeMillis = System.currentTimeMillis();
+            log.info("銆恎etInHospInfo銆憑}鎮h�呬俊鎭鐞嗗畬鎴愶紝鑰楁椂锛歿}ms", typeName, endTimeMillis - startTimeMillis);
+            
+        } catch (Exception e) {
+            log.error("銆恎etInHospInfo銆戣幏鍙杮}鎮h�呬俊鎭紓甯�", typeName, e);
+            throw new RuntimeException("鑾峰彇" + typeName + "鎮h�呬俊鎭け璐�", e);
+        }
+    }
+    
+    /**
+     * 绗竴姝ワ細璋冪敤HIS鎺ュ彛鑾峰彇鏁版嵁
+     */
+    private List<ThiedInhospInfo> fetchHisData(String cry, LocalDateTime startTime, LocalDateTime endTime) {
+        try {
+            // 鏋勫缓璇锋眰鍙傛暟
+            Map<String, String> requestParams = buildRequestParams(cry, startTime, endTime);
+            
+            // 鏋勫缓璇锋眰澶�
+            Map<String, String> headers = buildRequestHeaders(startTime);
+            
+            // 鍙戦�丠TTP璇锋眰
+            String result = HttpUtils.sendPostByHeader(hospInfoUrl, new Gson().toJson(requestParams), headers);
+            
+            // 瑙f瀽鍝嶅簲鏁版嵁
+            return parseResponseData(result);
+            
+        } catch (Exception e) {
+            log.error("銆恌etchHisData銆戣皟鐢℉IS鎺ュ彛寮傚父", e);
+            throw e;
+        }
+    }
+    
+    /**
+     * 鏋勫缓璇锋眰鍙傛暟
+     */
+    private Map<String, String> buildRequestParams(String cry, LocalDateTime startTime, LocalDateTime endTime) {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
         Map<String, String> req = new HashMap<>();
-        if (cry.equals("1")) {
+        
+        if ("1".equals(cry)) {
+            // 鍑洪櫌鍙傛暟
             req.put("cashStartDate", startTime.format(formatter));
             req.put("cashEndDate", endTime.format(formatter));
             req.put("currStatus", "4");
-        } else if (cry.equals("0")) {
+        } else {
+            // 鍏ラ櫌鍙傛暟
             req.put("admissStartDate", startTime.format(formatter));
             req.put("admissEndDate", endTime.format(formatter));
             req.put("currStatus", "2");
         }
+        
+        return req;
+    }
+    
+    /**
+     * 鏋勫缓璇锋眰澶�
+     */
+    private Map<String, String> buildRequestHeaders(LocalDateTime startTime) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
         Map<String, String> header = new HashMap<>();
         header.put("x-hcsb-serviceno", "IS002347");
         header.put("x-hcsb-version", "2.0");
         header.put("x-hcsb-sourcesyscode", "14");
         header.put("x-hcsb-token", "ArGE2JnHtxG/Zx5nrnGY4eOfMUJGGJokAJHigG1BrCY=");
         header.put("x-hcsb-msgdate", startTime.format(formatter));
-        String result = HttpUtils.sendPostByHeader(hospInfoUrl, new Gson().toJson(req), header);
-        //鏁版嵁瑙f瀽
-        Gson gson = new Gson();
-        JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
-        JsonArray resultArray = jsonObject.getAsJsonObject("data").getAsJsonArray("result");
-        Type resultType = new TypeToken<List<ThiedInhospInfo>>() {
-        }.getType();
-        List<ThiedInhospInfo> thiedInhospInfoList = gson.fromJson(resultArray, resultType);
-
-        // 鍒涘缓涓�涓柊鏂囦欢
-        String filename = null;
-        if (cry.equals("0")) filename = "鍏ラ櫌淇℃伅" + System.currentTimeMillis();
-        if (cry.equals("1")) filename = "鍑洪櫌淇℃伅" + System.currentTimeMillis();
-        File file = new File("D:\\public\\HIS鏁版嵁閲囬泦\\" + filename);
-        if (!file.exists()) {
-            // 濡傛灉鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘柊鏂囦欢
-            try {
-                if (file.createNewFile()) {
-                    System.out.println("鎴愬姛鍒涘缓浜嗘柊鏂囦欢!");
-                } else {
-                    System.out.println("澶辫触锛佹枃浠舵棤娉曞垱寤猴紒");
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        // 灏嗘暟鎹啓鍏ュ埌鏂囦欢涓�
+        return header;
+    }
+    
+    /**
+     * 瑙f瀽鍝嶅簲鏁版嵁
+     */
+    private List<ThiedInhospInfo> parseResponseData(String result) {
         try {
-            FileWriter writer = new FileWriter(file);
-            writer.write(result);
-        } catch (IOException e) {
-            e.printStackTrace();
+            Gson gson = new Gson();
+            JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
+            JsonArray resultArray = jsonObject.getAsJsonObject("data").getAsJsonArray("result");
+            Type resultType = new TypeToken<List<ThiedInhospInfo>>() {}.getType();
+            return gson.fromJson(resultArray, resultType);
+        } catch (Exception e) {
+            log.error("銆恜arseResponseData銆戣В鏋愬搷搴旀暟鎹紓甯革紝鍘熷鏁版嵁锛歿}", result, e);
+            throw e;
         }
-
-        if (CollectionUtils.isNotEmpty(thiedInhospInfoList)) {
-            for (ThiedInhospInfo thiedInhospInfo : thiedInhospInfoList) {
-                //閫氳繃韬唤璇佸彿鏌ヨ璇ユ偅鑰呭湪鎮h�呰〃鏄惁瀛樺湪
-                PatArchive patArchive = new PatArchive();
-                List<PatArchive> patArchives = null;
-                patArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
-                if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiIdCardNo().trim())) {
-                    patArchives = patArchiveService.selectPatArchiveList(patArchive);
+    }
+    
+    /**
+     * 绗簩姝ワ細淇濆瓨鍘熷鏁版嵁鍒版枃浠�
+     */
+    private void saveRawDataToFile(String cry, List<ThiedInhospInfo> dataList) {
+        try {
+            String typeName = "0".equals(cry) ? "鍏ラ櫌淇℃伅" : "鍑洪櫌淇℃伅";
+            String filename = typeName + "_" + System.currentTimeMillis() + ".json";
+            String filePath = "D:\\public\\HIS鏁版嵁閲囬泦\\" + filename;
+            
+            File file = new File(filePath);
+            File parentDir = file.getParentFile();
+            if (!parentDir.exists()) {
+                parentDir.mkdirs();
+            }
+            
+            if (!file.exists()) {
+                file.createNewFile();
+            }
+            
+            // 灏嗘暟鎹啓鍏ユ枃浠�
+            try (FileWriter writer = new FileWriter(file)) {
+                writer.write(new Gson().toJson(dataList));
+            }
+            
+            log.info("銆恠aveRawDataToFile銆戝師濮嬫暟鎹凡淇濆瓨鍒版枃浠讹細{}", filePath);
+            
+        } catch (Exception e) {
+            log.error("銆恠aveRawDataToFile銆戜繚瀛樺師濮嬫暟鎹埌鏂囦欢寮傚父", e);
+            // 鏂囦欢淇濆瓨澶辫触涓嶅奖鍝嶄富娴佺▼锛屽彧璁板綍鏃ュ織
+        }
+    }
+    
+    /**
+     * 绗笁姝ワ細澶勭悊鎮h�呮暟鎹�
+     */
+    private void processPatientData(List<ThiedInhospInfo> thiedInhospInfoList, String cry) {
+        int successCount = 0;
+        int skipCount = 0;
+        int errorCount = 0;
+        
+        for (ThiedInhospInfo thiedInhospInfo : thiedInhospInfoList) {
+            try {
+                if (processSinglePatient(thiedInhospInfo, cry)) {
+                    successCount++;
                 } else {
-                    //鎮h�呬俊鎭负绌猴紝鐩存帴 涓嬩竴涓�
-                    continue;
+                    skipCount++;
                 }
-                if (CollectionUtils.isEmpty(patArchives) || patArchives.size() == 0) {
-                    patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo());
-                    patArchive.setSourcefrom(2);
-                    patArchive.setPattype("2");
-                    if (StringUtils.isNotEmpty(thiedInhospInfo.getOutWayId()) && thiedInhospInfo.getOutWayId().equals("4")) {
-                        //濡傛灉涓�4灏辨槸姝讳骸
-                        patArchive.setNotrequiredFlag("1");
-                        patArchive.setNotrequiredreason(thiedInhospInfo.getOutWayName());
-                    }
-                    if (cry.equals("1") && StringUtils.isEmpty(thiedInhospInfo.getOutWayId())) {
-                        //濡傛灉涓�4灏辨槸姝讳骸
-                        patArchive.setNotrequiredFlag("1");
-                        patArchive.setNotrequiredreason("鍑洪櫌鏂瑰紡涓虹┖");
-                    }
-                    patArchive.setSex(thiedInhospInfo.getPatiRecordGender().equals("鐢�") ? 1L : 2L);
-                    patArchive.setNation(thiedInhospInfo.getPatiNation());
-                    patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
-                    patArchive.setPlaceOfResidence(StringUtils.isNotEmpty(thiedInhospInfo.getPatiHomeAddr()) ? thiedInhospInfo.getPatiHomeAddr().replace("null", "") : "");
-                    try {
-                        if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday()))
-                            patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
-                    } catch (ParseException e) {
-                        e.printStackTrace();
-                    }
-                    if (thiedInhospInfo.getTreateAge() != null) {
-                        patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge()));
-                    } else {
-                        patArchive.setAge(null);
-                    }
-                    patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit());
-                    patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum());
-                    patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone());
-                    patArchive.setDelFlag("0");
-                    patArchive.setCreateTime(new Date());
-                    patArchive.setUpdateTime(new Date());
-                    patArchive.setName(thiedInhospInfo.getPatiRecordName());
-                    patArchiveService.insertPatArchive(patArchive);
-                } else {
-                    patArchive = patArchives.get(0);
-                }
-
-                log.error("鍏ュ弬鐨刾atArchive锛歿}", patArchive);
-                PatMedInhosp patMedInhosp = new PatMedInhosp();
-                patMedInhosp.setPatid(patArchive.getId());
-                patMedInhosp.setPatno(patArchive.getPatientno());
-                patMedInhosp.setPatname(patArchive.getName());
-                patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
-                patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
-                patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
-                patMedInhosp.setFuflag("1");
-                if (cry.equals("0")) {
-                    patMedInhosp.setInhospstate("0");
-                } else if (cry.equals("1")) {
-                    patMedInhosp.setInhospstate("1");
-                }
-                patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId());
-                patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10());
-                patMedInhosp.setDiagname(thiedInhospInfo.getDiagName());
-                try {
-                    if (StringUtils.isNotEmpty(thiedInhospInfo.getAdmissDate()))
-                        patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate()));
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
-                try {
-                    if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate()))
-                        patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate()));
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
-                patMedInhosp.setDeptcode(thiedInhospInfo.getAdmissDeptId());
-                patMedInhosp.setDeptid(thiedInhospInfo.getAdmissDeptId());
-                patMedInhosp.setDeptname(thiedInhospInfo.getAdmissDeptName());
-                patMedInhosp.setBedNo(thiedInhospInfo.getAdmissBedNo());
-                patMedInhosp.setDelFlag("0");
-//                patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptCode());
-                patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId());
-                patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName());
-                patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName());
-                patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10());
-                patMedInhosp.setDrname(thiedInhospInfo.getDoctName());
-                patMedInhosp.setDrcode(thiedInhospInfo.getDoctId());
-                patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId());
-                patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName());
-                if (cry.equals("0")) {
-                    patMedInhosp.setSchemestatus(1L);
-                } else if (cry.equals("1")) {
-                    patMedInhosp.setSchemestatus(2L);
-                }
-                patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode());
-                patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId());
-                patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName());
-                patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode());
-                patMedInhosp.setOrgid("1");
-                //濡傛灉鏄嚭闄紝鍏堥�氳繃鎮h�呯紪鍙峰拰娴佹按鍙峰幓鏌ヤ竴涓嬶紝鎮h�呮槸鍚﹀瓨鍦紝濡傛灉瀛樺湪锛屽垯杩涜淇敼
-                PatMedInhosp inhosp = new PatMedInhosp();
-                inhosp.setPatno(patArchive.getPatientno());
-                inhosp.setSerialnum(patMedInhosp.getSerialnum());
-                List<PatMedInhosp> patMedInhosps = patMedInhospService.selectPatMedInhospList(inhosp);
-                log.error("鏄惁闇�瑕佹洿鏂帮細{}", patMedInhosps.size());
-                if (CollectionUtils.isNotEmpty(patMedInhosps)) {
-                    patMedInhosp.setInhospid(patMedInhosps.get(0).getInhospid());
-                    log.error("------鎮h�呭嚭鍏ラ櫌淇敼淇℃伅锛歿}", patMedInhosp);
-                    patMedInhospService.updatePatMedInhosp(patMedInhosp);
-                } else {
-                    log.error("----鎮h�呭嚭鍏ラ櫌鏂板淇℃伅锛歿}", patMedInhosp);
-                    patMedInhospService.insertPatMedInhosp(patMedInhosp);
-                }
-
+            } catch (Exception e) {
+                errorCount++;
+                log.error("銆恜rocessPatientData銆戝鐞嗘偅鑰呮暟鎹紓甯革紝鎮h�匢D锛歿}", 
+                    thiedInhospInfo.getPatiMediaNo(), e);
             }
         }
+        
+        log.info("銆恜rocessPatientData銆戞偅鑰呮暟鎹鐞嗗畬鎴愶紝鎴愬姛锛歿}锛岃烦杩囷細{}锛屽け璐ワ細{}", 
+            successCount, skipCount, errorCount);
+    }
+    
+    /**
+     * 澶勭悊鍗曚釜鎮h�呮暟鎹�
+     */
+    private boolean processSinglePatient(ThiedInhospInfo thiedInhospInfo, String cry) {
+        // 楠岃瘉韬唤璇佸彿
+        if (StringUtils.isEmpty(thiedInhospInfo.getPatiIdCardNo())) {
+            log.warn("銆恜rocessSinglePatient銆戞偅鑰呰韩浠借瘉鍙蜂负绌猴紝璺宠繃澶勭悊锛屾偅鑰呯紪鍙凤細{}", 
+                thiedInhospInfo.getPatiMediaNo());
+            return false;
+        }
+        
+        // 澶勭悊鎮h�呮。妗堜俊鎭�
+        PatArchive patArchive = processPatientArchive(thiedInhospInfo, cry);
+        
+        // 澶勭悊鎮h�呬綇闄俊鎭�
+        processPatientInhospInfo(thiedInhospInfo, patArchive, cry);
+        
+        return true;
+    }
+    
+    /**
+     * 澶勭悊鎮h�呮。妗堜俊鎭�
+     */
+    private PatArchive processPatientArchive(ThiedInhospInfo thiedInhospInfo, String cry) {
+        // 鏌ヨ鎮h�呮槸鍚﹀凡瀛樺湪
+        PatArchive queryArchive = new PatArchive();
+        queryArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
+        List<PatArchive> existingArchives = patArchiveService.selectPatArchiveList(queryArchive);
+        
+        // 鏋勫缓鎮h�呮。妗堜俊鎭�
+        PatArchive patArchive = buildPatientArchive(thiedInhospInfo, cry);
+        
+        // 淇濆瓨鎴栨洿鏂版偅鑰呮。妗�
+        if (CollectionUtils.isEmpty(existingArchives)) {
+            patArchiveService.insertPatArchive(patArchive);
+            log.debug("銆恜rocessPatientArchive銆戞柊澧炴偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
+        } else {
+            patArchive.setId(existingArchives.get(0).getId());
+            patArchiveService.updateArchive(patArchive);
+            log.debug("銆恜rocessPatientArchive銆戞洿鏂版偅鑰呮。妗堬紝鎮h�呯紪鍙凤細{}", patArchive.getPatientno());
+        }
+        
+        return patArchive;
+    }
+    
+    /**
+     * 鏋勫缓鎮h�呮。妗堜俊鎭�
+     */
+    private PatArchive buildPatientArchive(ThiedInhospInfo thiedInhospInfo, String cry) {
+        PatArchive patArchive = new PatArchive();
+        
+        // 鍩烘湰淇℃伅
+        patArchive.setPatientno(thiedInhospInfo.getPatiMediaNo());
+        patArchive.setIdcardno(thiedInhospInfo.getPatiIdCardNo().trim());
+        patArchive.setName(thiedInhospInfo.getPatiRecordName());
+        patArchive.setSourcefrom(2);
+        patArchive.setPattype("2");
+        
+        // 鎬у埆
+        patArchive.setSex("鐢�".equals(thiedInhospInfo.getPatiRecordGender()) ? 1L : 2L);
+        
+        // 姘戞棌鍜岀睄璐�
+        patArchive.setNation(thiedInhospInfo.getPatiNation());
+        patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
+        
+        // 灞呬綇鍦板潃
+        String homeAddr = thiedInhospInfo.getPatiHomeAddr();
+        patArchive.setPlaceOfResidence(StringUtils.isNotEmpty(homeAddr) ? homeAddr.replace("null", "") : "");
+        
+        // 鍑虹敓鏃ユ湡
+        if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday())) {
+            try {
+                patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
+            } catch (ParseException e) {
+                log.warn("銆恇uildPatientArchive銆戣В鏋愬嚭鐢熸棩鏈熷け璐ワ細{}", thiedInhospInfo.getPatiBirthday(), e);
+            }
+        }
+        
+        // 骞撮緞
+        if (thiedInhospInfo.getTreateAge() != null) {
+            patArchive.setAge(Long.valueOf(thiedInhospInfo.getTreateAge()));
+        }
+        patArchive.setAgeUnit(thiedInhospInfo.getTreatAgeunit());
+        
+        // 鑱旂郴鏂瑰紡
+        patArchive.setTelcode(thiedInhospInfo.getCompanyTelNum());
+        patArchive.setRelativetelcode(thiedInhospInfo.getContactPersonPhone());
+        
+        // 鍑洪櫌鏂瑰紡澶勭悊锛堟浜$瓑鐗规畩鎯呭喌锛�
+        if (StringUtils.isNotEmpty(thiedInhospInfo.getOutWayId()) && "4".equals(thiedInhospInfo.getOutWayId())) {
+            patArchive.setNotrequiredFlag("1");
+            patArchive.setNotrequiredreason(thiedInhospInfo.getOutWayName());
+        }
+        if ("1".equals(cry) && StringUtils.isEmpty(thiedInhospInfo.getOutWayId())) {
+            patArchive.setNotrequiredFlag("1");
+            patArchive.setNotrequiredreason("鍑洪櫌鏂瑰紡涓虹┖");
+        }
+        
+        // 绯荤粺瀛楁
+        patArchive.setDelFlag("0");
+        patArchive.setCreateTime(new Date());
+        patArchive.setUpdateTime(new Date());
+        
+        return patArchive;
+    }
+    
+    /**
+     * 澶勭悊鎮h�呬綇闄俊鎭�
+     */
+    private void processPatientInhospInfo(ThiedInhospInfo thiedInhospInfo, PatArchive patArchive, String cry) {
+        // 鏋勫缓浣忛櫌淇℃伅
+        PatMedInhosp patMedInhosp = buildPatientInhospInfo(thiedInhospInfo, patArchive, cry);
+        
+        // 鏌ヨ鏄惁宸插瓨鍦ㄤ綇闄㈣褰�
+        PatMedInhosp queryInhosp = new PatMedInhosp();
+        queryInhosp.setPatno(patArchive.getPatientno());
+        queryInhosp.setSerialnum(patMedInhosp.getSerialnum());
+        List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhospList(queryInhosp);
+        
+        // 淇濆瓨鎴栨洿鏂颁綇闄俊鎭�
+        if (CollectionUtils.isNotEmpty(existingInhosps)) {
+            patMedInhosp.setInhospid(existingInhosps.get(0).getInhospid());
+            patMedInhospService.updatePatMedInhosp(patMedInhosp);
+            log.debug("銆恜rocessPatientInhospInfo銆戞洿鏂颁綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", 
+                patArchive.getPatientno(), patMedInhosp.getSerialnum());
+        } else {
+            patMedInhospService.insertPatMedInhosp(patMedInhosp);
+            log.debug("銆恜rocessPatientInhospInfo銆戞柊澧炰綇闄俊鎭紝鎮h�呯紪鍙凤細{}锛屾祦姘村彿锛歿}", 
+                patArchive.getPatientno(), patMedInhosp.getSerialnum());
+        }
+    }
+    
+    /**
+     * 鏋勫缓鎮h�呬綇闄俊鎭�
+     */
+    private PatMedInhosp buildPatientInhospInfo(ThiedInhospInfo thiedInhospInfo, PatArchive patArchive, String cry) {
+        PatMedInhosp patMedInhosp = new PatMedInhosp();
+        
+        // 鎮h�呭熀鏈俊鎭�
+        patMedInhosp.setPatid(patArchive.getId());
+        patMedInhosp.setPatno(patArchive.getPatientno());
+        patMedInhosp.setPatname(patArchive.getName());
+        
+        // 鎶ょ悊淇℃伅
+        patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
+        patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
+        
+        // 浣忛櫌淇℃伅
+        patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
+        patMedInhosp.setFuflag("1");
+        patMedInhosp.setInhospstate("0".equals(cry) ? "0" : "1");
+        
+        // 鍖婚櫌鍜岀瀹や俊鎭�
+        patMedInhosp.setHospitalcode(thiedInhospInfo.getAreaId());
+        patMedInhosp.setDeptcode(thiedInhospInfo.getAdmissDeptId());
+        patMedInhosp.setDeptid(thiedInhospInfo.getAdmissDeptId());
+        patMedInhosp.setDeptname(thiedInhospInfo.getAdmissDeptName());
+        patMedInhosp.setBedNo(thiedInhospInfo.getAdmissBedNo());
+        
+        // 璇婃柇淇℃伅
+        patMedInhosp.setIcd10code(thiedInhospInfo.getDiagIcd10());
+        patMedInhosp.setDiagname(thiedInhospInfo.getDiagName());
+        
+        // 鏃堕棿淇℃伅
+        if (StringUtils.isNotEmpty(thiedInhospInfo.getAdmissDate())) {
+            try {
+                patMedInhosp.setStarttime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getAdmissDate()));
+            } catch (ParseException e) {
+                log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬叆闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getAdmissDate(), e);
+            }
+        }
+        
+        if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate())) {
+            try {
+                patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate()));
+            } catch (ParseException e) {
+                log.warn("銆恇uildPatientInhospInfo銆戣В鏋愬嚭闄㈡椂闂村け璐ワ細{}", thiedInhospInfo.getOutDate(), e);
+            }
+        }
+        
+        // 鍑洪櫌淇℃伅
+        patMedInhosp.setLeaveldeptcode(thiedInhospInfo.getCurrDeptId());
+        patMedInhosp.setLeaveldeptname(thiedInhospInfo.getCurrDeptName());
+        patMedInhosp.setLeavediagname(thiedInhospInfo.getDiagName());
+        patMedInhosp.setLeaveicd10code(thiedInhospInfo.getDiagIcd10());
+        patMedInhosp.setOutWayId(thiedInhospInfo.getOutWayId());
+        patMedInhosp.setOutWayName(thiedInhospInfo.getOutWayName());
+        
+        // 鍖荤敓淇℃伅
+        patMedInhosp.setDrname(thiedInhospInfo.getDoctName());
+        patMedInhosp.setDrcode(thiedInhospInfo.getDoctId());
+        
+        // 鐥呭尯淇℃伅
+        patMedInhosp.setLeavehospitaldistrictid(thiedInhospInfo.getCurrWardCode());
+        patMedInhosp.setLeavehospitaldistrictcode(thiedInhospInfo.getCurrWardId());
+        patMedInhosp.setLeavehospitaldistrictname(thiedInhospInfo.getCurrWardName());
+        patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode());
+        
+        // 鐘舵�佷俊鎭�
+        patMedInhosp.setSchemestatus("0".equals(cry) ? 1L : 2L);
+        
+        // 绯荤粺瀛楁
+        patMedInhosp.setDelFlag("0");
+        patMedInhosp.setOrgid("1");
+        
+        return patMedInhosp;
     }
 
 
@@ -862,7 +1079,7 @@
         } catch (IOException e) {
             e.printStackTrace();
         }
-        log.error("--------result鐨勫�间负锛歿}-----", result);
+        log.info("銆恎etDXCode銆戠煭淇″彂閫佺粨鏋滐細{}", result);
 
         JSONObject jsonObject = JSONObject.parseObject(result);
         String code = (String) jsonObject.toString();
@@ -881,7 +1098,7 @@
         xinHuaWXReq.setTitlename(taskName);
         xinHuaWXReq.setContent(taskDesc);
         xinHuaWXReq.setAppid(wxqqxx.get(1));
-        log.error("----getWXCode---xinHuaWXReq鐨勫嚭鍙備负锛歿}", xinHuaWXReq);
+        log.info("銆恎etWXCode銆戝井淇″叕浼楀彿璇锋眰鍙傛暟锛歿}", xinHuaWXReq);
         String body = new Gson().toJson(xinHuaWXReq);
         String encode = encode(wxqqxx.get(2).concat(body));
         Map<String, String> headerMap = new HashMap<>();

--
Gitblit v1.9.3