From d3b362de432a32c10ccd039dfc417d8c6233f543 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 28 三月 2025 18:10:21 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java |   82 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 75 insertions(+), 7 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 25925f2..a40936e 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
@@ -22,6 +22,7 @@
 import com.smartor.mapper.ServiceTaskMapper;
 import com.smartor.mapper.SysUserImportMapper;
 import com.smartor.service.*;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -48,6 +49,7 @@
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 瀹氭椂浠诲姟璋冨害娴嬭瘯
@@ -68,6 +70,9 @@
 
     @Autowired
     private IPatMedInhospService iPatMedInhospService;
+
+    @Autowired
+    private IPatMedOperationService iPatMedOperationService;
 
     @Autowired
     private IServiceSubtaskService iServiceSubtaskService;
@@ -215,7 +220,7 @@
     public void dealHisData2() {
         //灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆�
         // 鎸囧畾鐨勫紑濮嬫棩鏈�
-        LocalDate endDate = LocalDate.of(2024, 9, 1);
+        LocalDate endDate = LocalDate.of(2025, 3, 3);
         // 褰撳墠鏃ユ湡
         LocalDate currentDate = LocalDate.now();
         // 瀹氫箟鏃ユ湡鏍煎紡
@@ -235,6 +240,14 @@
      */
     public void dealOutHospInfo() {
         iPatMedInhospService.dealOutHospInfo();
+    }
+
+
+    /**
+     * 澶勭悊鎵嬫湳淇℃伅锛岃繘鍏ュ瓙浠诲姟琛�
+     */
+    public void dealOperationInfo() {
+        iPatMedOperationService.dealOperationInfo();
     }
 
     /**
@@ -308,7 +321,11 @@
                 ServiceSubtaskVO ivrTaskcall = new ServiceSubtaskVO();
                 ivrTaskcall.setTaskid(commonTaskcallMQ.getTaskid());
                 ivrTaskcall.setSendstate(2L);
-                List<ServiceSubtask> selectServiceSubtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall);
+                List<ServiceSubtask> subtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall);
+
+                // 鎸夌収 endtime 绂诲綋鍓嶆椂闂存渶杩戠殑鎺掑簭
+                List<ServiceSubtask> selectServiceSubtaskList = subtaskList.stream().sorted(Comparator.comparing(subtask -> Math.abs(subtask.getEndtime().getTime() - new Date().getTime()))).collect(Collectors.toList());
+
                 if (descByCode.equals("鐢佃瘽")) {
                     String value = "";
                     List<String> list = new ArrayList<>();
@@ -317,6 +334,14 @@
                         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());
+                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+                            continue;
                         }
                         boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
                         //璇存槑鏄珛鍗冲彂閫�(鍏堟妸娑堟伅鏀惧埌cache-0涓紝   displayNo涓嶇煡閬撴�庝箞閰嶇疆)
@@ -344,7 +369,8 @@
                     }
                     //灏嗚鎵ц鐨勬斁鍒扮紦瀛樹腑
                     if (list.size() > 0) {
-                        redisCache.setCacheListLeft("cache-0", list);
+//                        redisCache.setCacheListLeft("cache-0", list);
+                        redisCache.setCacheListLeftAndDistinct("cache-0", list);
                     }
                 } else if (descByCode.equals("澶氬獟浣�")) {
                     //澶氬獟浣�
@@ -352,8 +378,46 @@
                     //绾歌川
                 } else if (descByCode.equals("寰俊灏忕▼搴�")) {
                     //寰俊灏忕▼搴�
-                    for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
-                        log.error("寰俊灏忕▼搴忔湡浠诲姟鍙戦��---------杩涙潵浜嗗悧锛焮}", serviceSubtask);
+                    log.error("ivrTask1鐨勫�间负锛歿}", ivrTask1);
+                    if (ObjectUtils.isNotEmpty(ivrTask1) && ivrTask1.getPatCycle() == 1) {
+                        //璇存槑璇ヤ换鍔$殑鎮h�呮槸寰幆鎵ц鐨�
+                        ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
+                        serviceSubtaskVO.setTaskid(ivrTask1.getTaskid());
+                        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+                        //杩欓噷闇�瑕佹牴鎹韩浠借瘉鍘婚噸
+                        List<ServiceSubtask> serviceSubtaskListFilter = new ArrayList<>();
+                        aa:
+                        for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+                            for (ServiceSubtask ss : serviceSubtaskListFilter) {
+                                if (ss.getSfzh().equals(serviceSubtask.getSfzh())) {
+                                    continue aa;
+                                }
+                            }
+                            serviceSubtaskListFilter.add(serviceSubtask);
+                        }
+                        for (ServiceSubtask serviceSubtask : serviceSubtaskListFilter) {
+                            //灏嗗瓙浠诲姟ID鍒犻櫎 銆乻endstate鏀规垚3
+                            serviceSubtask.setSendstate(3L);
+                            serviceSubtask.setId(null);
+                            serviceSubtask.setFinishtime(null);
+                            serviceSubtask.setCreateTime(new Date());
+                            serviceSubtask.setUpdateTime(new Date());
+                            //澶勭悊閲嶅鏂板闂锛屽厛鏌ヤ竴涓嬩粖澶╂槸涓嶆槸鏈夋柊澧炶繃锛屾柊澧炶繃灏变笉鏂板浜�
+                            ServiceSubtaskVO ssvo = new ServiceSubtaskVO();
+                            LocalDate today = LocalDate.now();
+                            LocalTime startOfDay = LocalTime.of(0, 0, 0);
+                            LocalTime endOfDay = LocalTime.of(23, 59, 59);
+                            Date startOfDayDate = Date.from(today.atTime(startOfDay).atZone(ZoneId.systemDefault()).toInstant());
+                            Date endOfDayDate = Date.from(today.atTime(endOfDay).atZone(ZoneId.systemDefault()).toInstant());
+                            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);
+                        }
                     }
                 } else if (descByCode.equals("鐭俊")) {
                     RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
@@ -375,12 +439,14 @@
                                     continue;
                                 }
                                 String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+                                String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
                                 SendMagParam sendMagParam = new SendMagParam();
                                 sendMagParam.setType("4");
                                 ServiceOutPath serviceOutPath = new ServiceOutPath();
                                 serviceOutPath.setParam1(taskId);
                                 serviceOutPath.setParam2(patid);
                                 serviceOutPath.setParam3(ivrTask1.getTaskName());
+                                serviceOutPath.setParam6(subId);
                                 serviceOutPath.setCreateTime(new Date());
                                 iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                 String format = String.format("%03X", serviceOutPath.getId());
@@ -534,7 +600,7 @@
         String filename = null;
         if (cry.equals("0")) filename = "鍏ラ櫌淇℃伅" + System.currentTimeMillis();
         if (cry.equals("1")) filename = "鍑洪櫌淇℃伅" + System.currentTimeMillis();
-        File file = new File("D:\\public\\鍗庡崜闆嗘垚骞冲彴鏁版嵁\\" + filename);
+        File file = new File("D:\\public\\HIS鏁版嵁閲囬泦\\" + filename);
         if (!file.exists()) {
             // 濡傛灉鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘柊鏂囦欢
             try {
@@ -584,7 +650,7 @@
                     patArchive.setSex(thiedInhospInfo.getPatiRecordGender().equals("鐢�") ? 1L : 2L);
                     patArchive.setNation(thiedInhospInfo.getPatiNation());
                     patArchive.setNativePlace(thiedInhospInfo.getPatiNationality());
-                    patArchive.setPlaceOfResidence(thiedInhospInfo.getPatiHomeAddr());
+                    patArchive.setPlaceOfResidence(StringUtils.isNotEmpty(thiedInhospInfo.getPatiHomeAddr()) ? thiedInhospInfo.getPatiHomeAddr().replace("null", "") : "");
                     try {
                         if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday()))
                             patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getPatiBirthday()));
@@ -616,6 +682,7 @@
                 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")) {
@@ -659,6 +726,7 @@
                 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());

--
Gitblit v1.9.3