浏览代码

no message

xiaochan 1 年之前
父节点
当前提交
4b0ea21d74
共有 1 个文件被更改,包括 19 次插入17 次删除
  1. 19 17
      src/main/java/thyyxxk/webserver/service/inpatient/XiangMuLuRuService.java

+ 19 - 17
src/main/java/thyyxxk/webserver/service/inpatient/XiangMuLuRuService.java

@@ -490,7 +490,7 @@ public class XiangMuLuRuService {
             }
         }
         // 下面是二次匹配
-        if (erCiPiPei.size() > 0) {
+        if (!erCiPiPei.isEmpty()) {
             // 二次匹配 条件为 执行科室 项目编码 数量 账页号
             Map<String, List<ZyDetailCharge>> erCiPiPeiZhenShu = getYiZhuFeiYongZhenShu.stream().collect(Collectors.groupingBy(item -> item.getExecUnit() + item.getChargeCodeMx() + item.getChargeAmount() + item.getChargeFee() + item.getLedgerSn()));
             // 开始二次匹配
@@ -510,7 +510,7 @@ public class XiangMuLuRuService {
             }
         }
         // 开始匹配
-        if (piPei.size() > 0) {
+        if (!piPei.isEmpty()) {
             // 100 条的更新  ListUtils.partition 用来拆分 list size 是拆分的条数
             List<List<ZyDetailCharge>> fenDuan = ListUtils.partition(piPei, 100);
             for (List<ZyDetailCharge> list : fenDuan) {
@@ -521,7 +521,7 @@ public class XiangMuLuRuService {
             return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE, String.format("匹配成功共:{%d}条,匹配成功:{%s}条", getYiZhuFeiYongFuShu.size(), piPei.size()));
         }
         publicServer.genXingYuanLiuShuiBiaoZhi(inpatientNo, admissTimes, ledgerSn);
-        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, String.format("该患者有【%d】条,未能匹配 |д・)っ", getYiZhuFeiYongFuShu.size()));
+        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, String.format("该患者有【%d】条,未能匹配 ", getYiZhuFeiYongFuShu.size()));
     }
 
     /**
@@ -641,9 +641,16 @@ public class XiangMuLuRuService {
         } else if (zy.getOriDetailSn() != null || "2".equals(zy.getTransFlagYb())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该负数费用已被正负相抵。");
         }
+
         List<ZyDetailCharge> zhenShuShuJu = dao.piPeiXinXi(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), infantFlag, detailSnList);
+        if (zhenShuShuJu.size() != 1) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "每次只能匹配一条。");
+        }
+
+        Map<Integer, ZyDetailCharge> tuiFeiYuErPiPei = dao.tuiFeiYuEr2(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), infantFlag, detailSnList)
+                .stream()
+                .collect(Collectors.toMap(ZyDetailCharge::getOriDetailSn, a -> a, (k1, k2) -> k1));
 
-        Map<Integer, ZyDetailCharge> tuiFeiYuErPiPei = dao.tuiFeiYuEr2(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), infantFlag, detailSnList).stream().collect(Collectors.toMap(ZyDetailCharge::getOriDetailSn, a -> a, (k1, k2) -> k1));
         BigDecimal chargeFeeSum = new BigDecimal(0);
         BigDecimal chargeAmountSum = new BigDecimal(0);
 
@@ -657,22 +664,17 @@ public class XiangMuLuRuService {
             chargeFeeSum = chargeFeeSum.add(detailCharge.getChargeFee());
             chargeAmountSum = chargeAmountSum.add(detailCharge.getChargeAmount());
         }
-        if (zhenShuShuJu.size() == 1) {
-            if (!zy.getYbSelfFlag().equals(zhenShuShuJu.get(0).getYbSelfFlag())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "无法匹配这条医嘱,医保费用标志不一致。");
-            }
-            if (BigUtils.bigDaYu(chargeFeeSum, zy.getChargeFee().negate()) || BigUtils.dengYu(chargeFeeSum, zy.getChargeFee().negate())) {
-                dao.zhiYouYiGeJiuGenXingFuShuLiuShui(zyDetailCharge.getInpatientNo(), zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), zyDetailCharge.getDetailSn(), zhenShuShuJu.get(0).getDetailSn());
-                publicServer.genXingYuanLiuShuiBiaoZhi(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn());
-                return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE, "费用匹配成功。");
-            }
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("负数费用:{%.2f},匹配费用:{%.2f} \n 负数数量:{%.2f},匹配数量:{%.2f}", zy.getChargeFee().negate(), chargeFeeSum, zy.getChargeAmount().negate(), chargeAmountSum));
-        } else {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "每次只能匹配一条。");
+        if (!zy.getYbSelfFlag().equals(zhenShuShuJu.get(0).getYbSelfFlag())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "无法匹配这条医嘱,费用一条是自费,一条是医保,无法匹配。");
         }
+        if (BigUtils.bigDaYu(chargeFeeSum, zy.getChargeFee().negate()) || BigUtils.dengYu(chargeFeeSum, zy.getChargeFee().negate())) {
+            dao.zhiYouYiGeJiuGenXingFuShuLiuShui(zyDetailCharge.getInpatientNo(), zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn(), zyDetailCharge.getDetailSn(), zhenShuShuJu.get(0).getDetailSn());
+            publicServer.genXingYuanLiuShuiBiaoZhi(inpatientNo, zyDetailCharge.getAdmissTimes(), zyDetailCharge.getLedgerSn());
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE, "费用匹配成功。");
+        }
+        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("负数费用:{%.2f},匹配费用:{%.2f} \n 负数数量:{%.2f},匹配数量:{%.2f}", zy.getChargeFee().negate(), chargeFeeSum, zy.getChargeAmount().negate(), chargeAmountSum));
     }
 
-
     public void exportExcel(HttpServletResponse response, ZyDetailCharge param) {
         param.setPageSize(param.getTotal());
         param.setCurrentPage(1);