Browse Source

oracle数据同步代码

0027005599 1 year ago
parent
commit
6ccd69b168
22 changed files with 1040 additions and 63 deletions
  1. 3 6
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/afterwaring/XCFYDataTransferService.java
  2. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/CheckList.java
  3. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/DiagnoseItems.java
  4. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/HospitalizatioSettleDetail.java
  5. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MasterAdmissionBill.java
  6. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MaterialItems.java
  7. 4 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/PrescriptionOrder.java
  8. 74 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_MEDICAL_RECORD_HOMEPAGEJob.java
  9. 81 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_OPERATIONJob.java
  10. 67 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_OPERATIVE_ITEMSJob.java
  11. 85 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_PRESCRIPTION_ORDERJob.java
  12. 66 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_STAFF_INFOJob.java
  13. 69 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDataV_TREATMENT_ITEMSJob.java
  14. 73 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_check_listJob.java
  15. 79 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_diagnose_itemsJob.java
  16. 73 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_his_patientJob.java
  17. 34 27
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_hospitalizatio_settle_detailJob.java
  18. 33 23
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_master_admission_billJob.java
  19. 71 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_material_itemsJob.java
  20. 76 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_medical_insJob.java
  21. 69 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_medical_insurance_drugsJob.java
  22. 76 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/XCFYDatav_outpatient_settle_detailsJob.java

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

