Browse Source

出院费用计算有未处理的药单时返回药房和药单号

lighter 2 years ago
parent
commit
1278568ecd

+ 1 - 0
src/main/java/thyyxxk/webserver/config/exception/ExceptionEnum.java

@@ -19,6 +19,7 @@ public enum ExceptionEnum {
     NULL_POINTER(1002, "有不合法的空值存在!"),
     NETWORK_ERROR(1003, "网络异常!"),
     EXIST_NEGATIVE_FEES(1004, "此患者费用清单存在负数。"),
+    EXIST_UNHANDLED_DRUG_ORDER(1104, "此患者有未处理的药单,请联系药房处理。"),
     NO_DATA_EXIST(1005, "没有查询到符合条件的数据。"),
     ABNORMAL_YZ_ACT_ORDER(1006, "此患者存在异常状态医嘱。"),
     INVALID_PARAM(1007, "参数异常,请检查。"),

+ 2 - 2
src/main/java/thyyxxk/webserver/controller/inpatient/DismissController.java

@@ -50,7 +50,7 @@ public class DismissController {
     }
 
     @PostMapping("/dismissCalculate")
-    public ResultVo<List<NegativeFee>> calculate(@RequestBody Patient param) {
+    public ResultVo<List<IllegalFee>> calculate(@RequestBody Patient param) {
         param.setStaffId(TokenUtil.getTokenUserId());
         return service.calculateForDismiss(param);
     }
@@ -63,7 +63,7 @@ public class DismissController {
 
     @PassToken
     @PostMapping("/verification")
-    public ResultVo<List<NegativeFee>> verification(@Validated @RequestBody HrgDismissParam param) {
+    public ResultVo<List<IllegalFee>> verification(@Validated @RequestBody HrgDismissParam param) {
         if (param.getDismissFlag() == 2 && null == param.getZjdzDatetime()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "中间断账时,断账时间不能为空。");
         }

+ 9 - 10
src/main/java/thyyxxk/webserver/dao/his/inpatient/DismissDao.java

@@ -68,17 +68,16 @@ public interface DismissDao {
                           @Param("times") Integer times,
                           @Param("actOrderDisDate") Date actOrderDisDate);
 
-    @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
-            "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
-            "drug_class <> 'd' ) ) and status_flag='1' and page_no=0")
+    @Select("select count(1) from yz_yp_zy_order with(nolock) where inpatient_no=#{patNo} " +
+            "and admiss_times=#{times} and (amount>0 or (amount<0 and drug_class!='d')) " +
+            "and status_flag='1' and page_no=0")
     int hasUnSubmitDrugList(@Param("patNo") String patNo, @Param("times") Integer times);
 
-    @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
-            "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
-            "drug_class <> 'd' ) ) and status_flag='1' and ( case when amount > 0 then " +
-            "page_no else page_no_ty end > 0 ) ")
-    int hasUntreatedDrugWithdrawalOrder(@Param("patNo") String patNo,
-                                        @Param("times") Integer times);
+    @Select("select b.group_name,pageNo=cast(a.page_no as decimal),a.page_no_ty " +
+            "from yz_yp_zy_order a with(nolock),yp_zd_group_name b with(nolock) where a.inpatient_no=#{patNo} " +
+            "and a.admiss_times=#{times} and (a.amount>0 or (a.amount<0 and a.drug_class!='d')) and " +
+            "(case when a.amount>0 then a.page_no else a.page_no_ty end>0) and a.group_no=b.group_no and a.status_flag='1'")
+    List<IllegalFee> hasUntreatedDrugOrder(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Select("SELECT count(1) FROM yz_zy_patient_fee WHERE inpatient_no=#{patNo} " +
             "AND admiss_times=#{times} and charge_date<=#{actOrderDisDate} AND " +
@@ -93,7 +92,7 @@ public interface DismissDao {
             "sum(a.charge_fee) as code,a.charge_code_mx as chargeCode,b.name from zy_detail_charge a,yp_zd_dict b " +
             "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_code_mx=b.code " +
             "group by a.charge_code_mx,b.name ) as x where x.code<0")
-    List<NegativeFee> feeOrderNegative(@Param("patNo") String patNo, @Param("times") Integer times);
+    List<IllegalFee> feeOrderNegative(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Delete("delete zy_tmp_settle_select_detail where inpatient_no=#{patNo} and admiss_times=#{times}")
     void deleteTemporaryTable(@Param("patNo") String patNo, @Param("times") Integer times);

+ 7 - 1
src/main/java/thyyxxk/webserver/entity/inpatient/dismiss/NegativeFee.java → src/main/java/thyyxxk/webserver/entity/inpatient/dismiss/IllegalFee.java

@@ -8,8 +8,14 @@ import lombok.Data;
  * @create: 2021-06-15 08:51:04
  **/
 @Data
-public class NegativeFee {
+public class IllegalFee {
+    // 负数的药品
     private String code;
     private String chargeCode;
     private String name;
+
+    // 未处理的药单
+    private String groupName;
+    private String pageNo;
+    private String pageNoTy;
 }

+ 6 - 7
src/main/java/thyyxxk/webserver/service/inpatient/DismissService.java

@@ -50,7 +50,7 @@ public class DismissService {
         if (!actOrders.getData().isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.ABNORMAL_YZ_ACT_ORDER, actOrders.getData());
         }
-        ResultVo<List<NegativeFee>> calculate = calculateForDismiss(param);
+        ResultVo<List<IllegalFee>> calculate = calculateForDismiss(param);
         if (calculate.getCode() == ExceptionEnum.EXIST_NEGATIVE_FEES.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES, calculate.getData());
         }
@@ -103,7 +103,7 @@ public class DismissService {
         return ResultVoUtil.success(list);
     }
 
-    public ResultVo<List<NegativeFee>> calculateForDismiss(Patient param) {
+    public ResultVo<List<IllegalFee>> calculateForDismiss(Patient param) {
         final String patNo = param.getInpatientNo();
         final Integer times = param.getAdmissTimes();
         if (!param.getMidSetl()) {
@@ -207,17 +207,16 @@ public class DismissService {
             exception.setMessage("此患者有未提交的药单。");
             throw new BizException(exception);
         }
-        if (dao.hasUntreatedDrugWithdrawalOrder(patNo, times) > 0) {
-            ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
-            exception.setMessage("此患者有未处理的药单,请联系药房处理。");
-            throw new BizException(exception);
+        List<IllegalFee> unhandledList = dao.hasUntreatedDrugOrder(patNo, times);
+        if (unhandledList.size() > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.EXIST_UNHANDLED_DRUG_ORDER, unhandledList);
         }
         if (dao.hasUnconfirmedMedicalTech(patNo, times, tmpendtime) > 0) {
             ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
             exception.setMessage("此患者有未确认的医技。");
             throw new BizException(exception);
         }
-        List<NegativeFee> feeNegativeList = dao.feeOrderNegative(patNo, times);
+        List<IllegalFee> feeNegativeList = dao.feeOrderNegative(patNo, times);
         if (feeNegativeList.size() > 0) {
             return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES, feeNegativeList);
         }