| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.Instant; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | |
| | | serviceSubtask.setVisitDeptCode(patMedInhosp1.getLeavehospitaldistrictcode()); |
| | | serviceSubtask.setVisitDeptName(patMedInhosp1.getLeavehospitaldistrictname()); |
| | | } |
| | | |
| | | |
| | | Integer i = 0; |
| | | try { |
| | | //先判断一下,是否需要校验 |
| | | if (check && (Objects.isNull(serviceSubtask.getTaskSituation()) || serviceSubtask.getTaskSituation() != 6)) { |
| | | //在新增之前,先通过患者ID,sendstate=2查询一下,在所有长期任务中,是不是还有该患者待执行的任务,有的话,比较之前的endtime是否小于当前的endtaime,如果之前的小于现在的,则直接将之前的停掉(原因再入院) |
| | |
| | | i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | addServiceSubtaskPreachform(serviceSubtask, null); |
| | | } |
| | | if (i == 1) { |
| | | |
| | | //将check_flag改成1(已处理) |
| | | if(i == 1){ |
| | | PatMedInhosp patMedInhosp2 = new PatMedInhosp(); |
| | | patMedInhosp2.setInhospid(patMedInhosp1.getInhospid()); |
| | | if (type == 1) patMedInhosp2.setDeptcheckFlag("1"); |
| | | if (type == 2) patMedInhosp2.setWardcheckFlag("1"); |
| | | if (type == 3) patMedInhosp2.setDiagcheckFlag("1"); |
| | | |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp2); |
| | | } else { |
| | | //生成子任务失败, |
| | |
| | | patMedInhosp2.setRemark("生成子任务失败 " + type); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp2); |
| | | } |
| | | } catch (Exception e) { |
| | | //出错回滚事务 |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private Integer addServiceSubtaskPreachform(ServiceSubtask serviceSubtask, String sendstate) { |