From c885a9c26e624f403e3d73beac8c6346657ad561 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 23 十一月 2026 17:16:43 +0800
Subject: [PATCH] feat: 增加妇幼随访任务列表接口与随访结果字段

---
 smartor/src/main/java/com/smartor/service/mch/MchFollowupMessageSender.java |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/service/mch/MchFollowupMessageSender.java b/smartor/src/main/java/com/smartor/service/mch/MchFollowupMessageSender.java
index 8784bfd..4f20367 100644
--- a/smartor/src/main/java/com/smartor/service/mch/MchFollowupMessageSender.java
+++ b/smartor/src/main/java/com/smartor/service/mch/MchFollowupMessageSender.java
@@ -12,6 +12,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.SimpleDateFormat;
+
 /**
  * 濡囧辜闅忚娑堟伅鍙戦�佸櫒銆�
  *
@@ -28,7 +30,7 @@
 
     public MchFollowupSendOutcome sendSms(MchFollowupPlan plan, MchFollowupPlanItem item) {
         String phone = plan == null ? null : plan.getPhone();
-        String content = item == null ? null : item.getContent();
+        String content = item == null ? null : renderContent(item.getContent(), plan, item);
         if (StringUtils.isBlank(phone)) {
             return MchFollowupSendOutcome.skip("鎵嬫満鍙蜂负绌�");
         }
@@ -71,8 +73,8 @@
             message.setIdCard(plan.getIdcardno());
             message.setMobile(phone);
             message.setMedCardNo(plan.getSourceBizNo());
-            message.setTitleName(item.getTitleName());
-            message.setContent(item.getContent());
+            message.setTitleName(renderContent(item.getTitleName(), plan, item));
+            message.setContent(renderContent(item.getContent(), plan, item));
             message.setUrl(item.getUrl());
 
             String requestBody = requestSummary("wechat", phone, item.getTemplateId());
@@ -118,6 +120,37 @@
         }
     }
 
+    /**
+     * 娓叉煋濡囧辜闅忚鍐呭鍗犱綅绗︺�傚綋鍓嶆敮鎸侊細
+     * ${patname}銆�${patid}銆�${phone}銆�${idcardno}銆�${plannedFollowTime}銆�
+     * ${sourceBizNo}銆�${archiveType}銆�${orgid}銆�${seq}銆�
+     */
+    String renderContent(String text, MchFollowupPlan plan, MchFollowupPlanItem item) {
+        if (StringUtils.isBlank(text) || plan == null) {
+            return text;
+        }
+        String result = text;
+        result = result.replace("${patname}", nvl(plan.getPatname()));
+        result = result.replace("${patid}", plan.getPatid() == null ? "" : String.valueOf(plan.getPatid()));
+        result = result.replace("${phone}", nvl(plan.getPhone()));
+        result = result.replace("${idcardno}", nvl(plan.getIdcardno()));
+        result = result.replace("${sourceBizNo}", nvl(plan.getSourceBizNo()));
+        result = result.replace("${archiveType}", nvl(plan.getArchiveType()));
+        result = result.replace("${orgid}", nvl(plan.getOrgid()));
+        result = result.replace("${seq}", item == null || item.getSeq() == null ? "" : String.valueOf(item.getSeq()));
+        if (plan.getPlannedFollowTime() != null) {
+            result = result.replace("${plannedFollowTime}",
+                    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(plan.getPlannedFollowTime()));
+        } else {
+            result = result.replace("${plannedFollowTime}", "");
+        }
+        return result;
+    }
+
+    private String nvl(String value) {
+        return value == null ? "" : value;
+    }
+
     private String requestSummary(String sendType, String phone, Long templateId) {
         return "sendType=" + sendType
                 + "锛沺hone=" + maskPhone(phone)

--
Gitblit v1.9.3