lenovodn 2 éve
szülő
commit
b5a545ab9b

+ 104 - 28
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/FactorEnchanceController.java

@@ -241,7 +241,29 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
         if (factorEnchance == null) {
             return Result.error("未找到对应数据");
         }
-        if (factorEnchance.getEnhanceType() == 2) {
+        List<MedicalInsRuleInfo> ruleInfoList = medicalInsRuleInfoService.list();
+
+        Optional<MedicalInsRuleInfo> first = ruleInfoList.stream().filter(o ->
+                ObjectUtils.nullSafeEquals(o.getId(), factorEnchance.getFactorCatalog())).findFirst();
+        if (first.isPresent()) {
+            factorEnchance.setFactorCatalogStr(first.get().getRuleName());
+        }
+        factorEnchance.setFactorCatalogId(factorEnchance.getFactorCatalog());
+        if (factorEnchance.getEnhanceType() == 1 || factorEnchance.getEnhanceType() == 4) {
+            List<FactorAttrRela> inList = factorAttrRelaService.lambdaQuery().eq(FactorAttrRela::getIoType, Constant.INPUT).eq(FactorAttrRela::getFactorEnhanceId, factorEnchance.getId()).list();
+            if (inList.size() > 0) {
+                inList.sort(Comparator.comparing(FactorAttrRela::getSeqNum));
+                List<Integer> in = inList.stream().map(item -> item.getEventAttrId()).collect(Collectors.toList());
+                factorEnchance.setInParamList(in);
+            }
+            List<FactorAttrRela> outList = factorAttrRelaService.lambdaQuery().eq(FactorAttrRela::getIoType, Constant.OUTPUT).eq(FactorAttrRela::getFactorEnhanceId, factorEnchance.getId()).list();
+            if (outList.size() > 0) {
+                inList.sort(Comparator.comparing(FactorAttrRela::getSeqNum));
+                List<Integer> out = outList.stream().map(item -> item.getEventAttrId()).collect(Collectors.toList());
+                factorEnchance.setOutParamList(out);
+            }
+        }
+        if (factorEnchance.getEnhanceType() == 2 && factorEnchance.getExtAttr3().equals("0")) {
             List<FactorCondRela> factorCondRelaList = factorCondRelaService.lambdaQuery().eq(FactorCondRela::getFactorEnhanceId, factorEnchance.getId()).list();
             factorEnchance.setFactorCondRelaList(factorCondRelaList);
         }
@@ -250,42 +272,98 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
 
     @ApiOperation(value = "factor_enchance-通过id查询", notes = "factor_enchance-通过id查询")
     @GetMapping(value = "/queryDynamicDataById")
-    public Result<FactorEnchance> queryDynamicDataById(@RequestParam(name = "id", required = true) String id) {
+    public Result<?> queryDynamicDataById(@RequestParam(name = "id", required = true) String id) {
         RuleFactorRela ruleFactorRela = ruleFactorRelaService.getById(id);
 
         FactorEnchance factorEnchance = factorEnchanceService.getById(ruleFactorRela.getFactorEnhanceId());
         EnchanceTypeEnum enchanceTypeEnum = EnchanceTypeEnum.getType(factorEnchance.getEnhanceType());
-        HashMap<String, String> map = new HashMap<>();
+        List<MedicalInsRuleInfo> ruleInfoList = medicalInsRuleInfoService.list();
+
+        Optional<MedicalInsRuleInfo> first = ruleInfoList.stream().filter(o ->
+                ObjectUtils.nullSafeEquals(o.getId(), factorEnchance.getFactorCatalog())).findFirst();
+        if (first.isPresent()) {
+            factorEnchance.setFactorCatalogStr(first.get().getRuleName());
+        }
+        factorEnchance.setFactorCatalogId(factorEnchance.getFactorCatalog());
+        if (factorEnchance.getEnhanceType() == 1 || factorEnchance.getEnhanceType() == 4) {
+            List<FactorAttrRela> inList = factorAttrRelaService.lambdaQuery().eq(FactorAttrRela::getIoType, Constant.INPUT).eq(FactorAttrRela::getFactorEnhanceId, factorEnchance.getId()).list();
+            if (inList.size() > 0) {
+                inList.sort(Comparator.comparing(FactorAttrRela::getSeqNum));
+                List<Integer> in = inList.stream().map(item -> item.getEventAttrId()).collect(Collectors.toList());
+                factorEnchance.setInParamList(in);
+            }
+            List<FactorAttrRela> outList = factorAttrRelaService.lambdaQuery().eq(FactorAttrRela::getIoType, Constant.OUTPUT).eq(FactorAttrRela::getFactorEnhanceId, factorEnchance.getId()).list();
+            if (outList.size() > 0) {
+                inList.sort(Comparator.comparing(FactorAttrRela::getSeqNum));
+                List<Integer> out = outList.stream().map(item -> item.getEventAttrId()).collect(Collectors.toList());
+                factorEnchance.setOutParamList(out);
+            }
+        }
+        if (factorEnchance.getEnhanceType() == 2 && factorEnchance.getExtAttr3().equals("0")) {
+            List<FactorCondRela> factorCondRelaList = factorCondRelaService.lambdaQuery().eq(FactorCondRela::getFactorEnhanceId, factorEnchance.getId()).list();
+            factorEnchance.setFactorCondRelaList(factorCondRelaList);
+        }
+
+
+        LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+        String title = "";
         switch (enchanceTypeEnum) {
             case SQL:
-                map.put("要素提取标题\n", "");
-                map.put("医保规则\n", "");
-                map.put("数据库\n\n", "");
-                map.put("SQL语句\n\n\n", "");
-                map.put("输入要素\n\n", "");
-                map.put("输出要素\n\n\n", "");
-                map.put("备注\n\n\n\n", "");
-                break;
-            case EXPRESSION:
-                map.put("要素提取标题\n", "");
-                map.put("医保规则\n", "");
-                map.put("数据库\n\n", "");
-                map.put("SQL语句\n\n\n", "");
-                map.put("输入要素\n\n", "");
-                map.put("输出要素\n\n\n", "");
-                map.put("备注\n\n\n\n", "");
+                map.put("要素提取标题", factorEnchance.getRuleEnchanceName());
+                map.put("医保规则", factorEnchance.getFactorCatalogStr());
+                map.put("数据库", factorEnchance.getExtAttr1());
+                map.put("SQL语句", factorEnchance.getEnhanceValue());
+                map.put("输入要素", factorEnchance.getInParamList());
+                map.put("输出要素", factorEnchance.getOutParamList());
+                map.put("备注", factorEnchance.getExtAttr2());
+                title = "SQL取值";
                 break;
-            case DICT:
+            case LOGICAL_EXPRESSION:
+                map.put("要素提取标题", factorEnchance.getRuleEnchanceName());
+                map.put("医保规则", factorEnchance.getFactorCatalogStr());
+                map.put("判断类型", factorEnchance.getExtAttr1());
+                if (factorEnchance.getExtAttr3().equals("0")) {
+                    factorEnchance.getFactorCondRelaList().forEach(it -> {
+                        map.put("逻辑表达式", it.getExtAttr1());
+                        map.put("比较符", it.getOperator());
+                        map.put("引用属性类型", it.getRefAttrType());
+                        if (it.getRefAttrType() == 1) {
+                            map.put("扩展属性", it.getExtAttr1());
+                        } else {
+                            map.put("引用属性标识", it.getRefEventAttrId());
+                        }
+                    });
+                } else {
+                    map.put("判断表达式字符串", factorEnchance.getEnhanceValue());
+                }
+                map.put("输出要素", factorEnchance.getOutParamList());
+                title = "逻辑判断";
+
                 break;
             case PLUGIN:
+                map.put("插件名称", factorEnchance.getRuleEnchanceName());
+                map.put("医保规则", factorEnchance.getFactorCatalogStr());
+                map.put("描述", factorEnchance.getRemarks());
+                map.put("插件Bean名称", factorEnchance.getEnhanceValue());
+                map.put("输入要素", factorEnchance.getInParamList());
+                map.put("输出要素", factorEnchance.getOutParamList());
+                title = "插件提取";
 
                 break;
             case CONSTANT:
-                break;
-            case LOGICAL_EXPRESSION:
+                map.put("要素提取标题", factorEnchance.getRuleEnchanceName());
+                map.put("医保规则", factorEnchance.getFactorCatalogStr());
+                map.put("常量值", factorEnchance.getExtAttr1());
+                map.put("输出要素", factorEnchance.getOutParamList());
+                title = "常量赋值";
 
                 break;
             case PROPERTIES:
+                map.put("要素提取标题", factorEnchance.getRuleEnchanceName());
+                map.put("医保规则", factorEnchance.getFactorCatalogStr());
+                map.put("输入要素", factorEnchance.getInParamList());
+                map.put("输出要素", factorEnchance.getOutParamList());
+                title = "属性赋值";
 
                 break;
             default:
@@ -297,11 +375,10 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
         if (factorEnchance == null) {
             return Result.error("未找到对应数据");
         }
-        if (factorEnchance.getEnhanceType() == 2) {
-            List<FactorCondRela> factorCondRelaList = factorCondRelaService.lambdaQuery().eq(FactorCondRela::getFactorEnhanceId, factorEnchance.getId()).list();
-            factorEnchance.setFactorCondRelaList(factorCondRelaList);
-        }
-        return Result.OK(factorEnchance);
+        HashMap<String,Object> hashMap = new HashMap<>();
+        hashMap.put("title",title);
+        hashMap.put("map",map);
+        return Result.OK(hashMap);
     }
 
     /**
@@ -382,5 +459,4 @@ public class FactorEnchanceController extends JeecgController<FactorEnchance, IF
     }
 
 
-
 }

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

@@ -99,6 +99,7 @@ public class MedicalInsRuleInfo implements Serializable {
 	/**状态*/
 	@Excel(name = "状态", width = 15)
     @ApiModelProperty(value = "状态")
+    @Dict(dicCode = "state")
     private java.lang.String state;
 	/**版本号*/
 	@Excel(name = "版本号", width = 15)