@@ -18,14 +18,10 @@ 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) {
+    public Integer 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 = "";
@@ -40,7 +36,7 @@ public class XCFYDataTransferService {
         List<Map<String, Object>> dataList = namedParameterJdbcTemplate.queryForList(querySql, paramMap);
         if (CollectionUtil.isEmpty(dataList)) {
             log.error("querySql:{} paramMap:{} 未查询到数据,返回", querySql, paramMap);
-            return;
+            return 0;
         }
         log.info("querySql:{} paramMap:{} 查询到数据条数:{}", querySql, paramMap, dataList.size());
 
@@ -56,6 +52,7 @@ public class XCFYDataTransferService {
         }
 //        String insertSql = "insert into master_admission_bill() values()";
         localNamedParameterJdbcTemplate.batchUpdate(insertSql, batchArgs.toArray(new MapSqlParameterSource[batchArgs.size()]));
+        return dataList.size();
     }
 
 

+ 2 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/CheckList.java

@@ -33,9 +33,9 @@ public class CheckList implements Serializable {
     private static final long serialVersionUID = 1L;
 
 	/**主键*/
-	@TableId(type = IdType.ASSIGN_ID)
+	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
-    private java.lang.Integer id;
+    private java.lang.Long id;
 	/**关联结算主单字段;与住院/门诊结算主单的关联编码*/
 	@Excel(name = "关联结算主单字段;与住院/门诊结算主单的关联编码", width = 15)
     @ApiModelProperty(value = "关联结算主单字段;与住院/门诊结算主单的关联编码")

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/DiagnoseItems.java

@@ -34,7 +34,7 @@ public class DiagnoseItems implements Serializable {
 	/**主键ID*/
 	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键ID")
-    private Integer id;
+    private Long id;
 	/**医院诊断编码*/
 	@Excel(name = "医院诊断编码", width = 15)
     @ApiModelProperty(value = "医院诊断编码")

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/HospitalizatioSettleDetail.java

@@ -35,7 +35,7 @@ public class HospitalizatioSettleDetail implements Serializable {
 	/**主键*/
 	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
-    private java.lang.Integer id;
+    private java.lang.Long id;
 	/**结算单据号;单据唯一识别码,也称交易码(HISID),和住院主单关联条件 */
 	@Excel(name = "结算单据号;单据唯一识别码,也称交易码(HISID),和住院主单关联条件 ", width = 15)
     @ApiModelProperty(value = "结算单据号;单据唯一识别码,也称交易码(HISID),和住院主单关联条件 ")

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MasterAdmissionBill.java

@@ -35,7 +35,7 @@ public class MasterAdmissionBill implements Serializable {
     /**主键ID*/
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键ID")
-    private java.lang.Integer id;
+    private java.lang.Long id;
 
 	/**病案关联字段;与病案的关联编码,可关联该病人病案首页相关诊断等信息。*/
 	@Excel(name = "病案关联字段;与病案的关联编码,可关联该病人病案首页相关诊断等信息。", width = 15)

+ 2 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MaterialItems.java

@@ -32,9 +32,9 @@ import lombok.experimental.Accessors;
 public class MaterialItems implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @TableId(type = IdType.ASSIGN_ID)
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
-    private String id;
+    private Long id;
 	/**医保项目编码;医保耗材目录编码*/
 	@Excel(name = "医保项目编码", width = 15)
     @ApiModelProperty(value = "医保项目编码")

+ 4 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/PrescriptionOrder.java

@@ -31,6 +31,10 @@ import lombok.experimental.Accessors;
 @ApiModel(value="prescription_order对象", description="prescription_order")
 public class PrescriptionOrder implements Serializable {
     private static final long serialVersionUID = 1L;
+    /**主键*/
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private java.lang.Long id;
 
 	/**关联结算主单字段;与病案的关联编码*/
 	@Excel(name = "关联结算主单字段;与病案的关联编码", width = 15)

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

@@ -0,0 +1,74 @@
+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.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.batch.BatchProperties;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 病案首页,增量同步
+ * 每小时执行一次
+ */
+@Slf4j
+public class XCFYDataV_MEDICAL_RECORD_HOMEPAGEJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO medical_record_homepage (id, bridge_id, zyh, hospital_id, patient_name, patient_id, social_card_id, patient_address, patient_company, icd10_code_basy, icd10_name_basy, icd10_name_describe, special_remarks, disease_id1, disease_name1, icd9_code_basy, icd9_name_basy, icd9_code1, icd9_name1, nb_weight, nb_admission_weight, bm_hours, icu_flag, icu_hours, main_con_desc, treatment_process, pathological_findings, discharge_condition, discharge_order, death_date, death_diagnosis, death_cause, admission_plan, disease_his, past_his, personal_his, auxiliary_inspection, assist_lab_test_results, auxiliary_imaging_ex_results, discharge_status, create_time, create_by) " +
+            "VALUES (:ID,:BRIDGE_ID,:ZYH,:HOSPITAL_ID,:PATIENT_NAME,:PATIENT_ID,:SOCIAL_CARD_ID,:PATIENT_ADDRESS,:PATIENT_COMPANY,:ICD10_CODE_BASY,:ICD10_NAME_BASY,:ICD10_NAME_DESCRIBE,:SPECIAL_REMARKS,:DISEASE_ID1,:DISEASE_NAME1,:ICD9_CODE_BASY,:ICD9_NAME_BASY,:ICD9_CODE1,:ICD9_NAME1,:NB_WEIGHT,:NB_ADMISSION_WEIGHT,:BM_HOURS,:ICU_FLAG,:ICU_HOURS,:MAIN_CON_DESC,:TREATMENT_PROCESS,:PATHOLOGICAL_FINDINGS,:DISCHARGE_CONDITION,:DISCHARGE_ORDER,:DEATH_DATE,:DEATH_DIAGNOSIS,:DEATH_CAUSE,:ADMISSION_PLAN,:DISEASE_HIS,:PAST_HIS,:PERSONAL_HIS,:AUXILIARY_INSPECTION,:ASSIST_LAB_TEST_RESULTS,:AUXILIARY_IMAGING_EX_RESULTS,:DISCHARGE_STATUS,:CREATE_TIME,:CREATE_BY)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from V_MEDICAL_RECORD_HOMEPAGE where rownum<1000 %s";
+        while(true) {
+            log.info("开始同步V_MEDICAL_RECORD_HOMEPAGE数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步V_MEDICAL_RECORD_HOMEPAGE数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String,Object> paramMap = new HashMap<>();
+            if(null != hsdId && hsdId>0){
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
+            }
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if(count<=0){
+                log.info("V_MEDICAL_RECORD_HOMEPAGE 大于ID:{} 没有的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId(){
+        Long id = jdbcTemplate.queryForObject("select max(id) as id from medical_record_homepage", Long.class);
+        return id;
+    }
+
+}

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

@@ -0,0 +1,81 @@
+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.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 住院手术信息,增量同步
+ */
+@Slf4j
+public class XCFYDataV_OPERATIONJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+    public static String insertSql = "INSERT INTO operation (hisid, treatment_type, operation_no, operation_code, patient_id, patient_name, patient_gender, operation_name, operation_start_time, " +
+            "operation_end_time, operation_doc_no, operation_doc_name, operation_dept_no, operation_dept_name, operation_source, operation_order_time, operation_room_no, " +
+            "operation_site_code, operation_diag_code, operation_diag_name, suf_diag_code, suf_diag_name, operation_type, operation_level, reoperation, incision_healing_code, " +
+            "incision_type, is_implant, implant_no, implant_name, first_doc_no, first_doc_name, second_doc_no, second_doc_name, third_doc_no, third_doc_name, direct_doc_no, " +
+            "direct_doc_name, anesthesia_type_name, anesthesia_doc_no, " +
+            "anesthesia_doc_name, anesthesia_start_time, anesthesia_end_time, antibacterial_time, premedication_time_point, intraoperative_dosing, amount, create_by, create_time) " +
+            "VALUES (:HISID,:TREATMENT_TYPE,:OPERATION_NO,:OPERATION_CODE,:PATIENT_ID,:PATIENT_NAME,:PATIENT_GENDER,:OPERATION_NAME,:OPERATION_START_TIME,:OPERATION_END_TIME," +
+            ":OPERATION_DOC_NO,:OPERATION_DOC_NAME,:OPERATION_DEPT_NO,:OPERATION_DEPT_NAME,:OPERATION_SOURCE,:OPERATION_ORDER_TIME,:OPERATION_ROOM_NO,:OPERATION_SITE_CODE," +
+            ":OPERATION_DIAG_CODE,:OPERATION_DIAG_NAME,:SUF_DIAG_CODE,:SUF_DIAG_NAME,:OPERATION_TYPE,:OPERATION_LEVEL,:REOPERATION,:INCISION_HEALING_CODE,:INCISION_TYPE," +
+            ":IS_IMPLANT,:IMPLANT_NO,:IMPLANT_NAME,:FIRST_DOC_NO,:FIRST_DOC_NAME,:SECOND_DOC_NO,:SECOND_DOC_NAME,:THIRD_DOC_NO,:THIRD_DOC_NAME,:DIRECT_DOC_NO,:DIRECT_DOC_NAME," +
+            ":ANESTHESIA_TYPE_NAME,:ANESTHESIA_DOC_NO,:ANESTHESIA_DOC_NAME,:ANESTHESIA_START_TIME,:ANESTHESIA_END_TIME,:ANTIBACTERIAL_TIME,:PREMEDICATION_TIME_POINT," +
+            ":INTRAOPERATIVE_DOSING,:AMOUNT,:CREATE_BY,:CREATE_TIME)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from V_OPERATION where rownum<1000 %s";
+        while(true) {
+            log.info("开始同步V_OPERATION数据");
+            String whereSql = "";
+            Date opEndDate = getLastOpEndDate();
+            log.info("开始同步V_OPERATION数据,获取上个同步记录访问最大手术结束时间:{}", opEndDate);
+            Map<String,Object> paramMap = new HashMap<>();
+            if(null != opEndDate){
+                whereSql = "and operation_end_time>:OPERATION_END_TIME";
+                paramMap.put("OPERATION_END_TIME", opEndDate);
+            }
+            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");
+                    if(!dataMap.containsKey("HISID")){
+                        dataMap.put("HISID", null);
+                    }
+                    dataMap.put("CREATE_TIME", new Date());
+                }
+            });
+            if(count<=0){
+                log.info("V_OPERATION 大于手术结束时间:{} 没有的数据,停止同步", opEndDate);
+                return;
+            }
+        }
+
+    }
+
+    public Date getLastOpEndDate(){
+        Date opEndDate = jdbcTemplate.queryForObject("select max(operation_end_time) as opEndDate from OPERATION", Date.class);
+        return opEndDate;
+    }
+
+}

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

@@ -0,0 +1,67 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+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.Map;
+
+/**
+ * 手术目录表(含对照关系)全量同步
+ * 定时任务周期要1个月执行一次
+ * 新增OPERATIVE_CODE唯一索引
+ */
+@Slf4j
+public class XCFYDataV_OPERATIVE_ITEMSJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    IHospitalizatioSettleDetailService hospitalizatioSettleDetailService;
+
+    String insertSql = "INSERT INTO operative_items (operative_code, operative_name, medical_operative_code, medical_operative_name, create_by, create_time) " +
+            "VALUES (OPERATIVE_CODE,:OPERATIVE_NAME,:MEDICAL_OPERATIVE_CODE,:MEDICAL_OPERATIVE_NAME,:CREATE_BY,:CREATE_TIME) on duplicate key update " +
+            "MEDICAL_OPERATIVE_CODE = :MEDICAL_OPERATIVE_CODE," +
+            "OPERATIVE_NAME = :OPERATIVE_NAME," +
+            "MEDICAL_OPERATIVE_NAME = :MEDICAL_OPERATIVE_NAME,CREATE_TIME=:CREATE_TIME";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Integer startRows = 0;
+        Integer endRows = 1000;
+        String sql = "select * from V_OPERATIVE_ITEMS where rownum>=%s and rownum<%s ";
+        while (true) {
+            log.info("开始同步V_OPERATIVE_ITEMS数据 startRows:{} endRows:{}", startRows, endRows);
+            Map<String, Object> paramMap = new HashMap<>();
+
+
+            sql = String.format(sql, startRows, endRows);
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("V_OPERATIVE_ITEMS 开始rownum:{} 结束rownum:{} 没有的数据,停止同步", startRows, endRows);
+                return;
+            }
+            startRows = startRows + endRows;
+            endRows = endRows + 1000;
+        }
+
+
+    }
+
+
+}

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

@@ -0,0 +1,85 @@
+package org.jeecg.modules.medical.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import jdk.nashorn.internal.scripts.JD;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 处方医嘱
+ * 一个小时执行一次
+ */
+@Slf4j
+public class XCFYDataV_PRESCRIPTION_ORDERJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO prescription_order (hisid, patient_id, inp_outpatient_number, order_number, " +
+            "order_time, stop_order_time, order_status, order_type, order_catalog, item_id, item_name, drug_spec, " +
+            "each_dose, dose_unit, exe_frequency, days_timelines, medication_method, drug_use_total, inspection_site, " +
+            "mark, start_exc_time, intended_stop_time, input_operator, input_time, order_doctor, order_department, " +
+            "proof_nurse, proof_time, stop_order_operater, stop_order_exc_time, stop_order_doctor, exc_operater, " +
+            "exc_department, approver, approval_time, medical_insurance_mark, create_time, create_by, " +
+            "medical_insurance_ratio) VALUES (:HISID,:PATIENT_ID,:INP_OUTPATIENT_NUMBER,:ORDER_NUMBER," +
+            ":ORDER_TIME,:STOP_ORDER_TIME,:ORDER_STATUS,:ORDER_TYPE,:ORDER_CATALOG,:ITEM_ID,:ITEM_NAME," +
+            ":DRUG_SPEC,:EACH_DOSE,:DOSE_UNIT,:EXE_FREQUENCY,:DAYS_TIMELINES,:MEDICATION_METHOD,:DRUG_USE_TOTAL," +
+            ":INSPECTION_SITE,:MARK,:START_EXC_TIME,:INTENDED_STOP_TIME,:INPUT_OPERATOR,:INPUT_TIME,:ORDER_DOCTOR," +
+            ":ORDER_DEPARTMENT,:PROOF_NURSE,:PROOF_TIME,:STOP_ORDER_OPERATER,:STOP_ORDER_EXC_TIME,:STOP_ORDER_DOCTOR," +
+            ":EXC_OPERATER,:EXC_DEPARTMENT,:APPROVER,:APPROVAL_TIME,:MEDICAL_INSURANCE_MARK,:CREATE_TIME,:CREATE_BY," +
+            ":MEDICAL_INSURANCE_RATIO)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from V_PRESCRIPTION_ORDER where rownum<1000 %s";
+        while(true) {
+            log.info("开始同步V_PRESCRIPTION_ORDER数据");
+            String whereSql = "";
+            Date orderTime = getLastOpEndDate();
+            log.info("开始同步V_PRESCRIPTION_ORDER数据,获取上个同步记录访问最大ORDER_TIME:{}", orderTime);
+            Map<String,Object> paramMap = new HashMap<>();
+            if(null != orderTime){
+                whereSql = "and ORDER_TIME>:ORDER_TIME";
+                paramMap.put("ORDER_TIME", orderTime);
+            }
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if(count<=0){
+                log.info(" V_PRESCRIPTION_ORDER 大于ORDER_TIME:{} 没有的数据,停止同步", orderTime);
+                return;
+            }
+        }
+
+    }
+
+    public Date getLastOpEndDate(){
+        Date opEndDate = jdbcTemplate.queryForObject("select max(ORDER_TIME) as opEndDate from PRESCRIPTION_ORDER", Date.class);
+        return opEndDate;
+    }
+
+
+}

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

@@ -0,0 +1,66 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 医生员工表
+ * 一天执行一次
+ */
+@Slf4j
+public class XCFYDataV_STAFF_INFOJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO staff_info (DEPT_CODE, DEPT_NAME,DOCTOR_ID, DOCTOR_NAME, SEX, BIRTH_DATE, DUTY_NAME, DOCTOR_LEVEL) VALUES (DEPT_CODE,:DEPT_NAME,:DOCTOR_ID,:DOCTOR_NAME,:SEX,:BIRTH_DATE,:DUTY_NAME,:DOCTOR_LEVEL)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from V_STAFF_INFO where rownum<1000 %s";
+        while (true) {
+            log.info("开始同步V_STAFF_INFO数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步V_STAFF_INFO数据,获取上个同步记录访问最大doctor_ID:{}", hsdId);
+            Map<String, Object> paramMap = new HashMap<>();
+            if (null != hsdId && hsdId > 0) {
+                whereSql = "and DOCTOR_ID>:DOCTOR_ID";
+                paramMap.put("DOCTOR_ID", hsdId);
+            }
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("V_STAFF_INFO 大于医生ID:{} 没有的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId() {
+        Long id = jdbcTemplate.queryForObject("select max(doctor_id) as id from STAFF_INFO", Long.class);
+        return id;
+    }
+
+}

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

@@ -0,0 +1,69 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+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.Map;
+
+/**
+ * 医保诊疗项目目录(含对照关系)
+ * * 定时任务周期要1个月执行一次
+ * * 新增TREATMENT_ITEMS唯一索引
+ */
+@Slf4j
+public class XCFYDataV_TREATMENT_ITEMSJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    
+    String insertSql = "INSERT INTO treatment_items (item_id, item_name, item_id_hosp, item_name_hosp, item_type, " +
+            "item_connotation, excluded_medical, p_category, percentage_payment, p_type_pct, remarks, celling_price, " +
+            "tertiary_hosp_price, two_hosp_price, one_hosp_price, retirement_price, outpatient_p_pay_rate, " +
+            "hosp_p_pay_rate, injury_p_pay_rate, create_time, create_by, procreation_p_pay_rate) " +
+            "VALUES (:ITEM_ID,:ITEM_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:ITEM_TYPE,:ITEM_CONNOTATION," +
+            ":EXCLUDED_MEDICAL,:P_CATEGORY,:PERCENTAGE_PAYMENT,:P_TYPE_PCT,:REMARKS,:CELLING_PRICE," +
+            ":TERTIARY_HOSP_PRICE,:TWO_HOSP_PRICE,:ONE_HOSP_PRICE,:RETIREMENT_PRICE,:OUTPATIENT_P_PAY_RATE," +
+            ":HOSP_P_PAY_RATE,:INJURY_P_PAY_RATE,:CREATE_TIME,:CREATE_BY,:PROCREATION_P_PAY_RATE) on duplicate key update " +
+            "ITEM_ID = :ITEM_ID," +
+            "ITEM_NAME = :ITEM_NAME," +
+            "ITEM_NAME_HOSP = :ITEM_NAME_HOSP,CREATE_TIME=:CREATE_TIME";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Integer startRows = 0;
+        Integer endRows = 1000;
+        String sql = "select * from V_TREATMENT_ITEMS where rownum>=%s and rownum<%s ";
+        while (true) {
+            log.info("开始同步V_TREATMENT_ITEMS数据 startRows:{} endRows:{}", startRows, endRows);
+            Map<String, Object> paramMap = new HashMap<>();
+
+
+            sql = String.format(sql, startRows, endRows);
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("V_TREATMENT_ITEMS 开始rownum:{} 结束rownum:{} 没有的数据,停止同步", startRows, endRows);
+                return;
+            }
+            startRows = startRows + endRows;
+            endRows = endRows + 1000;
+        }
+
+    }
+
+    
+}

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

@@ -0,0 +1,73 @@
+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.CheckList;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.ICheckListService;
+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_check_listJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    ICheckListService checkListService;
+
+    String insertSql = "INSERT INTO check_list (id, hisid, patient_id, gender, age, department, inp_outpatient_number, check_list_num, item_id, item_name, check_time, create_time, create_by, report_time) VALUES (:ID,:HISID,:PATIENT_ID,:GENDER,:AGE,:DEPARTMENT,:INP_OUTPATIENT_NUMBER,:CHECK_LIST_NUM,:ITEM_ID,:ITEM_NAME,:CHECK_TIME,:CREATE_TIME,:CREATE_BY,:REPORT_TIME)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from v_check_list where rownum<1000 %s";
+        while (true) {
+            log.info("开始同步v_check_list数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步v_check_list数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String, Object> paramMap = new HashMap<>();
+            if (null != hsdId && hsdId > 0) {
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
+            }
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("v_check_list 没有大于id:{} 的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId() {
+        List<CheckList> checkLists = checkListService.lambdaQuery().orderByDesc(CheckList::getId).last("limit 1").list();
+        if (CollectionUtil.isEmpty(checkLists)) {
+            return null;
+        }
+        return checkLists.get(0).getId();
+    }
+
+
+}

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

@@ -0,0 +1,79 @@
+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.DiagnoseItems;
+import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IDiagnoseItemsService;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+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_diagnose_itemsJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    IDiagnoseItemsService diagnoseItemsService;
+
+    String insertSql = "INSERT INTO diagnose_items (id, diagnose_code, diagnose_name, medical_diagnose_code, medical_diagnose_name, state, CREATE_BY, CREATE_TIME) VALUES (:ID,:DIAGNOSE_CODE,:DIAGNOSE_NAME,:MEDICAL_DIAGNOSE_CODE,:MEDICAL_DIAGNOSE_NAME,:STATE,:CREATE_BY,:CREATE_TIME)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from v_diagnose_items where rownum<1000 %s";
+        while(true) {
+            log.info("开始同步v_diagnose_items数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步v_diagnose_items数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String,Object> paramMap = new HashMap<>();
+            if(null != hsdId && hsdId>0){
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
+            }
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if(count<=0){
+                log.info("v_diagnose_items 没有大于id:{} 的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId(){
+        List<DiagnoseItems> diagnoseItems = diagnoseItemsService.lambdaQuery().orderByDesc(DiagnoseItems::getId).last("limit 1").list();
+        if(CollectionUtil.isEmpty(diagnoseItems)){
+            return null;
+        }
+        return diagnoseItems.get(0).getId();
+    }
+
+//    @Async("commonTaskAsyncPool")
+//    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
+//        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
+//    }
+}

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

@@ -0,0 +1,73 @@
+package org.jeecg.modules.medical.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 病人表 增量同步
+ * 每天执行一次
+ */
+@Slf4j
+public class XCFYDatav_his_patientJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO his_patient (id, patient_no, gender, patient_name, id_type, id_no, birth_weight, birthday, create_by, create_time) VALUES (:ID,:PATIENT_NO,:GENDER,:PATIENT_NAME,:ID_TYPE,:ID_NO,:BIRTH_WEIGHT,:BIRTHDAY,:CREATE_BY,:CREATE_TIME))";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from v_his_patient where rownum<1000 %s";
+        while(true) {
+            log.info("开始同步v_his_patient数据");
+            String whereSql = "";
+            Long id = getLastId();
+            log.info("开始同步v_his_patient数据,获取上个同步记录访问最大主键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("CREATE_TIME", new Date());
+                }
+            });
+            if(count<=0){
+                log.info("v_his_patient 没有大于id:{} 的数据,停止同步", id);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId(){
+
+        Long id = jdbcTemplate.queryForObject("select max(id) as id from his_patient", Long.class);
+        return id;
+    }
+
+}

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

@@ -3,9 +3,9 @@ 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.entity.HospitalizatioSettleDetail;
 import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
-import org.jeecg.modules.medical.service.IMasterAdmissionBillService;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -17,7 +17,8 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 事后统计类指标
+ * 住院结算明细
+ * 每个小时执行一次
  */
 @Slf4j
 public class XCFYDatav_hospitalizatio_settle_detailJob implements Job {
@@ -25,41 +26,47 @@ public class XCFYDatav_hospitalizatio_settle_detailJob implements Job {
     @Autowired
     XCFYDataTransferService xcfyDataTransferService;
     @Autowired
-    IMasterAdmissionBillService masterAdmissionBillService;
+    IHospitalizatioSettleDetailService hospitalizatioSettleDetailService;
+
+    String insertSql = "INSERT INTO hospitalizatio_settle_detail (id, hisid, patient_id, zyh, hospital_id, p_category, categories_items, usage_date, discharge_dept_id, discharge_dept_name, item_id, item_name, item_id_hosp, item_name_hosp, drug_spec, dosage_form, package_unit, unit_price, num, cost, use_day, bmi_convered_amount, bmi_pay_amount, individual_payment_amount, amount_refusal, amount_reason, discharge_medication, refund_falge, refund_date, p_type, p_type_pct, create_time, create_by) VALUES (:ID,:HISID,:PATIENT_ID,:ZYH,:HOSPITAL_ID,:P_CATEGORY,:CATEGORIES_ITEMS,:USAGE_DATE,:DISCHARGE_DEPT_ID,:DISCHARGE_DEPT_NAME,:ITEM_ID,:ITEM_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:DRUG_SPEC,:DOSAGE_FORM,:PACKAGE_UNIT,:UNIT_PRICE,:NUM,:COST,:USE_DAY,:BMI_CONVERED_AMOUNT,:BMI_PAY_AMOUNT,:INDIVIDUAL_PAYMENT_AMOUNT,:AMOUNT_REFUSAL,:AMOUNT_REASON,:DISCHARGE_MEDICATION,:REFUND_FALGE,:REFUND_DATE,:P_TYPE,:P_TYPE_PCT,:CREATE_TIME,:CREATE_BY)";
 
     @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());
+        String sql = "select * from v_hospitalizatio_settle_detail where rownum<1000 %s";
+        while (true) {
+            log.info("开始同步v_hospitalizatio_settle_detail数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步v_hospitalizatio_settle_detail数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String, Object> paramMap = new HashMap<>();
+            if (null != hsdId && hsdId > 0) {
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
             }
-        });
 
 
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                return;
+            }
+        }
 
     }
 
