Преглед на файлове

Merge remote-tracking branch 'origin/master'

lenovodn преди 1 година
родител
ревизия
0ee6ae348b

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/Constant.java

@@ -106,6 +106,11 @@ public class Constant {
      */
     public static final String LOCAL_MYSQL = "local_mysql";
 
+    /**
+     * 妇幼oracle数据库
+     */
+    public static final String FY_ORACLE = "fyoracle";
+
     /**
      * 管理统计类规则定时执行,并统计数据
      */

+ 62 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/afterwaring/XCFYDataTransferService.java

@@ -0,0 +1,62 @@
+package org.jeecg.modules.medical.afterwaring;
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.dynamic.db.DynamicDBUtil;
+import org.jeecg.modules.medical.Constant;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+@DependsOn("redisTemplate")
+public class XCFYDataTransferService {
+
+    @Autowired
+    RedisTemplate redisTemplate;
+
+
+    public void transferDataList(String querySql, String insertSql, Map<String, Object> paramMap, TransferDataCallFunction transferDataCallFunction) {
+        NamedParameterJdbcTemplate namedParameterJdbcTemplate = DynamicDBUtil.getNamedParameterJdbcTemplate(Constant.FY_ORACLE);
+        NamedParameterJdbcTemplate localNamedParameterJdbcTemplate = DynamicDBUtil.getNamedParameterJdbcTemplate(Constant.LOCAL_MYSQL);
+//        String whereSql = "";
+//        Date visitTime = null;
+//        Map<String,Object> paramMap = new HashMap<>();
+//        if(null != visitTime){
+//            whereSql = "where VISIT_TIME>:VISIT_TIME";
+//            paramMap.put("VISIT_TIME", visitTime);
+//        }
+//        String sql = "select * from v_master_admission_bill %s order by VISIT_TIME asc limit 1000";
+//        sql = String.format(sql, whereSql);
+        List<Map<String, Object>> dataList = namedParameterJdbcTemplate.queryForList(querySql, paramMap);
+        if (CollectionUtil.isEmpty(dataList)) {
+            log.error("querySql:{} paramMap:{} 未查询到数据,返回", querySql, paramMap);
+            return;
+        }
+        log.info("querySql:{} paramMap:{} 查询到数据条数:{}", querySql, paramMap, dataList.size());
+
+        List<MapSqlParameterSource> batchArgs = new ArrayList<>();
+        for (Map<String, Object> dataMap : dataList) {
+            try {
+                transferDataCallFunction.transferData(dataMap);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+            }
+            MapSqlParameterSource parameters = new MapSqlParameterSource(dataMap);
+            batchArgs.add(parameters);
+        }
+//        String insertSql = "insert into master_admission_bill() values()";
+        localNamedParameterJdbcTemplate.batchUpdate(insertSql, batchArgs.toArray(new MapSqlParameterSource[batchArgs.size()]));
+    }
+
+
+}

+ 48 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/AfterWaringLogTestJob.java

@@ -1,12 +1,15 @@
 package org.jeecg.modules.medical.job;
 
 import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.medical.Constant;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
 import org.jeecg.modules.medical.entity.AfterIncidentDetailLog;
 import org.jeecg.modules.medical.entity.AfterIncidentLog;
 import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
 import org.jeecg.modules.medical.entity.MasterAdmissionBill;
 import org.jeecg.modules.medical.ruleengine.RuleEngine;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
 import org.jeecg.modules.medical.service.IAfterIncidentDetailLogService;
 import org.jeecg.modules.medical.service.IAfterIncidentLogService;
 import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
@@ -23,11 +26,15 @@ import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 事后监管任务生成
  */
+@Slf4j
 @Component
 public class AfterWaringLogTestJob{
     @Autowired
@@ -45,6 +52,11 @@ public class AfterWaringLogTestJob{
     @Autowired
     ISysUserService sysUserService;
 
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+//    @Autowired
+//    IMasterAdmissionBillService masterAdmissionBillService;
+
 
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().isNull(MasterAdmissionBill::getState).last(" limit 1000").list();
@@ -110,4 +122,40 @@ public class AfterWaringLogTestJob{
     }
 
 
+
+
+    public void testMasterAdmBill() {
+        log.info("开始同步master_admission_bill数据");
+        String whereSql = "";
+        Date visitTime = getLastVisitDate();
+        log.info("开始同步master_admission_bill数据,获取上个同步记录访问日期:{}", visitTime);
+        Map<String,Object> paramMap = new HashMap<>();
+        if(null != visitTime){
+            whereSql = "where VISIT_TIME>:VISIT_TIME and rownum<1000";
+            paramMap.put("VISIT_TIME", visitTime);
+        }
+        String sql = "select * from master_admission_bill %s order by VISIT_TIME asc";
+        sql = String.format(sql, whereSql);
+        String insertSql = "INSERT INTO master_admission_bill (id, bridge_id, hisid, zyh, recipe_no, pay_method, benefit_type, hospital_id, hospital_name, p_level_yy, refund_flag, p_level, bmi_area_id, bmi_area_name, bill_date, refund_date, admission_dept_id, admission_dept_name, adm_bed, transfer_dept_id, transfer_dept_name, discharge_dept_id, discharge_dept_name, dscg_bed, doctor_id, doctor_name, patient_id, patient_name, patient_gender, patient_birthday, patient_age, patient_age_days, claim_type, visit_time, if_local_flag, admission_date, discharge_date, zyts, discharge_status, pre_admission_date, days_re_admission_31, yb_admission_disease_id, yb_admission_disease_name, yb_discharge_disease_id_main, yb_discharge_disease_name_main, admission_disease_id, admission_disease_name, discharge_disease_id_main, discharge_disease_name_main, yb_pay_type, drgs_code, drgs_name, medfee_sumamt, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, act_pay_dedc, hifp_pay, pool_prop_selfpay, cvlserv_pay, hifes_pay, hifmi_pay, hifob_pay, maf_pay, oth_pay, fund_pay_sumamt, state, create_time, create_by) " +
+                "VALUES (:ID,:BRIDGE_ID,:HISID,:ZYH,:RECIPE_NO,:PAY_METHOD,:BENEFIT_TYPE,:HOSPITAL_ID,:HOSPITAL_NAME,:P_LEVEL_YY,:REFUND_FLAG,:P_LEVEL,:BMI_AREA_ID,:BMI_AREA_NAME,:BILL_DATE,:REFUND_DATE,:ADMISSION_DEPT_ID,:ADMISSION_DEPT_NAME,:ADM_BED,:TRANSFER_DEPT_ID,:TRANSFER_DEPT_NAME,:DISCHARGE_DEPT_ID,:DISCHARGE_DEPT_NAME,:DSCG_BED,:DOCTOR_ID,:DOCTOR_NAME,:PATIENT_ID,:PATIENT_NAME,:PATIENT_GENDER,:PATIENT_BIRTHDAY,:PATIENT_AGE,:PATIENT_AGE_DAYS,:CLAIM_TYPE,:VISIT_TIME,:IF_LOCAL_FLAG,:ADMISSION_DATE,:DISCHARGE_DATE,:ZYTS,:DISCHARGE_STATUS,:PRE_ADMISSION_DATE,:DAYS_RE_ADMISSION_31,:YB_ADMISSION_DISEASE_ID,:YB_ADMISSION_DISEASE_NAME,:YB_DISCHARGE_DISEASE_ID_MAIN,:YB_DISCHARGE_DISEASE_NAME_MAIN,:ADMISSION_DISEASE_ID,:ADMISSION_DISEASE_NAME,:DISCHARGE_DISEASE_ID_MAIN,:DISCHARGE_DISEASE_NAME_MAIN,:YB_PAY_TYPE,:DRGS_CODE,:DRGS_NAME,:MEDFEE_SUMAMT,:FULAMT_OWNPAY_AMT,:OVERLMT_SELFPAY,:PRESELFPAY_AMT,:INSCP_SCP_AMT,:ACT_PAY_DEDC,:HIFP_PAY,:POOL_PROP_SELFPAY,:CVLSERV_PAY,:HIFES_PAY,:HIFMI_PAY,:HIFOB_PAY,:MAF_PAY,:OTH_PAY,:FUND_PAY_SUMAMT,:STATE,:NOW,:CREATE_BY)";
+        xcfyDataTransferService.transferDataList(sql, insertSql, paramMap, new TransferDataCallFunction() {
+            @Override
+            public void transferData(Map<String, Object> dataMap) throws Exception {
+                dataMap.put("CREATE_BY","auto");
+                dataMap.put("NOW",new Date());
+            }
+        });
+
+
+    }
+
+    public Date getLastVisitDate(){
+        List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getVisitTime).last("limit 1").list();
+        if(CollectionUtil.isEmpty(masterAdmissionBillList)){
+            return null;
+        }
+        return masterAdmissionBillList.get(0).getVisitTime();
+    }
+
+
 }

+ 69 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_hospitalizatio_settle_detailJob.java

@@ -0,0 +1,69 @@
+package org.jeecg.modules.medical.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.entity.MasterAdmissionBill;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IMasterAdmissionBillService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 事后统计类指标
+ */
+@Slf4j
+public class XCFYDatav_hospitalizatio_settle_detailJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    IMasterAdmissionBillService masterAdmissionBillService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        log.info("开始同步v_hospitalizatio_settle_detail数据");
+        String whereSql = "";
+        Date visitTime = getLastVisitDate();
+        log.info("开始同步v_hospitalizatio_settle_detail数据,获取上个同步记录访问日期:{}", visitTime);
+        Map<String,Object> paramMap = new HashMap<>();
+        if(null != visitTime){
+            whereSql = "where VISIT_TIME>:VISIT_TIME and rownum<1000";
+            paramMap.put("VISIT_TIME", visitTime);
+        }
+        String sql = "select * from v_hospitalizatio_settle_detail %s order by VISIT_TIME asc";
+        sql = String.format(sql, whereSql);
+        String insertSql = "INSERT INTO `master_admission_bill` (`id`, `bridge_id`, `hisid`, `zyh`, `recipe_no`, `pay_method`, `benefit_type`, `hospital_id`, `hospital_name`, `p_level_yy`, `refund_flag`, `p_level`, `bmi_area_id`, `bmi_area_name`, `bill_date`, `refund_date`, `admission_dept_id`, `admission_dept_name`, `adm_bed`, `transfer_dept_id`, `transfer_dept_name`, `discharge_dept_id`, `discharge_dept_name`, `dscg_bed`, `doctor_id`, `doctor_name`, `patient_id`, `patient_name`, `patient_gender`, `patient_birthday`, `patient_age`, `patient_age_days`, `claim_type`, `visit_time`, `if_local_flag`, `admission_date`, `discharge_date`, `zyts`, `discharge_status`, `pre_admission_date`, `days_re_admission_31`, `yb_admission_disease_id`, `yb_admission_disease_name`, `yb_discharge_disease_id_main`, `yb_discharge_disease_name_main`, `admission_disease_id`, `admission_disease_name`, `discharge_disease_id_main`, `discharge_disease_name_main`, `yb_pay_type`, `drgs_code`, `drgs_name`, `medfee_sumamt`, `fulamt_ownpay_amt`, `overlmt_selfpay`, `preselfpay_amt`, `inscp_scp_amt`, `act_pay_dedc`, `hifp_pay`, `pool_prop_selfpay`, `cvlserv_pay`, `hifes_pay`, `hifmi_pay`, `hifob_pay`, `maf_pay`, `oth_pay`, `fund_pay_sumamt`, `state`, `create_time`, `create_by`) " +
+                "VALUES (:ID,:BRIDGE_ID,:HISID,:ZYH,:RECIPE_NO,:PAY_METHOD,:BENEFIT_TYPE,:HOSPITAL_ID,:HOSPITAL_NAME,:P_LEVEL_YY,:REFUND_FLAG,:P_LEVEL,:BMI_AREA_ID,:BMI_AREA_NAME,:BILL_DATE,:REFUND_DATE,:ADMISSION_DEPT_ID,:ADMISSION_DEPT_NAME,:ADM_BED,:TRANSFER_DEPT_ID,:TRANSFER_DEPT_NAME,:DISCHARGE_DEPT_ID,:DISCHARGE_DEPT_NAME,:DSCG_BED,:DOCTOR_ID,:DOCTOR_NAME,:PATIENT_ID,:PATIENT_NAME,:PATIENT_GENDER,:PATIENT_BIRTHDAY,:PATIENT_AGE,:PATIENT_AGE_DAYS,:CLAIM_TYPE,:VISIT_TIME,:IF_LOCAL_FLAG,:ADMISSION_DATE,:DISCHARGE_DATE,:ZYTS,:DISCHARGE_STATUS,:PRE_ADMISSION_DATE,:DAYS_RE_ADMISSION_31,:YB_ADMISSION_DISEASE_ID,:YB_ADMISSION_DISEASE_NAME,:YB_DISCHARGE_DISEASE_ID_MAIN,:YB_DISCHARGE_DISEASE_NAME_MAIN,:ADMISSION_DISEASE_ID,:ADMISSION_DISEASE_NAME,:DISCHARGE_DISEASE_ID_MAIN,:DISCHARGE_DISEASE_NAME_MAIN,:YB_PAY_TYPE,:DRGS_CODE,:DRGS_NAME,:MEDFEE_SUMAMT,:FULAMT_OWNPAY_AMT,:OVERLMT_SELFPAY,:PRESELFPAY_AMT,:INSCP_SCP_AMT,:ACT_PAY_DEDC,:HIFP_PAY,:POOL_PROP_SELFPAY,:CVLSERV_PAY,:HIFES_PAY,:HIFMI_PAY,:HIFOB_PAY,:MAF_PAY,:OTH_PAY,:FUND_PAY_SUMAMT,:STATE,:NOW,:CREATE_BY)";
+        xcfyDataTransferService.transferDataList(sql, insertSql, paramMap, new TransferDataCallFunction() {
+            @Override
+            public void transferData(Map<String, Object> dataMap) throws Exception {
+                dataMap.put("CREATE_BY","auto");
+                dataMap.put("NOW", new Date());
+            }
+        });
+
+
+
+    }
+
+    public Date getLastVisitDate(){
+        List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getVisitTime).last("limit 1").list();
+        if(CollectionUtil.isEmpty(masterAdmissionBillList)){
+            return null;
+        }
+        return masterAdmissionBillList.get(0).getVisitTime();
+    }
+
+//    @Async("commonTaskAsyncPool")
+//    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
+//        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
+//    }
+}

