Browse Source

出院时不删除已打印的发票

lighter 1 year ago
parent
commit
57226539b8

+ 4 - 5
src/main/java/thyyxxk/webserver/dao/his/inpatient/DismissDao.java

@@ -162,11 +162,10 @@ public interface DismissDao {
                                 @Param("times") Integer times,
                                 @Param("ledgerSn") int ledgerSn);
 
-    @Delete("delete from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
-    void deleteZyReceipt(@Param("patNo") String patNo,
-                         @Param("times") int times,
-                         @Param("ledgerSn") int ledgerSn);
-
+    @Select("select count(1) from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
+    int selectReceiptCount(@Param("patNo") String patNo,
+                           @Param("times") int times,
+                           @Param("ledgerSn") int ledgerSn);
 
     @Insert("insert into zy_receipt (inpatient_no,admiss_times,ledger_sn,receipt_sn,receipt_no," +
             "account_date,date_1,date_2,ward,dept,print_date,responce_unit,op_id_code,total_charge," +

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -264,7 +264,8 @@ public interface SiZyDao {
                               @Param("times") int times,
                               @Param("ledgerSn") int ledgerSn);
 
-    @Delete("delete from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
+    @Delete("delete from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} " +
+            "and ledger_sn=#{ledgerSn} and receipt_no='00000000'")
     void deleteZyReceipt(@Param("patNo") String patNo,
                          @Param("times") int times,
                          @Param("ledgerSn") int ledgerSn);

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

@@ -314,6 +314,12 @@ public class DismissService {
             }
         }
 
+        if (dao.selectReceiptCount(patNo, times, ledgerSn) > 0) {
+            ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
+            exception.setMessage("此患者有未冲销的发票,请联系财务进行冲销。");
+            throw new BizException(exception);
+        }
+
         dao.deleteTemporaryTable(patNo, times);
         BriefMdtrtInfo medinfo = dao.selectMdtrtId(patNo, times, ledgerSn);
         if (null == medinfo) {
@@ -425,7 +431,6 @@ public class DismissService {
                 indata.getLedgerSn()) < 1) {
             return -1;
         }
-        dao.deleteZyReceipt(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getLedgerSn());
         Date admissDate = getBegntime(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getLedgerSn(), indata.getTable());
         Date dismissDate = getEndtime(indata.getMidSetl(), indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getZjdzDatetime());