From 0afac42fb2e9d6e5291304dd0044ce3042b45d2b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期六, 10 十月 2026 15:09:14 +0800
Subject: [PATCH] 短信模块提交

---
 smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java |   47 ++++++++++++++---------------------------------
 1 files changed, 14 insertions(+), 33 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 f13c364..d434c92 100644
--- a/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/XHGatherPatArchiveServiceImpl.java
@@ -12,6 +12,9 @@
 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.*;
@@ -57,17 +60,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 +133,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);

--
Gitblit v1.9.3