| | |
| | | * @return |
| | | */ |
| | | public void dealSubtaskDeadline(String orgid, Integer deadlineDay){ |
| | | |
| | | //获取任务信息 |
| | | ServiceTask st = new ServiceTask(); |
| | | st.setDelFlag("0"); |
| | | st.setLongTask(1); |
| | | st.setNexttaskflag("1"); |
| | | st.setOrgid(orgid); |
| | | List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st); |
| | | for (ServiceTask serviceTask : serviceTasks) { |
| | | deadlineDay = -deadlineDay; |
| | | Date deadline = DateUtils.addDays(new Date(), deadlineDay); |
| | | //通过任务ID拿到患者信息,并且随访时间得是今天之前的 |
| | | ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity(); |
| | |
| | | serviceSubtaskVO.setSendstate(7L); |
| | | //只扫描首次随访的 |
| | | serviceSubtaskVO.setVisitCount(1); |
| | | serviceSubtaskVO.setTaskid(serviceTask.getTaskid()); |
| | | serviceSubtaskVO.setEndOutHospTime(deadline); |
| | | List<ServiceSubtask> serviceSubtaskList |
| | | = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | log.info("【dealSubtaskDeadline】获取到{}个超时任务", serviceSubtaskList.size()); |
| | | log.info("【dealSubtaskDeadline】获取到{}个超时任务, taskid={}", serviceSubtaskList.size(), serviceTask.getTaskid()); |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | PatMedInhosp patMedInhospVo = new PatMedInhosp(); |
| | | patMedInhospVo.setOrgid(serviceSubtask.getOrgid()); |
| | | patMedInhospVo.setInhospid(serviceSubtask.getInhospid()); |
| | | List<PatMedInhosp> patMedInhospList = iPatMedInhospService.selectPatMedInhospList(patMedInhospVo); |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setInhospid(serviceSubtask.getInhospid()); |
| | | List<PatMedInhosp> patMedInhospList = iPatMedInhospService.selectPatMedInhospList(patMedInhosp); |
| | | |
| | | if (patMedInhospList.size() > 0) { |
| | | serviceSubtask.setIsVisitAgain(2); |
| | | serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";患者再入院了" : "患者再入院了"); |
| | | serviceSubtask.setSendstate(4L); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | //return "无需再次随访,患者再入院了"; |
| | | if (!patMedInhospList.isEmpty()) { |
| | | patMedInhosp = patMedInhospList.get(0); |
| | | }else { |
| | | continue; |
| | | } |
| | | if(ObjectUtils.isEmpty(serviceTask.getNexttaskid())){ |
| | | continue; |
| | | } |
| | | ServiceTask nextServiceTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceTask.getNexttaskid()); |
| | | PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtask.getPatid()); |
| | | String config = configService.selectConfigByKey("visit.early.day"); |
| | | Integer type = 1; |
| | | |
| | | //新增再次随访任务 |
| | | ServiceSubtask serviceSubtaskAgain = DtoConversionUtils.sourceToTarget(serviceSubtask, ServiceSubtask.class); |
| | | ServiceSubtask serviceSubtaskAgain = iPatMedInhospService.boxedServiceSubtask(nextServiceTask, |
| | | patMedInhosp, patArchive, config, type); |
| | | serviceSubtaskAgain.setId(null); |
| | | serviceSubtaskAgain.setUpid(serviceSubtask.getId().intValue()); |
| | | serviceSubtaskAgain.setVisitCount(serviceSubtask.getVisitCount() + 1); |
| | |
| | | int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtaskAgain); |
| | | if (i == 1) { |
| | | //再次随访任务创建成功后,原任务改为失败状态 |
| | | serviceSubtask.setIsVisitAgain(2); |
| | | serviceSubtask.setSendstate(5L); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |