| | |
| | | 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; |
| | |
| | | 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\"}," |
| | |
| | | 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; |
| | | } |
| | |
| | | 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)) { |
| | |
| | | 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)) { |
| | |
| | | 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); |
| | |
| | | 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("========== 结果:PASS=" + passed + ",FAIL=" + failed + " =========="); |
| | | if (failed > 0) { |
| | | System.exit(1); |