| | |
| | | // 出院(发送)时间 + 本步补偿时间 小于当前时间 -> 超时 |
| | | return deadline.getTime() < new Date().getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 处理超时随访任务 |
| | | * @return |
| | | */ |
| | | public void dealSubtaskDeadline(String orgid, Integer deadlineDay){ |
| | | |
| | | Date deadline = DateUtils.addDays(new Date(), deadlineDay); |
| | | //通过任务ID拿到患者信息,并且随访时间得是今天之前的 |
| | | ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity(); |
| | | serviceSubtaskVO.setOrgid(orgid); |
| | | serviceSubtaskVO.setSendstate(7L); |
| | | //只扫描首次随访的 |
| | | serviceSubtaskVO.setVisitCount(1); |
| | | serviceSubtaskVO.setEndOutHospTime(deadline); |
| | | List<ServiceSubtask> serviceSubtaskList |
| | | = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | log.info("【dealSubtaskDeadline】获取到{}个超时任务", serviceSubtaskList.size()); |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | 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 "无需再次随访,患者再入院了"; |
| | | }else { |
| | | continue; |
| | | } |
| | | //新增再次随访任务 |
| | | ServiceSubtask serviceSubtaskAgain = DtoConversionUtils.sourceToTarget(serviceSubtask, ServiceSubtask.class); |
| | | serviceSubtaskAgain.setId(null); |
| | | serviceSubtaskAgain.setUpid(serviceSubtask.getId().intValue()); |
| | | serviceSubtaskAgain.setVisitCount(serviceSubtask.getVisitCount() + 1); |
| | | serviceSubtaskAgain.setSendstate(2L); |
| | | serviceSubtaskAgain.setCreateTime(new Date()); |
| | | serviceSubtaskAgain.setUpdateTime(new Date()); |
| | | serviceSubtaskAgain.setVisitType(serviceSubtask.getVisitType()); |
| | | serviceSubtaskAgain.setVisitDeptCode(serviceSubtask.getVisitDeptCode()); |
| | | serviceSubtaskAgain.setVisitDeptName(serviceSubtask.getVisitDeptName()); |
| | | int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtaskAgain); |
| | | if (i == 1) { |
| | | //再次随访任务创建成功后,原任务改为失败状态 |
| | | serviceSubtask.setIsVisitAgain(2); |
| | | serviceSubtask.setSendstate(5L); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |