浏览代码

重庆石柱分支规则查询,查看功能更新

wangsy 7 月之前
父节点
当前提交
c1733df1e9
共有 30 个文件被更改,包括 899 次插入76 次删除
  1. 89 0
      src/main/java/com/diagbot/aggregate/DictionaryAggregate.java
  2. 112 13
      src/main/java/com/diagbot/aggregate/RuleAggregate.java
  3. 25 0
      src/main/java/com/diagbot/dto/AllRulesDTO.java
  4. 17 0
      src/main/java/com/diagbot/dto/DictionaryDTO.java
  5. 1 1
      src/main/java/com/diagbot/dto/RuleBaseInitDTO.java
  6. 1 1
      src/main/java/com/diagbot/dto/RuleConditionDTO.java
  7. 2 2
      src/main/java/com/diagbot/dto/RuleConditionInitDTO.java
  8. 16 0
      src/main/java/com/diagbot/dto/RuleIdDTO.java
  9. 3 2
      src/main/java/com/diagbot/dto/RuleInitDTO.java
  10. 83 0
      src/main/java/com/diagbot/entity/KlLexicon.java
  11. 101 0
      src/main/java/com/diagbot/entity/KlRuleSearch.java
  12. 18 1
      src/main/java/com/diagbot/facade/KlDictionaryInfoFacade.java
  13. 41 0
      src/main/java/com/diagbot/facade/KlLexiconFacade.java
  14. 10 0
      src/main/java/com/diagbot/facade/KlRulePlanFacade.java
  15. 7 9
      src/main/java/com/diagbot/facade/NeoFacade.java
  16. 16 0
      src/main/java/com/diagbot/mapper/KlLexiconMapper.java
  17. 5 0
      src/main/java/com/diagbot/mapper/KlRuleMapper.java
  18. 3 0
      src/main/java/com/diagbot/mapper/KlRulePlanMapper.java
  19. 16 0
      src/main/java/com/diagbot/mapper/KlRuleSearchMapper.java
  20. 16 0
      src/main/java/com/diagbot/service/KlLexiconService.java
  21. 3 0
      src/main/java/com/diagbot/service/KlRulePlanService.java
  22. 16 0
      src/main/java/com/diagbot/service/KlRuleSearchService.java
  23. 5 0
      src/main/java/com/diagbot/service/KlRuleService.java
  24. 20 0
      src/main/java/com/diagbot/service/impl/KlLexiconServiceImpl.java
  25. 6 0
      src/main/java/com/diagbot/service/impl/KlRulePlanServiceImpl.java
  26. 20 0
      src/main/java/com/diagbot/service/impl/KlRuleSearchServiceImpl.java
  27. 11 0
      src/main/java/com/diagbot/service/impl/KlRuleServiceImpl.java
  28. 115 47
      src/main/resources/mapper/KlRuleMapper.xml
  29. 106 0
      src/main/resources/mapper/KlRulePlanMapper.xml
  30. 15 0
      src/main/resources/mapper/KlRuleSearchMapper.xml

+ 89 - 0
src/main/java/com/diagbot/aggregate/DictionaryAggregate.java

@@ -0,0 +1,89 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.DictionaryDTO;
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.facade.KlDictionaryInfoFacade;
+import com.diagbot.facade.KlLexiconFacade;
+import com.diagbot.facade.KlRulePlanFacade;
+import com.diagbot.process.PushProcess;
+import com.diagbot.util.ListUtil;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description: 获取字典类型聚合
+ * @author: zhoutg
+ * @time: 2019/10/16 13:37
+ */
+@Component
+@Slf4j
+public class DictionaryAggregate {
+
+    @Autowired
+    PushProcess pushProcess;
+    @Autowired
+    PushNewServiceClient pushNewServiceClient;
+    @Autowired
+    KlDictionaryInfoFacade klDictionaryInfoFacade;
+    @Autowired
+    KlRulePlanFacade klRulePlanFacade;
+    @Autowired
+    KlLexiconFacade klLexiconFacade;
+
+    @DataProvider("getDictionary")
+    public DictionaryDTO getDictionary(
+            @DataConsumer("getDic") List<DictionaryInfoDTO> dicList,
+            @DataConsumer("getLexicon") List<DictionaryInfoDTO> lexiconList,
+            @DataConsumer("getPlan") List<DictionaryInfoDTO> planList) {
+
+        DictionaryDTO res = new DictionaryDTO();
+        List<DictionaryInfoDTO> list = res.getList();
+
+        if (ListUtil.isNotEmpty(dicList)) {
+            list.addAll(dicList);
+        }
+        if (ListUtil.isNotEmpty(lexiconList)) {
+            list.addAll(lexiconList);
+        }
+        if (ListUtil.isNotEmpty(planList)) {
+            list.addAll(planList);
+        }
+        return res;
+    }
+
+    /**
+     * 获取字典数据
+     *
+     * @return
+     */
+    @DataProvider("getDic")
+    public List<DictionaryInfoDTO> getDic() {
+        return klDictionaryInfoFacade.getListBackCommon();
+    }
+
+    /**
+     * 获取lexicon字典数据
+     *
+     * @return
+     */
+    @DataProvider("getLexicon")
+    public List<DictionaryInfoDTO> getLexicon() {
+        return klLexiconFacade.getLexiconDic();
+    }
+
+    /**
+     * 获取rulePlan字典数据
+     *
+     * @return
+     */
+    @DataProvider("getPlan")
+    public List<DictionaryInfoDTO> getPlan() {
+        return klRulePlanFacade.getPlanDicFac();
+    }
+}

+ 112 - 13
src/main/java/com/diagbot/aggregate/RuleAggregate.java

