From f8c4acf0b173a73163c0f101e38c0e60251a2935 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 22 四月 2025 19:15:28 +0800
Subject: [PATCH] 丽水公众号

---
 smartor/src/main/java/com/smartor/domain/XinHuaWXReq.java              |   60 +++++++----
 ruoyi-admin/src/main/resources/application-druid.yml                   |   22 ++--
 ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java |  177 ++++++++++++++++++-----------------
 3 files changed, 142 insertions(+), 117 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
index fcfb2f9..a3b6e4e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -13,6 +13,7 @@
 import com.smartor.common.SendService;
 import com.smartor.config.RobotPhoneUtils;
 import com.smartor.domain.*;
+import com.smartor.mapper.PatArchiveMapper;
 import com.smartor.mapper.ServiceSubtaskMapper;
 import com.smartor.mapper.ServiceTaskMapper;
 import com.smartor.service.IBaseSmsaccountService;
@@ -28,6 +29,7 @@
 import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 import org.springframework.stereotype.Component;
 
+import java.net.URLEncoder;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -64,7 +66,7 @@
     private ServiceTaskMapper ivrTaskMapper;
 
     @Autowired
-    private SendService sendService;
+    private PatArchiveMapper patArchiveMapper;
 
     @Autowired
     private RedisCache redisCache;
@@ -89,6 +91,9 @@
 
     @Value("${xhsmsPath}")
     private String xhsmsPath;
+
+    @Value("${appid}")
+    private String appid;
 
     // 鍒涘缓鍥哄畾澶у皬鐨勭嚎绋嬫睜
     private static final ExecutorService executorService = Executors.newFixedThreadPool(10);
@@ -423,87 +428,86 @@
                         try {
                             SendMagParam sendMagParam = new SendMagParam();
                             sendMagParam.setType("5");
-                            sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName() + "&param5=false");
-                            log.info("閾炬帴瀹屾暣璺緞锛歿}", ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName() + "&param5=false");
-                            //杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙��
-                            sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
-                            Map map = new HashMap();
-                            map.put("first", ivrTask1.getTaskName());
-                            sendMagParam.setContent(JSON.toJSONString(map));
-                            sendMagParam.setOpenid(serviceSubtask.getOpenid());
-                            Boolean aBoolean = sendService.sendMsg(sendMagParam);
-                            String url = null;
-
-////                            if (type == 1) {
-////                                url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
-////                            } else if (type == 2) {
-////                                url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
-////                            } else if (type == 3) {
-////                                url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
-////                            }
-//                            if (type == 1) {
-//                                //闅忚
-//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
-//                                serviceOutPath.setParam1(taskId);
-//                                serviceOutPath.setParam2(patid);
-//                                serviceOutPath.setCreateTime(new Date());
-//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-//                                String format = String.format("%03X", serviceOutPath.getId());
-//                                serviceOutPath.setRadix(format);
-//                                serviceOutPath.setUpdateTime(new Date());
-//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
-////                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
-//                                url = ip + ":" + req_path + "/sf?p=" + format;
-//                            } else if (type == 2) {
-//                                //闂埜
-//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
-//                                serviceOutPath.setParam1(taskId);
-//                                serviceOutPath.setParam2(patid);
-////                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
-//                                serviceOutPath.setParam3(ivrTask1.getTaskName());
-//                                serviceOutPath.setCreateTime(new Date());
-//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-//                                String format = String.format("%03X", serviceOutPath.getId());
-//                                serviceOutPath.setRadix(format);
-//                                serviceOutPath.setUpdateTime(new Date());
-//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
-////                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
-//                                url = ip + ":" + req_path + "/wt?p=" + format;
-//                            } else if (type == 3) {
-//                                //瀹f暀
-//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
-//                                serviceOutPath.setParam1(taskId);
-//                                serviceOutPath.setParam2(patid);
-////                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
-//                                serviceOutPath.setParam3(ivrTask1.getTaskName());
-//                                serviceOutPath.setCreateTime(new Date());
-//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-//                                String format = String.format("%03X", serviceOutPath.getId());
-//                                serviceOutPath.setRadix(format);
-//                                serviceOutPath.setUpdateTime(new Date());
-//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
-//                                url = ip + ":" + req_path + "/xj?p=" + format;
-//                            }
+//                            sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName() + "&param5=false");
+//                            log.info("閾炬帴瀹屾暣璺緞锛歿}", ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName() + "&param5=false");
+//                            //杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙��
+//                            sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
+//                            Map map = new HashMap();
+//                            map.put("first", ivrTask1.getTaskName());
+//                            sendMagParam.setContent(JSON.toJSONString(map));
+//                            sendMagParam.setOpenid(serviceSubtask.getOpenid());
+//                            Boolean aBoolean = sendService.sendMsg(sendMagParam);
 //
