Просмотр исходного кода

新增违规描述动态变量替换功能

0027005599 1 год назад
Родитель
Сommit
b860635aeb

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

@@ -205,4 +205,14 @@ public class Constant {
      * 事后监管提醒类规则id列表
      */
     public static final String DICT_AFTER_ADVANCE_RULE_ID_LIST_KEY = "AFTER_ADVANCE_RULE_ID_LIST";
+
+    /**
+     * 错误描述A和B设置的参数变量
+     */
+    public static final String ADESC = "AProject";
+
+    /**
+     * 错误描述A和B设置的参数变量
+     */
+    public static final String BDESC = "BProject";
 }

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

@@ -1,7 +1,6 @@
 package org.jeecg.modules.medical.ruleengine;
 
 import cn.hutool.core.collection.CollectionUtil;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +12,6 @@ import org.jeecg.modules.medical.EnchanceTypeEnum;
 import org.jeecg.modules.medical.SystemEventAttrConstant;
 import org.jeecg.modules.medical.entity.AdvanceWarningAudit;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
-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.EventAttr;
@@ -95,6 +93,8 @@ public class FactorEnchangeFactory {
 
     public Map<Integer, List<FactorAttrRela>> factorEnhanceIdAndListMap = new HashMap<>();
 
+    public static ThreadLocal<Map<String, Object>> currentThreadLocalMap = new ThreadLocal<>();
+
     public void init() {
         log.info("进入初始化FactorEnchangeFactory");
         List<EventAttr> eventAttrList = eventAttrService.lambdaQuery().eq(EventAttr::getDelFlag, CommonConstant.DEL_FLAG_0).list();
@@ -119,62 +119,67 @@ 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) throws Exception {
-        if(CollectionUtil.isEmpty(factorEnchanceList)) {
+        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) {
-            Integer factorEnchanceId = ruleFactorRela.getFactorEnhanceId();
-            FactorEnchance factorEnchance = factorEnchanceMap.get(factorEnchanceId);
-            if (null == factorEnchance) {
-                continue;
-            }
+        try {
+            localMap.put(Constant.ADESC, localMap.getOrDefault(SystemEventAttrConstant.MEDICAL_PROJECT_NAME_KEY,""));
+            currentThreadLocalMap.set(localMap);
+            for (RuleFactorRela ruleFactorRela : ruleFactorRelaList) {
+                Integer factorEnchanceId = ruleFactorRela.getFactorEnhanceId();
+                FactorEnchance factorEnchance = factorEnchanceMap.get(factorEnchanceId);
+                if (null == factorEnchance) {
+                    continue;
+                }
 
-            EnchanceTypeEnum enchanceTypeEnum = EnchanceTypeEnum.getType(factorEnchance.getEnhanceType());
-            switch (enchanceTypeEnum) {
-                case SQL:
-                    Map<Integer, List<FactorAttrRela>> ioTypeMap = getIoMap(factorEnchanceId);
-                    sqlUtil.setSqlResultByFactorEnchance(localMap, ioTypeMap, factorEnchance, medicalInfoRuleInfoId);
-                    break;
-                case EXPRESSION:
+                EnchanceTypeEnum enchanceTypeEnum = EnchanceTypeEnum.getType(factorEnchance.getEnhanceType());
+                switch (enchanceTypeEnum) {
+                    case SQL:
+                        Map<Integer, List<FactorAttrRela>> ioTypeMap = getIoMap(factorEnchanceId);
+                        sqlUtil.setSqlResultByFactorEnchance(localMap, ioTypeMap, factorEnchance, medicalInfoRuleInfoId);
+                        break;
+                    case EXPRESSION:
 //                    setLogicalExpressionResultByFactorEnchance(localMap, ioTypeMap, factorEnchance, medicalInfoRuleInfoId);
-                    break;
-                case DICT:
-                    dictUtil.transferData(localMap, factorEnchance, medicalInfoRuleInfoId);
-                    break;
-                case PLUGIN:
-                    Map<Integer, List<FactorAttrRela>> ioTypeMap1 = getIoMap(factorEnchanceId);
-                    PluginInterface pluginInterface = (PluginInterface) SpringContextUtils.getBean(factorEnchance.getEnhanceValue());
-                    pluginInterface.plugin(localMap, ioTypeMap1, factorEnchance, medicalInfoRuleInfoId);
-                    break;
-                case CONSTANT:
-                    localMap.put(getParamName(factorEnchance.getEventAttrId()), factorEnchance.getExtAttr1());
-                    break;
-                case LOGICAL_EXPRESSION:
-//                    Map<Integer, List<FactorAttrRela>> ioTypeMap2 = getIoMap(factorEnchanceId);
-                    result = setLogicalExpressionResultByFactorEnchance(localMap, factorEnchance);
-                    if (Constant.WARING_EVENT_ATTR_ID == factorEnchance.getEventAttrId()) {
-                        if (result) {
-                            insertWarningDetail(localMap, medicalInsRuleInfo, audit, itemList);
+                        break;
+                    case DICT:
+                        dictUtil.transferData(localMap, factorEnchance, medicalInfoRuleInfoId);
+                        break;
+                    case PLUGIN:
+                        Map<Integer, List<FactorAttrRela>> ioTypeMap1 = getIoMap(factorEnchanceId);
+                        PluginInterface pluginInterface = (PluginInterface) SpringContextUtils.getBean(factorEnchance.getEnhanceValue());
+                        pluginInterface.plugin(localMap, ioTypeMap1, factorEnchance, medicalInfoRuleInfoId);
+                        break;
+                    case CONSTANT:
+                        localMap.put(getParamName(factorEnchance.getEventAttrId()), factorEnchance.getExtAttr1());
+                        break;
+                    case LOGICAL_EXPRESSION:
+                        result = setLogicalExpressionResultByFactorEnchance(localMap, factorEnchance);
+                        if (Constant.WARING_EVENT_ATTR_ID == factorEnchance.getEventAttrId()) {
+                            if (result) {
+                                insertWarningDetail(localMap, medicalInsRuleInfo, audit, itemList);
+                            }
+                        } else {
+                            localMap.put(getParamName(factorEnchance.getEventAttrId()), result);
                         }
-                    } else {
-                        localMap.put(getParamName(factorEnchance.getEventAttrId()), result);
-                    }
-                    break;
-                case PROPERTIES:
-                    Object valueTemp = localMap.get(getParamName(Integer.parseInt(factorEnchance.getExtAttr1())));
-                    if (null == valueTemp) {
-                        log.error("要素提取:{} 规则ID:{} 常量赋值:{} 配置的属性:{}无值", factorEnchance.getId(), medicalInfoRuleInfoId, factorEnchance.getRuleEnchanceName(), factorEnchance.getExtAttr1());
-                    } else {
-                        localMap.put(getParamName(factorEnchance.getEventAttrId()), valueTemp);
-                    }
-                    break;
-                default:
-                    log.error("有配置的未处理类型");
-                    break;
+                        break;
+                    case PROPERTIES:
+                        Object valueTemp = localMap.get(getParamName(Integer.parseInt(factorEnchance.getExtAttr1())));
+                        if (null == valueTemp) {
+                            log.error("要素提取:{} 规则ID:{} 常量赋值:{} 配置的属性:{}无值", factorEnchance.getId(), medicalInfoRuleInfoId, factorEnchance.getRuleEnchanceName(), factorEnchance.getExtAttr1());
+                        } else {
+                            localMap.put(getParamName(factorEnchance.getEventAttrId()), valueTemp);
+                        }
+                        break;
+                    default:
+                        log.error("有配置的未处理类型");
+                        break;
+                }
             }
+        } finally {
+            currentThreadLocalMap.remove();
         }
         return result;
     }
@@ -186,7 +191,7 @@ public class FactorEnchangeFactory {
         List<FactorAttrRela> factorAttrRelaList = factorEnhanceIdAndListMap.get(factorEnchanceId);
 //        Map<Integer, List<FactorAttrRela>> ioTypeMap = new HashMap<>();
 //        if (CollectionUtil.isNotEmpty(factorAttrRelaList)) {
-        if(CollectionUtil.isEmpty(factorAttrRelaList)){
+        if (CollectionUtil.isEmpty(factorAttrRelaList)) {
             return new HashMap<>();
         }
         Map<Integer, List<FactorAttrRela>> ioTypeMap = factorAttrRelaList.stream().collect(Collectors.groupingBy(FactorAttrRela::getIoType));
@@ -231,6 +236,15 @@ public class FactorEnchangeFactory {
         advanceWarningAuditDetailService.save(advanceWarningAuditDetail);
     }
 
+    /**
+     * 生成违规描述
+     *
+     * @param itemMap
+     * @return
+     */
+//    public String genDescription(Map<String,Object> itemMap, String prescription){
+//
+//    }
     public void insertAfterWarningDetail(Map<String, Object> itemMap, MedicalInsRuleInfo medicalInsRuleInfo, AfterwardsAudit afterwardsAudit, List<Map<String, Object>> itemList) {
 
         if (Constant.VALIDATION_HANDER_METHOD_RETURN.equals(medicalInsRuleInfo.getViolationHandingMethod())) {
@@ -259,7 +273,8 @@ public class FactorEnchangeFactory {
                 afterwardsAuditDetail.setMedicalInsRuleInfoCode(medicalInsRuleInfo.getRuleCode());
                 afterwardsAuditDetail.setMedicalInsRuleInfoId(medicalInsRuleInfo.getId());
                 afterwardsAuditDetail.setMedicalInsRuleInfoName(medicalInsRuleInfo.getRuleName());
-                afterwardsAuditDetail.setDescription(medicalInsRuleInfo.getViolationDesc());
+                String desc = getDesc(medicalInsRuleInfo, itemMap);
+                afterwardsAuditDetail.setDescription(desc);
                 afterwardsAuditDetail.setOutpatientNumber(afterwardsAudit.getOutpatientNumber());
                 afterwardsAuditDetail.setPrescriptionNumber(afterwardsAudit.getPrescriptionNumber());
 
@@ -273,8 +288,8 @@ public class FactorEnchangeFactory {
                 afterwardsAuditDetail.setCreateBy("auto");
                 afterwardsAuditDetail.setQuantity(otherMap.get(SystemEventAttrConstant.QUANTITY) != null ? Integer.parseInt(otherMap.get(SystemEventAttrConstant.QUANTITY).toString()) : 1);
                 afterwardsAuditDetail.setMedicalInsuranceMark(otherMap.get(Constant.MEDICAL_INSURANCE_MARK_KEY) != null ? otherMap.get(Constant.MEDICAL_INSURANCE_MARK_KEY).toString() : "0");
-                afterwardsAuditDetail.setAfterIncidentDetailLogId((Integer)itemMap.get(SystemEventAttrConstant.ITEMMAP_AFTER_INCIDENT_DETAIL_LOG_ID));
-                afterwardsAuditDetail.setMedicalInsRuleInfoId((Integer)itemMap.get(SystemEventAttrConstant.MEDICAL_INS_RULE_PROJECT_ID));
+                afterwardsAuditDetail.setAfterIncidentDetailLogId((Integer) itemMap.get(SystemEventAttrConstant.ITEMMAP_AFTER_INCIDENT_DETAIL_LOG_ID));
+                afterwardsAuditDetail.setMedicalInsRuleInfoId((Integer) itemMap.get(SystemEventAttrConstant.MEDICAL_INS_RULE_PROJECT_ID));
                 afterwardsAuditDetailList.add(afterwardsAuditDetail);
 
             }
@@ -302,7 +317,8 @@ public class FactorEnchangeFactory {
             afterwardsAuditDetail.setMedicalInsRuleInfoCode(medicalInsRuleInfo.getRuleCode());
             afterwardsAuditDetail.setMedicalInsRuleInfoId(medicalInsRuleInfo.getId());
             afterwardsAuditDetail.setMedicalInsRuleInfoName(medicalInsRuleInfo.getRuleName());
-            afterwardsAuditDetail.setDescription(medicalInsRuleInfo.getViolationDesc());
+            String desc = getDesc(medicalInsRuleInfo, itemMap);
+            afterwardsAuditDetail.setDescription(desc);
             afterwardsAuditDetail.setOutpatientNumber(afterwardsAudit.getOutpatientNumber());
             afterwardsAuditDetail.setPrescriptionNumber(afterwardsAudit.getPrescriptionNumber());
 //            afterwardsAuditDetail.setReminderLevel();
@@ -314,8 +330,8 @@ public class FactorEnchangeFactory {
             afterwardsAuditDetail.setAfterwardsAuditId(afterwardsAudit.getId());
             afterwardsAuditDetail.setMedicalInsuranceMark(itemMap.get(Constant.MEDICAL_INSURANCE_MARK_KEY) != null ? itemMap.get(Constant.MEDICAL_INSURANCE_MARK_KEY).toString() : "0");
             afterwardsAuditDetail.setPrice(itemMap.get(SystemEventAttrConstant.PRICE) != null ? new BigDecimal(itemMap.get(SystemEventAttrConstant.PRICE).toString()) : null);
-            afterwardsAuditDetail.setMedicalRuleProjectId((Integer)itemMap.get(SystemEventAttrConstant.MEDICAL_INS_RULE_PROJECT_ID));
-            afterwardsAuditDetail.setAfterIncidentDetailLogId((Integer)itemMap.get(SystemEventAttrConstant.ITEMMAP_AFTER_INCIDENT_DETAIL_LOG_ID));
+            afterwardsAuditDetail.setMedicalRuleProjectId((Integer) itemMap.get(SystemEventAttrConstant.MEDICAL_INS_RULE_PROJECT_ID));
+            afterwardsAuditDetail.setAfterIncidentDetailLogId((Integer) itemMap.get(SystemEventAttrConstant.ITEMMAP_AFTER_INCIDENT_DETAIL_LOG_ID));
             afterwardsAuditService.lambdaUpdate().setSql("amount = amount +" + amount.doubleValue()).eq(AfterwardsAudit::getId, afterwardsAudit.getId()).update();
             afterwardsAuditDetailService.save(afterwardsAuditDetail);
         }
@@ -347,17 +363,13 @@ public class FactorEnchangeFactory {
                 midIncidentAuditDetail.setMedicalInsRuleInfoCode(medicalInsRuleInfo.getRuleCode());
                 midIncidentAuditDetail.setMedicalInsRuleInfoId(medicalInsRuleInfo.getId());
                 midIncidentAuditDetail.setMedicalInsRuleInfoName(medicalInsRuleInfo.getRuleName());
-                String desc = medicalInsRuleInfo.getViolationDesc();
+                String desc = getDesc(medicalInsRuleInfo, itemMap);
                 if (otherItemMap.containsKey(Constant.PROJECT_CODE_KEY)) {
                     midIncidentAuditDetail.setProejctCode(otherItemMap.get(Constant.PROJECT_CODE_KEY).toString());
                     midIncidentAuditDetail.setProejctName(otherItemMap.get(Constant.PROJECT_NAME_KEY).toString());
                     midIncidentAuditDetail.setMedicalProjectCode(otherItemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
                     midIncidentAuditDetail.setMedicalProjectName(otherItemMap.get(Constant.MEDICAL_PROJECT_NAME_KEY).toString());
                     midIncidentAuditDetail.setProjectType(otherItemMap.getOrDefault(Constant.PROJECT_TYPE_KEY, "default").toString());
-                    Object descObject = redisTemplate.opsForHash().get(Constant.PROJECT_VOLIDATION_DESC_KEY + medicalInsRuleInfo.getId(), otherItemMap.get(Constant.MEDICAL_PROJECT_NAME_KEY).toString());
-                    if (null != descObject) {
-                        desc = descObject.toString();
-                    }
                 }
 
                 midIncidentAuditDetail.setDescription(desc);
@@ -401,7 +413,8 @@ public class FactorEnchangeFactory {
             midIncidentAuditDetail.setMedicalInsRuleInfoCode(medicalInsRuleInfo.getRuleCode());
             midIncidentAuditDetail.setMedicalInsRuleInfoId(medicalInsRuleInfo.getId());
             midIncidentAuditDetail.setMedicalInsRuleInfoName(medicalInsRuleInfo.getRuleName());
-            midIncidentAuditDetail.setDescription(medicalInsRuleInfo.getViolationDesc());
+            String desc = getDesc(medicalInsRuleInfo, itemMap);
+            midIncidentAuditDetail.setDescription(desc);
             midIncidentAuditDetail.setOutpatientNumber(midIncidentAudit.getOutpatientNumber());
             midIncidentAuditDetail.setPrescriptionNumber(midIncidentAudit.getPrescriptionNumber());
             midIncidentAuditDetail.setViolationLevel(medicalInsRuleInfo.getViolationLevel());
@@ -430,6 +443,21 @@ public class FactorEnchangeFactory {
 
     }
 
+    public String getDesc(MedicalInsRuleInfo medicalInsRuleInfo, Map<String, Object> itemMap) {
+        String desc = medicalInsRuleInfo.getViolationDesc();
+        Object descObject = redisTemplate.opsForHash().get(Constant.PROJECT_VOLIDATION_DESC_KEY + medicalInsRuleInfo.getId(), itemMap.get(Constant.MEDICAL_PROJECT_NAME_KEY).toString());
+        if (null != descObject) {
+            desc = descObject.toString();
+        }
+        if (null != desc && desc.contains("#")) {
+            Map<String,Object> itemMapTemp = currentThreadLocalMap.get();
+            Object descSpel = spelUtil.getExpressionStr(itemMapTemp, desc);
+            return descSpel.toString();
+        }
+
+        return desc;
+    }
+
 
     /**
      * 逻辑表达式
@@ -441,9 +469,9 @@ public class FactorEnchangeFactory {
         if (StringUtils.isNotBlank(factorEnchance.getEnhanceValue())) {
             List<FactorCondRela> factorCondRelaList = factorCondRelaMap.get(factorEnchance.getId());
             Set<String> condStrParamName = new HashSet<>();
-            for (FactorCondRela factorCondRela : factorCondRelaList){
+            for (FactorCondRela factorCondRela : factorCondRelaList) {
                 condStrParamName.add(enchanceAttrMap.get(factorCondRela.getEventAttrId()).getEnName());
-                if(2 == factorCondRela.getRefAttrType()){
+                if (2 == factorCondRela.getRefAttrType()) {
                     condStrParamName.add(enchanceAttrMap.get(factorCondRela.getRefEventAttrId()).getEnName());
                 }
             }
@@ -461,7 +489,7 @@ public class FactorEnchangeFactory {
                 for (FactorCondRela factorCondRela : factorCondRelaList) {
                     Set<String> condStrParamName = new HashSet<>();
                     condStrParamName.add(enchanceAttrMap.get(factorCondRela.getEventAttrId()).getEnName());
-                    if(2 == factorCondRela.getRefAttrType()){
+                    if (2 == factorCondRela.getRefAttrType()) {
                         condStrParamName.add(enchanceAttrMap.get(factorCondRela.getRefEventAttrId()).getEnName());
                     }
                     if (!StringUtils.isNotBlank(factorCondRela.getCondStr())) {

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

@@ -863,7 +863,7 @@ public class RuleEngine {
                     projectCodeList.add(medicalInsRuleProjectDiagnose.getMedicalInsProjectCode());
                 }
                 List<MedicalInsRuleProject> medicalInsRuleProjectTempList = medicalInsRuleProjectService.lambdaQuery().in(MedicalInsRuleProject::getProjectCode, projectCodeList)
-                        .in(MedicalInsRuleProject::getMedicalInsRuleInfoId, diagRuleIdList).list();
+                        .in(MedicalInsRuleProject::getMedicalInsRuleInfoId, diagRuleIdList).eq(MedicalInsRuleProject::getState, Constant.EFF_STATE).list();
                 if (CollectionUtil.isNotEmpty(medicalInsRuleProjectTempList)) {
                     Set<Integer> ruleIdSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
                     log.info("有项目编码以诊断编码为主的诊断规则 诊断编码:{} 匹配的规则id:{} ", diagnoseList, ruleIdSet);
@@ -877,7 +877,7 @@ public class RuleEngine {
             List<MedicalInsRuleProjectDiagnose> projectDiagnoseList = medicalInsRuleProjectDiagnoseService.getRuleProjectByDiagCodeAndRuleId(noProjectCodeDiagRuleIdList, diagnoseList);
             if (CollectionUtil.isNotEmpty(projectDiagnoseList)) {
                 Set<Integer> medicalRuleIdSet = projectDiagnoseList.stream().map(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId).collect(Collectors.toSet());
-                List<String> diagnoseCodeList = new ArrayList<>();
+                Set<String> diagnoseCodeList = new HashSet<>();
                 for (MedicalInsRuleProjectDiagnose medicalInsRuleProjectDiagnose : projectDiagnoseList) {
                     diagnoseCodeList.add(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode());
                 }

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

@@ -7,26 +7,26 @@ 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;
 import org.jeecg.modules.medical.service.IEventAttrService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.expression.EvaluationContext;
 import org.springframework.expression.Expression;
 import org.springframework.expression.ExpressionParser;
+import org.springframework.expression.common.TemplateParserContext;
 import org.springframework.expression.spel.standard.SpelExpressionParser;
 import org.springframework.expression.spel.support.StandardEvaluationContext;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -66,9 +66,6 @@ public class SPELUtil {
             String inKey = eventAttr.getDispArgs();
             String outKey = refEventAttr.getDispArgs();
             if (ColumnTypeEnum.ARRAY_MAP == eventColumnTypeEnum) {
-//                if (ColumnTypeEnum.ARRAY == refEventColumnTypeEnum) {
-//                    spelStr = "#isMemberLeftListObject(#" + eventAttr.getEnName() + ",#" + refEventAttr.getEnName() + ")";
-//                }else
                 if (ColumnTypeEnum.MAP == refEventColumnTypeEnum) {
                     spelStr = "#isMemberLeftMapAndRightListMap(#" + refEventAttr.getEnName() + ",#" + eventAttr.getEnName() + ",'" + outKey + "','" + inKey + "')";
                 } else {
@@ -91,9 +88,6 @@ public class SPELUtil {
             String inKey = eventAttr.getDispArgs();
             String outKey = refEventAttr.getDispArgs();
             if (ColumnTypeEnum.ARRAY_MAP == eventColumnTypeEnum) {
-//                if (ColumnTypeEnum.ARRAY == refEventColumnTypeEnum) {
-//                    spelStr = "!#isMemberLeftListObject(#" + eventAttr.getEnName() + ",#" + refEventAttr.getEnName() + ")";
-//                }
                 if (ColumnTypeEnum.MAP == refEventColumnTypeEnum) {
                     spelStr = "!#isMemberLeftMapAndRightListMap(#" + refEventAttr.getEnName() + ",#" + eventAttr.getEnName() + ",'" + outKey + "','" + inKey + "')";
                 } else {
@@ -152,9 +146,24 @@ public class SPELUtil {
         return defResult;
     }
 
+    public Object getExpressionStr(Map<String, Object> contentMap, String condStr){
+        StandardEvaluationContext ctx = new StandardEvaluationContext();
+        ctx.setVariables(contentMap);
+        return parser.parseExpression(condStr).getValue(ctx);
+    }
+
     public static String getCondStrAndParam(String condStr, Set<String> condStrParamName, Map<String, Object> itemMap) {
+        Set<String> sortSet = new TreeSet<String>(new Comparator<String>() {
+            @Override
+            public int compare(String o1, String o2) {
+                int lleng = o1.length();
+                int rleng = o2.length();
+                return rleng-lleng;//降序排列
+            }
+        });
+        sortSet.addAll(condStrParamName);
 
-        for (String condStrParam : condStrParamName) {
+        for (String condStrParam : sortSet) {
             Object replaceValue = itemMap.get(condStrParam);
             if (null == replaceValue) {
                 replaceValue = "[未找到该属性]";
@@ -218,14 +227,6 @@ public class SPELUtil {
         return false;
     }
 
-    public static Boolean isMemberLeftInt(Integer inValue, List<Integer> memberList) {
-        if (null != inValue && CollectionUtil.isNotEmpty(memberList)) {
-            if (memberList.contains(inValue)) {
-                return true;
-            }
-        }
-        return false;
-    }
 
 
     /**
@@ -258,29 +259,6 @@ public class SPELUtil {
         return false;
     }
 
-    /**
-     * inList 对象是否是 memberList成员
-     *
-     * @param inList     包含的参数
-     * @param memberList 被包含的参数主体
-     * @param key
-     * @return
-     */
-    public static Boolean isMemberLeftListObject(List<Object> inList, List<Map<String, Object>> memberList, String key) {
-        if (CollectionUtil.isNotEmpty(inList) && CollectionUtil.isNotEmpty(memberList) && StringUtils.isNotBlank(key)) {
-            List<String> memberValueList = new ArrayList<>();
-            for (Map<String, Object> itemMap : memberList) {
-                memberValueList.add(itemMap.get(key).toString());
-            }
-            for (Object inParam : inList) {
-                if (!memberValueList.contains(inParam.toString())) {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    }
 
     public static Boolean isMemberLeftMapRightListObject(Map<String, Object> inMap, List<Object> memberList, String inKey) {
         if (CollectionUtil.isNotEmpty(inMap) && CollectionUtil.isNotEmpty(memberList) && null != inKey) {
@@ -297,6 +275,7 @@ public class SPELUtil {
 
     /**
      * 简单类型比对
+     *
      * @param srcObj
      * @param memberObj
      * @return
@@ -305,16 +284,44 @@ public class SPELUtil {
 
         if (null != srcObj && null != memberObj) {
             boolean srcFlag = srcObj.toString().startsWith(memberObj.toString());
-
+            FactorEnchangeFactory.currentThreadLocalMap.get().put(Constant.ADESC, srcObj.toString());
+            FactorEnchangeFactory.currentThreadLocalMap.get().put(Constant.BDESC, memberObj.toString());
             return srcFlag;
         }
         return false;
     }
 
+    public static Boolean isMemberLeftObjectByList(Object inValue, List<Object> memberList) {
+
+        if (null != inValue && CollectionUtil.isNotEmpty(memberList)) {
+
+            if (inValue instanceof List) {
+                List<Object> lList = (List<Object>) inValue;
+                for (Object value : lList) {
+                    boolean flag = isMemberLeftObject(value, memberList);
+                    if (flag) {
+                        return true;
+                    }
+                }
+            }
+            if (memberList.contains(inValue)) {
+
+                return true;
+            }
+            for (Object member : memberList) {
+                if (startWithKey(member.toString(), inValue.toString())) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 
     public static Boolean isMemberLeftObject(Object inValue, List<Object> memberList) {
 
         if (null != inValue && CollectionUtil.isNotEmpty(memberList)) {
+
             if (inValue instanceof List) {
                 List<Object> lList = (List<Object>) inValue;
                 for (Object value : lList) {
@@ -338,6 +345,7 @@ public class SPELUtil {
 
     /**
      * 列表包含
+     *
      * @param lList 左边是作为源列表
      * @param rList 右边是作为被包含的列表
      * @return
@@ -346,27 +354,19 @@ public class SPELUtil {
         if (CollectionUtil.isEmpty(rList) || CollectionUtil.isEmpty(lList)) {
             return false;
         }
-        for (Object value : rList) {
-            boolean flag = isMemberLeftObject(value, lList);
+        List<String> medicalProjectNameList = (List<String>) FactorEnchangeFactory.currentThreadLocalMap.get().get(SystemEventAttrConstant.MEDICAL_PROJECT_NAME_LIST);
+        for (int i=0;i<rList.size();i++) {
+            Object value = rList.get(i);
+            Object valueName = medicalProjectNameList.get(i);
+            boolean flag = isMemberLeftObjectByList(value, lList);
             if (flag) {
+                FactorEnchangeFactory.currentThreadLocalMap.get().put(Constant.BDESC, valueName);
                 return true;
             }
         }
         return false;
     }
 
-    public static Boolean isNotMemberListAndList(List<Object> lList, List<Object> rList) {
-        if (CollectionUtil.isEmpty(rList) || CollectionUtil.isEmpty(lList)) {
-            return true;
-        }
-        for (Object value : rList) {
-            boolean flag = isMemberLeftObject(value, lList);
-            if (flag) {
-                return false;
-            }
-        }
-        return true;
-    }
 
     public static boolean isNumeric(String str) {
         Pattern pattern = Pattern.compile("[0-9]*");
@@ -384,28 +384,29 @@ public class SPELUtil {
         return false;
     }
 
-    public static String getProjectUseDay(Object projectUseTime){
-        if(null == projectUseTime){
+    public static String getProjectUseDay(Object projectUseTime) {
+        if (null == projectUseTime) {
             return null;
         }
-        if(projectUseTime instanceof String){
-            String projectUseTimeStr  = (String) projectUseTime;
-            if(projectUseTimeStr.length()>15){
+        if (projectUseTime instanceof String) {
+            String projectUseTimeStr = (String) projectUseTime;
+            if (projectUseTimeStr.length() > 15) {
                 return projectUseTimeStr.substring(0, 10);
             }
-        }else if(projectUseTime instanceof java.util.Date || projectUseTime instanceof java.sql.Date){
+        } else if (projectUseTime instanceof java.util.Date || projectUseTime instanceof java.sql.Date) {
             Date projectUseTimeDate = (Date) projectUseTime;
             return DateUtil.formatDate(projectUseTimeDate);
-        }else if(projectUseTime instanceof java.lang.Long){
+        } else if (projectUseTime instanceof java.lang.Long) {
             Date projectUseTimeDate = new Date(((Long) projectUseTime));
             return DateUtil.formatDate(projectUseTimeDate);
 
-        }else{
+        } else {
             log.error("时间类型匹配不上:{}", projectUseTime.getClass());
         }
         return projectUseTime.toString();
     }
 
+
     public static void main(String[] args) {
         SPELUtil spelUtil = new SPELUtil();
 //        Map<String, Object> inMap = new HashMap<>();
@@ -449,6 +450,13 @@ public class SPELUtil {
 
         Long day = 1607475808000l;
         System.out.println(getProjectUseDay(day));
+
+        ExpressionParser ep = new SpelExpressionParser();
+        // 创建上下文变量
+        EvaluationContext ctx = new StandardEvaluationContext();
+        ctx.setVariable("alarmTime", "2018-09-26 13:00:00");
+        ctx.setVariable("location", "二楼201机房");
+        System.out.println(ep.parseExpression("告警发生时间 #{#alarmTime},位置是在#{#location}", new TemplateParserContext()).getValue(ctx));
 //        String test ="A0123123";
 //        System.out.println(isNumeric(test));
 //        String[] rolesArr = new String []{"correlationMedicalDiagnoseCode","111"};