Browse Source

项目录入限制有出院医嘱后无法退费以及项目录入

xiaochan 3 years ago
parent
commit
e142645dfe

+ 5 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/QueRenYiZhuShouFeiDao.java

@@ -43,6 +43,9 @@ public interface QueRenYiZhuShouFeiDao {
             "<if test=\"execUnit != null and execUnit !='' and execUnit != '3100000'\">" +
             "      a.exec_unit    =    #{execUnit} and   " +
             "</if>" +
+            "<if test=\"wardCode != null and wardCode !='' \">" +
+            "      a.ward_code    =    #{wardCode} and   " +
+            "</if>" +
             "      a.inpatient_no=b.inpatient_no and   " +
             "      a.admiss_times=b.admiss_times and  " +
             "      convert(varchar(20),a.occ_time,23)&lt;=convert(varchar(20),getdate(),23) " +
@@ -51,7 +54,8 @@ public interface QueRenYiZhuShouFeiDao {
     IPage<YzActOrder> getXuQueFeiYiZhu(IPage<YzActOrder> page,
                                        @Param("inpatientNo") String inpatientNo,
                                        @Param("admissTimes") Integer admissTimes,
-                                       @Param("execUnit") String execUnit);
+                                       @Param("execUnit") String execUnit,
+                                       @Param("wardCode") String wardCode);
 
     @Select("<script>" +
             "SELECT a.inpatient_no,  " +

+ 28 - 12
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.yibao.DismissDao;
 import thyyxxk.webserver.dao.his.yibao.XiangMuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.FeiYongLeiXin;
@@ -37,13 +38,15 @@ public class XiangMuLuRuService {
 
     private final XiangMuLuRuDao dao;
 
-
     private final PublicServer publicServer;
 
+    private final DismissDao dismissDao;
+
     @Autowired
-    public XiangMuLuRuService(XiangMuLuRuDao dao, PublicServer publicServer) {
+    public XiangMuLuRuService(XiangMuLuRuDao dao, PublicServer publicServer, DismissDao dismissDao) {
         this.dao = dao;
         this.publicServer = publicServer;
+        this.dismissDao = dismissDao;
     }
 
     /**
@@ -125,16 +128,19 @@ public class XiangMuLuRuService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "项目退费一次性大于100条数据<br/>╮(﹀_﹀”)╭");
         }
         if (StringUtil.isBlank(param.getInpatientNo()) || param.getAdmissTimes() == null || param.getList().size() == 0) {
-            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者信息不全");
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者信息不全 (;´д`)ゞ");
         }
         if (dao.chaKanHuanZheSFZaiYuan(param.getInpatientNo()) == 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已出院");
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已出院 /(ㄒoㄒ)/~~");
+        }
+        if (dismissDao.countDisActOrders(param.getInpatientNo(), param.getAdmissTimes()) > 0 || dismissDao.countDisActOrders2(param.getInpatientNo(), param.getAdmissTimes()) > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已有出院医嘱无法退费 ε(┬┬﹏┬┬)3");
         }
         // 判断数据是否为 退费数据
         List<ZyDetailCharge> chaKanSFtuiFei = dao.chaKanSFYiJingTuiFeiLe(param.getInpatientNo(), param.getAdmissTimes(), param.getList());
 
         for (ZyDetailCharge charge : chaKanSFtuiFei) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:【%s】已退费,请勿重复退费 <br/>···=థ౪థ.... ", charge.getOriDetailSn()));
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:【%s】已退费,请勿重复退费 <br/>···(。•́︿•̀。) ", charge.getOriDetailSn()));
         }
         // 判断是否为婴儿
         if (param.getInpatientNo().contains("$")) {
@@ -287,6 +293,9 @@ public class XiangMuLuRuService {
         if (errorStr.length() > 3) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, errorStr.toString());
         }
+        if (dismissDao.countDisActOrders(param.getInpatientNo(), param.getAdmissTimes()) > 0 || dismissDao.countDisActOrders2(param.getInpatientNo(), param.getAdmissTimes()) > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已有出院医嘱无法退费 ε(┬┬﹏┬┬)3");
+        }
 
         // 婴儿 要特殊处理
         // 如果带有这个 $ 说明是婴儿
@@ -318,19 +327,26 @@ public class XiangMuLuRuService {
                     zyDetailCharge.setChargeCode(zyDetailCharge.getChargeCodeMx());
                     break;
             }
+            if (zyDetailCharge.getChargeAmount() == null || zyDetailCharge.getAmount() == null) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "数量或金额不能为空。(▼ヘ▼#)");
+            }
             // 判断患者的费用是否存在负数
             if (zyDetailCharge.getChargeAmount().signum() == -1 || zyDetailCharge.getAmount().signum() == -1) {
-                return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES);
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "不能录入负数,(〃>皿<)");
+            }
+            if (zyDetailCharge.getChargeAmount().compareTo(new BigDecimal(0)) == 0 || zyDetailCharge.getAmount().compareTo(new BigDecimal(0)) == 0) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "录入费用为 0 (╯°Д°)╯");
             }
             if (StringUtil.isBlank(zyDetailCharge.getChargeCodeMx())) {
-                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "项目编码空值。( ´•︵•` )");
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "项目编码空值。( ´•︵•` )");
             }
             if (StringUtil.isBlank(zyDetailCharge.getDeptCode())) {
-                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "执行科室为空。( ´•︵•` )");
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "执行科室为空。( ´•︵•` )");
             }
             if (zyDetailCharge.getChargeCodeMx() == null) {
                 zyDetailCharge.setChargeCodeMx(zyDetailCharge.getChargeCode());
             }
+            // 0 - 住院费用  3 - 门急诊 6 - 医技
             if (param.getOrderNo() != null) {
                 zyDetailCharge.setOrderNo(param.getOrderNo());
             } else {
@@ -363,7 +379,6 @@ public class XiangMuLuRuService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "模板名称重复,๐·°(৹˃̵﹏˂̵৹)°·๐");
         }
         zyDetailCharge.setOpIdCode(TokenUtil.getTokenUserId());
-
         for (ZyDetailCharge detailCharge : zyDetailCharge.getList()) {
             if (StringUtil.notBlank(zyDetailCharge.getBillItemCode())) {
                 if (detailCharge.getBillItemCode().equals("001") || detailCharge.getBillItemCode().equals("002")) {
@@ -424,6 +439,7 @@ public class XiangMuLuRuService {
                 Collectors.groupingBy(item -> item.getOrderNo() + DateUtil.formatDatetime(item.getChargeDate()) + item.getChargeCodeMx() + item.getChargeAmount() + item.getChargeFee() + item.getLedgerSn())
         );
         // 用负数拼接的 key 去查找
+        log.info("开始退费匹配住院号:{},次数:{}", inpatientNo, admissTimes);
         for (ZyDetailCharge fuShu : getYiZhuFeiYongFuShu) {
             String key = fuShu.getOrderNo() + DateUtil.formatDatetime(fuShu.getChargeDate()) + fuShu.getChargeCodeMx() + fuShu.getChargeAmount().negate()
                     + fuShu.getChargeFee().negate() + fuShu.getLedgerSn();
@@ -433,7 +449,7 @@ public class XiangMuLuRuService {
                         fuShu.setOriDetailSn(zyDetailCharge.getDetailSn());
                         zyDetailCharge.setTuiFeiFlag(1);
                         piPei.add(fuShu);
-                        log.info("第一次匹配==》流水{},匹配流水:{},", fuShu.getDetailSn(), fuShu.getOriDetailSn());
+                        log.info("第一次匹配==》流水:{},匹配流水:{},", fuShu.getDetailSn(), fuShu.getOriDetailSn());
                         break;
                     }
                 }
@@ -458,7 +474,7 @@ public class XiangMuLuRuService {
                             zyDetailCharge.setOriDetailSn(detailCharge.getDetailSn());
                             detailCharge.setTuiFeiFlag(1);
                             piPei.add(zyDetailCharge);
-                            log.info("第二次匹配==》流水{},匹配流水:{}", zyDetailCharge.getDetailSn(), zyDetailCharge.getOriDetailSn());
+                            log.info("第二次匹配==》流水:{},匹配流水:{}", zyDetailCharge.getDetailSn(), zyDetailCharge.getOriDetailSn());
                             break;
                         }
                     }
@@ -506,7 +522,7 @@ public class XiangMuLuRuService {
     }
 
     /**
-     * 根据病人科室
+     * 根据对应的病区来获取科室
      *
      * @param ward 科室编码
      * @return 返回对应的

+ 1 - 0
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/MenZhengXiangMuServer.java

@@ -63,6 +63,7 @@ public class MenZhengXiangMuServer {
             if (map.containsKey(item.getReqNo())) {
                 item.setJe(map.get(item.getReqNo()).getJe());
             }
+            item.setXiangMuZhuangTai(item.getConfirmFlag());
         });
         if (feiYong.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/QueRenYiZhuShouFeiServer.java

@@ -51,7 +51,7 @@ public class QueRenYiZhuShouFeiServer {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室信息为空 [・_・?]");
         }
         log.info("查询需确费医嘱:数据:{}", JSON.toJSONString(yzActOrder));
-        dao.getXuQueFeiYiZhu(page, yzActOrder.getInpatientNo(), yzActOrder.getAdmissTimes(), yzActOrder.getExecUnit());
+        dao.getXuQueFeiYiZhu(page, yzActOrder.getInpatientNo(), yzActOrder.getAdmissTimes(), yzActOrder.getExecUnit(), yzActOrder.getWardCode());
         if (page.getRecords().isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
         }