浏览代码

门诊结算由医保科做。

lighter 3 年之前
父节点
当前提交
1dd5f09d18

+ 2 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/SiMzFeeOprnSystmApplication.java

@@ -2,7 +2,9 @@ package thyyxxk.simzfeeoprnsystm;
 
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 
+@EnableScheduling
 @SpringBootApplication
 @SpringBootApplication
 public class SiMzFeeOprnSystmApplication {
 public class SiMzFeeOprnSystmApplication {
 
 

+ 13 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/dao/ScheduledDao.java

@@ -0,0 +1,13 @@
+package thyyxxk.simzfeeoprnsystm.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.simzfeeoprnsystm.pojo.SiSetlinfo;
+
+import java.util.List;
+
+@Mapper
+public interface ScheduledDao {
+    @Select("select * from t_si_setlinfo where setl_type=11 and mz_saved=0 and revoked=0 and datediff(day, endtime, getdate())<3")
+    List<SiSetlinfo> selectSetlinfos();
+}

+ 1 - 1
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiMzDao.java

@@ -110,7 +110,7 @@ public interface SiMzDao {
             "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
             "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
     Setlmt selectSetlmt(@Param("patNo") String patNo, @Param("times") int times);
     Setlmt selectSetlmt(@Param("patNo") String patNo, @Param("times") int times);
 
 
-    @Update("update t_si_setlinfo set revoked=1 where pat_no=#{patNo} and times=#{times}")
+    @Update("update t_si_setlinfo set revoked=1,mz_saved=0 where pat_no=#{patNo} and times=#{times}")
     void deleteSetlInfo(@Param("patNo") String patNo, @Param("times") int times);
     void deleteSetlInfo(@Param("patNo") String patNo, @Param("times") int times);
 
 
     @Update("delete from t_si_setldetail where pat_no=#{patNo} and times=#{times}")
     @Update("delete from t_si_setldetail where pat_no=#{patNo} and times=#{times}")

+ 5 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/SiSetlinfo.java

@@ -267,6 +267,11 @@ public class SiSetlinfo implements Serializable {
 	 * */
 	 * */
 	private Date endtime;
 	private Date endtime;
 
 
+	/**
+	 * HIS是否已入库;0-否,1-是
+	 * */
+	private Integer mzSaved;
+
 	@TableField(exist = false)
 	@TableField(exist = false)
 	private String gendName;
 	private String gendName;
 	@TableField(exist = false)
 	@TableField(exist = false)

+ 30 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/scheduled/ScheduledTask.java

@@ -0,0 +1,30 @@
+package thyyxxk.simzfeeoprnsystm.scheduled;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import thyyxxk.simzfeeoprnsystm.dao.ScheduledDao;
+import thyyxxk.simzfeeoprnsystm.pojo.SiSetlinfo;
+import thyyxxk.simzfeeoprnsystm.service.SiMzFeeService;
+
+import java.util.List;
+
+@Component
+public class ScheduledTask {
+    private final SiMzFeeService service;
+    private final ScheduledDao dao;
+
+    @Autowired
+    public ScheduledTask(SiMzFeeService service, ScheduledDao dao) {
+        this.service = service;
+        this.dao = dao;
+    }
+
+    @Scheduled(cron = "0 0 2 * * ?")
+    public void cancelSettlement() {
+        List<SiSetlinfo> list = dao.selectSetlinfos();
+        if (null != list && !list.isEmpty()) {
+            list.forEach(service::revokeOutpatientSettlementForTask);
+        }
+    }
+}

+ 25 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -347,6 +347,7 @@ public class SiMzFeeService {
             setlEntity.setInsuplcAdmdvs(setlmt.getInsuplcAdmdvs());
             setlEntity.setInsuplcAdmdvs(setlmt.getInsuplcAdmdvs());
             setlEntity.setBegntime(mzDao.selectBegntime(p.getPatNo(), p.getTimes()));
             setlEntity.setBegntime(mzDao.selectBegntime(p.getPatNo(), p.getTimes()));
             setlEntity.setEndtime(setlEntity.getSetlTime());
             setlEntity.setEndtime(setlEntity.getSetlTime());
+            setlEntity.setMzSaved(0);
             setlinfoDao.insert(setlEntity);
             setlinfoDao.insert(setlEntity);
             setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
             setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
                     setlEntity.getMedinsSetlId(), input.getString("msgid"));
                     setlEntity.getMedinsSetlId(), input.getString("msgid"));
@@ -401,4 +402,28 @@ public class SiMzFeeService {
         }
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
     }
+
+    public void revokeOutpatientSettlementForTask(SiSetlinfo setlinfo) {
+        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
+                mzDao.selectAdmdvs(setlinfo.getPatNo(), setlinfo.getTimes(), setlinfo.getLedgerSn()), "99999");
+        JSONObject data = new JSONObject();
+        data.put("setl_id", setlinfo.getSetlId());
+        data.put("mdtrt_id", setlinfo.getMdtrtId());
+        data.put("psn_no", setlinfo.getPsnNo());
+        input.getJSONObject("input").put("data", data);
+        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
+        Integer infcode = result.getInteger(RESULT_CODE);
+        logDao.insert(new SiLog(input, result, setlinfo.getPatNo(), setlinfo.getTimes(), infcode));
+        if (null != infcode && infcode == 0) {
+            mzDao.deleteSetlInfo(setlinfo.getPatNo(), setlinfo.getTimes());
+            mzDao.deleteSetlDetail(setlinfo.getPatNo(), setlinfo.getTimes());
+            mzDao.updateRvkSetlMsgid(setlinfo.getPatNo(), setlinfo.getTimes(), input.getString("msgid"));
+            MzPatientInfo mzPatientInfo = new MzPatientInfo();
+            mzPatientInfo.setPatNo(setlinfo.getPatNo());
+            mzPatientInfo.setTimes(setlinfo.getTimes());
+            mzPatientInfo.setStaffId("99999");
+            revokeOutpatientFeeDetails(mzPatientInfo);
+            revokeOutpatientRegistration(mzPatientInfo);
+        }
+    }
 }
 }