陈昶聿
2 天以前 d9e25dc82419ab00542e029af47b1cd471c1568f
【丽水】writeInSubTask 增加回滚事务
已修改1个文件
12 ■■■■■ 文件已修改
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -17,6 +17,7 @@
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.*;
@@ -579,9 +580,8 @@
            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,如果之前的小于现在的,则直接将之前的停掉(原因再入院)
@@ -693,14 +693,14 @@
            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 {
            //生成子任务失败,
@@ -713,6 +713,10 @@
            patMedInhosp2.setRemark("生成子任务失败 " + type);
            patMedInhospMapper.updatePatMedInhosp(patMedInhosp2);
        }
        } catch (Exception e) {
            //出错回滚事务
            e.printStackTrace();
        }
    }
    private Integer addServiceSubtaskPreachform(ServiceSubtask serviceSubtask, String sendstate) {