Browse Source

优化出院结算时出院医嘱的获取

lighter 4 years ago
parent
commit
7ab7dea2ae

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

@@ -147,11 +147,11 @@ public interface DismissDao {
 
     @Select("select count(1) from yz_act_order where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} " +
             "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
-    int countDisActOrders(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
+    Integer countDisActOrders(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
 
     @Select("select count(1) from yz_inact_order where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} " +
             "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
-    int countDisActOrders2(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
+    Integer countDisActOrders2(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
 
     @Select("select (select total_fee=sum ( charge_fee ) from zy_detail_charge where " +
             "inpatient_no=#{inpatientNo} AND admiss_times=#{admissTimes} AND ledger_sn=#{ledgerSn} and isnull " +

+ 13 - 11
src/main/java/thyyxxk/webserver/service/yibao/DismissService.java

@@ -105,11 +105,12 @@ public class DismissService {
         final String inpatientNo = param.getInpatientNo();
         final Integer admissTimes = param.getAdmissTimes();
         if (param.getDismissFlag() == 1) {
-            int disActOrderCount;
-            if ("zy_actpatient".equals(param.getTable())) {
-                disActOrderCount = dao.countDisActOrders(inpatientNo, admissTimes);
-            } else {
+            Integer disActOrderCount = dao.countDisActOrders(inpatientNo, admissTimes);
+            if (null == disActOrderCount || disActOrderCount == 0) {
                 disActOrderCount = dao.countDisActOrders2(inpatientNo, admissTimes);
+                if (null == disActOrderCount) {
+                    disActOrderCount = 0;
+                }
             }
             if (disActOrderCount < 1) {
                 ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
@@ -127,7 +128,7 @@ public class DismissService {
             exception.setMessage("没有找到入院时间,请重新获取病人信息。");
             throw new BizException(exception);
         }
-        Date actOrderDisDate = getDismissDate(param.getTable(), param.getDismissFlag(), inpatientNo, admissTimes, param.getZjdzDatetime());
+        Date actOrderDisDate = getDismissDate(param.getDismissFlag(), inpatientNo, admissTimes, param.getZjdzDatetime());
         final int ledgerSn = dao.getLedgerSn(inpatientNo, admissTimes);
         if (dao.hasUnsettledStepOne(inpatientNo, admissTimes, ledgerSn) < 0) {
             ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
@@ -352,8 +353,9 @@ public class DismissService {
         }
         final int infantFlag = dao.selectInfantFlag(indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getLedgerSn()); // =0 无婴儿,>0 有婴儿
-        final Date dismissDate = getDismissDate(indata.getTable(), indata.getFlag(), indata.getInpatientNo(), indata.getAdmissTimes(),
+        final Date dismissDate = getDismissDate(indata.getFlag(), indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getZjdzDatetime());
+
         final Integer transFlag = indata.getFlag() == 1 ? 0 : 2;
         final Date admissDate = dao.selectAdmissDate(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getTable());
         final List<ReceiptFee> fees = dao.calculateCost(indata.getInpatientNo(), indata.getAdmissTimes(),
@@ -403,15 +405,15 @@ public class DismissService {
         return totalCharge;
     }
 
-    private Date getDismissDate(String table, Integer flag, String inpatientNo, Integer admissTimes, Date zjdzDate) {
+    private Date getDismissDate(Integer flag, String inpatientNo, Integer admissTimes, Date zjdzDate) {
         if (flag == 2) {
             return zjdzDate;
         }
-        if ("zy_actpatient".equals(table)) {
-            return dao.selectActOrderDisDate(inpatientNo, admissTimes);
-        } else {
-            return dao.selectActOrderDisDate2(inpatientNo, admissTimes);
+        Date disdate = dao.selectActOrderDisDate(inpatientNo, admissTimes);
+        if (null == disdate) {
+            disdate = dao.selectActOrderDisDate2(inpatientNo, admissTimes);;
         }
+        return disdate;
     }
 
     private int updateCostStatusToSettled(YbSettleFee param) {