Ver Fonte

批量提交更新

xiaochan há 2 anos atrás
pai
commit
4cf3539bb9

+ 16 - 6
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -2,15 +2,15 @@ package thyyxxk.webserver.service.zhuyuanyisheng;
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.ListUtils;
+import org.apache.ibatis.session.ExecutorType;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
@@ -19,6 +19,7 @@ import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.ChargeStatus;
 import thyyxxk.webserver.dao.his.inpatient.XiangMuLuRuDao;
+import thyyxxk.webserver.dao.his.medicaladvice.nursing.NursingManagementDao;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.RoleCode;
@@ -64,6 +65,7 @@ public class YiZhuLuRuServer {
     private final XiangMuLuRuDao xiangMuLuRuDao;
     private final DrgWebServices drgWebServices;
     private final CaseFrontSheetMainService caseFrontSheetMainService;
+    private final SqlSessionFactory sqlSessionFactory;
 
     /**
      * 转科的医嘱编码
@@ -77,13 +79,14 @@ public class YiZhuLuRuServer {
     }
 
 
-    public YiZhuLuRuServer(YiZhuLuRuDao dao, PublicServer publicServer, RedisLikeService redisLikeService, XiangMuLuRuDao xiangMuLuRuDao, DrgWebServices drgWebServices, CaseFrontSheetMainService caseFrontSheetMainService) {
+    public YiZhuLuRuServer(YiZhuLuRuDao dao, PublicServer publicServer, RedisLikeService redisLikeService, XiangMuLuRuDao xiangMuLuRuDao, DrgWebServices drgWebServices, CaseFrontSheetMainService caseFrontSheetMainService, SqlSessionFactory sqlSessionFactory) {
         this.dao = dao;
         this.publicServer = publicServer;
         this.redisLikeService = redisLikeService;
         this.xiangMuLuRuDao = xiangMuLuRuDao;
         this.drgWebServices = drgWebServices;
         this.caseFrontSheetMainService = caseFrontSheetMainService;
+        this.sqlSessionFactory = sqlSessionFactory;
     }
 
 
@@ -293,8 +296,15 @@ public class YiZhuLuRuServer {
             dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), repel.getDate(), userCode, repel.getOrderNo());
         }
 
-        for (BigDecimal decimal : confirmOrderInformation) {
-            dao.confirmOrders(decimal, userCode, new Date());
+        SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
+        YiZhuLuRuDao mapper = sqlSession.getMapper(YiZhuLuRuDao.class);
+        try {
+            for (BigDecimal decimal : confirmOrderInformation) {
+                mapper.confirmOrders(decimal, userCode, new Date());
+            }
+            sqlSession.commit();
+        } finally {
+            sqlSession.close();
         }
 
         getThis().drgOrderUpdate(patInfo.getInpatientNo() + "_" + patInfo.getAdmissTimes() + "_" + patInfo.getLedgerSn());