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

---
 smartor/src/test/java/com/smartor/service/mch/MchFollowupPlanServiceCheck.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/smartor/src/test/java/com/smartor/service/mch/MchFollowupPlanServiceCheck.java b/smartor/src/test/java/com/smartor/service/mch/MchFollowupPlanServiceCheck.java
index 028eef8..001ec7f 100644
--- a/smartor/src/test/java/com/smartor/service/mch/MchFollowupPlanServiceCheck.java
+++ b/smartor/src/test/java/com/smartor/service/mch/MchFollowupPlanServiceCheck.java
@@ -5,6 +5,8 @@
 import com.smartor.common.SpecificArchiveConstants;
 import com.smartor.domain.MchFollowupPlan;
 import com.smartor.domain.MchFollowupPlanItem;
+import com.smartor.domain.MchFollowupTaskQuery;
+import com.smartor.domain.MchFollowupTaskVO;
 import com.smartor.domain.PatChildArchiveDetail;
 import com.smartor.domain.PatMaternityArchiveDetail;
 import com.smartor.mapper.MchFollowupPlanItemMapper;
@@ -111,6 +113,7 @@
         detail.setPhone("13800000000");
         detail.setIdcardno("330102199001010000");
         detail.setPlannedFollowTime(plannedTime);
+        detail.setFollowupStatus(MchFollowupConstants.FOLLOWUP_STATUS_ACTIVE);
         detail.setFollowupPeriod("{\"items\":["
                 + "{\"dayOffset\":0,\"sendTime\":\"09:00\",\"sendType\":\"sms\",\"content\":\"鐭俊1\"},"
                 + "{\"dayOffset\":3,\"sendType\":\"wechat\",\"templateId\":16,\"content\":\"寰俊2\"},"
@@ -132,6 +135,7 @@
         detail.setParentPhone("13700000000");
         detail.setIdcardno("330102199202020000");
         detail.setPlannedFollowTime(plannedTime);
+        detail.setFollowupStatus(MchFollowupConstants.FOLLOWUP_STATUS_ACTIVE);
         detail.setFollowupPeriod("{\"items\":[{\"dayOffset\":1,\"sendType\":\"sms\",\"content\":\"鍎夸繚鐭俊\"}]}");
         return detail;
     }
@@ -170,6 +174,7 @@
             return defaultValue(method.getReturnType());
         });
 