-//                            String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "鏃�");
-//                            Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
-//                            if (!map.isEmpty()) {
-                            serviceSubtask.setResult("success");
-                            serviceSubtask.setSendstate(3L);
-                            if (aBoolean == false) {
-                                ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
-                                serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
-                                serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId());
-                                serviceSubtaskRecord.setUuid(UUID.randomUUID().toString());
-                                serviceSubtaskRecord.setTasktype(serviceSubtask.getType());
-                                serviceSubtaskRecord.setPreachform("5");
-                                serviceSubtaskRecord.setStartTime(System.currentTimeMillis());
-                                serviceSubtaskRecord.setRemark(map.get("msg").toString());
-                                lssubIds.add(serviceSubtask.getId());
-                                serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
-                                continue;
-                            }
+
+//                            if (type == 1) {
+//                                url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
+//                            } else if (type == 2) {
+//                                url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
+//                            } else if (type == 3) {
+//                                url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
 //                            }
+                            String url = null;
+                            Boolean aBoolean = false;
+                            if (type == 1) {
+                                //闅忚
+                                ServiceOutPath serviceOutPath = new ServiceOutPath();
+                                serviceOutPath.setParam1(taskId);
+                                serviceOutPath.setParam2(patid);
+                                serviceOutPath.setCreateTime(new Date());
+                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+                                String format = String.format("%03X", serviceOutPath.getId());
+                                serviceOutPath.setRadix(format);
+                                serviceOutPath.setUpdateTime(new Date());
+                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+                                url = ip + ":" + req_path + "/sf?p=" + format;
+                            } else if (type == 2) {
+                                //闂埜
+                                ServiceOutPath serviceOutPath = new ServiceOutPath();
+                                serviceOutPath.setParam1(taskId);
+                                serviceOutPath.setParam2(patid);
+//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
+                                serviceOutPath.setParam3(ivrTask1.getTaskName());
+                                serviceOutPath.setCreateTime(new Date());
+                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+                                String format = String.format("%03X", serviceOutPath.getId());
+                                serviceOutPath.setRadix(format);
+                                serviceOutPath.setUpdateTime(new Date());
+                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+                                url = ip + ":" + req_path + "/wt?p=" + format;
+                            } else if (type == 3) {
+                                //瀹f暀
+                                ServiceOutPath serviceOutPath = new ServiceOutPath();
+                                serviceOutPath.setParam1(taskId);
+                                serviceOutPath.setParam2(patid);
+                                serviceOutPath.setParam3(ivrTask1.getTaskName());
+                                serviceOutPath.setCreateTime(new Date());
+                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+                                String format = String.format("%03X", serviceOutPath.getId());
+                                serviceOutPath.setRadix(format);
+                                serviceOutPath.setUpdateTime(new Date());
+                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+                                url = ip + ":" + req_path + "/xj?p=" + format;
+                            }
+                            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(serviceSubtask.getPatid());
+                            String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), null,null,patArchive.getPatientno());
+                            Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
+                            if (!map.isEmpty()) {
+                                serviceSubtask.setResult("success");
+                                serviceSubtask.setSendstate(3L);
+                                if (aBoolean == false) {
+                                    ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
+                                    serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
+                                    serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId());
+                                    serviceSubtaskRecord.setUuid(UUID.randomUUID().toString());
+                                    serviceSubtaskRecord.setTasktype(serviceSubtask.getType());
+                                    serviceSubtaskRecord.setPreachform("5");
+                                    serviceSubtaskRecord.setStartTime(System.currentTimeMillis());
+                                    serviceSubtaskRecord.setRemark(map.get("msg").toString());
+                                    lssubIds.add(serviceSubtask.getId());
+                                    serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
+                                    continue;
+                                }
+                            }
                         } catch (Exception e) {
                             ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                             serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
@@ -629,14 +633,17 @@
         return key;
     }
 
