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/resources/mapper/smartor/MchFollowupPlanMapper.xml |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/MchFollowupPlanMapper.xml b/smartor/src/main/resources/mapper/smartor/MchFollowupPlanMapper.xml
index f19893f..6a8e512 100644
--- a/smartor/src/main/resources/mapper/smartor/MchFollowupPlanMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/MchFollowupPlanMapper.xml
@@ -107,19 +107,33 @@
         from pat_maternity_archive_detail d
         where d.orgid = #{orgid}
           and (d.del_flag is null or d.del_flag = '0')
+          and d.followup_status = '1'
           and d.planned_follow_time is not null
           and d.followup_period is not null
           and d.followup_period &lt;&gt; ''
           and d.archiveid is not null
+          and not exists (
+              select 1 from mch_followup_plan p
+              where p.archive_type = '1'
+                and p.archive_detail_id = d.id
+                and p.plan_status in ('0', '3')
+          )
         union all
         select '2' as archiveType, d.archiveid as archiveId, d.id as archiveDetailId
         from pat_child_archive_detail d
         where d.orgid = #{orgid}
           and (d.del_flag is null or d.del_flag = '0')
+          and d.followup_status = '1'
           and d.planned_follow_time is not null
           and d.followup_period is not null
           and d.followup_period &lt;&gt; ''
           and d.archiveid is not null
+          and not exists (
+              select 1 from mch_followup_plan p
+              where p.archive_type = '2'
+                and p.archive_detail_id = d.id
+                and p.plan_status in ('0', '3')
+          )
         limit #{limit}
     </select>
 

--
Gitblit v1.9.3