-    public Date getLastVisitDate(){
-        List<MasterAdmissionBill> masterAdmissionBillList = masterAdmissionBillService.lambdaQuery().orderByDesc(MasterAdmissionBill::getVisitTime).last("limit 1").list();
-        if(CollectionUtil.isEmpty(masterAdmissionBillList)){
+    public Long getLastId() {
+        List<HospitalizatioSettleDetail> masterAdmissionBillList = hospitalizatioSettleDetailService.lambdaQuery().orderByDesc(HospitalizatioSettleDetail::getId).last("limit 1").list();
+        if (CollectionUtil.isEmpty(masterAdmissionBillList)) {
             return null;
         }
-        return masterAdmissionBillList.get(0).getVisitTime();
+        return masterAdmissionBillList.get(0).getId();
     }
 
 //    @Async("commonTaskAsyncPool")

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

@@ -6,6 +6,7 @@ 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.HospitalizatioSettleDetail;
 import org.jeecg.modules.medical.entity.MasterAdmissionBill;
 import org.jeecg.modules.medical.entity.MedicalInsRuleInfo;
 import org.jeecg.modules.medical.ruleengine.RuleEngine;
@@ -28,7 +29,8 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 事后统计类指标
+ * 住院结算主单
+ * 每天执行一次
  */
 @Slf4j
 public class XCFYDatav_master_admission_billJob implements Job {
@@ -38,41 +40,49 @@ public class XCFYDatav_master_admission_billJob implements Job {
     @Autowired
     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
     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)){
             return null;
         }
-        return masterAdmissionBillList.get(0).getVisitTime();
+        return masterAdmissionBillList.get(0).getId();
     }
 
+
 //    @Async("commonTaskAsyncPool")
 //    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
 //        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);

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

@@ -0,0 +1,71 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.jeecg.modules.medical.service.IMaterialItemsService;
+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.Map;
+
+/**
+ * 医保耗材目录(含对照关系) 全量同步
+ * 要一个月执行一次
+ * 新增ITEM_ID_HOSP唯一索引
+ */
+@Slf4j
+public class XCFYDatav_material_itemsJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    IMaterialItemsService materialItemsService;
+
+    String insertSql = "INSERT INTO material_items (item_id, item_name, item_id_hosp, item_name_hosp, item_connotation, excluded_medical, p_category, p_type_pct, remarks, celling_price, tertiary_hosp_price, two_hosp_price, create_time, update_by, update_time, create_by, one_hosp_price, reg_spe, company_name, consumable_material, one_category, two_category, three_category) " +
+            "VALUES (:ITEM_ID,:ITEM_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:ITEM_CONNOTATION,:EXCLUDED_MEDICAL,:P_CATEGORY,:P_TYPE_PCT,:REMARKS,:CELLING_PRICE,:TERTIARY_HOSP_PRICE,:TWO_HOSP_PRICE,:CREATE_TIME,:CREATE_BY,:ONE_HOSP_PRICE,:REG_SPE,:COMPANY_NAME,:CONSUMABLE_MATERIAL,:ONE_CATEGORY,:TWO_CATEGORY,:THREE_CATEGORY) on duplicate key update " +
+            "ITEM_ID = :ITEM_ID," +
+            "ITEM_NAME = :ITEM_NAME," +
+            "ITEM_NAME_HOSP = :ITEM_NAME_HOSP,CREATE_TIME=:CREATE_TIME";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Integer startRows = 0;
+        Integer endRows = 1000;
+        String sql = "select * from v_material_items where rownum>=%s and rownum<%s ";
+        while (true) {
+            log.info("开始同步v_material_items数据 startRows:{} endRows:{}", startRows, endRows);
+            Map<String, Object> paramMap = new HashMap<>();
+
+
+            sql = String.format(sql, startRows, endRows);
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("v_material_items 开始rownum:{} 结束rownum:{} 没有的数据,停止同步", startRows, endRows);
+                return;
+            }
+            startRows = startRows + endRows;
+            endRows = endRows + 1000;
+        }
+
+
+    }
+
+
+//    @Async("commonTaskAsyncPool")
+//    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
+//        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
+//    }
+}

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

