Ver Fonte

出院结算费用计算时校验超标收费。

lighter há 3 anos atrás
pai
commit
81eb83a764

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>2</version>
+    <version>1</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

+ 9 - 0
src/main/java/thyyxxk/webserver/dao/his/yibao/DismissDao.java

@@ -407,4 +407,13 @@ public interface DismissDao {
             "and admiss_times=#{times} and ledger_sn>0 and isnull(charge_status,'1')!='1' ")
     String selectTotalCharge(@Param("patNo") String patNo,
                              @Param("times") int times);
+
+    @Select("select datediff(day,admiss_date,getdate()) from zy_actpatient where inpatient_no=#{patNo}")
+    int selectInhospdays(@Param("patNo") String patNo);
+
+    @Select("select b.bill_item_zy as code,sum(a.charge_amount) as name from zy_detail_charge a, zd_charge_item b " +
+            "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_status!='1' and " +
+            "b.bill_item_zy in ('003') and a.charge_code=b.code group by b.bill_item_zy")
+    List<PureCodeName> selectChargeQuantities(@Param("patNo") String patNo,
+                                              @Param("times") int times);
 }

+ 15 - 6
src/main/java/thyyxxk/webserver/service/yibao/DismissService.java

@@ -61,7 +61,7 @@ public class DismissService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取帐页数失败。");
         }
         dao.acceptFeeStepOne(patNo, times);
-        if(dao.acceptFeeStepTwo(patNo, times) < 0) {
+        if (dao.acceptFeeStepTwo(patNo, times) < 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "接收费用失败。");
         }
         if (dao.getOrderList(patNo, times) < 0) {
@@ -183,7 +183,7 @@ public class DismissService {
             throw new BizException(exception);
         }
         dao.recountDeposit(patNo, times, ledgerSn);
-        Date begntime = getBegntime(patNo,times,"zy_actpatient");
+        Date begntime = getBegntime(patNo, times, "zy_actpatient");
         dismissFeeAnalyse(patNo, times, ledgerSn, begntime, tmpendtime);
 
         if (dao.getFeeOffset(patNo, times, ledgerSn, begntime, tmpendtime) != 0) {
@@ -191,6 +191,19 @@ public class DismissService {
             exception.setMessage("此患者明细费用与账页费用不一致。");
             throw new BizException(exception);
         }
+
+        int inhospdays = dao.selectInhospdays(patNo);
+        List<PureCodeName> charges = dao.selectChargeQuantities(patNo, times);
+        for (PureCodeName item : charges) {
+            if (item.getCode().equals("003")) {
+                if (DecimalUtil.compare(item.getName(), String.valueOf(inhospdays)) > 0) {
+                    ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
+                    exception.setMessage("此患者床位费收取超标。");
+                    throw new BizException(exception);
+                }
+            }
+        }
+
         dao.deleteTemporaryTable(patNo, times);
         PureCodeName medinfo = dao.selectMdtrtId(patNo, times, ledgerSn);
         if (null == medinfo) {
@@ -314,7 +327,6 @@ public class DismissService {
         Map<String, String> ledgerMap = initReceiptMap();
         Map<String, String> infantMap = initReceiptMap();
         Map<String, String> adultMap = initReceiptMap();
-
         List<ReceiptFee> ledgerFees = dao.selectLedgerFees(patNo, times, ledgerSn, begntime, endtime);
         if (null == ledgerFees) {
             ledgerFees = new ArrayList<>();
@@ -340,14 +352,11 @@ public class DismissService {
                 restype = "al";
             }
         }
-
         String deposit = dao.selectDepositSumamt(patNo, times, ledgerSn);
         if (StringUtil.isBlank(deposit)) {
             deposit = "0";
         }
-
         String balance = DecimalUtil.minus(deposit, ledgerMap.get("total"));
-
         dao.updateZyLedgerFileCharges(patNo, times, ledgerSn, deposit, balance, restype, ledgerMap);
         ReceiptEntity entity = new ReceiptEntity();
         if (DecimalUtil.compare(infantMap.get("total"), "0") == 1) {