Browse Source

可以匹配 药品。

xiaochan 3 years ago
parent
commit
e4de3c4b89

+ 10 - 4
src/main/java/thyyxxk/webserver/dao/his/yibao/XiangMuLuRuDao.java

@@ -970,6 +970,12 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
                                         @Param("ledger") Integer ledger,
                                         @Param("list") List<ZyDetailCharge> map);
 
+    @Update("update zy_detail_charge set exec_unit = ward_code  where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
+            "and len(order_no) > 2 and exec_unit is null  and charge_fee < 0 ")
+    void xiuGaiKongDeZhiXingKeShi(@Param("inpatientNo") String inpatientNo,
+                                  @Param("admissTimes") Integer admissTimes,
+                                  @Param("ledger") Integer ledger);
+
 
     @Select("select b.code from zy_detail_charge a, yp_zd_dict b " +
             "where order_no <> 6 and trans_flag_yb not in (1,2)  and charge_code like 'BILL%' " +
@@ -1023,7 +1029,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
 
 
     @Select("<script>" +
-            "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,ori_detail_sn,charge_fee,charge_amount, " +
+            "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,ori_detail_sn,order_no,charge_fee,charge_amount, " +
             "       exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb, exec_unit, " +
             "       op_id_code = (select rtrim(name) name from a_employee_mi where code  = op_id_code)," +
             "       charge_code_name = (select rtrim(name) name from zd_charge_item where code = charge_code_mx),charge_code = 'xm' from zy_detail_charge " +
@@ -1032,7 +1038,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
             "  and  trans_flag_yb not in (1,2) " +
             "  and ori_detail_sn is null " +
             "<if test=\"chuYuanYiZhu == 1\">" +
-            "  and charge_date &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
+            "  and CONVERT(varchar(100), charge_date, 23) &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
             "</if>" +
             "<if test=\"list.size >0 \">" +
             " and exec_unit in " +
@@ -1049,7 +1055,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
                                                      @Param("chuYuanYiZhu") Integer chuYuanYiZhu);
 
     @Select("<script>" +
-            "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,ori_detail_sn,charge_fee,charge_amount, " +
+            "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,order_no,ori_detail_sn,charge_fee,charge_amount, " +
             "       exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb,exec_unit, " +
             "       op_id_code = (select rtrim(name) name from a_employee_mi where code  = op_id_code)," +
             "       charge_code_name = (select top(1) rtrim(name) name from yp_zd_dict where code = charge_code_mx),charge_code = 'yp' from zy_detail_charge " +
@@ -1058,7 +1064,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
             "  and  trans_flag_yb not in (1,2) " +
             "  and ori_detail_sn is null" +
             "<if test=\"chuYuanYiZhu == 1\">" +
-            "  and charge_date &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
+            "  and CONVERT(varchar(100), charge_date, 23) &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
             "</if>" +
             "<if test=\"list.size > 0 \">" +
             " and exec_unit in " +

+ 0 - 6
src/main/java/thyyxxk/webserver/entity/datamodify/ZyDetailCharge.java

@@ -282,12 +282,6 @@ public class ZyDetailCharge implements Serializable {
      */
     private Integer feiYongType;
 
-    /**
-     * 药品
-     */
-    private boolean yaoPing = true;
-
-
     /**
      * 0:全部
      * 1:未退费

+ 21 - 16
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -153,6 +153,7 @@ public class XiangMuLuRuService {
         List<ZyDetailCharge> tuiFeiList = new ArrayList<>();
         // 获取到用户角色   管理员角色可以无视
         List<String> zhiXinKeShi = dao.chaXunZhiZXinKeShi(param.getDeptCode());
+
         for (ZyDetailCharge pojo : yuanTuiFeiList) {
             // 判断患者的费用是否存在负数
             if (pojo.getChargeFee().signum() == -1 || pojo.getChargeAmount().signum() == -1) {
@@ -162,7 +163,7 @@ public class XiangMuLuRuService {
                 yaoPingDan.add(pojo);
             }
             // 在这里判断执行科室
-            ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, param, pojo);
+            ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, param, pojo, true);
             if (LOGICAL_ERROR != null) return LOGICAL_ERROR;
             // 数据库有个 触发器 如果带了医嘱号且有篆刻那么这里就需要改成 0
             if (BigUtils.bigDaYu(pojo.getOrderNo(), 10)) {
@@ -200,25 +201,27 @@ public class XiangMuLuRuService {
     }
 
     private ResultVo<String> getStringResultVo(List<Integer> yongHuJueSe, List<String> zhiXinKeShi, ZyDetailCharge xuYaoTuiDeShuJu,
-                                               ZyDetailCharge piPeiDeShuJu) {
+                                               ZyDetailCharge piPeiDeShuJu, Boolean panDuanYaoPin) {
         // 获取到用户角色   管理员角色可以无视
         if (!yongHuJueSe.contains(1)) {
             // 科室开头 是 8 就不是医技科室 只有医技科室可以退药品
             if (xuYaoTuiDeShuJu.getDeptCode().startsWith("8")) {
                 //获取到这个人是否属于这个科室
                 if (!zhiXinKeShi.contains(piPeiDeShuJu.getExecUnit())) {
-                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。<br/>( ´Д`)y━・~~", piPeiDeShuJu.getDetailSn()));
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。<br/>(;´д`)ゞ", piPeiDeShuJu.getDetailSn()));
                 }
                 // 护士是不可以退药品的
-                if (xuYaoTuiDeShuJu.isYaoPing()) {
+                if (panDuanYaoPin) {
                     if (piPeiDeShuJu.getChargeCode().startsWith("BILL")) {
-                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,包含药品费用,无法退费。<br/>( ´Д`)y━・~~", piPeiDeShuJu.getDetailSn()));
+                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,包含药品费用,无法退费。<br/>(T▽T)", piPeiDeShuJu.getDetailSn()));
                     }
                 }
-            } else if (!xuYaoTuiDeShuJu.getDeptCode().equals(piPeiDeShuJu.getExecUnit())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。<br/>( ´Д`)y━・~~", piPeiDeShuJu.getDetailSn()));
-            } else if ((BigUtils.bigDaYu(piPeiDeShuJu.getOrderNo(), 100) || BigUtils.bigXiaoYu(piPeiDeShuJu.getOrderNo(), 0)) && piPeiDeShuJu.getSerial().equals("01")) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,只能退本科室录入的药品。<br/>( ´Д`)y━・~~", piPeiDeShuJu.getDetailSn()));
+            } else if (panDuanYaoPin) {
+                if (!xuYaoTuiDeShuJu.getDeptCode().equals(piPeiDeShuJu.getExecUnit())) {
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。<br/>(iДi)", piPeiDeShuJu.getDetailSn()));
+                } else if ((BigUtils.bigDaYu(piPeiDeShuJu.getOrderNo(), 100) || BigUtils.bigXiaoYu(piPeiDeShuJu.getOrderNo(), 0)) && piPeiDeShuJu.getSerial().equals("01")) {
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,只能退本科室录入的药品。<br/>⊙﹏⊙|||", piPeiDeShuJu.getDetailSn()));
+                }
             }
         }
         return null;
@@ -617,14 +620,16 @@ public class XiangMuLuRuService {
         publicServer.genXingYuanLiuShuiBiaoZhi(inpatientNo, patient.getAdmissTimes(), ledger);
         // 药品 分大包装和小包装 可能大包装 匹配了 小包装没有 匹配 所以这里编码同步 一下
         List<Integer> yaoPingBianMaTongBu = dao.weiGuiYaoPinInt(inpatientNo, patient.getAdmissTimes(), ledger, infantFlag);
+
         if (BigUtils.bigDaYu(dao.zhenFuXingDiFeiYong(inpatientNo, patient.getAdmissTimes(), ledger), 0)) {
             dao.chongXingZhengFuXiangDi(inpatientNo, patient.getAdmissTimes(), ledger);
         }
         // 这里退药 医嘱 有可能会没有携带 执行科室
-        List<ZyDetailCharge> huoQuYaoPingZhongKeShiWeiKongDe = dao.huoQuYaoPingZhongKeShiWeiKongDe(inpatientNo, patient.getAdmissTimes(), ledger);
-        if (!huoQuYaoPingZhongKeShiWeiKongDe.isEmpty()) {
-            dao.yiZhuTuiFeiGenXingZhiXingKeShi(inpatientNo, patient.getAdmissTimes(), ledger, huoQuYaoPingZhongKeShiWeiKongDe);
-        }
+//        List<ZyDetailCharge> huoQuYaoPingZhongKeShiWeiKongDe = dao.huoQuYaoPingZhongKeShiWeiKongDe(inpatientNo, patient.getAdmissTimes(), ledger);
+//        if (!huoQuYaoPingZhongKeShiWeiKongDe.isEmpty()) {
+//            dao.yiZhuTuiFeiGenXingZhiXingKeShi(inpatientNo, patient.getAdmissTimes(), ledger, huoQuYaoPingZhongKeShiWeiKongDe);
+//        }
+        dao.xiuGaiKongDeZhiXingKeShi(inpatientNo, patient.getAdmissTimes(), ledger);
         if (yaoPingBianMaTongBu.size() > 0) {
             dao.genXinYaoPingPiPeiXinXi(yaoPingBianMaTongBu);
         }
@@ -658,7 +663,8 @@ public class XiangMuLuRuService {
                     len--;
                     i--;
                 } else {
-                    zy.setYiTuiFei(zy.getChargeFee().subtract(yuErPiPei.get(key).getYiTuiFei()));
+                    log.info("原本的费用:{},减去的费用:{}", zy.getChargeFee(), yuErPiPei.get(key).getYiTuiFei());
+                    zy.setYiTuiFei(yuErPiPei.get(key).getYiTuiFei());
                 }
             }
         }
@@ -693,8 +699,7 @@ public class XiangMuLuRuService {
         List<String> zhiXinKeShi = dao.chaXunZhiZXinKeShi(zyDetailCharge.getDeptCode());
 
         for (ZyDetailCharge detailCharge : zhenShuShuJu) {
-            zyDetailCharge.setYaoPing(false);
-            ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, zyDetailCharge, detailCharge);
+            ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, zyDetailCharge, detailCharge, false);
             if (LOGICAL_ERROR != null) return LOGICAL_ERROR;
             if (detailCharge.getTransFlagYb().equals("2")) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:{%d},已被正负抵消。", detailCharge.getDetailSn()));