Pārlūkot izejas kodu

缓存所有去重的基础诊断依据

gaodm 4 gadi atpakaļ
vecāks
revīzija
fd2920fa66
23 mainītis faili ar 1062 papildinājumiem un 3 dzēšanām
  1. 3 0
      src/main/java/com/diagbot/config/CacheDeleteInit.java
  2. 88 0
      src/main/java/com/diagbot/dto/BaseDiagnoseDTO.java
  3. 153 0
      src/main/java/com/diagbot/entity/KlDiagnose.java
  4. 293 0
      src/main/java/com/diagbot/entity/KlDiagnoseBase.java
  5. 195 0
      src/main/java/com/diagbot/entity/KlDiagnoseCondition.java
  6. 2 1
      src/main/java/com/diagbot/enums/RedisEnum.java
  7. 12 0
      src/main/java/com/diagbot/facade/CacheFacade.java
  8. 13 0
      src/main/java/com/diagbot/facade/KlDiagnoseBaseFacade.java
  9. 11 1
      src/main/java/com/diagbot/facade/NeoFacade.java
  10. 20 0
      src/main/java/com/diagbot/mapper/KlDiagnoseBaseMapper.java
  11. 16 0
      src/main/java/com/diagbot/mapper/KlDiagnoseConditionMapper.java
  12. 16 0
      src/main/java/com/diagbot/mapper/KlDiagnoseMapper.java
  13. 20 0
      src/main/java/com/diagbot/service/KlDiagnoseBaseService.java
  14. 16 0
      src/main/java/com/diagbot/service/KlDiagnoseConditionService.java
  15. 16 0
      src/main/java/com/diagbot/service/KlDiagnoseService.java
  16. 26 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseBaseServiceImpl.java
  17. 20 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseConditionServiceImpl.java
  18. 20 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseServiceImpl.java
  19. 1 0
      src/main/java/com/diagbot/web/CacheController.java
  20. 81 0
      src/main/resources/mapper/KlDiagnoseBaseMapper.xml
  21. 21 0
      src/main/resources/mapper/KlDiagnoseConditionMapper.xml
  22. 18 0
      src/main/resources/mapper/KlDiagnoseMapper.xml
  23. 1 1
      src/test/java/com/diagbot/CodeGeneration.java