@@ -0,0 +1,76 @@
+//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.HospitalizatioSettleDetail;
+//import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+//import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+//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_medical_insJob implements Job {
+//
+//    @Autowired
+//    XCFYDataTransferService xcfyDataTransferService;
+//    @Autowired
+//    IHospitalizatioSettleDetailService hospitalizatioSettleDetailService;
+//
+//    @Override
+//    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+//        while(true) {
+//            log.info("开始同步v_medical_ins数据");
+//            String whereSql = "";
+//            Long hsdId = getLastId();
+//            log.info("开始同步v_medical_ins数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+//            Map<String,Object> paramMap = new HashMap<>();
+//            if(null != hsdId && hsdId>0){
+//                whereSql = "and ID>:ID";
+//                paramMap.put("ID", hsdId);
+//            }
+//
+//            String sql = "select * from v_hospitalizatio_settle_detail where rownum<1000 %s";
+//            sql = String.format(sql, whereSql);
+////        String insertSql = "INSERT INTO `hospitalizatio_settle_detaill` (`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)";
+//
+//            String insertSql = "INSERT INTO hospitalizatio_settle_detail (id, hisid, patient_id, zyh, hospital_id, p_category, categories_items, usage_date, discharge_dept_id, discharge_dept_name, item_id, item_name, item_id_hosp, item_name_hosp, drug_spec, dosage_form, package_unit, unit_price, num, cost, use_day, bmi_convered_amount, bmi_pay_amount, individual_payment_amount, amount_refusal, amount_reason, discharge_medication, refund_falge, refund_date, p_type, p_type_pct, create_time, create_by) VALUES (:ID,:HISID,:PATIENT_ID,:ZYH,:HOSPITAL_ID,:P_CATEGORY,:CATEGORIES_ITEMS,:USAGE_DATE,:DISCHARGE_DEPT_ID,:DISCHARGE_DEPT_NAME,:ITEM_ID,:ITEM_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:DRUG_SPEC,:DOSAGE_FORM,:PACKAGE_UNIT,:UNIT_PRICE,:NUM,:COST,:USE_DAY,:BMI_CONVERED_AMOUNT,:BMI_PAY_AMOUNT,:INDIVIDUAL_PAYMENT_AMOUNT,:AMOUNT_REFUSAL,:AMOUNT_REASON,:DISCHARGE_MEDICATION,:REFUND_FALGE,:REFUND_DATE,:P_TYPE,:P_TYPE_PCT,:CREATE_TIME,:CREATE_BY)";
+//            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("HISID", dataMap.get("ID").toString());
+//                    dataMap.put("NOW", new Date());
+//                }
+//            });
+//            if(count<=0){
+//                return;
+//            }
+//        }
+//
+//    }
+//
+//    public Long getLastId(){
+//        List<HospitalizatioSettleDetail> masterAdmissionBillList = hospitalizatioSettleDetailService.lambdaQuery().orderByDesc(HospitalizatioSettleDetail::getId).last("limit 1").list();
+//        if(CollectionUtil.isEmpty(masterAdmissionBillList)){
+//            return null;
+//        }
+//        return masterAdmissionBillList.get(0).getId();
+//    }
+//
+////    @Async("commonTaskAsyncPool")
+////    public void statictisRuleByRuleEngine(MedicalInsRuleInfo medicalInsRuleInfo) {
+////        ruleEngine.runStatictisEngine(new HashMap<>(), medicalInsRuleInfo);
+////    }
+//}

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