+ 80 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_master_admission_billJob.java

@@ -0,0 +1,80 @@
+package org.jeecg.modules.medical.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.util.dynamic.db.DynamicDBUtil;
+import org.jeecg.modules.medical.Constant;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.entity.MasterAdmissionBill;
+import org.jeecg.modules.medical.entity.MedicalInsRuleInfo;
+import org.jeecg.modules.medical.ruleengine.RuleEngine;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IAfterStatisticsService;
+import org.jeecg.modules.medical.service.IMasterAdmissionBillService;
+import org.jeecg.modules.medical.service.IMedicalInsRuleInfoService;
+import org.jeecg.modules.system.service.ISysDictService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.scheduling.annotation.Async;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 事后统计类指标
+ */
+@Slf4j
+public class XCFYDatav_master_admission_billJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    IMasterAdmissionBillService masterAdmissionBillService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        log.info("开始同步master_admission_bill数据");
+        String whereSql = "";
+        Date visitTime = getLastVisitDate();
+        log.info("开始同步master_admission_bill数据,获取上个同步记录访问日期:{}", visitTime);
+        Map<String,Object> paramMap = new HashMap<>();
+        if(null != visitTime){
+            whereSql = "where VISIT_TIME>:VISIT_TIME and rownum<1000";
+            paramMap.put("VISIT_TIME", visitTime);
+        }
+        String sql = "select * from v_master_admission_bill %s order by VISIT_TIME asc";
+        sql = String.format(sql, whereSql);
+        String insertSql = "INSERT INTO `master_admission_bill` (`id`, `bridge_id`, `hisid`, `zyh`, `recipe_no`, `pay_method`, `benefit_type`, `hospital_id`, `hospital_name`, `p_level_yy`, `refund_flag`, `p_level`, `bmi_area_id`, `bmi_area_name`, `bill_date`, `refund_date`, `admission_dept_id`, `admission_dept_name`, `adm_bed`, `transfer_dept_id`, `transfer_dept_name`, `discharge_dept_id`, `discharge_dept_name`, `dscg_bed`, `doctor_id`, `doctor_name`, `patient_id`, `patient_name`, `patient_gender`, `patient_birthday`, `patient_age`, `patient_age_days`, `claim_type`, `visit_time`, `if_local_flag`, `admission_date`, `discharge_date`, `zyts`, `discharge_status`, `pre_admission_date`, `days_re_admission_31`, `yb_admission_disease_id`, `yb_admission_disease_name`, `yb_discharge_disease_id_main`, `yb_discharge_disease_name_main`, `admission_disease_id`, `admission_disease_name`, `discharge_disease_id_main`, `discharge_disease_name_main`, `yb_pay_type`, `drgs_code`, `drgs_name`, `medfee_sumamt`, `fulamt_ownpay_amt`, `overlmt_selfpay`, `preselfpay_amt`, `inscp_scp_amt`, `act_pay_dedc`, `hifp_pay`, `pool_prop_selfpay`, `cvlserv_pay`, `hifes_pay`, `hifmi_pay`, `hifob_pay`, `maf_pay`, `oth_pay`, `fund_pay_sumamt`, `state`, `create_time`, `create_by`) " +
+                "VALUES (:ID,:BRIDGE_ID,:HISID,:ZYH,:RECIPE_NO,:PAY_METHOD,:BENEFIT_TYPE,:HOSPITAL_ID,:HOSPITAL_NAME,:P_LEVEL_YY,:REFUND_FLAG,:P_LEVEL,:BMI_AREA_ID,:BMI_AREA_NAME,:BILL_DATE,:REFUND_DATE,:ADMISSION_DEPT_ID,:ADMISSION_DEPT_NAME,:ADM_BED,:TRANSFER_DEPT_ID,:TRANSFER_DEPT_NAME,:DISCHARGE_DEPT_ID,:DISCHARGE_DEPT_NAME,:DSCG_BED,:DOCTOR_ID,:DOCTOR_NAME,:PATIENT_ID,:PATIENT_NAME,:PATIENT_GENDER,:PATIENT_BIRTHDAY,:PATIENT_AGE,:PATIENT_AGE_DAYS,:CLAIM_TYPE,:VISIT_TIME,:IF_LOCAL_FLAG,:ADMISSION_DATE,:DISCHARGE_DATE,:ZYTS,:DISCHARGE_STATUS,:PRE_ADMISSION_DATE,:DAYS_RE_ADMISSION_31,:YB_ADMISSION_DISEASE_ID,:YB_ADMISSION_DISEASE_NAME,:YB_DISCHARGE_DISEASE_ID_MAIN,:YB_DISCHARGE_DISEASE_NAME_MAIN,:ADMISSION_DISEASE_ID,:ADMISSION_DISEASE_NAME,:DISCHARGE_DISEASE_ID_MAIN,:DISCHARGE_DISEASE_NAME_MAIN,:YB_PAY_TYPE,:DRGS_CODE,:DRGS_NAME,:MEDFEE_SUMAMT,:FULAMT_OWNPAY_AMT,:OVERLMT_SELFPAY,:PRESELFPAY_AMT,:INSCP_SCP_AMT,:ACT_PAY_DEDC,:HIFP_PAY,:POOL_PROP_SELFPAY,:CVLSERV_PAY,:HIFES_PAY,:HIFMI_PAY,:HIFOB_PAY,:MAF_PAY,:OTH_PAY,:FUND_PAY_SUMAMT,:STATE,:NOW,:CREATE_BY)";
+        xcfyDataTransferService.transferDataList(sql, insertSql, paramMap, new TransferDataCallFunction() {
+            @Override
+            public void transferData(Map<String, Object> dataMap) throws Exception {
+                dataMap.put("CREATE_BY","auto");
+                dataMap.put("NOW", new Date());
+            }
+        });
+
+
+
+    }
+
+    public Date getLastVisitDate(){
+        List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getVisitTime).last("limit 1").list();
+        if(CollectionUtil.isEmpty(masterAdmissionBillList)){
+            return null;
+        }
+        return masterAdmissionBillList.get(0).getVisitTime();
+    }
+
+//    @Async("commonTaskAsyncPool")
+//    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
+//        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
+//    }
+}

+ 13 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/ruleengine/TransferDataCallFunction.java

@@ -0,0 +1,13 @@
+package org.jeecg.modules.medical.ruleengine;
+
+import java.util.Map;
+
+/**
+ * 数据转换回调函数
+ * @author lin.dong
+ */
+@FunctionalInterface
+@SuppressWarnings("PMD")
+public interface TransferDataCallFunction {
+    void transferData(Map<String,Object> dataMap) throws Exception;
+}

+ 15 - 4
jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/AfterwardsAuditDataTest.java

@@ -105,6 +105,16 @@ public class AfterwardsAuditDataTest {
     @Autowired
     RedisTemplate redisTemplate;
 
+    @Test
+    public void testMAB() {
+        try {
+            afterWaringLogTestJob.testMasterAdmBill();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
     @Test
     public void testJob() {
         try {
@@ -114,6 +124,7 @@ public class AfterwardsAuditDataTest {
         }
     }
 
+
     @Test
     public void insertAfterWordDetail() {
         QueryWrapper<SttlMasterBill> queryWrapper = new QueryWrapper();
@@ -123,7 +134,7 @@ public class AfterwardsAuditDataTest {
         List<SttlMasterBill> sttlMasterBills = sttlMasterBillService.list(queryWrapper);
         List<AfterwardsAuditDetail> detailList = new ArrayList<>();
         Map<String, Boolean> codeDataMap = new ConcurrentHashMap<>();
-        String[] sAr = {"1", "2","3"};
+        String[] sAr = {"1", "2", "3"};
         List<MedicalInsRuleInfo> medicalInsRuleInfoList = medicalInsRuleInfoService.lambdaQuery().in(MedicalInsRuleInfo::getTreatmentType, sAr).eq(MedicalInsRuleInfo::getState, Constant.EFF_STATE).list();
         if (!CollectionUtil.isNotEmpty(medicalInsRuleInfoList)) {
             log.error("规则配置表没有有效的规则");
@@ -166,7 +177,7 @@ public class AfterwardsAuditDataTest {
         List<SttlMasterBill> sttlMasterBills = sttlMasterBillService.list(queryWrapper);
         List<AfterwardsAuditDetail> detailList = new ArrayList<>();
         Map<String, Boolean> codeDataMap = new ConcurrentHashMap<>();
-        String[] sAr = {"1", "2","3"};
+        String[] sAr = {"1", "2", "3"};
         List<MedicalInsRuleInfo> medicalInsRuleInfoList = medicalInsRuleInfoService.lambdaQuery().in(MedicalInsRuleInfo::getTreatmentType, sAr).eq(MedicalInsRuleInfo::getState, Constant.EFF_STATE).list();
         if (!CollectionUtil.isNotEmpty(medicalInsRuleInfoList)) {
             log.error("规则配置表没有有效的规则");
@@ -217,8 +228,8 @@ public class AfterwardsAuditDataTest {
             Set<Integer> medicalRuleInfoIdSet = RuleEngine.itemCodeAndRuleIdMap.get(projectCode);
             if (CollectionUtil.isEmpty(medicalRuleInfoIdSet)) {
                 log.info("医保编码未匹配到规则:{}", projectCode);
-                if(!codeDataMap.containsKey(projectCode)){
-                    ruleEngine.genItemCodeAndRuleIdMapTest(projectCode, afterwardsAuditDetail, medicalInsRuleInfoList, medicalMap,codeDataMap);
+                if (!codeDataMap.containsKey(projectCode)) {
+                    ruleEngine.genItemCodeAndRuleIdMapTest(projectCode, afterwardsAuditDetail, medicalInsRuleInfoList, medicalMap, codeDataMap);
                 }
 
             } else {

+ 6 - 2
jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/MidAuditDataTest.java

@@ -133,14 +133,18 @@ public class MidAuditDataTest {
 
     @Test
     public void genMidDiag(){
-        List<MidIncidentAudit> midIncidentAuditList = midIncidentAuditService.lambdaQuery().eq(MidIncidentAudit::getPatientId, "2222941236").list();
+        List<MidIncidentAudit> midIncidentAuditList = midIncidentAuditService.lambdaQuery().list();
         log.info("进入查询,数据条数:{}", midIncidentAuditList.size());
 
         List<MidIncidentAuditDiagnose> midIncidentAuditDiagnoseList = new ArrayList<>();
         MidIncidentAuditDiagnose midIncidentAuditDiagnose = null;
         for(MidIncidentAudit midIncidentAudit : midIncidentAuditList){
             midIncidentAuditDiagnose = new MidIncidentAuditDiagnose();
-            SttlMasterBill sttlMasterBill = sttlMasterBillService.lambdaQuery().eq(SttlMasterBill::getJsdjh, midIncidentAudit.getPrescriptionNumber()).list().get(0);
+            List<SttlMasterBill> sttlMasterBills = sttlMasterBillService.lambdaQuery().eq(SttlMasterBill::getJsdjh, midIncidentAudit.getPrescriptionNumber()).list();
+            if(CollectionUtil.isEmpty(sttlMasterBills)){
+                continue;
+            }
+            SttlMasterBill sttlMasterBill = sttlMasterBills.get(0);
             midIncidentAuditDiagnose.setMidIncidentAuditId(midIncidentAudit.getId());
             midIncidentAuditDiagnose.setDiagnoseCode(sttlMasterBill.getCyzdbm());
             midIncidentAuditDiagnose.setDiagnoseDesc(sttlMasterBill.getCyzdmc());