Browse Source

事后规则匹配优化

0027005599 1 year ago
parent
commit
455f6f6aef

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

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -312,15 +313,15 @@ public class AfterIncidentDetailLog implements Serializable {
 	@Excel(name = "医保诊断编码;", width = 15)
     @ApiModelProperty(value = "医保诊断编码;")
     @TableField("medical_diagnose_code")
-    @JsonProperty("medical_diagnose_code")
-    @JSONField(name = "medical_diagnose_code")
+    @JsonProperty("medicalDiagnoseCodeStr")
+    @JSONField(name = "medicalDiagnoseCodeStr")
     private java.lang.String medicalDiagnoseCodeStr;
 	/**医保诊断描述;*/
 	@Excel(name = "医保诊断描述;", width = 15)
     @ApiModelProperty(value = "医保诊断描述;")
     @TableField("medical_diagnose_desc")
-    @JsonProperty("medical_diagnose_desc")
-    @JSONField(name = "medical_diagnose_desc")
+    @JsonProperty("medicalDiagnoseNameStr")
+    @JSONField(name = "medicalDiagnoseNameStr")
     private java.lang.String medicalDiagnoseNameStr;
 	/**状态;WAITING,DEALING,SUCCESS,FAIL*/
 	@Excel(name = "状态;WAITING,DEALING,SUCCESS,FAIL", width = 15)

+ 1 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/AfterWaringJob.java

@@ -39,8 +39,7 @@ public class AfterWaringJob {
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         QueryWrapper<AfterIncidentLog> queryWrapper = new QueryWrapper();
         queryWrapper.eq("state", Constant.WATING);
-//        long count = afterIncidentLogService.count(queryWrapper);
-//        if (count > 0) {
+
         queryWrapper.last(" limit 1000");
         List<AfterIncidentLog> afterIncidentLogList = afterIncidentLogService.list(queryWrapper);
         if (CollectionUtil.isNotEmpty(afterIncidentLogList)) {
@@ -52,7 +51,6 @@ public class AfterWaringJob {
             log.error("没有待处理的事后工单记录");
         }
 
-//        }
     }
 
 

+ 2 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/AfterWaringLogJob.java

@@ -76,7 +76,7 @@ public class AfterWaringLogJob implements Job {
 
             afterIncidentDetailLog.setAfterIncidentLogId(afterIncidentLog.getId());
             afterIncidentDetailLog.setMedicalDiagnoseNameStr(masterAdmissionBill.getYbAdmissionDiseaseName());
-            afterIncidentDetailLog.setMedicalDiagnoseCodeStr(masterAdmissionBill.getYbAdmissionDiseaseId());
+            afterIncidentDetailLog.setMedicalDiagnoseCodeStr(masterAdmissionBill.getYbAdmissionDiseaseId().trim());
             afterIncidentDetailLog.setAmount(hospitalizatioSettleDetail.getCost());
 
             if (StringUtils.isNotBlank(hospitalizatioSettleDetail.getItemId())) {
@@ -107,7 +107,7 @@ public class AfterWaringLogJob implements Job {
             afterIncidentDetailLog.setChangeClass(hospitalizatioSettleDetail.getPType());
 //            afterIncidentDetailLog.setInspectionSite();
             afterIncidentDetailLog.setOutHospDate(masterAdmissionBill.getDischargeDate());
-            afterIncidentDetailLog.setDiagnoseCodeStr(masterAdmissionBill.getDischargeDiseaseIdMain());
+            afterIncidentDetailLog.setDiagnoseCodeStr(masterAdmissionBill.getDischargeDiseaseIdMain().trim());
             afterIncidentDetailLog.setDiagnoseNameStr(masterAdmissionBill.getDischargeDiseaseNameMain());
             afterIncidentDetailLog.setMedicalInsuranceMark(masterAdmissionBill.getPayMethod());
             afterIncidentDetailLog.setMedicalSpecification(hospitalizatioSettleDetail.getDrugSpec());

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

@@ -112,6 +112,10 @@ public class FactorEnchangeFactory {
     }
 
     public boolean runFactorEnchange(Integer medicalInfoRuleInfoId, MedicalInsRuleInfo medicalInsRuleInfo, Object audit, Map<String, Object> localMap, List<RuleFactorRela> ruleFactorRelaList, List<FactorEnchance> factorEnchanceList, List<Map<String, Object>> itemList) {
+        if(CollectionUtil.isEmpty(factorEnchanceList)) {
+            log.error("工单记录:{} 匹配到的规则ID:{} 未配置处理流程-请到规则配置管理页面配置医保规则对应处理流程", audit, medicalInfoRuleInfoId);
+            return false;
+        }
         Map<Integer, FactorEnchance> factorEnchanceMap = factorEnchanceList.stream().collect(Collectors.toMap(FactorEnchance::getId, v -> v, (v1, v2) -> v1));
         boolean result = false;
         for (RuleFactorRela ruleFactorRela : ruleFactorRelaList) {

+ 11 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/ruleengine/RuleEngine.java

@@ -133,6 +133,7 @@ public class RuleEngine {
     IMedicalInsuranceDrugsService medicalInsuranceDrugsService;
     @Autowired
     IDiagnoseItemsService diagnoseItemsService;
+
     @Value("${cache.auto:false}")
     private Boolean cacheAutoInit;
 
@@ -643,9 +644,14 @@ public class RuleEngine {
             Set<String> auditDetailSet = new HashSet<>();
             Set<Integer> medicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
             if (CollectionUtil.isEmpty(medicalInsRuleInfoIdList)) {
-                log.error("项目编码未匹配到对应的医保规则:{}", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
-
-                return;
+                log.error("项目编码未匹配到对应的医保规则:{} 再次从数据库检索", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
+                List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
+                if(CollectionUtil.isEmpty(medicalInsRuleProjectList)){
+                    log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据,退出规则执行", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
+                    return;
+                }
+                medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
+                log.info("数据库检索到匹配规则ID列表:{}", medicalInsRuleInfoIdList);
             }
             Object diagnose = itemMap.get(Constant.MEDICAL_DIAGNOSE_CODE_KEY);
             if (null != diagnose) {
@@ -758,7 +764,7 @@ public class RuleEngine {
         advanceWarningAudit.setMedicalDeptName(advanceWarningVO.getMedical_dept_name());
         advanceWarningAudit.setPatientId(advanceWarningVO.getPatient_id());
         advanceWarningAudit.setPatientName(advanceWarningVO.getPatient_name());
-        advanceWarningAudit.setNoticeType("事前提醒");
+        advanceWarningAudit.setNoticeType("before");
         advanceWarningAudit.setTreatmentType(advanceWarningVO.getVisit_type());
 
         advanceWarningAuditService.save(advanceWarningAudit);
@@ -779,7 +785,7 @@ public class RuleEngine {
         midIncidentAudit.setPatientName(midIncidentWarningVO.getPatient_name());
         midIncidentAudit.setTreatmentType(midIncidentWarningVO.getVisit_type());
         midIncidentAudit.setPrescriptionNumber(midIncidentWarningVO.getDoctor_advice_no());
-        midIncidentAudit.setNoticeType("事中预警");
+        midIncidentAudit.setNoticeType("middle");
         midIncidentAudit.setAmount((double) 0);
         midIncidentAudit.setDoctorLevel(midIncidentWarningVO.getDoctor_level());
         midIncidentAudit.setPatientAge(midIncidentWarningVO.getPatient_age().toString());

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IMedicalInsRuleProjectService.java

@@ -33,4 +33,18 @@ public interface IMedicalInsRuleProjectService extends IService<MedicalInsRulePr
      * @return
      */
     List<MedicalInsRuleProject> loadDbExistsList(List<MedicalInsRuleProject> list, ExportRuleTitleDTO exportRuleTitle, Integer ruleId);
+
+    /**
+     * 根据医保编码模糊匹配规则
+     * @param medicalProjectCode
+     * @return
+     */
+    List<MedicalInsRuleProject> getRuleProjectByMedicalProjectCode(String medicalProjectCode);
+
+    /**
+     * 根据诊断编码模糊匹配规则
+     * @param medicalDiagnoseCode
+     * @return
+     */
+    List<MedicalInsRuleProject> getRuleProjectByMedicalDiagnoseCode(String medicalDiagnoseCode);
 }

+ 19 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/MedicalInsRuleProjectServiceImpl.java

@@ -17,6 +17,7 @@ import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.system.vo.MedicalDto;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.medical.Constant;
 import org.jeecg.modules.medical.common.ExcelImportUtilService;
 import org.jeecg.modules.medical.common.bo.ExportRuleFieldDTO;
 import org.jeecg.modules.medical.common.bo.ExportRuleTitleDTO;
@@ -626,6 +627,24 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
         return this.list(queryWrapper);
     }
 
+    @Override
+    public List<MedicalInsRuleProject> getRuleProjectByMedicalProjectCode(String medicalProjectCode) {
+        QueryWrapper<MedicalInsRuleProject> queryWrapper = new QueryWrapper<MedicalInsRuleProject>();
+        queryWrapper.eq("STATE", Constant.EFF_STATE);
+        queryWrapper.last(" and (INSTR('"+medicalProjectCode+"',project_code) or INSTR('"+medicalProjectCode+"',correlation_project_code)) ");
+
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public List<MedicalInsRuleProject> getRuleProjectByMedicalDiagnoseCode(String medicalDiagnoseCode) {
+        QueryWrapper<MedicalInsRuleProject> queryWrapper = new QueryWrapper<MedicalInsRuleProject>();
+        queryWrapper.eq("STATE", Constant.EFF_STATE);
+        queryWrapper.last(" and (INSTR('"+medicalDiagnoseCode+"',project_code) or INSTR('"+medicalDiagnoseCode+"',correlation_project_code)) ");
+
+        return this.list(queryWrapper);
+    }
+
     public static void main(String[] args) {
 //        String role = "a,b,c";
 //        System.out.println(role.indexOf("a") > -1);

+ 9 - 0
jeecg-module-system/jeecg-system-start/src/test/java/org/jeecg/AfterwardsAuditDataTest.java

@@ -10,6 +10,7 @@ import org.jeecg.modules.medical.entity.AfterIncidentDetailLog;
 import org.jeecg.modules.medical.entity.AfterwardsAudit;
 import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
 import org.jeecg.modules.medical.entity.MedicalInsRuleInfo;
+import org.jeecg.modules.medical.entity.MedicalInsRuleProject;
 import org.jeecg.modules.medical.entity.SttlMasterBill;
 import org.jeecg.modules.medical.entity.SttlMasterDetailBill;
 import org.jeecg.modules.medical.job.AfterWaringJob;
@@ -117,6 +118,14 @@ public class AfterwardsAuditDataTest {
     IAfterIncidentDetailLogService afterIncidentDetailLogService;
     @Autowired
     ISysDictService sysDictService;
+//    @Autowired
+//    IMedicalInsRuleProjectService medicalInsRuleProjectService;
+    @Test
+    public void testProjectCode(){
+        List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode("C17040122300004123asfsdf");
+        System.out.println(medicalInsRuleProjectList);
+    }
+
     @Test
     public void testDD(){
         List<DictModel> cateGoriesList = sysDictService.getDictItems(Constant.DICT_CATEGORIES_ITEMS_KEY);