| | |
| | | return "再次随访任务创建失败,找不到对应任务 taskid = " + serviceSubtask.getTaskid() + ", 再请次重试"; |
| | | } |
| | | // nexttaskflag=0 表示任务链终止,不允许再生成 |
| | | if ("0".equals(serviceTask.getNexttaskflag())) { |
| | | log.info("无需再次随访,任务已标记无后续随访, taskid = {}", serviceSubtask.getTaskid()); |
| | | return "无需再次随访,该任务无后续随访安排"; |
| | | } |
| | | // if ("0".equals(serviceTask.getNexttaskflag())) { |
| | | // log.info("无需再次随访,任务已标记无后续随访, taskid = {}", serviceSubtask.getTaskid()); |
| | | // return "无需再次随访,该任务无后续随访安排"; |
| | | // } |
| | | // 幂等校验:同一原任务只允许生成一条二次随访 |
| | | ServiceSubtaskEntity againQuery = new ServiceSubtaskEntity(); |
| | | againQuery.setUpid(serviceSubtask.getId().intValue()); |
| | |
| | | return "再次随访任务创建失败,患者出院记录不完整或下一任务配置异常, 再请次重试"; |
| | | } |
| | | Date now = new Date(); |
| | | applyAgainVisitTime(serviceSubtaskAgain, serviceSubtask, nextServiceTask, config, now); |
| | | // 医生处理意见取自本次请求,按下一任务重建子任务时需显式带入,否则不会落库 |
| | | if (request != null) { |
| | | serviceSubtaskAgain.setDoctorOpinion(request.getDoctorOpinion()); |
| | | serviceSubtaskAgain.setRemark(request.getRemark()); |
| | | serviceSubtaskAgain.setDrcode(request.getDrcode()); |
| | | serviceSubtaskAgain.setDrname(request.getDrname()); |
| | | serviceSubtaskAgain.setNurseId(request.getNurseId()); |
| | | serviceSubtaskAgain.setNurseName(request.getNurseName()); |
| | | serviceSubtaskAgain.setManagementDoctor(request.getManagementDoctor()); |
| | | serviceSubtaskAgain.setManagementDoctorCode(request.getManagementDoctorCode()); |
| | | } |
| | | serviceSubtaskAgain.setId(null); |
| | | serviceSubtaskAgain.setUpid(serviceSubtask.getId().intValue()); |
| | | serviceSubtaskAgain.setVisitCount(ObjectUtils.isNotEmpty(serviceSubtask.getVisitCount()) |
| | |
| | | serviceSubtaskAgain.setIsVisitAgain(1); |
| | | serviceSubtaskAgain.setCreateTime(now); |
| | | serviceSubtaskAgain.setUpdateTime(now); |
| | | |
| | | // 二次随访时间:上次随访完成时间(未完成则当前时间)+ 下一任务发送天数;过去时间兜底为当前时间 |
| | | applyAgainVisitTime(serviceSubtaskAgain, serviceSubtask, nextServiceTask, config, now); |
| | | // 新任务的随访方式记录本次选择的再次随访方式;resource 本身不落库 |
| | | serviceSubtaskAgain.setVisitType(resource); |
| | | serviceSubtaskAgain.setVisitDeptCode(visitDeptCode); |
| | |
| | | if (dueTime.before(now)) { |
| | | dueTime = now; |
| | | } |
| | | if(ObjectUtils.isNotEmpty(origin.getVisitTime())){ |
| | | dueTime = ObjectUtils.isNotEmpty(origin.getVisitTime()) ? origin.getVisitTime() : now; |
| | | } |
| | | |
| | | target.setLongSendTime(dueTime); |
| | | Date visitTime = dueTime; |
| | | if ("3".equals(nextTask.getType())) { |