-    private String getWXCode(String idcard, String url, String taskName, String taskDesc, String submitprompt) {
+    private String getWXCode(String idcard, String url, String taskName, String taskDesc, String Medcardno, String setPatientname, String setPatientid) {
         XinHuaWXReq xinHuaWXReq = new XinHuaWXReq();
         xinHuaWXReq.setIdcard(idcard);
         xinHuaWXReq.setUrl(url);
-        xinHuaWXReq.setKeyword1("娴欎腑鍖诲ぇ浜岄櫌鍑洪櫌闅忚");
-        xinHuaWXReq.setKeyword2(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        xinHuaWXReq.setKeyword3(taskName);
-        xinHuaWXReq.setKeyword4("鐤剧梾搴峰娉ㄦ剰浜嬮」");
+        xinHuaWXReq.setPatientid(setPatientid);
+        xinHuaWXReq.setPatientname(setPatientname);
+        xinHuaWXReq.setMobile(taskName);
+        xinHuaWXReq.setMedcardno(Medcardno);
+        xinHuaWXReq.setTitlename(taskName);
+        xinHuaWXReq.setContent(taskDesc);
+        xinHuaWXReq.setAppid(appid);
 
         String result = HttpUtils.sendPost(thirdWXUrl, new Gson().toJson(xinHuaWXReq));
         JSONObject jsonObject = JSONObject.parseObject(result);
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index 33c712e..316c5f2 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -13,10 +13,10 @@
         #        鍏徃
         #        url: jdbc:mysql://192.168.2.9:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         #        涓芥按
-        #        url: jdbc:mysql://127.0.0.1:3308/smartor-lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-        #        username: smartor
-        #        password: Smartor.2023
-        #        driverClassName: com.mysql.cj.jdbc.Driver
+        url: jdbc:mysql://127.0.0.1:3308/smartor-lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: smartor
+        password: Smartor.2023
+        driverClassName: com.mysql.cj.jdbc.Driver
         #        # 鏂板崕
         #        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         #        username: smartor
@@ -24,10 +24,10 @@
         #        driverClassName: com.mysql.cj.jdbc.Driver
 
         #  鍏徃浜�
-        url: jdbc:mysql://116.62.18.175:6002/smartor_lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-        username: hxsoft
-        password: Hxerp2000
-        driverClassName: com.mysql.cj.jdbc.Driver
+#        url: jdbc:mysql://116.62.18.175:6002/smartor_lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#        username: hxsoft
+#        password: Hxerp2000
+#        driverClassName: com.mysql.cj.jdbc.Driver
 
 
       # 浠庡簱鏁版嵁婧�
@@ -103,10 +103,10 @@
     default-size: 10
 
   #寰俊鍏紬鍙风殑瀵嗛挜
-appid: wx1c5243d2337753f4
-appSecret: 84a2186a0d175e88345267c716516cd3
+appid: 3311000002.
+appSecret: MzMxMTAwMDAwMg==
 #绗笁鏂瑰井淇″叕浼楀彿鍙戦�佸湴鍧�锛堟柊鍗庡尰闄級
-thirdWXUrl: http://192.16.4.220:8103/api
+thirdWXUrl: http://192.168.10.170:18001/frontend/medical/api
 
 #閽夐拤鐨勫瘑閽�
 dingAppid: dingn8iip5ubj7clrrsv
diff --git a/smartor/src/main/java/com/smartor/domain/XinHuaWXReq.java b/smartor/src/main/java/com/smartor/domain/XinHuaWXReq.java
index 75ea276..2e853db 100644
--- a/smartor/src/main/java/com/smartor/domain/XinHuaWXReq.java
+++ b/smartor/src/main/java/com/smartor/domain/XinHuaWXReq.java
@@ -16,13 +16,13 @@
 public class XinHuaWXReq {
     private static final long serialVersionUID = 1L;
 
-    /**
-     * 鎺ュ彛鏈嶅姟鍚嶏紝鍥哄畾鍊�
-     */
-    @ApiModelProperty(value = "鎺ュ彛鏈嶅姟鍚嶏紝鍥哄畾鍊�")
-    private String service = "smarthos.yygh.ApiService.push";
-
-    private String spid = "1001";
+//    /**
+//     * 鎺ュ彛鏈嶅姟鍚嶏紝鍥哄畾鍊�
+//     */
+//    @ApiModelProperty(value = "鎺ュ彛鏈嶅姟鍚嶏紝鍥哄畾鍊�")
+//    private String service = "smarthos.yygh.ApiService.push";
+//
+//    private String spid = "1001";
 
     /**
      * 璇佷欢鍙�
@@ -34,33 +34,51 @@
     /**
      * 璇︽儏鍦板潃
      */
-    @Excel(name = "璇︽儏鍦板潃")
-    @ApiModelProperty(value = "璇︽儏鍦板潃")
+    @Excel(name = "閾炬帴鍦板潃")
+    @ApiModelProperty(value = "閾炬帴鍦板潃")
     private String url;
 
 
     /**
-     * 鍙戦�佺被鍨�: 1 鏃堕棿娈�   2 鏃堕棿鐐�   3 鍗冲埢鍙戦��
+     * 搴旂敤缂栧彿
      */
-    @ApiModelProperty(value = "闅忚椤圭洰")
-    private String keyword1;
+    @ApiModelProperty(value = "搴旂敤缂栧彿")
+    private String appid;
 
     /**
-     * 鎻愰啋鏃堕棿
+     * 鎮h�呯紪鍙�
      */
-    @ApiModelProperty(value = "鎻愰啋鏃堕棿")
-    private String keyword2;
+    @ApiModelProperty(value = "鎮h�呯紪鍙�")
+    private String patientid;
 
     /**
-     * 鎻愰啋鍐呭
+     * 鎮h�呭鍚�
      */
-    @ApiModelProperty(value = "鎻愰啋鍐呭")
-    private String keyword3;
+    @ApiModelProperty(value = "鎮h�呭鍚�")
+    private String patientname;
 
     /**
-     * 娉ㄦ剰浜嬮」
+     * 鎵嬫満鍙风爜
      */
-    @ApiModelProperty(value = "娉ㄦ剰浜嬮」")
-    private String keyword4;
+    @ApiModelProperty(value = "鎵嬫満鍙风爜")
+    private String mobile;
+
+    /**
+     * 灏辫瘖鍗″彿
+     */
+    @ApiModelProperty(value = "灏辫瘖鍗″彿")
+    private String medcardno;
+
+    /**
+     * 閫氱煡鍐呭
+     */
+    @ApiModelProperty(value = "閫氱煡鍐呭")
+    private String titlename;
+
+    /**
+     * 閾炬帴鍦板潃
+     */
+    @ApiModelProperty(value = "閾炬帴鍦板潃")
+    private String content;
 
 }

--
Gitblit v1.9.3