فهرست منبع

门诊统筹结算撤销任务,如果已缴费,update mz_saved=1

lighter 3 سال پیش
والد
کامیت
f67dbddd3e

+ 10 - 4
src/main/java/thyyxxk/simzfeeoprnsystm/dao/ScheduledDao.java

@@ -2,15 +2,21 @@ package thyyxxk.simzfeeoprnsystm.dao;
 
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import thyyxxk.simzfeeoprnsystm.pojo.SiSetlinfo;
 
 import java.util.List;
 
 @Mapper
 public interface ScheduledDao {
-    @Select("select a.pat_no,a.times,a.ledger_sn,a.setl_id,a.mdtrt_id,a.psn_no from " +
-            "t_si_setlinfo a,mz_deposit_file b where a.setl_type=11 and a.mz_saved=0 " +
-            "and a.revoked=0 and b.pay_mark!=0 and a.pat_no=b.patient_id and a.times=b.times " +
-            "and datediff(hour, a.setl_time, getdate()) between 13 and 72")
+    @Select("select pat_no,times,ledger_sn,setl_id,mdtrt_id,psn_no from t_si_setlinfo where setl_type=11 " +
+            "and mz_saved=0 and revoked=0 and datediff(hour, endtime, getdate()) between 12 and 72 ")
     List<SiSetlinfo> selectSetlinfos();
+
+    @Select("select count(1) from mz_deposit_file WITH(NOLOCK) where " +
+            "patient_id=#{patNo} and times=#{times} and pay_mark=0")
+    int alreadyPayed(String patNo, int times);
+
+    @Update("update t_si_setlinfo set mz_saved=1 where setl_id=#{setlId}")
+    void updateMzSaved(String setlId);
 }

+ 7 - 2
src/main/java/thyyxxk/simzfeeoprnsystm/scheduled/ScheduledTask.java

@@ -25,8 +25,13 @@ public class ScheduledTask {
     public void cancelSettlement() throws Exception {
         List<SiSetlinfo> list = dao.selectSetlinfos();
         for (SiSetlinfo setlinfo : list) {
-            service.revokeOutpatientSettlementForTask(setlinfo);
-            TimeUnit.SECONDS.sleep(2);
+            int payedCount = dao.alreadyPayed(setlinfo.getPatNo(), setlinfo.getTimes());
+            if (payedCount > 0) {
+                dao.updateMzSaved(setlinfo.getSetlId());
+            } else {
+                service.revokeOutpatientSettlementForTask(setlinfo);
+            }
+            TimeUnit.MILLISECONDS.sleep(1500);
         }
     }
 }