浏览代码

确认医嘱时的质控病历

DESKTOP-0GD05B0\Administrator 2 年之前
父节点
当前提交
aa17a8b5d8

+ 2 - 2
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/YizhuLuRuController.java

@@ -70,9 +70,9 @@ public class YizhuLuRuController {
     }
 
     @GetMapping("/correctSubOrders")
-    public ResultVo<String> correctSubOrders(@RequestParam("patNo") String patNo,
+    public void correctSubOrders(@RequestParam("patNo") String patNo,
                                              @RequestParam("times") Integer times) {
-        return server.correctSubOrders(patNo, times);
+        server.correctSubOrders(patNo, times);
     }
 
 

+ 4 - 1
src/main/java/thyyxxk/webserver/dao/his/PublicDao.java

@@ -241,7 +241,10 @@ public interface PublicDao {
      * @param wardCode 科室编码
      * @return 数据
      */
-    @Select("select code " + "from a_employee_mi " + "where dept_code = #{wardCode} " + "  and isnull(del_flag, 0) <> 1 " + " and emp_tit_code in ('010') ")
+    @Select("select code " +
+            "from a_employee_mi " +
+            "where dept_code = #{wardCode} " +
+            "  and isnull(del_flag, 0) <> 1 " + " and emp_tit_code in ('010') ")
     List<String> huoQuHuanZheBingFangDeHuShi(String wardCode);
 
 

+ 14 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -479,6 +479,20 @@ public interface YiZhuLuRuDao {
                                      Integer times,
                                      BigDecimal orderNo);
 
+    @Select("select count(1) " +
+            "from yz_act_order " +
+            "where inpatient_no = #{yz.inpatientNo} " +
+            "  and admiss_times = #{yz.admissTimes} " +
+            "  and status_flag = 1 " +
+            "  and isnull(self_buy, '0') <> '4' " +
+            "  and enter_oper = #{userCode} " +
+            "  and order_code in (select rtrim(order_code) " +
+            "                     from yz_zd_order_item_confirm " +
+            "                     where item_name = N'出院')")
+    int selectDischargeOrde(@Param("yz") XinZhenYiZhu yz,
+                            @Param("userCode") String userCode);
+
+
 
     @Update("update yz_act_order " +
             "set modifier = #{userCode}, " +

+ 46 - 11
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
 import thyyxxk.webserver.constants.sidicts.ChargeStatus;
@@ -19,9 +20,11 @@ import thyyxxk.webserver.dao.his.inpatient.XiangMuLuRuDao;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.RoleCode;
+import thyyxxk.webserver.entity.casefrontsheet.SheetOverview;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.YzActOrder;
 import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
+import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.inpatient.patient.Overview;
 import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.entity.login.UserInfo;
@@ -29,6 +32,7 @@ import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
 import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
 import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.service.casefrontsheet.CaseFrontSheetMainService;
 import thyyxxk.webserver.service.externalhttp.DrgWebServices;
 import thyyxxk.webserver.service.heliyongyao.RationalUseServer;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
@@ -51,15 +55,13 @@ import java.util.stream.Collectors;
 @Slf4j
 public class YiZhuLuRuServer {
 
-
     private final YiZhuLuRuDao dao;
     private final PublicServer publicServer;
     private final RedisLikeService redisLikeService;
     private final XiangMuLuRuDao xiangMuLuRuDao;
-
     private final RationalUseServer rationalUseServer;
-
     private final DrgWebServices drgWebServices;
+    private final CaseFrontSheetMainService caseFrontSheetMainService;
 
     /**
      * 转科的医嘱编码
@@ -79,13 +81,14 @@ public class YiZhuLuRuServer {
     }
 
 
-    public YiZhuLuRuServer(YiZhuLuRuDao dao, PublicServer publicServer, RedisLikeService redisLikeService, XiangMuLuRuDao xiangMuLuRuDao, RationalUseServer rationalUseServer, DrgWebServices drgWebServices) {
+    public YiZhuLuRuServer(YiZhuLuRuDao dao, PublicServer publicServer, RedisLikeService redisLikeService, XiangMuLuRuDao xiangMuLuRuDao, RationalUseServer rationalUseServer, DrgWebServices drgWebServices, CaseFrontSheetMainService caseFrontSheetMainService) {
         this.dao = dao;
         this.publicServer = publicServer;
         this.redisLikeService = redisLikeService;
         this.xiangMuLuRuDao = xiangMuLuRuDao;
         this.rationalUseServer = rationalUseServer;
         this.drgWebServices = drgWebServices;
+        this.caseFrontSheetMainService = caseFrontSheetMainService;
     }
 
 
@@ -220,7 +223,7 @@ public class YiZhuLuRuServer {
         return ResultVoUtil.success(dao.getParentOrders(patNo, times));
     }
 
-    public ResultVo<String> correctSubOrders(String patNo, Integer times) {
+    public void correctSubOrders(String patNo, Integer times) {
         QueryWrapper<?> qw = new QueryWrapper<>();
         qw.eq("a.inpatient_no", patNo)
                 .eq("a.admiss_times", times)
@@ -228,7 +231,7 @@ public class YiZhuLuRuServer {
                 .eq("a.enter_oper", TokenUtil.getTokenUserId());
         List<XinZhenYzActOrder> list = dao.huoQuYiZhuShuJu(qw);
         if (ListUtil.isBlank(list)) {
-            return ResultVoUtil.success();
+            return;
         }
         // 父医嘱
         Map<BigDecimal, XinZhenYzActOrder> parentOrder = new HashMap<>(list.size());
@@ -242,7 +245,6 @@ public class YiZhuLuRuServer {
                 }
             }
         });
-        return ResultVoUtil.success();
     }
 
     private boolean updateSubOrders(XinZhenYzActOrder parent, XinZhenYzActOrder children) {
@@ -285,6 +287,7 @@ public class YiZhuLuRuServer {
         if (ListUtil.isBlank(yiZhuList)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有需要确认的医嘱.");
         }
+        dischargeQCVerification(param);
         // 药品 code
         Set<String> yaoPingCode = new HashSet<>();
         // 项目的 code
@@ -327,9 +330,9 @@ public class YiZhuLuRuServer {
                     orderNo = item.getActOrderNo();
                 }
             }
-
             confirmOrderInformation.add(item.getActOrderNo());
             Map<String, Object> errorMessageMap = checkData(item, drug, project, patInfo, doctorLevel);
+
             String key = item.getId();
             if (rationalUseOfMedicine.containsKey(key)) {
                 List<String> temp = (List<String>) errorMessageMap.get("error");
@@ -358,6 +361,8 @@ public class YiZhuLuRuServer {
             if (count > 0) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有未确认和未执行的长期医嘱,无法确认全排斥医嘱,请先确认其他医嘱。");
             }
+
+
             dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), excludeOrders, userCode, orderNo);
         }
         for (BigDecimal decimal : confirmOrderInformation) {
@@ -368,6 +373,27 @@ public class YiZhuLuRuServer {
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
     }
 
+    /**
+     * 出院医嘱质控校验
+     *
+     * @param param 患者信息
+     */
+    private void dischargeQCVerification(XinZhenYiZhu param) {
+        if (dao.selectDischargeOrde(param, TokenUtil.getTokenUserId()) > 0) {
+            SheetOverview overview = new SheetOverview();
+            overview.setBah(param.getInpatientNo());
+            overview.setTimes(param.getAdmissTimes());
+            overview.setInOutFlag(1);
+            ResultVo<Map<String, List<CodeName>>> result = caseFrontSheetMainService.sheetVerification(overview);
+            if (!result.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
+                throw new BizException(ExceptionEnum.LOGICAL_ERROR, result.getMessage());
+            }
+            if (!result.getData().get("force").isEmpty()) {
+                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "未通过病案首页质控,无法确认出院类型的医嘱。");
+            }
+        }
+    }
+
 
     /**
      * 在开医嘱时 drg 需要调用一下这个接口
@@ -471,7 +497,6 @@ public class YiZhuLuRuServer {
             if (errorMessageMap.containsKey("error")) {
                 return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请修改有错误的医嘱。", map);
             }
-
         }
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "添加成功.");
     }
@@ -897,13 +922,23 @@ public class YiZhuLuRuServer {
         }
     }
 
-    private Map<String, Object> checkData(XinZhenYzActOrder item, Map<String, XinZhenYzActOrder> drug, Map<String, List<XinZhenYzActOrder>> project, XinZhenYiZhu huanZheXinXi, Integer 医生级别) {
+
+    private Map<String, Object> checkData(XinZhenYzActOrder item,
+                                          Map<String, XinZhenYzActOrder> drug,
+                                          Map<String, List<XinZhenYzActOrder>> project,
+                                          XinZhenYiZhu huanZheXinXi,
+                                          Integer doctorLevel) {
         boolean strictVerification = huanZheXinXi != null;
         List<String> errorMessage = new ArrayList<>();
         List<String> warningMessage = new ArrayList<>();
         if (StringUtil.isBlank(item.getGroupNo())) {
             errorMessage.add("没有药房请重新开。");
         }
+        if (item.getParentNo() != null) {
+            if (BigUtils.bigXiaoYu(item.getActOrderNo(), item.getParentNo())) {
+                errorMessage.add("子医嘱的医嘱号,小于父医嘱号,无法成组。【原因如果子医嘱的医嘱号小于父医嘱,会导致打印乱码】");
+            }
+        }
         if (ITEM.equals(item.getSerial())) {
             List<XinZhenYzActOrder> projectDetails = project.get(item.getOrderCode());
             // 如果这个项目下面没有费用明细,那么这就是一条口头医,口头医嘱每次只能开一个
@@ -924,7 +959,7 @@ public class YiZhuLuRuServer {
                 if (detailsOfDrugs.getDelFlag() == 1) {
                     errorMessage.add("药品已经被停用了,请联系药剂科");
                 }
-                if (detailsOfDrugs.getYpLevel() > 医生级别) {
+                if (detailsOfDrugs.getYpLevel() > doctorLevel) {
                     errorMessage.add("您没有开此药品的权限");
                 }
                 if (ITEM.equals(item.getGroupNo().trim())) {