+ 3 - 0
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -41,6 +41,9 @@ public class CacheDeleteInit implements CommandLineRunner {
 //        cacheFacade.loadAllRuleCache();
 //        log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
 //
+//        cacheFacade.loadAllBaseDiagnoseCache();
+//        log.info("CDSS-CORE服务启动加载医学知识库中的所有去重的基础诊断依据!");
+
         //无用的缓存
         //
         //        cacheFacade.getSymptomCache();

+ 88 - 0
src/main/java/com/diagbot/dto/BaseDiagnoseDTO.java

@@ -0,0 +1,88 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 10:49
+ */
+@Getter
+@Setter
+public class BaseDiagnoseDTO {
+    /**
+     * 联合唯一键
+     */
+    private String baseKey;
+
+    /**
+     * id逗号隔开
+     */
+    private String ids;
+
+    /**
+     * 医学基本术语
+     */
+    private String libName;
+
+    /**
+     * 术语类型
+     */
+    private String libNype;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    private Integer type;
+
+    /**
+     * 最小域比较符
+     */
+    private String minOperator;
+
+    /**
+     * 最小域值
+     */
+    private String minValue;
+
+    /**
+     * 最小域单位
+     */
+    private String minUnit;
+
+    /**
+     * 最大域比较符
+     */
+    private String maxOperator;
+
+    /**
+     * 最大域值
+     */
+    private String maxValue;
+
+    /**
+     * 最大域单位
+     */
+    private String maxUnit;
+
+    /**
+     * 等于域比较符
+     */
+    private String eqOperator;
+
+    /**
+     * 等于域值
+     */
+    private String eqValue;
+
+    /**
+     * 等于域单位
+     */
+    private String eqUnit;
+}

+ 153 - 0
src/main/java/com/diagbot/entity/KlDiagnose.java

@@ -0,0 +1,153 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据信息表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public class KlDiagnose 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;
+
+    /**
+     * 疾病概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date 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;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnose{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", conceptId=" + conceptId +
+                ", description=" + description +
+                ", status=" + status +
+                "}";
+    }
+}

+ 293 - 0
src/main/java/com/diagbot/entity/KlDiagnoseBase.java

@@ -0,0 +1,293 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据基础表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public class KlDiagnoseBase 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;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    private Integer type;
+
+    /**
+     * 最小域比较符
+     */
+    private String minOperator;
+
+    /**
+     * 最小域值
+     */
+    private String minValue;
+
+    /**
+     * 最小域单位
+     */
+    private String minUnit;
+
+    /**
+     * 最大域比较符
+     */
+    private String maxOperator;
+
+    /**
+     * 最大域值
+     */
+    private String maxValue;
+
+    /**
+     * 最大域单位
+     */
+    private String maxUnit;
+
+    /**
+     * 等于域比较符
+     */
+    private String eqOperator;
+
+    /**
+     * 等于域值
+     */
+    private String eqValue;
+
+    /**
+     * 等于域单位
+     */
+    private String eqUnit;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date 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;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getMinOperator() {
+        return minOperator;
+    }
+
+    public void setMinOperator(String minOperator) {
+        this.minOperator = minOperator;
+    }
+
+    public String getMinValue() {
+        return minValue;
+    }
+
+    public void setMinValue(String minValue) {
+        this.minValue = minValue;
+    }
+
+    public String getMinUnit() {
+        return minUnit;
+    }
+
+    public void setMinUnit(String minUnit) {
+        this.minUnit = minUnit;
+    }
+
+    public String getMaxOperator() {
+        return maxOperator;
+    }
+
+    public void setMaxOperator(String maxOperator) {
+        this.maxOperator = maxOperator;
+    }
+
+    public String getMaxValue() {
+        return maxValue;
+    }
+
+    public void setMaxValue(String maxValue) {
+        this.maxValue = maxValue;
+    }
+
+    public String getMaxUnit() {
+        return maxUnit;
+    }
+
+    public void setMaxUnit(String maxUnit) {
+        this.maxUnit = maxUnit;
+    }
+
+    public String getEqOperator() {
+        return eqOperator;
+    }
+
+    public void setEqOperator(String eqOperator) {
+        this.eqOperator = eqOperator;
+    }
+
+    public String getEqValue() {
+        return eqValue;
+    }
+
+    public void setEqValue(String eqValue) {
+        this.eqValue = eqValue;
+    }
+
+    public String getEqUnit() {
+        return eqUnit;
+    }
+
+    public void setEqUnit(String eqUnit) {
+        this.eqUnit = eqUnit;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnoseBase{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", conceptId=" + conceptId +
+                ", description=" + description +
+                ", type=" + type +
+                ", minOperator=" + minOperator +
+                ", minValue=" + minValue +
+                ", minUnit=" + minUnit +
+                ", maxOperator=" + maxOperator +
+                ", maxValue=" + maxValue +
+                ", maxUnit=" + maxUnit +
+                ", eqOperator=" + eqOperator +
+                ", eqValue=" + eqValue +
+                ", eqUnit=" + eqUnit +
+                ", status=" + status +
+                "}";
+    }
+}

+ 195 - 0
src/main/java/com/diagbot/entity/KlDiagnoseCondition.java

@@ -0,0 +1,195 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据条件表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public class KlDiagnoseCondition 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;
+
+    /**
+     * 诊断依据主表id
+     */
+    private Long diagnoseId;
+
+    /**
+     * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
+     */
+    private Integer conditionType;
+
+    /**
+     * 规则组别(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer conditionGroup;
+
+    /**
+     * 符合数量(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer fitNo;
+
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+
+    /**
+     * 基础规则id(condition_type为1:基础条件有效)
+     */
+    private Long ruleBaseId;
+
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date 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;
+    }
+
+    public Long getDiagnoseId() {
+        return diagnoseId;
+    }
+
+    public void setDiagnoseId(Long diagnoseId) {
+        this.diagnoseId = diagnoseId;
+    }
+
+    public Integer getConditionType() {
+        return conditionType;
+    }
+
+    public void setConditionType(Integer conditionType) {
+        this.conditionType = conditionType;
+    }
+
+    public Integer getConditionGroup() {
+        return conditionGroup;
+    }
+
+    public void setConditionGroup(Integer conditionGroup) {
+        this.conditionGroup = conditionGroup;
+    }
+
+    public Integer getFitNo() {
+        return fitNo;
+    }
+
+    public void setFitNo(Integer fitNo) {
+        this.fitNo = fitNo;
+    }
+
+    public Integer getBaseGroup() {
+        return baseGroup;
+    }
+
+    public void setBaseGroup(Integer baseGroup) {
+        this.baseGroup = baseGroup;
+    }
+
+    public Long getRuleBaseId() {
+        return ruleBaseId;
+    }
+
+    public void setRuleBaseId(Long ruleBaseId) {
+        this.ruleBaseId = ruleBaseId;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnoseCondition{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", diagnoseId=" + diagnoseId +
+                ", conditionType=" + conditionType +
+                ", conditionGroup=" + conditionGroup +
+                ", fitNo=" + fitNo +
+                ", baseGroup=" + baseGroup +
+                ", ruleBaseId=" + ruleBaseId +
+                "}";
+    }
+}

