Ver Fonte

中间断账优化

lighter há 4 meses atrás
pai
commit
7e229cc73f

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

@@ -308,9 +308,9 @@ public interface DismissDao {
                                   @Param("ledgerSn") Integer ledgerSn);
                                   @Param("ledgerSn") Integer ledgerSn);
 
 
     @Insert("insert into zy_deposit_file (inpatient_no, admiss_times, depo_times, depo_date, op_id_code, " +
     @Insert("insert into zy_deposit_file (inpatient_no, admiss_times, depo_times, depo_date, op_id_code, " +
-            "depo_amount, depo_type, status, ledger_sn, window_no, deleted) " +
+            "depo_amount, depo_type, status, ledger_sn, window_no, receipt_no, deleted) " +
             "values (#{inpatientNo},#{admissTimes},#{depoTimes},#{depoDate},#{opIdCode},#{depoAmount}, " +
             "values (#{inpatientNo},#{admissTimes},#{depoTimes},#{depoDate},#{opIdCode},#{depoAmount}, " +
-            "#{depoType},#{status},#{ledgerSn},#{windowNo},#{deleted})")
+            "#{depoType},#{status},#{ledgerSn},#{windowNo},#{receiptNo},#{deleted})")
     void insertNewDeposit(DepositFile depositFile);
     void insertNewDeposit(DepositFile depositFile);
 
 
     @Delete("delete from zy_deposit_file where inpatient_no=#{patNo} and admiss_times=#{times} and depo_type='B' ")
     @Delete("delete from zy_deposit_file where inpatient_no=#{patNo} and admiss_times=#{times} and depo_type='B' ")

+ 11 - 14
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSettleApplyDao.java