@@ -0,0 +1,69 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 药品目录映射关系同步,目前增量同步,后期看运行情况
+ * 一个月执行一次
+ */
+@Slf4j
+public class XCFYDatav_medical_insurance_drugsJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO medical_insurance_drugs (id, medicine_code, medicine_name, item_id_hosp, item_name_hosp, item_type, dosage_form, drug_spec, medication_method, drug_use_total, percentage_payment, p_type_pct, p_category, remarks, price, single_dose_number, celling_price, tertiary_hosp_price, two_hosp_price, one_hosp_price, create_time, create_by, retirement_price) " +
+            "VALUES (:ID,:MEDICINE_CODE,:MEDICINE_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:ITEM_TYPE,:DOSAGE_FORM,:DRUG_SPEC,:MEDICATION_METHOD,:DRUG_USE_TOTAL,:PERCENTAGE_PAYMENT,:P_TYPE_PCT,:P_CATEGORY,:REMARKS,:PRICE,:SINGLE_DOSE_NUMBER,:CELLING_PRICE,:TERTIARY_HOSP_PRICE,:TWO_HOSP_PRICE,:ONE_HOSP_PRICE,:CREATE_TIME,:CREATE_BY,:RETIREMENT_PRICE)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from v_medical_insurance_drugs where rownum<1000 %s";
+        while (true) {
+            log.info("开始同步v_medical_insurance_drugs数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步v_medical_insurance_drugs数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String, Object> paramMap = new HashMap<>();
+            if (null != hsdId && hsdId > 0) {
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
+            }
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("v_medical_insurance_drugs 大于ID:{} 没有的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId() {
+        Long id = jdbcTemplate.queryForObject("select max(id) as id from medical_insurance_drugs", Long.class);
+        return id;
+    }
+
+
+}

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

@@ -0,0 +1,76 @@
+package org.jeecg.modules.medical.job;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.medical.afterwaring.XCFYDataTransferService;
+import org.jeecg.modules.medical.ruleengine.TransferDataCallFunction;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 门诊结算明细 增量同步
+ * 执行频率:每天执行24次,每小时执行一次
+ */
+@Slf4j
+public class XCFYDatav_outpatient_settle_detailsJob implements Job {
+
+    @Autowired
+    XCFYDataTransferService xcfyDataTransferService;
+    @Autowired
+    JdbcTemplate jdbcTemplate;
+
+    String insertSql = "INSERT INTO outpatient_settlement_details (id, hisid, visit_no, patient_id, hospital_id, " +
+            "usage_date, item_id, item_name, item_id_hosp, item_name_hosp, drug_spec, dosage_form, package_unit," +
+            " unit_price, num, cost, use_day, categories_items, bmi_convered_amount, bmi_pay_amount, " +
+            "individual_payment_amount, amount_refusal, amount_reason, expense_category, change_class, " +
+            "refund_falge, refund_date, p_category, create_time, create_by, p_type_pct) " +
+            "VALUES (:ID,:HISID,:VISIT_NO,:PATIENT_ID,:HOSPITAL_ID,:USAGE_DATE,:ITEM_ID," +
+            ":ITEM_NAME,:ITEM_ID_HOSP,:ITEM_NAME_HOSP,:DRUG_SPEC,:DOSAGE_FORM,:PACKAGE_UNIT," +
+            ":UNIT_PRICE,:NUM,:COST,:USE_DAY,:CATEGORIES_ITEMS,:BMI_CONVERED_AMOUNT,:BMI_PAY_AMOUNT," +
+            ":INDIVIDUAL_PAYMENT_AMOUNT,:AMOUNT_REFUSAL,:AMOUNT_REASON,:EXPENSE_CATEGORY,:CHANGE_CLASS," +
+            ":REFUND_FALGE,:REFUND_DATE,:P_CATEGORY,:CREATE_TIME,:CREATE_BY,:P_TYPE_PCT)";
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String sql = "select * from v_outpatient_settle_details where rownum<1000 %s";
+        while (true) {
+            log.info("开始同步v_outpatient_settle_details数据");
+            String whereSql = "";
+            Long hsdId = getLastId();
+            log.info("开始同步v_outpatient_settle_details数据,获取上个同步记录访问最大主键ID:{}", hsdId);
+            Map<String, Object> paramMap = new HashMap<>();
+            if (null != hsdId && hsdId > 0) {
+                whereSql = "and ID>:ID";
+                paramMap.put("ID", hsdId);
+            }
+
+
+            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("CREATE_TIME", new Date());
+                }
+            });
+            if (count <= 0) {
+                log.info("v_outpatient_settle_details 大于ID:{} 没有的数据,停止同步", hsdId);
+                return;
+            }
+        }
+
+    }
+
+    public Long getLastId() {
+        Long id = jdbcTemplate.queryForObject("select max(id) as id from outpatient_settle_details", Long.class);
+        return id;
+    }
+
+
+}