Explorar o código

解决规则跑数据插件入参数问题

0027005599 %!s(int64=2) %!d(string=hai) anos
pai
achega
43dd01b1b7

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

@@ -186,6 +186,9 @@ public class FactorEnchangeFactory {
         List<FactorAttrRela> factorAttrRelaList = factorEnhanceIdAndListMap.get(factorEnchanceId);
 //        Map<Integer, List<FactorAttrRela>> ioTypeMap = new HashMap<>();
 //        if (CollectionUtil.isNotEmpty(factorAttrRelaList)) {
+        if(CollectionUtil.isEmpty(factorAttrRelaList)){
+            return new HashMap<>();
+        }
         Map<Integer, List<FactorAttrRela>> ioTypeMap = factorAttrRelaList.stream().collect(Collectors.groupingBy(FactorAttrRela::getIoType));
 //        }
 

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

@@ -783,35 +783,24 @@ public class RuleEngine {
             String jsonStr = JSON.toJSONString(afterIncidentDetailLog);
             log.info("事后处理日志:{}", jsonStr);
             JSONObject itemMap = JSON.parseObject(jsonStr);
-            Set<Integer> medicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
-            List<MedicalInsRuleProject> medicalInsRuleProjectList = null;
-            if (CollectionUtil.isEmpty(medicalInsRuleInfoIdList)) {
-                log.error("项目编码未匹配到对应的医保规则:{} 再次从数据库检索", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
-                medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
-                if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
-                    log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
-                } else {
-                    medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
-                    log.info("数据库检索到匹配规则ID列表:{}", medicalInsRuleInfoIdList);
-                }
+            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));
             } else {
-                medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndProjectCode(new ArrayList<>(medicalInsRuleInfoIdList), itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
+                Set<Integer> medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
+                log.info("项目编码:{} 数据库检索到匹配规则ID列表:{}", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY), medicalInsRuleInfoIdList);
             }
+
             Object diagnose = itemMap.get(Constant.MEDICAL_DIAGNOSE_CODE_KEY);
             if (null != diagnose) {
                 //获取诊断编码配置的规则ID,加入需要执行的规则
-                Set<Integer> diagnoseMedicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(diagnose.toString());
-                List<MedicalInsRuleProject> medicalInsRuleProjectTempList = null;
-                if (CollectionUtil.isEmpty(diagnoseMedicalInsRuleInfoIdList)) {
-                    medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
-                    if (CollectionUtil.isEmpty(medicalInsRuleProjectTempList)) {
-                        log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
-                    }
-                    Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
-                    log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
-                } else {
-                    medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndDiagCode(new ArrayList<>(diagnoseMedicalInsRuleInfoIdList), diagnose.toString());
+                List<MedicalInsRuleProject> medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
+                if (CollectionUtil.isEmpty(medicalInsRuleProjectTempList)) {
+                    log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
                 }
+                Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
+                log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
+
                 if (CollectionUtil.isNotEmpty(medicalInsRuleProjectTempList)) {
                     if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
                         medicalInsRuleProjectList = new ArrayList<>();
@@ -838,7 +827,7 @@ public class RuleEngine {
                 return;
             }
             Map<Integer, List<MedicalInsRuleProject>> ruleAndProjectMap = medicalInsRuleProjectList.stream().collect(Collectors.groupingBy(MedicalInsRuleProject::getMedicalInsRuleInfoId));
-            log.info("明细记录ID:{} 匹配到规则:{}", afterIncidentDetailLog.getId(), ruleAndProjectMap.keySet());
+            log.info("明细记录ID:{} 项目编码:{} 匹配到规则:{}", afterIncidentDetailLog.getId(), itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY), ruleAndProjectMap.keySet());
             for (Integer medicalInsRuleInfoId : ruleAndProjectMap.keySet()) {
                 List<String> medicalInsCorrProjectCodeList = ruleAndProjectMap.get(medicalInsRuleInfoId).stream().map(MedicalInsRuleProject::getCorrelationProjectCode).collect(Collectors.toList());
                 MedicalInsRuleProject medicalInsRuleProject = ruleAndProjectMap.get(medicalInsRuleInfoId).get(0);

+ 3 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/ruleengine/SPELUtil.java

@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.modules.medical.ColumnTypeEnum;
 import org.jeecg.modules.medical.Constant;
+import org.jeecg.modules.medical.SystemEventAttrConstant;
 import org.jeecg.modules.medical.common.CommonUtil;
 import org.jeecg.modules.medical.entity.EventAttr;
 import org.jeecg.modules.medical.entity.FactorCondRela;
@@ -145,8 +146,8 @@ public class SPELUtil {
             contentMap.put(Constant.SPEL_LOG, getCondStrAndParam(condStr, condStrParamName, contentMap) + " " + e.getMessage());
             throw new Exception("执行失败el表达式:" + condStr);
         }
-        log.info("执行语句:{} 执行结果:{}  ", condStr, defResult);
-        log.info("执行语句:{} 执行结果:{} ", getCondStrAndParam(condStr, condStrParamName, contentMap), defResult);
+        log.info("项目编码:{} 执行语句:{} 执行结果:{}  ", contentMap.getOrDefault(SystemEventAttrConstant.MEDICAL_PROJECT_CODE_KEY, "无项目编码"), condStr, defResult);
+        log.info("项目编码:{} 执行语句:{} 执行结果:{} ", contentMap.getOrDefault(SystemEventAttrConstant.MEDICAL_PROJECT_CODE_KEY, "无项目编码"), getCondStrAndParam(condStr, condStrParamName, contentMap), defResult);
         contentMap.put(Constant.SPEL_LOG, getCondStrAndParam(condStr, condStrParamName, contentMap) + " " + defResult);
         return defResult;
     }