+        MchFollowupPlanItem[] updatedFollowupItem = new MchFollowupPlanItem[1];
         MchFollowupPlanItemMapper itemMapper = proxy(MchFollowupPlanItemMapper.class, (p, method, a) -> {
             String name = method.getName();
             if ("insertMchFollowupPlanItem".equals(name)) {
@@ -184,12 +189,46 @@
             if ("countPendingByPlanId".equals(name)) {
                 return 1;
             }
+            if ("selectMchFollowupPlanItemById".equals(name)) {
+                MchFollowupPlanItem item = new MchFollowupPlanItem();
+                item.setId((Long) a[0]);
+                return item;
+            }
+            if ("updateFollowupResult".equals(name)) {
+                updatedFollowupItem[0] = (MchFollowupPlanItem) a[0];
+                return 1;
+            }
+            if ("selectByPlanId".equals(name)) {
+                Long queryPlanId = (Long) a[0];
+                List<MchFollowupPlanItem> list = new ArrayList<>();
+                for (MchFollowupPlanItem item : insertedItems) {
+                    if (queryPlanId.equals(item.getPlanId())) {
+                        list.add(item);
+                    }
+                }
+                return list;
+            }
+            if ("selectTaskList".equals(name)) {
+                MchFollowupTaskVO vo = new MchFollowupTaskVO();
+                vo.setItemId(1L);
+                vo.setPlanId(1L);
+                vo.setTaskname("鏃╁瓡鍏崇埍闅忚");
+                vo.setPatid(100L);
+                vo.setPatname("寮犱笁");
+                vo.setSendname("寮犱笁");
+                List<MchFollowupTaskVO> list = new ArrayList<>();
+                list.add(vo);
+                return list;
+            }
             return defaultValue(method.getReturnType());
         });
 
         Map<Long, PatMaternityArchiveDetail> maternityMap = new HashMap<>();
         maternityMap.put(20L, maternityDetail(20L, 10L, date("2026-11-20 14:30:00")));
         maternityMap.put(21L, maternityDetail(21L, 11L, null));
+        PatMaternityArchiveDetail pendingDetail = maternityDetail(22L, 13L, date("2026-11-25 10:00:00"));
+        pendingDetail.setFollowupStatus(MchFollowupConstants.FOLLOWUP_STATUS_PENDING);
+        maternityMap.put(22L, pendingDetail);
         PatMaternityArchiveDetailMapper maternityMapper = proxy(PatMaternityArchiveDetailMapper.class, (p, method, a) -> {
             String name = method.getName();
             if ("selectPatMaternityArchiveDetailById".equals(name)) {
@@ -254,6 +293,13 @@
         check("璁″垝鏁颁笉鍙�", 1, activePlans.size());
         check("鑺傜偣鏁颁笉鍙�", 3, insertedItems.size());
 
+        System.out.println("-- 2.1) 寰呯‘璁ゆ。妗堜笉鐢熸垚 --");
+        int pendingGenerated = service.rebuildForArchive(
+                MchFollowupConstants.ARCHIVE_TYPE_MATERNITY, 13L, 22L);
+        check("寰呯‘璁や笉鐢熸垚", 0, pendingGenerated);
+        check("寰呯‘璁よ鍒掓暟涓嶅彉", 1, activePlans.size());
+        check("寰呯‘璁よ妭鐐规暟涓嶅彉", 3, insertedItems.size());
+
         System.out.println("-- 3) 鎷熼殢璁挎椂闂翠负绌� --");
         int waiting = service.rebuildForArchive(MchFollowupConstants.ARCHIVE_TYPE_MATERNITY, 11L, 21L);
         check("绛夊緟璁″垝涓嶇敓鎴愯妭鐐�", 0, waiting);
@@ -275,6 +321,32 @@
         int otherGenerated = service.rebuildForArchive(MchFollowupConstants.ARCHIVE_TYPE_MATERNITY, 20L, 40L);
         check("鍏朵粬鏈烘瀯涓嶇敓鎴�", 0, otherGenerated);
 
+        System.out.println("-- 6) 鍥炲~浜哄伐闅忚缁撴灉 --");
+        MchFollowupPlanItem feedback = new MchFollowupPlanItem();
+        feedback.setId(1L);
+        feedback.setFollowupDate(date("2026-11-24 10:00:00"));
+        feedback.setFollowupUserId("U001");
+        feedback.setFollowupUserName("鐜嬫姢澹�");
+        feedback.setFollowupSituation("鐢佃瘽闅忚锛屾儏鍐电ǔ瀹�");
+        feedback.setFollowupStatus(MchFollowupConstants.ITEM_FOLLOWUP_STATUS_DONE);
+        int feedbackUpdated = service.updateItemFollowupResult(feedback);
+        check("鍥炲~鏇存柊琛屾暟", 1, feedbackUpdated);
+        check("鍥炲~鐘舵��", MchFollowupConstants.ITEM_FOLLOWUP_STATUS_DONE,
+                updatedFollowupItem[0].getFollowupStatus());
+        check("鍥炲~浜哄憳", "鐜嬫姢澹�", updatedFollowupItem[0].getFollowupUserName());
+        check("鍥炲~鏃堕棿闈炵┖", true, updatedFollowupItem[0].getUpdateTime() != null);
+        check("鑺傜偣鍒楄〃鏁�", 3, service.listItems(1L).size());
+
+        System.out.println("-- 7) 濡囧辜浠诲姟鍒楄〃瀛楁 --");
+        MchFollowupTaskQuery taskQuery = new MchFollowupTaskQuery();
+        taskQuery.setOrgid(SpecificArchiveConstants.LISHUI_MCH_ORG_ID);
+        List<MchFollowupTaskVO> taskList = service.listTasks(taskQuery);
+        check("浠诲姟鍒楄〃鏁�", 1, taskList.size());
+        check("taskid涓虹┖", null, taskList.get(0).getTaskid());
+        check("taskname", "鏃╁瓡鍏崇埍闅忚", taskList.get(0).getTaskname());
+        check("sendname", "寮犱笁", taskList.get(0).getSendname());
+        check("patid", 100L, taskList.get(0).getPatid());
+
         System.out.println("========== 缁撴灉锛歅ASS=" + passed + "锛孎AIL=" + failed + " ==========");
         if (failed > 0) {
             System.exit(1);

--
Gitblit v1.9.3