From f0a09ee996ab2605869844d6a3d812709e2bf0fa Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 16 十月 2026 16:07:25 +0800
Subject: [PATCH] 任务模块、电话模块

---
 smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java |   57 ++++++++++++++++++++-------------------------------------
 1 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java
index 150769f..8c74c73 100644
--- a/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java
@@ -12,9 +12,13 @@
 import com.ruoyi.common.utils.HttpUtil;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.message.SendResult;
+import com.ruoyi.message.sms.SmsSendRequest;
+import com.ruoyi.message.sms.SmsSenderFactory;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.smartor.domain.*;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
 import com.smartor.mapper.*;
 import com.smartor.service.*;
 import lombok.extern.slf4j.Slf4j;
@@ -36,6 +40,7 @@
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import com.ruoyi.common.core.domain.entity.PatArchive;
 
 /**
  * 鏂板崕鏁版嵁閲囬泦澶勭悊
@@ -57,17 +62,12 @@
     IServiceAppointRecordService iServiceAppointRecordService;
     @Autowired
     private SysConfigMapper sysConfigMapper;
-    @Value("${xhsmsPath}")
-    private String xhsmsPath;
-    // 甯愬彿
-    @Value("${xhsmsAccount}")
-    private String xhsmsAccount;
-    //  鎺ュ彛瀵嗙爜
-    @Value("${xhsmsPwd}")
-    private String xhsmsPwd;
-    // 铏氭嫙鎺ュ叆鐮�
-    @Value("${xhsmsjrm}")
-    private String xhsmsjrm;
+
+    /**
+     * 娑堟伅鍙戦�佹柟宸ュ巶锛堢煭淇�/寰俊鍏紬鍙凤級锛屾浛浠e師鏉ョ洿鎺ユ敞鍏� xhsms* 閰嶇疆 + HttpUtils 鐨勫啓娉�
+     */
+    @Autowired
+    private SmsSenderFactory smsSenderFactory;
 
 
     /**
@@ -135,28 +135,11 @@
                 // 绗簩姝ワ細澶勭悊鍋滆瘖璁板綍淇℃伅
                 for (ServiceAppointRecord serviceAppointRecord : appointRecordFromHIS) {
                     String replace = smsContemt.replace("${patFileName}", StringUtils.defaultString(serviceAppointRecord.getPatFileName())).replace("${registTimeRange}", StringUtils.defaultString(serviceAppointRecord.getRegistTimeRange())).replace("${registDeptName}", StringUtils.defaultString(serviceAppointRecord.getRegistDeptName())).replace("${treatDoctName}", StringUtils.defaultString(serviceAppointRecord.getTreatDoctName()));
-                    Map<String, String> map2 = new HashMap<String, String>();
-                    map2.put("action", "send");
-                    map2.put("account", xhsmsAccount);
-                    map2.put("password", xhsmsPwd);
-                    map2.put("mobile", serviceAppointRecord.getPatTel());
-                    map2.put("content", replace);
-                    map2.put("extno", xhsmsjrm);
-                    map2.put("rt", "json");
-                    StringBuilder encodedParams = new StringBuilder();
-
-                    for (Map.Entry<String, String> entry : map2.entrySet()) {
-                        if (encodedParams.length() > 0) {
-                            encodedParams.append("&");
-                        }
-                        // 瀵归敭鍜屽�艰繘琛孶RL缂栫爜
-                        String encodedKey = URLEncoder.encode(entry.getKey(), "UTF-8");
-                        String encodedValue = URLEncoder.encode(entry.getValue(), "UTF-8");
-                        encodedParams.append(encodedKey).append("=").append(encodedValue);
-                    }
-                    Boolean isSuccess = HttpUtils.sendPost(xhsmsPath, encodedParams.toString());
-                    if (isSuccess) {
-                        log.info("---澶勭悊鍋滆瘖璁板綍淇℃伅鍙戦�佹垚鍔�,鍏ュ弬涓�:{}", encodedParams.toString());
+                    //鐭俊鍙戦�佸凡鏀跺彛鍒� ruoyi-message 妯″潡锛堟柊鍗庨�氶亾璧拌〃鍗曟ā寮忥紝涓庡師瀹炵幇涓�鑷达級
+                    SendResult sendResult = smsSenderFactory.send("xh",
+                            SmsSendRequest.of(serviceAppointRecord.getPatTel(), replace));
+                    if (sendResult.isOk()) {
+                        log.info("---澶勭悊鍋滆瘖璁板綍淇℃伅鍙戦�佹垚鍔�,鍏ュ弬涓�:{}", sendResult.getRawResponse());
                         serviceAppointRecord.setSendTime(new Date());
                         serviceAppointRecord.setSenderName("绯荤粺绠$悊鍛�");
                         iServiceAppointRecordService.insertServiceAppointRecord(serviceAppointRecord);
@@ -284,8 +267,8 @@
     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", "IS044056");
-//        header.put("x-hcsb-serviceno", "IS002347");
+//        header.put("x-hcsb-serviceno", "IS044056");
+        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=");
@@ -333,14 +316,14 @@
             // 鏍¢獙data瀛楁鏄惁涓篔sonObject
             JsonElement dataElement = jsonObject.get("data");
             if (dataElement == null || !dataElement.isJsonObject()) {
-                log.warn("銆恜arseResponseData銆戝搷搴旀暟鎹腑data瀛楁涓虹┖鎴栭潪瀵硅薄绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+                log.info("銆恜arseResponseData銆戝搷搴旀暟鎹腑data瀛楁涓虹┖鎴栭潪瀵硅薄绫诲瀷锛屽師濮嬫暟鎹細{}", result);
                 return new ArrayList<>();
             }
 
             JsonObject dataObject = dataElement.getAsJsonObject();
             JsonElement resultElement = dataObject.get("result");
             if (resultElement == null || !resultElement.isJsonArray()) {
-                log.warn("銆恜arseResponseData銆戝搷搴旀暟鎹腑result瀛楁涓虹┖鎴栭潪鏁扮粍绫诲瀷锛屽師濮嬫暟鎹細{}", result);
+                log.info("銆恜arseResponseData銆戝搷搴旀暟鎹腑result瀛楁涓虹┖鎴栭潪鏁扮粍绫诲瀷锛屽師濮嬫暟鎹細{}", result);
                 return new ArrayList<>();
             }
 

--
Gitblit v1.9.3