Переглянути джерело

费用接收重算小于入院时间就加一分钟

DESKTOP-0GD05B0\Administrator 2 роки тому
батько
коміт
2b6c131253

+ 6 - 6
src/main/java/thyyxxk/webserver/dao/his/inpatient/PatientDao.java

@@ -298,22 +298,22 @@ public interface PatientDao {
             "</script>")
     void insertDisDiags(@Param("staffId") String staffId, @Param("list") List<ZyInYbDiag> list);
 
-    @Update("update zy_detail_charge set charge_date=#{admdate} where inpatient_no=#{zyh} " +
-            "and admiss_times=#{times} and charge_date<#{admdate}")
+    @Update("update zy_detail_charge set charge_date=#{newDate} where inpatient_no=#{zyh} " +
+            "and admiss_times=#{times} and CONVERT(varchar(20), charge_date, 20) <= #{admdate}")
     void correctFeeChargeTimeBeforeAdmiss(@Param("zyh") String zyh,
                                           @Param("times") int times,
-                                          @Param("admdate") Date admdate);
+                                          @Param("admdate") Date admdate,
+                                          @Param("newDate") Date newDate);
 
     @Select("select start_time from yz_act_order 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')")
     Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
 
-    @Update("update zy_detail_charge set charge_date=#{newDate} where inpatient_no=#{zyh} " +
+    @Update("update zy_detail_charge set charge_date=#{disdate} where inpatient_no=#{zyh} " +
             "and admiss_times=#{times} and charge_date>#{disdate}")
     void correctFeeChargeTimeAfterDismiss(@Param("zyh") String zyh,
                                           @Param("times") int times,
-                                          @Param("disdate") Date disdate,
-                                          @Param("newDate") Date newDate);
+                                          @Param("disdate") Date disdate);
 
     @Update("update zy_ledger_file set deposit=(select isnull(sum(depo_amount),0) from zy_deposit_file f with(nolock) " +
             "where f.inpatient_no=#{zyh} and f.admiss_times=#{times} and f.ledger_sn=#{ledger} and f.status in ('1','2') ) " +

+ 2 - 2
src/main/java/thyyxxk/webserver/service/inpatient/PatientService.java

@@ -349,11 +349,11 @@ public class PatientService {
         int times = p.getAdmissTimes();
         int infant = zyh.startsWith("$") ? 1 : 0;
         int ledger = p.getLedgerSn();
-        dao.correctFeeChargeTimeBeforeAdmiss(zyh, times, p.getAdmissDate());
+        dao.correctFeeChargeTimeBeforeAdmiss(zyh, times, p.getAdmissDate(), DateUtil.timePlusSecond(p.getAdmissDate(), 60));
         Date disdate = dao.selectActOrderDisDate(zyh, times);
         if (null != disdate) {
             // 如果费用发生时间小于入院时间那么就加一分钟。
-            dao.correctFeeChargeTimeAfterDismiss(zyh, times, disdate, DateUtil.timePlusSecond(disdate, 60));
+            dao.correctFeeChargeTimeAfterDismiss(zyh, times, disdate);
         }
         dao.recountDeposit(zyh, times, ledger);
         dao.zyReceiveDrug(zyh, times, infant);