@@ -1,11 +1,16 @@
 package com.diagbot.aggregate;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.AllRulesDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleBaseInitDTO;
+import com.diagbot.vo.RuleBaseQueryVO;
 import com.diagbot.dto.RuleConditionDTO;
 import com.diagbot.dto.RuleConditionInitDTO;
 import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.RuleIdDTO;
 import com.diagbot.dto.RuleInitDTO;
+import com.diagbot.entity.KlRuleSearch;
 import com.diagbot.enums.BaseTypeEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
@@ -13,21 +18,26 @@ import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.facade.KlRuleFacade;
+import com.diagbot.service.KlRuleSearchService;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
 import io.github.lvyahui8.spring.annotation.DataConsumer;
 import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -41,16 +51,23 @@ public class RuleAggregate {
     private KlRuleFacade klRuleFacade;
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    @Qualifier("klRuleSearchServiceImpl")
+    private KlRuleSearchService klRuleSearchService;
 
     @DataProvider("getAllRules")
-    public Map<String, RuleDTO> getAllRules(
+    public AllRulesDTO getAllRules(
             @DataConsumer("getRuleInit") Map<String, List<RuleInitDTO>> ruleInits,
             @DataConsumer("getRuleConditionInit") Map<Integer, Map<String, List<RuleConditionInitDTO>>> ruleConditionInits,
             @DataConsumer("getRuleBaseInit") Map<Integer, List<RuleBaseInitDTO>> ruleBaseInits) {
         try {
-            Map<String, RuleDTO> res = new HashMap();
+            //有效规则Map
+            Map<String, RuleDTO> ruleDTOMap = new HashMap();
             //药物过敏源
             Map<String, Integer> drugAllergen = new HashMap<>();
+            //规则搜索有效的规则ID
+            HashSet<Long> ruleIdSet = new HashSet<>();
+            List<KlRuleSearch> klRuleSearchList = new ArrayList<>();
             //结果判空第一层规则类型
             if (MapUtils.isNotEmpty(ruleInits)) {
                 for (String ruleKey : ruleInits.keySet()) {
@@ -74,6 +91,7 @@ public class RuleAggregate {
                                 for (String ruleGroup : map.keySet()) {
                                     RuleConditionDTO ruleConditionDTO = new RuleConditionDTO();
                                     ruleConditionDTO.setHasSubCond(ruleInitDTO.getHasSubCond());
+                                    ruleConditionDTO.setDescription(ruleInitDTO.getDescription());
                                     ruleConditionDTO.setRuleGroup(ruleGroup);
                                     //结果判空第三层条件明细
                                     if (ListUtil.isNotEmpty(map.get(ruleGroup))) {
@@ -98,6 +116,7 @@ public class RuleAggregate {
                                             RuleConditionDTO ruleConditionDTO1 = new RuleConditionDTO();
                                             ruleConditionDTO1.setHasSubCond(ruleConditionDTO.getHasSubCond());
                                             ruleConditionDTO1.setRuleGroup(ruleConditionDTO.getRuleGroup());
+                                            ruleConditionDTO1.setDescription(ruleConditionDTO.getDescription());
                                             ruleConditionDTO1.setMsg(ruleConditionDTO.getMsg());
                                             ruleConditionDTO1.getRuleBaseDTOList().addAll(ruleBaseDTOList);
                                             if (!ruleConditionMap.containsKey(ruleConditionDTO1.toString())) {
@@ -115,6 +134,13 @@ public class RuleAggregate {
                                                     }
                                                 }
                                                 ruleConditionMap.put(ruleConditionDTO1.toString(), 1);
+                                                //规则搜索有效的规则ID
+                                                if (!ruleIdSet.contains(ruleInitDTO.getRuleId())) {
+                                                    ruleIdSet.add(ruleInitDTO.getRuleId());
+                                                    KlRuleSearch klRuleSearch = new KlRuleSearch();
+                                                    klRuleSearch.setId(ruleInitDTO.getRuleId());
+                                                    klRuleSearchList.add(klRuleSearch);
+                                                }
                                             }
                                         }
                                     }
@@ -123,6 +149,7 @@ public class RuleAggregate {
                         } else {
                             RuleConditionDTO ruleConditionDTO = new RuleConditionDTO();
                             ruleConditionDTO.setHasSubCond(ruleInitDTO.getHasSubCond());
+                            ruleConditionDTO.setDescription(ruleInitDTO.getDescription());
                             ruleConditionDTO.setMsg(ruleInitDTO.getMsg());
                             //无条件
                             ruleConditionDTO.setRuleGroup(ruleInitDTO.getRuleId() + "-1");
@@ -130,17 +157,25 @@ public class RuleAggregate {
                             if (!ruleConditionMap.containsKey(ruleConditionDTO.toString())) {
                                 ruleDTO.getRuleConditionDTOList().add(ruleConditionDTO);
                                 ruleConditionMap.put(ruleConditionDTO.toString(), 1);
+                                //规则搜索有效的规则ID
+                                if (!ruleIdSet.contains(ruleInitDTO.getRuleId())) {
+                                    ruleIdSet.add(ruleInitDTO.getRuleId());
+                                    KlRuleSearch klRuleSearch = new KlRuleSearch();
+                                    klRuleSearch.setId(ruleInitDTO.getRuleId());
+                                    klRuleSearchList.add(klRuleSearch);
+                                }
                             }
                         }
                     }
-                    res.put(RedisEnum.allRule.getName() + ruleDTO.getLibType() + "_" + ruleDTO.getLibName() + "_" + ruleDTO.getRuleType(), ruleDTO);
-                }
-                //直接加载缓存
-                if (MapUtils.isNotEmpty(drugAllergen)) {
-                    redisUtil.set(RedisEnum.drugAllergen.getName(), drugAllergen);
+                    ruleDTOMap.put(RedisEnum.allRule.getName() + ruleDTO.getLibType() + "_" + ruleDTO.getLibName() + "_" + ruleDTO.getRuleType(), ruleDTO);
                 }
             }
-            return res;
+            //出参设置
+            AllRulesDTO allRulesDTO = new AllRulesDTO();
+            allRulesDTO.setRuleDTOMap(ruleDTOMap);
+            allRulesDTO.setDrugAllergen(drugAllergen);
+            allRulesDTO.setKlRuleSearchList(klRuleSearchList);
+            return allRulesDTO;
         } catch (Exception e) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "全部规则加载出错:" + e.getMessage());
         }
@@ -167,18 +202,18 @@ public class RuleAggregate {
     //    }
 
     @DataProvider("getRuleConditionInit")
-    public Map<Integer, Map<String, List<RuleConditionInitDTO>>> getRuleConditionInit() {
+    public Map<Long, Map<String, List<RuleConditionInitDTO>>> getRuleConditionInit() {
         List<RuleConditionInitDTO> list = klRuleFacade.getRuleConditionInitDTO();
-        Map<Integer, List<RuleConditionInitDTO>> map = EntityUtil.makeEntityListMap(list, "ruleId");
-        Map<Integer, Map<String, List<RuleConditionInitDTO>>> res = new HashMap<>();
-        for (Integer ruleId : map.keySet()) {
+        Map<Long, List<RuleConditionInitDTO>> map = EntityUtil.makeEntityListMap(list, "ruleId");
+        Map<Long, Map<String, List<RuleConditionInitDTO>>> res = new HashMap<>();
+        for (Long ruleId : map.keySet()) {
             res.put(ruleId, EntityUtil.makeEntityListMap(map.get(ruleId), "ruleGroup"));
         }
         return res;
     }
 
     @DataProvider("getRuleBaseInit")
-    public Map<Integer, List<RuleBaseInitDTO>> getRuleBaseInit(
+    public Map<Long, List<RuleBaseInitDTO>> getRuleBaseInit(
             @DataConsumer("getRuleBaseInitNotHaveClass") List<RuleBaseInitDTO> ruleBaseNotHaveClass,
             @DataConsumer("getRuleBaseInitHaveClass") List<RuleBaseInitDTO> ruleBaseHaveClass) {
         List<RuleBaseInitDTO> list = new ArrayList<>();
@@ -246,6 +281,70 @@ public class RuleAggregate {
         }
     }
 
+    @DataProvider("setAllRules")
+    public Boolean setAllRules(
+            @InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO,
+            @DataConsumer("setRuleDTOMap") Boolean resRuleDTOMap,
+            @DataConsumer("setDrugAllergen") Boolean resDrugAllergen,
+            @DataConsumer("setKlRuleSearchList") Boolean resKlRuleSearchList) {
+        return true;
+    }
+
+    @DataProvider("setRuleDTOMap")
+    public Boolean setRuleDTOMap(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
+        //加载有效规则Map
+        if (MapUtils.isNotEmpty(allRulesDTO.getRuleDTOMap())) {
+            redisUtil.multiSet(allRulesDTO.getRuleDTOMap());
+        }
+        return true;
+    }
+
+    @DataProvider("setDrugAllergen")
+    public Boolean setDrugAllergen(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
+        //加载药物过敏源缓存
+        if (MapUtils.isNotEmpty(allRulesDTO.getDrugAllergen())) {
+            redisUtil.set(RedisEnum.drugAllergen.getName(), allRulesDTO.getDrugAllergen());
+        }
+        return true;
+    }
+
+    @DataProvider("setKlRuleSearchList")
+    public Boolean setKlRuleSearchList(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
+        //存储有效规则Id
+        klRuleSearchService.remove(new QueryWrapper<>());
+        if (ListUtil.isNotEmpty(allRulesDTO.getKlRuleSearchList())) {
+            klRuleSearchService.saveBatch(allRulesDTO.getKlRuleSearchList());
+        }
+        return true;
+    }
+
+    @DataProvider("getAllRuleIds")
+    public List<Long> setAllRules(
+            @InvokeParameter("ruleBaseQueryVO") RuleBaseQueryVO ruleBaseQueryVO,
+            @DataConsumer("getRuleNotHaveClass") List<RuleIdDTO> notHaveClassRuleIds,
+            @DataConsumer("getRuleHaveClass") List<RuleIdDTO> haveClassRuleIds) {
+        List<Long> ruleIds = new ArrayList<>();
+        if (ListUtil.isNotEmpty(notHaveClassRuleIds)){
+            ruleIds.addAll(notHaveClassRuleIds.stream().map(RuleIdDTO::getRuleId).distinct().collect(Collectors.toList()));
+        }
+        if (ListUtil.isNotEmpty(haveClassRuleIds)){
+            ruleIds.addAll(haveClassRuleIds.stream().map(RuleIdDTO::getRuleId).distinct().collect(Collectors.toList()));
+        }
+        if (ListUtil.isEmpty(ruleIds)){
+            ruleIds.add(-1000L);
+        }
+        return ruleIds;
+    }
+    @DataProvider("getRuleNotHaveClass")
+    public List<RuleIdDTO> getRuleNotHaveClass( @InvokeParameter("ruleBaseQueryVO") RuleBaseQueryVO ruleBaseQueryVO){
+        return klRuleFacade.getRuleNotHaveClass(ruleBaseQueryVO);
+    }
+
+    @DataProvider("getRuleHaveClass")
+    public List<RuleIdDTO> getRuleHaveClass( @InvokeParameter("ruleBaseQueryVO") RuleBaseQueryVO ruleBaseQueryVO){
+        return klRuleFacade.getRuleHaveClass(ruleBaseQueryVO);
+    }
+
     public static void main(String[] args) {
         List<List<RuleBaseDTO>> ruleBaseList = new ArrayList<>();
         List<RuleBaseDTO> ruleBaseDTOListA = new ArrayList<>();

+ 25 - 0
src/main/java/com/diagbot/dto/AllRulesDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.KlRuleSearch;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: dsYun
+ * @time: 2024/10/29 10:49
+ */
+@Data
+public class AllRulesDTO {
+
+    //有效规则Map
+    Map<String, RuleDTO> ruleDTOMap = new HashMap();
+    //药物过敏源
+    Map<String, Integer> drugAllergen = new HashMap<>();
+    //规则搜索有效的规则ID
+    List<KlRuleSearch> klRuleSearchList = new ArrayList<>();
+}

+ 17 - 0
src/main/java/com/diagbot/dto/DictionaryDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2021/6/7 10:27
+ */
+@Data
+public class DictionaryDTO {
+    // 字典数据
+    private List<DictionaryInfoDTO> list = new ArrayList<>();
+}

+ 1 - 1
src/main/java/com/diagbot/dto/RuleBaseInitDTO.java

@@ -11,5 +11,5 @@ import lombok.Setter;
 @Getter
 @Setter
 public class RuleBaseInitDTO extends RuleBaseDTO {
-    private Integer ruleBaseId;
+    private Long ruleBaseId;
 }

+ 1 - 1
src/main/java/com/diagbot/dto/RuleConditionDTO.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 @Getter
 @Setter
-@ToString(exclude = { "ruleGroup", "msg" }, includeFieldNames = false)
+@ToString(exclude = { "ruleGroup", "msg", "description" }, includeFieldNames = false)
 public class RuleConditionDTO {
     private Integer hasSubCond;
     private String ruleGroup;

+ 2 - 2
src/main/java/com/diagbot/dto/RuleConditionInitDTO.java

@@ -11,8 +11,8 @@ import lombok.Setter;
 @Getter
 @Setter
 public class RuleConditionInitDTO {
-    private Integer ruleId;
+    private Long ruleId;
     private String ruleGroup;
-    private Integer ruleBaseId;
+    private Long ruleBaseId;
     private String msg;
 }

+ 16 - 0
src/main/java/com/diagbot/dto/RuleIdDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: dsYun
+ * @time: 2024/10/29 14:13
+ */
+@Getter
+@Setter
+public class RuleIdDTO {
+    //规则ID
+    private Long ruleId;
+}

+ 3 - 2
src/main/java/com/diagbot/dto/RuleInitDTO.java

@@ -15,11 +15,12 @@ import java.util.List;
 @Setter
 public class RuleInitDTO {
     private String conceptGroup;
-    private Integer conceptId;
-    private Integer ruleId;
+    private Long conceptId;
+    private Long ruleId;
     private String libName;
     private Integer libType;
     private Integer ruleType;
     private String msg;
     private Integer hasSubCond;
+    private String description;
 }

+ 83 - 0
src/main/java/com/diagbot/entity/KlLexicon.java

@@ -0,0 +1,83 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 术语分类表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2022-02-23
+ */
+@Data
+public class KlLexicon implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 类型名称
+     */
+    private String name;
+
+    /**
+     * 数字编码(100~500)
+     */
+    private Integer code;
+
+    /**
+     * 是否有通用扩展(0:否;1:是)
+     */
+    private Integer isHasCommon;
+
+    /**
+     * 是否只有一个(0:否;1:是)
+     */
+    private Integer onlyOne;
+
+    /**
+     * 是否允许修改(0:否;1:是)
+     */
+    private Integer canChange;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 101 - 0
src/main/java/com/diagbot/entity/KlRuleSearch.java

@@ -0,0 +1,101 @@
+package com.diagbot.entity;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 有效规则搜索表
+ * </p>
+ *
+ * @author dsYun
+ */
+public class KlRuleSearch implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 规则id
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    @Override
+    public String toString() {
+        return "KlRuleSearch{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                "}";
+    }
+}

+ 18 - 1
src/main/java/com/diagbot/facade/KlDictionaryInfoFacade.java

@@ -1,13 +1,19 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.DictionaryDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.KlDictionaryInfo;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KlDictionaryInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExtUtil;
 import com.diagbot.util.ListUtil;
+import io.github.lvyahui8.spring.facade.DataFacade;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -20,6 +26,7 @@ import java.util.Map;
  */
 @Component
 public class KlDictionaryInfoFacade extends KlDictionaryInfoServiceImpl {
+
     /**
      * 返回字典信息
      *
@@ -40,12 +47,22 @@ public class KlDictionaryInfoFacade extends KlDictionaryInfoServiceImpl {
      * @return
      */
     public Map<Long, List<DictionaryInfoDTO>> getListBack() {
+        try {
+            // Map<String, Object> invokeParams = new HashMap<>();
+            DictionaryDTO dictionaryDTO = DataFacade.get("getDictionary", null, DictionaryDTO.class);
+            return ExtUtil.getKeyList(dictionaryDTO.getList(), "groupType");
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取字典数据出错" + e.getMessage());
+        }
+    }
+
+    public List<DictionaryInfoDTO> getListBackCommon() {
         List<KlDictionaryInfo> list = this.list(new QueryWrapper<KlDictionaryInfo>()
                 .in("return_type", ListUtil.arrayToList(new Long[] { 0L, 1L }))
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .orderByAsc("group_type", "order_no"));
         List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
-        return EntityUtil.makeEntityListMap(listRes, "groupType");
+        return listRes;
     }
 
     /**

+ 41 - 0
src/main/java/com/diagbot/facade/KlLexiconFacade.java

@@ -0,0 +1,41 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.entity.KlLexicon;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.KlLexiconServiceImpl;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2020/12/28 11:47
+ */
+@Component
+public class KlLexiconFacade extends KlLexiconServiceImpl {
+
+    /**
+     * 获取词性字典数据
+     *
+     * @return
+     */
+    public List<DictionaryInfoDTO> getLexiconDic() {
+        List<DictionaryInfoDTO> res = new ArrayList<>();
+        List<KlLexicon> lexiconList = this.list(new QueryWrapper<KlLexicon>().lambda()
+                .eq(KlLexicon::getIsDeleted, IsDeleteEnum.N.getKey()));
+        for (KlLexicon klLexicon : lexiconList) {
+            DictionaryInfoDTO dictionaryInfoDTO = new DictionaryInfoDTO();
+            dictionaryInfoDTO.setGroupType(-100L);
+            dictionaryInfoDTO.setName(klLexicon.getName());
+            dictionaryInfoDTO.setVal(String.valueOf(klLexicon.getCode()));
+            dictionaryInfoDTO.setOrderNo(klLexicon.getId().intValue());
+            dictionaryInfoDTO.setRemark("词库所有类型");
+            res.add(dictionaryInfoDTO);
+        }
+        return res;
+    }
+}

+ 10 - 0
src/main/java/com/diagbot/facade/KlRulePlanFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.wrapper.KlRuleMenuWrapper;
 import com.diagbot.service.impl.KlRulePlanServiceImpl;
 import com.diagbot.util.EntityUtil;
@@ -50,4 +51,13 @@ public class KlRulePlanFacade extends KlRulePlanServiceImpl {
         }
         return res;
     }
+
+    /**
+     * 获取plan字典数据
+     *
+     * @return
+     */
+    public List<DictionaryInfoDTO> getPlanDicFac() {
+        return getPlanDic();
+    }
 }

+ 7 - 9
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -3,13 +3,7 @@ package com.diagbot.facade;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.StandConvertServiceClient;
-import com.diagbot.dto.BaseDiagnoseDTO;
-import com.diagbot.dto.BaseRegulationDTO;
-import com.diagbot.dto.DrugNameDTO;
-import com.diagbot.dto.DrugTypeCacheDTO;
-import com.diagbot.dto.DrugTypeDTO;
-import com.diagbot.dto.NeoPushDTO;
-import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.*;
 import com.diagbot.entity.KlDiseaseCorresponding;
 import com.diagbot.entity.SymptomFeature;
 import com.diagbot.entity.TranHospitalFilter;
@@ -492,9 +486,13 @@ public class NeoFacade {
 //            redisTemplate.opsForValue().multiSet(map);
 //        }
         try {
+            //取得所有需要设置的规则
             Map<String, Object> invokeParams = new HashMap<>();
-            Map<String, RuleDTO> map = DataFacade.get("getAllRules", invokeParams, Map.class);
-            redisUtil.multiSet(map);
+            AllRulesDTO allRulesDTO = DataFacade.get("getAllRules", invokeParams, AllRulesDTO.class);
+            //设置的所有规则
+            Map<String, Object> invokeParamsSet = new HashMap<>();
+            invokeParamsSet.put("allRulesDTO", allRulesDTO);
+            Boolean res = DataFacade.get("setAllRules", invokeParamsSet, Boolean.class);
         } catch (Exception e) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有规则失败" + e.getMessage());
         }

+ 16 - 0
src/main/java/com/diagbot/mapper/KlLexiconMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlLexicon;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 术语分类表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2022-02-23
+ */
+public interface KlLexiconMapper extends BaseMapper<KlLexicon> {
+
+}

+ 5 - 0
src/main/java/com/diagbot/mapper/KlRuleMapper.java

@@ -6,6 +6,7 @@ import com.diagbot.entity.KlRule;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoVO;
+import com.diagbot.vo.RuleBaseQueryVO;
 import com.diagbot.vo.RuleQueryVO;
 
 import java.util.List;
@@ -43,4 +44,8 @@ public interface KlRuleMapper extends BaseMapper<KlRule> {
     List<RuleBaseInitDTO> getRuleBaseInitDTONotHaveClass();
 
     List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass();
+
+    List<RuleIdDTO> getRuleNotHaveClass(RuleBaseQueryVO ruleBaseQueryVO);
+
+    List<RuleIdDTO> getRuleHaveClass(RuleBaseQueryVO ruleBaseQueryVO);
 }

+ 3 - 0
src/main/java/com/diagbot/mapper/KlRulePlanMapper.java

@@ -1,6 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.KlRulePlan;
 import com.diagbot.entity.wrapper.KlRuleMenuWrapper;
 import com.diagbot.vo.KlRuleMenuVO;
@@ -17,4 +18,6 @@ import java.util.List;
  */
 public interface KlRulePlanMapper extends BaseMapper<KlRulePlan> {
     List<KlRuleMenuWrapper> getComeMenu(KlRuleMenuVO klRuleMenuVO);
+
+    public List<DictionaryInfoDTO> getPlanDic();
 }

+ 16 - 0
src/main/java/com/diagbot/mapper/KlRuleSearchMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlRuleSearch;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 有效规则搜索表 Mapper 接口
+ * </p>
+ *
+ * @author dsYun
+ * @since 2024-10-29
+ */
+public interface KlRuleSearchMapper extends BaseMapper<KlRuleSearch> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/KlLexiconService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlLexicon;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 术语分类表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2022-02-23
+ */
+public interface KlLexiconService extends IService<KlLexicon> {
+
+}

+ 3 - 0
src/main/java/com/diagbot/service/KlRulePlanService.java

@@ -1,5 +1,6 @@
 package com.diagbot.service;
 
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.KlRulePlan;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.wrapper.KlRuleMenuWrapper;
@@ -17,4 +18,6 @@ import java.util.List;
  */
 public interface KlRulePlanService extends IService<KlRulePlan> {
     List<KlRuleMenuWrapper>  getComeMenu(KlRuleMenuVO klRuleMenuVO);
+
+    List<DictionaryInfoDTO> getPlanDic();
 }

+ 16 - 0
src/main/java/com/diagbot/service/KlRuleSearchService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlRuleSearch;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 有效规则搜索表 服务类
+ * </p>
+ *
+ * @author dsYun
+ * @since 2024-10-29
+ */
+public interface KlRuleSearchService extends IService<KlRuleSearch> {
+
+}

+ 5 - 0
src/main/java/com/diagbot/service/KlRuleService.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.*;
 import com.diagbot.entity.KlRule;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoVO;
+import com.diagbot.vo.RuleBaseQueryVO;
 import com.diagbot.vo.RuleQueryVO;
 
 import java.util.List;
@@ -39,4 +40,8 @@ public interface KlRuleService extends IService<KlRule> {
     List<RuleBaseInitDTO> getRuleBaseInitDTONotHaveClass();
 
     List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass();
+
+    List<RuleIdDTO> getRuleNotHaveClass(RuleBaseQueryVO ruleBaseQueryVO);
+
+    List<RuleIdDTO> getRuleHaveClass(RuleBaseQueryVO ruleBaseQueryVO);
 }

+ 20 - 0
src/main/java/com/diagbot/service/impl/KlLexiconServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlLexicon;
+import com.diagbot.mapper.KlLexiconMapper;
+import com.diagbot.service.KlLexiconService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 术语分类表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2022-02-23
+ */
+@Service
+public class KlLexiconServiceImpl extends ServiceImpl<KlLexiconMapper, KlLexicon> implements KlLexiconService {
+
+}

+ 6 - 0
src/main/java/com/diagbot/service/impl/KlRulePlanServiceImpl.java

@@ -1,5 +1,6 @@
 package com.diagbot.service.impl;
 
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.KlRulePlan;
 import com.diagbot.entity.wrapper.KlRuleMenuWrapper;
 import com.diagbot.mapper.KlRulePlanMapper;
@@ -25,4 +26,9 @@ public class KlRulePlanServiceImpl extends ServiceImpl<KlRulePlanMapper, KlRuleP
     public List<KlRuleMenuWrapper> getComeMenu(KlRuleMenuVO klRuleMenuVO) {
         return baseMapper.getComeMenu(klRuleMenuVO);
     }
+
+    @Override
+    public List<DictionaryInfoDTO> getPlanDic() {
+        return baseMapper.getPlanDic();
+    }
 }

+ 20 - 0
src/main/java/com/diagbot/service/impl/KlRuleSearchServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlRuleSearch;
+import com.diagbot.mapper.KlRuleSearchMapper;
+import com.diagbot.service.KlRuleSearchService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 有效规则搜索表 服务实现类
+ * </p>
+ *
+ * @author dsYun
+ * @since 2024-10-29
+ */
+@Service
+public class KlRuleSearchServiceImpl extends ServiceImpl<KlRuleSearchMapper, KlRuleSearch> implements KlRuleSearchService {
+
+}

+ 11 - 0
src/main/java/com/diagbot/service/impl/KlRuleServiceImpl.java

@@ -8,6 +8,7 @@ import com.diagbot.mapper.KlRuleMapper;
 import com.diagbot.service.KlRuleService;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoVO;
+import com.diagbot.vo.RuleBaseQueryVO;
 import com.diagbot.vo.RuleQueryVO;
 import org.springframework.stereotype.Service;
 
@@ -82,4 +83,14 @@ public class KlRuleServiceImpl extends ServiceImpl<KlRuleMapper, KlRule> impleme
     public List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass(){
         return baseMapper.getRuleBaseInitDTOHaveClass();
     }
+
+    @Override
+    public List<RuleIdDTO> getRuleNotHaveClass(RuleBaseQueryVO ruleBaseQueryVO){
+        return baseMapper.getRuleNotHaveClass(ruleBaseQueryVO);
+    }
+
+    @Override
+    public List<RuleIdDTO> getRuleHaveClass(RuleBaseQueryVO ruleBaseQueryVO){
+        return baseMapper.getRuleHaveClass(ruleBaseQueryVO);
+    }
 }

+ 115 - 47
src/main/resources/mapper/KlRuleMapper.xml

@@ -309,15 +309,16 @@
                 SELECT
                     t1.concept_id AS conceptId,
                     CONCAT_WS(
-                        "_",
-                        t1.concept_id,
-                        t1.rule_type
+                            "_",
+                            t1.concept_id,
+                            t1.rule_type
                     ) AS conceptGroup,
                     t1.id AS ruleId,
                     t4.lib_name AS libName,
                     t4.lib_type AS libType,
                     t1.rule_type AS ruleType,
                     t1.has_sub_cond AS hasSubCond,
+                    t1.description AS description,
                     t1.msg AS msg,
                     t1.gmt_modified AS gmtModified
                 FROM
@@ -325,42 +326,43 @@
                     kl_concept t4
                 WHERE
                     t1.is_deleted = "N"
-                AND t4.is_deleted = "N"
-                AND t1.concept_id = t4.id
-                AND t1. STATUS = 1
-                AND t4. STATUS = 1
-                AND t4.lib_type BETWEEN 100 AND 299
+                  AND t4.is_deleted = "N"
+                  AND t1.concept_id = t4.id
+                  AND t1. STATUS = 1
+                  AND t4. STATUS = 1
+                  AND t4.lib_type BETWEEN 100 AND 299
                 UNION
-                    SELECT
-                        t11.id AS conceptId,
-                        CONCAT_WS("_", t11.id, t1.rule_type) AS conceptGroup,
-                        t1.id AS ruleId,
-                        t11.lib_name AS libName,
-                        t11.lib_type AS libType,
-                        t1.rule_type AS ruleType,
-                        t1.has_sub_cond AS hasSubCond,
-                        t1.msg AS msg,
-                        t1.gmt_modified AS gmtModified
-                    FROM
-                        kl_rule t1,
-                        kl_concept t4,
-                        kl_relation t10,
-                        kl_concept t11
-                    WHERE
-                        t1.is_deleted = "N"
-                    AND t4.is_deleted = "N"
-                    AND t1.concept_id = t4.id
-                    AND t1. STATUS = 1
-                    AND t4. STATUS = 1
-                    AND t4.lib_type BETWEEN 300 AND 399
-                    AND t10.start_id = t4.id
-                    AND t10.relation_id = 600
-                    AND t10.end_id = t11.id
-                    AND t11.lib_type BETWEEN 100 AND 299
-                    AND t10.is_deleted = "N"
-                    AND t11.is_deleted = "N"
-                    AND t10. STATUS = 1
-                    AND t11. STATUS = 1
+                SELECT
+                    t11.id AS conceptId,
+                    CONCAT_WS("_", t11.id, t1.rule_type) AS conceptGroup,
+                    t1.id AS ruleId,
+                    t11.lib_name AS libName,
+                    t11.lib_type AS libType,
+                    t1.rule_type AS ruleType,
+                    t1.has_sub_cond AS hasSubCond,
+                    t1.description AS description,
+                    t1.msg AS msg,
+                    t1.gmt_modified AS gmtModified
+                FROM
+                    kl_rule t1,
+                    kl_concept t4,
+                    kl_relation t10,
+                    kl_concept t11
+                WHERE
+                    t1.is_deleted = "N"
+                  AND t4.is_deleted = "N"
+                  AND t1.concept_id = t4.id
+                  AND t1. STATUS = 1
+                  AND t4. STATUS = 1
+                  AND t4.lib_type BETWEEN 300 AND 399
+                  AND t10.start_id = t4.id
+                  AND t10.relation_id = 600
+                  AND t10.end_id = t11.id
+                  AND t11.lib_type BETWEEN 100 AND 299
+                  AND t10.is_deleted = "N"
+                  AND t11.is_deleted = "N"
+                  AND t10. STATUS = 1
+                  AND t11. STATUS = 1
             ) t12
         ORDER BY
             t12.conceptId,
@@ -582,13 +584,12 @@
             kl_concept t5
         WHERE
             t3.is_deleted = "N"
-        AND t5.is_deleted = "N"
-        AND t3. STATUS = 1
-        AND t5. STATUS = 1
-        AND t3.concept_id = t5.id
-        AND (t5.lib_type BETWEEN 100 AND 299
-		OR t5.lib_type= 410)
-        ORDER BY t5.id
+          AND t5.is_deleted = "N"
+          AND t3. STATUS = 1
+          AND t5. STATUS = 1
+          AND t3.concept_id = t5.id
+          AND (t5.lib_type BETWEEN 100 AND 299
+            OR t5.lib_type= 410)
     </select>
 
     <select id="getRuleBaseInitDTOHaveClass" resultType="com.diagbot.dto.RuleBaseInitDTO">
@@ -613,7 +614,69 @@
             kl_concept t11
         WHERE
             t3.is_deleted = "N"
+          AND t5.is_deleted = "N"
+          AND t3. STATUS = 1
+          AND t5. STATUS = 1
+          AND t3.concept_id = t5.id
+          AND t5.lib_type BETWEEN 300 AND 399
+          AND t10.start_id = t5.id
+          AND t10.relation_id = 600
+          AND t10.end_id = t11.id
+          AND (t11.lib_type BETWEEN 100 AND 299
+            OR t11.lib_type = 410)
+          AND t10.is_deleted = "N"
+          AND t11.is_deleted = "N"
+          AND t10. STATUS = 1
+          AND t11. STATUS = 1
+    </select>
+
+    <select id="getRuleNotHaveClass" resultType="com.diagbot.dto.RuleIdDTO" parameterType="com.diagbot.vo.RuleBaseQueryVO">
+        SELECT
+        t2.rule_id AS ruleId,
+        t3.id AS ruleBaseId,
+        t5.lib_name AS baseLibName,
+        t5.lib_type AS baseLibType,
+        t3.type AS baseType
+        FROM
+        kl_rule_condition t2,
+        kl_rule_base t3,
+        kl_concept t5
+        WHERE
+        t3.is_deleted = "N"
+        AND t5.is_deleted = "N"
+        AND t2.is_deleted = "N"
+        AND t2.rule_base_id = t3.id
+        AND t3. STATUS = 1
+        AND t5. STATUS = 1
+        AND t3.concept_id = t5.id
+        <if test="baseLibName!=null and baseLibName!=''">
+            AND UPPER(t5.lib_name) LIKE CONCAT('%', UPPER(trim(#{baseLibName})), '%')
+        </if>
+        <if test="baseLibType !=null">
+            AND t5.lib_type = #{baseLibType}
+        </if>
+        AND (t5.lib_type BETWEEN 100 AND 299
+        OR t5.lib_type= 410)
+    </select>
+
+    <select id="getRuleHaveClass" resultType="com.diagbot.dto.RuleIdDTO" parameterType="com.diagbot.vo.RuleBaseQueryVO">
+        SELECT
+        t2.rule_id AS ruleId,
+        t3.id AS ruleBaseId,
+        t11.lib_name AS baseLibName,
+        t11.lib_type AS baseLibType,
+        t3.type AS baseType
+        FROM
+        kl_rule_condition t2,
+        kl_rule_base t3,
+        kl_concept t5,
+        kl_relation t10,
+        kl_concept t11
+        WHERE
+        t3.is_deleted = "N"
         AND t5.is_deleted = "N"
+        AND t2.is_deleted = "N"
+        AND t2.rule_base_id = t3.id
         AND t3. STATUS = 1
         AND t5. STATUS = 1
         AND t3.concept_id = t5.id
@@ -621,12 +684,17 @@
         AND t10.start_id = t5.id
         AND t10.relation_id = 600
         AND t10.end_id = t11.id
+        <if test="baseLibName!=null and baseLibName!=''">
+            AND UPPER(t11.lib_name) LIKE CONCAT('%', UPPER(trim(#{baseLibName})), '%')
+        </if>
+        <if test="baseLibType !=null">
+            AND t11.lib_type = #{baseLibType}
+        </if>
         AND (t11.lib_type BETWEEN 100 AND 299
-		OR t11.lib_type = 410)
+        OR t11.lib_type = 410)
         AND t10.is_deleted = "N"
         AND t11.is_deleted = "N"
         AND t10. STATUS = 1
         AND t11. STATUS = 1
-        ORDER BY t11.id
     </select>
 </mapper>

+ 106 - 0
src/main/resources/mapper/KlRulePlanMapper.xml

@@ -30,4 +30,110 @@
             and plan_code = #{planCode}
         </if>
     </select>
+
+    <select id="getPlanDic" resultType="com.diagbot.dto.DictionaryInfoDTO">
+        SELECT * FROM
+            (
+                SELECT DISTINCT
+                    a. NAME,
+                    a.rule_type val,
+                    -101 group_type,
+                    '规则查询_规则类型' remark
+                FROM
+                    `kl_rule_plan` a
+                WHERE
+                    a.is_deleted = 'N'
+                  AND a.plan_code = 'rule'
+                  AND a.parent_id = - 1
+                ORDER BY
+                    a.order_no
+            ) t1
+
+        UNION
+
+        SELECT * FROM
+            (
+                SELECT DISTINCT
+                    b. NAME,
+                    b. CODE val,
+                    -102 group_type,
+                    '规则查询_术语类型' remark
+                FROM
+                    `kl_rule_plan` a,
+                    `kl_rule_plan` b
+                WHERE
+                    a.is_deleted = 'N'
+                  AND b.is_deleted = 'N'
+                  AND a.plan_code = 'rule'
+                  AND b.plan_code = 'rule'
+                  AND a.parent_id = - 1
+                  AND a.id = b.parent_id
+        <![CDATA[ AND (b. CODE < 308 OR b. CODE > 350) ]]>
+        ORDER BY
+                    a.order_no,
+                    b.order_no
+            ) t2
+
+        union
+        SELECT * FROM
+            (
+                SELECT DISTINCT
+                    c. NAME,
+                    c. type val,
+                    -103 group_type,
+                    '规则查询_基础规则类型' remark
+                FROM
+                    `kl_rule_plan` a,
+                    `kl_rule_plan` b,
+                    `kl_rule_plan` c
+                WHERE
+                    a.is_deleted = 'N'
+                  AND b.is_deleted = 'N'
+                  AND c.is_deleted = 'N'
+                  AND a.plan_code = 'rule'
+                  AND b.plan_code = 'rule'
+                  AND c.plan_code = 'rule'
+                  AND a.parent_id = -1
+                  AND a.id = b.parent_id
+                  AND b.id = c.parent_id
+        <![CDATA[ AND (b. CODE < 308 OR b. CODE > 350) ]]>
+        ORDER BY
+                    c.type
+            ) t3
+
+        UNION
+        SELECT * FROM
+            (
+                SELECT DISTINCT
+                    d. NAME,
+                    d. CODE val,
+                    -104 group_type,
+                    '规则查询_基础规则术语类型' remark
+                FROM
+                    `kl_rule_plan` a,
+                    `kl_rule_plan` b,
+                    `kl_rule_plan` c,
+                    `kl_rule_plan` d
+                WHERE
+                    a.is_deleted = 'N'
+                  AND b.is_deleted = 'N'
+                  AND c.is_deleted = 'N'
+                  AND d.is_deleted = 'N'
+                  AND a.plan_code = 'rule'
+                  AND b.plan_code = 'rule'
+                  AND c.plan_code = 'rule'
+                  AND d.plan_code = 'rule'
+                  AND a.parent_id = -1
+                  AND a.id = b.parent_id
+                  AND b.id = c.parent_id
+                  AND c.id = d.parent_id
+        <![CDATA[ AND (d. CODE < 308 OR d. CODE > 350) ]]>
+        ORDER BY
+                    a.order_no,
+                    b.order_no,
+                    c.order_no,
+                    d.order_no
+            ) t4
+    </select>
+
 </mapper>

+ 15 - 0
src/main/resources/mapper/KlRuleSearchMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.KlRuleSearchMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlRuleSearch">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+    </resultMap>
+
+</mapper>