+ 2 - 1
src/main/java/com/diagbot/enums/RedisEnum.java

@@ -20,7 +20,8 @@ public enum RedisEnum implements KeyedNamed {
     diseaseCorrespond(8, "diseaseCorrespond:"),
     diseaseFilter(9, "diseaseFilter:"),
     diseaseType(2, "diseaseType:"),
-    allRule(10, "allRule:");
+    allRule(10, "allRule:"),
+    allBaseDiagnose(11, "allBaseDiagnose");
 
     @Setter
     private int key;

+ 12 - 0
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -19,6 +19,8 @@ public class CacheFacade {
     RedisUtil redisUtil;
     @Autowired
     NeoFacade neoFacade;
+    @Autowired
+    private KlDiagnoseBaseFacade klDiagnoseBaseFacade;
 
     /**
      * 清除缓存信息
@@ -97,6 +99,16 @@ public class CacheFacade {
         neoFacade.allRuleCache();
     }
 
+    /**
+     * 缓存医学知识库中的所有去重的基础诊断依据
+     *
+     * @return
+     */
+    public void loadAllBaseDiagnoseCache(){
+        redisUtil.delete(RedisEnum.allBaseDiagnose.getName());
+        neoFacade.allBaseDiagnose();
+    }
+
     public void clearLoadCache(String str) {
         redisUtil.deleteByPrex(str);
     }

+ 13 - 0
src/main/java/com/diagbot/facade/KlDiagnoseBaseFacade.java

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.KlDiagnoseBaseServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 10:58
+ */
+@Component
+public class KlDiagnoseBaseFacade extends KlDiagnoseBaseServiceImpl {
+}

+ 11 - 1
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.ChiefPresentSimilarityServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
+import com.diagbot.dto.BaseDiagnoseDTO;
 import com.diagbot.dto.DrugNameDTO;
 import com.diagbot.dto.DrugTypeCacheDTO;
 import com.diagbot.dto.DrugTypeDTO;
@@ -86,6 +87,8 @@ public class NeoFacade {
     private KlRuleFacade klRuleFacade;
     @Autowired
     private KlRelationFacade klRelationFacade;
+    @Autowired
+    private KlDiagnoseBaseFacade klDiagnoseBaseFacade;
 
     /**
      * 返回药品缓存信息
@@ -489,7 +492,7 @@ public class NeoFacade {
      * 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital"
      *
      * @param standConvert
-     * @return Map<String,Map<String,String>> -->Map<类型, Map<原始词, 标准词>>
+     * @return Map<String , Map < String , String>> -->Map<类型, Map<原始词, 标准词>>
      */
     public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
         Map<String, Map<String, String>> map = new LinkedHashMap<>();
@@ -694,4 +697,11 @@ public class NeoFacade {
             redisTemplate.opsForValue().multiSet(map);
         }
     }
+
+    public void allBaseDiagnose() {
+        List<BaseDiagnoseDTO> list = klDiagnoseBaseFacade.getAllBaseDiagnose();
+        if (ListUtil.isNotEmpty(list)) {
+            redisTemplate.opsForValue().set(RedisEnum.allBaseDiagnose.getName(), list);
+        }
+    }
 }

+ 20 - 0
src/main/java/com/diagbot/mapper/KlDiagnoseBaseMapper.java

@@ -0,0 +1,20 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.entity.KlDiagnoseBase;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseBaseMapper extends BaseMapper<KlDiagnoseBase> {
+    //获取所有去重的基础诊断依据
+    List<BaseDiagnoseDTO> getAllBaseDiagnose();
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 诊断依据条件表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseConditionMapper extends BaseMapper<KlDiagnoseCondition> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 诊断依据信息表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseMapper extends BaseMapper<KlDiagnose> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service;
+
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.entity.KlDiagnoseBase;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseBaseService extends IService<KlDiagnoseBase> {
+    //获取所有去重的基础诊断依据
+    List<BaseDiagnoseDTO> getAllBaseDiagnose();
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 诊断依据条件表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseConditionService extends IService<KlDiagnoseCondition> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseService extends IService<KlDiagnose> {
+
+}

+ 26 - 0
src/main/java/com/diagbot/service/impl/KlDiagnoseBaseServiceImpl.java

@@ -0,0 +1,26 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.mapper.KlDiagnoseBaseMapper;
+import com.diagbot.service.KlDiagnoseBaseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseBaseServiceImpl extends ServiceImpl<KlDiagnoseBaseMapper, KlDiagnoseBase> implements KlDiagnoseBaseService {
+    //获取所有去重的基础诊断依据
+    public List<BaseDiagnoseDTO> getAllBaseDiagnose(){
+        return baseMapper.getAllBaseDiagnose();
+    }
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.diagbot.mapper.KlDiagnoseConditionMapper;
+import com.diagbot.service.KlDiagnoseConditionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 诊断依据条件表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseConditionServiceImpl extends ServiceImpl<KlDiagnoseConditionMapper, KlDiagnoseCondition> implements KlDiagnoseConditionService {
+
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.mapper.KlDiagnoseMapper;
+import com.diagbot.service.KlDiagnoseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseServiceImpl extends ServiceImpl<KlDiagnoseMapper, KlDiagnose> implements KlDiagnoseService {
+
+}

+ 1 - 0
src/main/java/com/diagbot/web/CacheController.java

@@ -37,6 +37,7 @@ public class CacheController {
         cacheFacade.getDiseaseCorrespondCache();
         cacheFacade.getdiseaseFilterCache();
         cacheFacade.loadAllRuleCache();
+        cacheFacade.loadAllBaseDiagnoseCache();
         //无用的缓存
 //        cacheFacade.loadDiseaseTypeCache();
 //        cacheFacade.getSymptomCache();

+ 81 - 0
src/main/resources/mapper/KlDiagnoseBaseMapper.xml

@@ -0,0 +1,81 @@
+<?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.KlDiagnoseBaseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnoseBase">
+        <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" />
+        <result column="concept_id" property="conceptId" />
+        <result column="description" property="description" />
+        <result column="type" property="type" />
+        <result column="min_operator" property="minOperator" />
+        <result column="min_value" property="minValue" />
+        <result column="min_unit" property="minUnit" />
+        <result column="max_operator" property="maxOperator" />
+        <result column="max_value" property="maxValue" />
+        <result column="max_unit" property="maxUnit" />
+        <result column="eq_operator" property="eqOperator" />
+        <result column="eq_value" property="eqValue" />
+        <result column="eq_unit" property="eqUnit" />
+        <result column="status" property="status" />
+    </resultMap>
+
+    <select id="getAllBaseDiagnose" resultType="com.diagbot.dto.BaseDiagnoseDTO">
+        SELECT DISTINCT
+            CONCAT_WS(
+                "_",
+                t1.concept_id,
+                t1.type,
+                t1.max_operator,
+                t1.max_value,
+                t1.max_unit,
+                t1.min_operator,
+                t1.min_value,
+                t1.min_unit,
+                t1.eq_operator,
+                t1.eq_value,
+                t1.eq_unit
+            ) AS baseKey,
+            GROUP_CONCAT(t1.id) as ids,
+            t2.lib_name,
+            t2.lib_type,
+            t1.concept_id,
+            t1.type,
+            t1.max_operator,
+            t1.max_value,
+            t1.max_unit,
+            t1.min_operator,
+            t1.min_value,
+            t1.min_unit,
+            t1.eq_operator,
+            t1.eq_value,
+            t1.eq_unit
+        FROM
+            kl_diagnose_base t1,
+            kl_concept t2
+        WHERE
+            t1.concept_id = t2.id
+        AND t1.is_deleted = "N"
+        AND t1.`status` = 1
+        AND t2.is_deleted = "N"
+        AND t2.`status` = 1
+        GROUP BY
+            t1.concept_id,
+            t1.type,
+            t1.max_operator,
+            t1.max_value,
+            t1.max_unit,
+            t1.min_operator,
+            t1.min_value,
+            t1.min_unit,
+            t1.eq_operator,
+            t1.eq_value,
+            t1.eq_unit;
+    </select>
+
+</mapper>

+ 21 - 0
src/main/resources/mapper/KlDiagnoseConditionMapper.xml

@@ -0,0 +1,21 @@
+<?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.KlDiagnoseConditionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnoseCondition">
+        <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" />
+        <result column="diagnose_id" property="diagnoseId" />
+        <result column="condition_type" property="conditionType" />
+        <result column="condition_group" property="conditionGroup" />
+        <result column="fit_no" property="fitNo" />
+        <result column="base_group" property="baseGroup" />
+        <result column="rule_base_id" property="ruleBaseId" />
+    </resultMap>
+
+</mapper>

+ 18 - 0
src/main/resources/mapper/KlDiagnoseMapper.xml

@@ -0,0 +1,18 @@
+<?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.KlDiagnoseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnose">
+        <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" />
+        <result column="concept_id" property="conceptId" />
+        <result column="description" property="description" />
+        <result column="status" property="status" />
+    </resultMap>
+
+</mapper>

+ 1 - 1
src/test/java/com/diagbot/CodeGeneration.java

@@ -56,7 +56,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
         // strategy.setTablePrefix(new String[] { "demo_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "kl_relation_order"}); // 需要生成的表
+        strategy.setInclude(new String[] { "kl_diagnose","kl_diagnose_base","kl_diagnose_condition"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);