|
|
@@ -84,17 +84,11 @@ public class FactorEnchangeFactory {
|
|
|
if (null == factorEnchance) {
|
|
|
continue;
|
|
|
}
|
|
|
- LambdaQueryWrapper<FactorAttrRela> queryWrapper = new LambdaQueryWrapper();
|
|
|
- queryWrapper.eq(FactorAttrRela::getFactorEnhanceId, factorEnchanceId);
|
|
|
- queryWrapper.orderByAsc(FactorAttrRela::getSeqNum);
|
|
|
- List<FactorAttrRela> factorAttrRelaList = factorAttrRelaService.list(queryWrapper);
|
|
|
- Map<Integer, List<FactorAttrRela>> ioTypeMap = new HashMap<>();
|
|
|
- if (CollectionUtil.isNotEmpty(factorAttrRelaList)) {
|
|
|
- ioTypeMap = factorAttrRelaList.stream().collect(Collectors.groupingBy(FactorAttrRela::getIoType));
|
|
|
- }
|
|
|
+
|
|
|
EnchanceTypeEnum enchanceTypeEnum = EnchanceTypeEnum.getType(factorEnchanceId);
|
|
|
switch (enchanceTypeEnum) {
|
|
|
case SQL:
|
|
|
+ Map<Integer, List<FactorAttrRela>> ioTypeMap = getIoMap(factorEnchanceId);
|
|
|
setSqlResultByFactorEnchance(localMap, ioTypeMap, factorEnchance, medicalInfoRuleInfoId);
|
|
|
break;
|
|
|
case EXPRESSION:
|
|
|
@@ -104,14 +98,16 @@ public class FactorEnchangeFactory {
|
|
|
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, ioTypeMap, factorEnchance, medicalInfoRuleInfoId);
|
|
|
+ pluginInterface.plugin(localMap, ioTypeMap1, factorEnchance, medicalInfoRuleInfoId);
|
|
|
break;
|
|
|
case CONSTANT:
|
|
|
localMap.put(factorEnchance.getEventAttrId().toString(), factorEnchance.getExtAttr1());
|
|
|
break;
|
|
|
case LOGICAL_EXPRESSION:
|
|
|
- result = setLogicalExpressionResultByFactorEnchance(localMap, ioTypeMap, factorEnchance, medicalInsRuleInfo);
|
|
|
+// Map<Integer, List<FactorAttrRela>> ioTypeMap2 = getIoMap(factorEnchanceId);
|
|
|
+ result = setLogicalExpressionResultByFactorEnchance(localMap, factorEnchance);
|
|
|
if(Constant.WARING_EVENT_ATTR_ID == factorEnchance.getEventAttrId()){
|
|
|
if(result){
|
|
|
insertMidWarningDetail(localMap, medicalInsRuleInfo, midIncidentAudit);
|
|
|
@@ -136,6 +132,18 @@ public class FactorEnchangeFactory {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ public Map<Integer, List<FactorAttrRela>> getIoMap(Integer factorEnchanceId){
|
|
|
+ LambdaQueryWrapper<FactorAttrRela> queryWrapper = new LambdaQueryWrapper();
|
|
|
+ queryWrapper.eq(FactorAttrRela::getFactorEnhanceId, factorEnchanceId);
|
|
|
+ queryWrapper.orderByAsc(FactorAttrRela::getSeqNum);
|
|
|
+ List<FactorAttrRela> factorAttrRelaList = factorAttrRelaService.list(queryWrapper);
|
|
|
+ Map<Integer, List<FactorAttrRela>> ioTypeMap = new HashMap<>();
|
|
|
+ if (CollectionUtil.isNotEmpty(factorAttrRelaList)) {
|
|
|
+ ioTypeMap = factorAttrRelaList.stream().collect(Collectors.groupingBy(FactorAttrRela::getIoType));
|
|
|
+ }
|
|
|
+ return ioTypeMap;
|
|
|
+ }
|
|
|
+
|
|
|
public void insertMidWarningDetail(Map<String,Object> itemMap, MedicalInsRuleInfo medicalInsRuleInfo,MidIncidentAudit midIncidentAudit){
|
|
|
MidIncidentWarningVO midIncidentWarningVO = RuleEngine.midIncidentWarningVOThreadLocal.get();
|
|
|
MidIncidentAuditDetail midIncidentAuditDetail = new MidIncidentAuditDetail();
|
|
|
@@ -173,33 +181,36 @@ public class FactorEnchangeFactory {
|
|
|
* 逻辑表达式
|
|
|
*
|
|
|
* @param localMap
|
|
|
- * @param ioTypeMap
|
|
|
* @param factorEnchance
|
|
|
- * @param medicalInsRuleInfo
|
|
|
*/
|
|
|
- public boolean setLogicalExpressionResultByFactorEnchance(Map<String, Object> localMap, Map<Integer, List<FactorAttrRela>> ioTypeMap, FactorEnchance factorEnchance, MedicalInsRuleInfo medicalInsRuleInfo) {
|
|
|
- List<FactorCondRela> factorCondRelaList = factorCondRelaMap.get(factorEnchance.getId());
|
|
|
- if (CollectionUtil.isNotEmpty(factorCondRelaList)) {
|
|
|
- Boolean result = null;
|
|
|
- if (Constant.AND.equals(factorEnchance.getExtAttr1())) {
|
|
|
- result = true;
|
|
|
- } else {
|
|
|
- result = false;
|
|
|
- }
|
|
|
- for (FactorCondRela factorCondRela : factorCondRelaList) {
|
|
|
- if (!StringUtils.isNotBlank(factorCondRela.getCondStr())) {
|
|
|
- log.error("未正常生成表达式");
|
|
|
- String condStr = spelUtil.getSPELString(factorCondRela, enchanceAttrMap);
|
|
|
- factorCondRela.setCondStr(condStr);
|
|
|
- }
|
|
|
- Boolean resultTemp = (Boolean) spelUtil.runSpelExpression(localMap, factorCondRela.getCondStr());
|
|
|
+ public boolean setLogicalExpressionResultByFactorEnchance(Map<String, Object> localMap, FactorEnchance factorEnchance) {
|
|
|
+ if(StringUtils.isNotBlank(factorEnchance.getEnhanceValue())){
|
|
|
+ Boolean resultTemp = (Boolean) spelUtil.runSpelExpression(localMap, factorEnchance.getEnhanceValue());
|
|
|
+ return resultTemp;
|
|
|
+ }else {
|
|
|
+ List<FactorCondRela> factorCondRelaList = factorCondRelaMap.get(factorEnchance.getId());
|
|
|
+ if (CollectionUtil.isNotEmpty(factorCondRelaList)) {
|
|
|
+ Boolean result = null;
|
|
|
if (Constant.AND.equals(factorEnchance.getExtAttr1())) {
|
|
|
- result = resultTemp && result;
|
|
|
+ result = true;
|
|
|
} else {
|
|
|
- result = resultTemp || result;
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
+ for (FactorCondRela factorCondRela : factorCondRelaList) {
|
|
|
+ if (!StringUtils.isNotBlank(factorCondRela.getCondStr())) {
|
|
|
+ log.error("未正常生成表达式");
|
|
|
+ String condStr = spelUtil.getSPELString(factorCondRela, enchanceAttrMap);
|
|
|
+ factorCondRela.setCondStr(condStr);
|
|
|
+ }
|
|
|
+ Boolean resultTemp = (Boolean) spelUtil.runSpelExpression(localMap, factorCondRela.getCondStr());
|
|
|
+ if (Constant.AND.equals(factorEnchance.getExtAttr1())) {
|
|
|
+ result = resultTemp && result;
|
|
|
+ } else {
|
|
|
+ result = resultTemp || result;
|
|
|
+ }
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
return false;
|