From 3acf9415fce2dd21c0fd5d67805b72a8bde24a81 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 23 十一月 2026 17:12:00 +0800
Subject: [PATCH] 【丽水】妇幼随访发送
---
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