@@ -12,30 +12,27 @@ import java.util.List;
  */
  */
 @Mapper
 @Mapper
 public interface SiSettleApplyDao {
 public interface SiSettleApplyDao {
+    
+    @Select("select isnull(total_charge,0) from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
+    int selectTotalCharge(String patNo, int times, int ledgerSn);
+    
     @Select("select mdtrt_id from t_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
     @Select("select mdtrt_id from t_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
-    String selectMdtrtId(@Param("patNo") String patNo,
-                         @Param("times") int times,
-                         @Param("ledger") int ledger);
+    String selectMdtrtId(String patNo, int times, int ledger);
 
 
     @Select("select gend from t_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
     @Select("select gend from t_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
-    String selectYbGender(@Param("patNo") String patNo,
-                         @Param("times") int times,
-                         @Param("ledger") int ledger);
+    String selectYbGender(String patNo, int times, int ledger);
 
 
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
             "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
             "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
-    Date selectActOrderDisDate(@Param("table") String table, @Param("patNo") String patNo, @Param("times") Integer times);
+    Date selectActOrderDisDate(String table, String patNo, Integer times);
 
 
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
             "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
             "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
-    List<Date> selectActOrderDisDate2(@Param("table") String table, @Param("patNo") String patNo, @Param("times") Integer times);
+    List<Date> selectActOrderDisDate2(String table, String patNo, Integer times);
 
 
     @Select("select top 1 status,handle_comment,type,settle_datetime,acct_used_flag,death_flag,sort_no from t_si_settle_apply " +
     @Select("select top 1 status,handle_comment,type,settle_datetime,acct_used_flag,death_flag,sort_no from t_si_settle_apply " +
             "where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger} and type=#{type} order by sort_no desc")
             "where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger} and type=#{type} order by sort_no desc")
-    SiSettleApply selectSettleApply(@Param("patNo") String patNo,
-                                    @Param("times") int times,
-                                    @Param("ledger") int ledger,
-                                    @Param("type") int type);
+    SiSettleApply selectSettleApply(String patNo, int times, int ledger, int type);
 
 
     @Insert("insert into t_si_settle_apply " +
     @Insert("insert into t_si_settle_apply " +
             "(pat_no,times,ledger_sn,input_staff,input_comment,input_datetime,status,type," +
             "(pat_no,times,ledger_sn,input_staff,input_comment,input_datetime,status,type," +
@@ -75,8 +72,8 @@ public interface SiSettleApplyDao {
     SiSettleApply selectTotalChargeAgain(SiSettleApply apply);
     SiSettleApply selectTotalChargeAgain(SiSettleApply apply);
 
 
     @Select("select zyh,zycs,ssxh,ssbm,ssmc,ssrq,ssys,sszs1,sszs2,mzys from batj_ba4 where zyh=#{patNo} and zycs=#{times} order by ssxh")
     @Select("select zyh,zycs,ssxh,ssbm,ssmc,ssrq,ssys,sszs1,sszs2,mzys from batj_ba4 where zyh=#{patNo} and zycs=#{times} order by ssxh")
-    List<ZyDisYbSrgry> selectSurgeries(@Param("patNo") String patNo,
-                                       @Param("times") int times);
+    List<ZyDisYbSrgry> selectSurgeries(String patNo,
+                                       int times);
 
 
     @Update("update t_si_settle_apply set status=#{status},handle_staff=#{handleStaff}, " +
     @Update("update t_si_settle_apply set status=#{status},handle_staff=#{handleStaff}, " +
             "handle_comment=#{handleComment},handle_datetime=getdate() where pat_no=#{patNo} " +
             "handle_comment=#{handleComment},handle_datetime=getdate() where pat_no=#{patNo} " +

+ 3 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/dismiss/DepositFile.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.entity.inpatient.dismiss;
 package thyyxxk.webserver.entity.inpatient.dismiss;
 
 
 import lombok.Data;
 import lombok.Data;
+import thyyxxk.webserver.utils.SnowFlakeId;
 
 
 import java.util.Date;
 import java.util.Date;
 
 
@@ -16,6 +17,7 @@ public class DepositFile {
     private String depoType;
     private String depoType;
     private String status;
     private String status;
     private String windowNo;
     private String windowNo;
+    private String receiptNo;
     private Integer deleted;
     private Integer deleted;
 
 
     public DepositFile() {
     public DepositFile() {
@@ -34,6 +36,7 @@ public class DepositFile {
         this.depoType = "B";
         this.depoType = "B";
         this.status = "1";
         this.status = "1";
         this.windowNo = "1";
         this.windowNo = "1";
+        this.receiptNo = SnowFlakeId.instance().nextId();
         this.deleted = 0;
         this.deleted = 0;
     }
     }
 }
 }

+ 7 - 4
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiSettleApplyService.java

@@ -52,16 +52,19 @@ public class SiSettleApplyService {
 
 
     
     
     public ResultVo<SiSettleApply> selectSettleApply(Patient p) {
     public ResultVo<SiSettleApply> selectSettleApply(Patient p) {
+        int type = p.getMidSetl() ? MIDDLE_SETTLE : REAL_SETTLE;
+        if (type == MIDDLE_SETTLE) {
+            int totalCost = dao.selectTotalCharge(p.getPatNo(), p.getAdmissTimes(), p.getLedgerSn());
+            if (totalCost <= 0) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者总费用为0,不能进行中间断账。");
+            }
+        }
         String mdtrtId = dao.selectMdtrtId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
         String mdtrtId = dao.selectMdtrtId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
         if (StringUtil.isBlank(mdtrtId) || p.getInpatientNo().startsWith("JT")) {
         if (StringUtil.isBlank(mdtrtId) || p.getInpatientNo().startsWith("JT")) {
             SiSettleApply apply = new SiSettleApply();
             SiSettleApply apply = new SiSettleApply();
             apply.setStatus(APPROVED);
             apply.setStatus(APPROVED);
             return ResultVoUtil.success(apply);
             return ResultVoUtil.success(apply);
         }
         }
-        if (null == p.getMidSetl()) {
-            p.setMidSetl(false);
-        }
-        int type = p.getMidSetl() ? MIDDLE_SETTLE : REAL_SETTLE;
         Date disdate = null;
         Date disdate = null;
         if (type == REAL_SETTLE) {
         if (type == REAL_SETTLE) {
             List<Date> tempList = dao.selectActOrderDisDate2("yz_act_order", p.getInpatientNo(), p.getAdmissTimes());
             List<Date> tempList = dao.selectActOrderDisDate2("yz_act_order", p.getInpatientNo(), p.getAdmissTimes());

+ 1 - 1
src/main/resources/application-dev.yml

@@ -14,7 +14,7 @@ spring:
     cache: false
     cache: false
   datasource:
   datasource:
     dynamic:
     dynamic:
-      primary: his
+      primary: demo
       strict: false
       strict: false
       datasource:
       datasource:
         his:
         his: