|
@@ -6,6 +6,7 @@ import org.jeecg.common.system.vo.DictModel;
|
|
import org.jeecg.common.util.dynamic.db.DynamicDBUtil;
|
|
import org.jeecg.common.util.dynamic.db.DynamicDBUtil;
|
|
import org.jeecg.modules.medical.Constant;
|
|
import org.jeecg.modules.medical.Constant;
|
|
import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
|
|
import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
|
|
|
|
+import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
|
|
import org.jeecg.modules.medical.entity.MasterAdmissionBill;
|
|
import org.jeecg.modules.medical.entity.MasterAdmissionBill;
|
|
import org.jeecg.modules.medical.entity.MedicalInsRuleInfo;
|
|
import org.jeecg.modules.medical.entity.MedicalInsRuleInfo;
|
|
import org.jeecg.modules.medical.ruleengine.RuleEngine;
|
|
import org.jeecg.modules.medical.ruleengine.RuleEngine;
|
|
@@ -28,7 +29,8 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 事后统计类指标
|
|
|
|
|
|
+ * 住院结算主单
|
|
|
|
+ * 每天执行一次
|
|
*/
|
|
*/
|
|
@Slf4j
|
|
@Slf4j
|
|
public class XCFYDatav_master_admission_billJob implements Job {
|
|
public class XCFYDatav_master_admission_billJob implements Job {
|
|
@@ -38,41 +40,49 @@ public class XCFYDatav_master_admission_billJob implements Job {
|
|
@Autowired
|
|
@Autowired
|
|
IMasterAdmissionBillService masterAdmissionBillService;
|
|
IMasterAdmissionBillService masterAdmissionBillService;
|
|
|
|
|
|
|
|
+ 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)";
|
|
@Override
|
|
@Override
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
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());
|
|
|
|
|
|
+ String sql = "select * from v_master_admission_bill where rownum<1000 %s order by VISIT_TIME asc";
|
|
|
|
+ while(true) {
|
|
|
|
+ log.info("开始同步master_admission_bill数据");
|
|
|
|
+ String whereSql = "";
|
|
|
|
+ Long id = getLastId();
|
|
|
|
+ log.info("开始同步master_admission_bill数据,获取上个同步记录主键ID:{}", id);
|
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
|
+ if(null != id && id>0){
|
|
|
|
+ whereSql = "and ID>:ID";
|
|
|
|
+ paramMap.put("ID", id);
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
|
|
|
|
+ sql = String.format(sql, whereSql);
|
|
|
|
+
|
|
|
|
+ Integer count = 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());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if(count<=0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public Date getLastVisitDate(){
|
|
|
|
- List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getVisitTime).last("limit 1").list();
|
|
|
|
|
|
+ public Long getLastId(){
|
|
|
|
+ List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getId).last("limit 1").list();
|
|
if(CollectionUtil.isEmpty(masterAdmissionBillList)){
|
|
if(CollectionUtil.isEmpty(masterAdmissionBillList)){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- return masterAdmissionBillList.get(0).getVisitTime();
|
|
|
|
|
|
+ return masterAdmissionBillList.get(0).getId();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// @Async("commonTaskAsyncPool")
|
|
// @Async("commonTaskAsyncPool")
|
|
// public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
|
|
// public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
|
|
// ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
|
|
// ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
|