浏览代码

Merge branch 'debug' of http://192.168.2.236:10080/gaodm/diagbotcloud into debug

Zhaops 6 年之前
父节点
当前提交
666957b246
共有 100 个文件被更改,包括 5544 次插入524 次删除
  1. 20 0
      aipt-service/src/main/java/com/diagbot/client/AIServiceClient.java
  2. 53 0
      aipt-service/src/main/java/com/diagbot/client/AlgorithmClassify.java
  3. 202 0
      aipt-service/src/main/java/com/diagbot/client/Feature.java
  4. 159 0
      aipt-service/src/main/java/com/diagbot/client/bean/Constants.java
  5. 43 0
      aipt-service/src/main/java/com/diagbot/client/bean/FeatureRate.java
  6. 190 0
      aipt-service/src/main/java/com/diagbot/client/bean/Response.java
  7. 98 0
      aipt-service/src/main/java/com/diagbot/client/bean/ResponseData.java
  8. 273 0
      aipt-service/src/main/java/com/diagbot/client/bean/SearchData.java
  9. 132 0
      aipt-service/src/main/java/com/diagbot/client/bean/Status.java
  10. 23 0
      aipt-service/src/main/java/com/diagbot/client/hystrix/AIServiceHystrix.java
  11. 22 0
      aipt-service/src/main/java/com/diagbot/dto/LisResult.java
  12. 53 0
      aipt-service/src/main/java/com/diagbot/facade/ClinicalFacade.java
  13. 64 0
      aipt-service/src/main/java/com/diagbot/vo/SearchVo.java
  14. 56 0
      aipt-service/src/main/java/com/diagbot/web/ClinicalController.java
  15. 3 0
      config-server/src/main/resources/shared/aipt-service-dev.yml
  16. 3 0
      config-server/src/main/resources/shared/aipt-service-local.yml
  17. 3 0
      config-server/src/main/resources/shared/aipt-service-pro.yml
  18. 3 0
      config-server/src/main/resources/shared/aipt-service-test.yml
  19. 6 0
      config-server/src/main/resources/shared/knowledgeman-service-dev.yml
  20. 6 0
      config-server/src/main/resources/shared/knowledgeman-service-local.yml
  21. 6 0
      config-server/src/main/resources/shared/knowledgeman-service-pro.yml
  22. 6 0
      config-server/src/main/resources/shared/knowledgeman-service-test.yml
  23. 6 2
      knowledge-service/src/main/java/com/diagbot/dto/ConceptDTO.java
  24. 5 0
      knowledge-service/src/main/java/com/diagbot/dto/LibraryInfoDTO.java
  25. 3 13
      knowledge-service/src/main/java/com/diagbot/dto/MedicalDTO.java
  26. 49 0
      knowledge-service/src/main/java/com/diagbot/dto/RelationDTO.java
  27. 56 0
      knowledge-service/src/main/java/com/diagbot/entity/LexiconRelationship.java
  28. 196 0
      knowledge-service/src/main/java/com/diagbot/entity/LibraryDetail.java
  29. 171 0
      knowledge-service/src/main/java/com/diagbot/entity/LibraryInfo.java
  30. 48 44
      knowledge-service/src/main/java/com/diagbot/entity/Medical.java
  31. 78 0
      knowledge-service/src/main/java/com/diagbot/entity/Relation.java
  32. 24 22
      knowledge-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  33. 17 3
      knowledge-service/src/main/java/com/diagbot/facade/LibraryInfoFacade.java
  34. 12 5
      knowledge-service/src/main/java/com/diagbot/facade/MedicalFacade.java
  35. 140 0
      knowledge-service/src/main/java/com/diagbot/facade/RelationFacade.java
  36. 31 0
      knowledge-service/src/main/java/com/diagbot/facade/RelationshipFacade.java
  37. 18 0
      knowledge-service/src/main/java/com/diagbot/mapper/LexiconRelationshipMapper.java
  38. 25 0
      knowledge-service/src/main/java/com/diagbot/mapper/LibraryDetailMapper.java
  39. 25 0
      knowledge-service/src/main/java/com/diagbot/mapper/LibraryInfoMapper.java
  40. 2 2
      knowledge-service/src/main/java/com/diagbot/mapper/MedicalMapper.java
  41. 26 0
      knowledge-service/src/main/java/com/diagbot/mapper/RelationMapper.java
  42. 18 0
      knowledge-service/src/main/java/com/diagbot/service/LexiconRelationshipService.java
  43. 19 0
      knowledge-service/src/main/java/com/diagbot/service/LibraryDetailService.java
  44. 19 0
      knowledge-service/src/main/java/com/diagbot/service/LibraryInfoService.java
  45. 1 1
      knowledge-service/src/main/java/com/diagbot/service/MedicalService.java
  46. 20 0
      knowledge-service/src/main/java/com/diagbot/service/RelationService.java
  47. 25 0
      knowledge-service/src/main/java/com/diagbot/service/impl/LexiconRelationshipServiceImpl.java
  48. 26 0
      knowledge-service/src/main/java/com/diagbot/service/impl/LibraryDetailServiceImpl.java
  49. 25 0
      knowledge-service/src/main/java/com/diagbot/service/impl/LibraryInfoServiceImpl.java
  50. 1 1
      knowledge-service/src/main/java/com/diagbot/service/impl/MedicalServiceImpl.java
  51. 26 0
      knowledge-service/src/main/java/com/diagbot/service/impl/RelationServiceImpl.java
  52. 7 3
      knowledgeman-service/src/main/java/com/diagbot/vo/AddLibraryVo.java
  53. 3 0
      knowledge-service/src/main/java/com/diagbot/vo/TermVo.java
  54. 1 1
      knowledge-service/src/main/java/com/diagbot/web/ConceptController.java
  55. 3 3
      knowledgeman-service/src/main/java/com/diagbot/web/InformationController.java
  56. 2 0
      knowledge-service/src/main/java/com/diagbot/web/LibraryController.java
  57. 20 0
      knowledge-service/src/main/java/com/diagbot/web/LibraryDetailController.java
  58. 4 4
      knowledgeman-service/src/main/java/com/diagbot/web/BodypartController.java
  59. 3 3
      knowledgeman-service/src/main/java/com/diagbot/web/LexiconController.java
  60. 1 0
      knowledge-service/src/main/resources/mapper/ConceptMapper.xml
  61. 12 0
      knowledge-service/src/main/resources/mapper/LexiconRelationshipMapper.xml
  62. 22 0
      knowledge-service/src/main/resources/mapper/LibraryDetailMapper.xml
  63. 20 0
      knowledge-service/src/main/resources/mapper/LibraryInfoMapper.xml
  64. 4 6
      knowledge-service/src/main/resources/mapper/MedicalMapper.xml
  65. 18 0
      knowledge-service/src/main/resources/mapper/RelationMapper.xml
  66. 1 1
      knowledge-service/src/test/java/com/diagbot/CodeGeneration.java
  67. 11 0
      knowledgeman-service/pom.xml
  68. 76 76
      knowledgeman-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  69. 458 0
      knowledgeman-service/src/main/java/com/diagbot/api/ImportExcel.java
  70. 68 0
      knowledgeman-service/src/main/java/com/diagbot/api/ImportWord.java
  71. 72 0
      knowledgeman-service/src/main/java/com/diagbot/dto/ConceptDTO.java
  72. 95 0
      knowledgeman-service/src/main/java/com/diagbot/dto/LibraryDetailDTO.java
  73. 80 0
      knowledgeman-service/src/main/java/com/diagbot/dto/LibraryInfoDTO.java
  74. 27 7
      knowledgeman-service/src/main/java/com/diagbot/dto/MedicalDTO.java
  75. 64 0
      knowledgeman-service/src/main/java/com/diagbot/dto/RelationDTO.java
  76. 5 0
      knowledgeman-service/src/main/java/com/diagbot/dto/TermDTO.java
  77. 27 0
      knowledgeman-service/src/main/java/com/diagbot/dto/TypeDTO.java
  78. 80 0
      knowledgeman-service/src/main/java/com/diagbot/entity/Concept.java
  79. 0 91
      knowledgeman-service/src/main/java/com/diagbot/entity/Information.java
  80. 57 0
      knowledgeman-service/src/main/java/com/diagbot/entity/LexiconRelationship.java
  81. 0 53
      knowledgeman-service/src/main/java/com/diagbot/entity/Library.java
  82. 210 0
      knowledgeman-service/src/main/java/com/diagbot/entity/LibraryDetail.java
  83. 171 0
      knowledgeman-service/src/main/java/com/diagbot/entity/LibraryInfo.java
  84. 57 39
      knowledgeman-service/src/main/java/com/diagbot/entity/Medical.java
  85. 102 0
      knowledgeman-service/src/main/java/com/diagbot/entity/Relation.java
  86. 244 0
      knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  87. 0 28
      knowledgeman-service/src/main/java/com/diagbot/facade/InformationFacade.java
  88. 191 0
      knowledgeman-service/src/main/java/com/diagbot/facade/LibraryDetailFacade.java
  89. 0 82
      knowledgeman-service/src/main/java/com/diagbot/facade/LibraryFacade.java
  90. 116 0
      knowledgeman-service/src/main/java/com/diagbot/facade/LibraryInfoFacade.java
  91. 185 7
      knowledgeman-service/src/main/java/com/diagbot/facade/MedicalFacade.java
  92. 306 0
      knowledgeman-service/src/main/java/com/diagbot/facade/RelationFacade.java
  93. 36 0
      knowledgeman-service/src/main/java/com/diagbot/facade/RelationshipFacade.java
  94. 32 0
      knowledgeman-service/src/main/java/com/diagbot/facade/TypeFacade.java
  95. 36 0
      knowledgeman-service/src/main/java/com/diagbot/mapper/ConceptMapper.java
  96. 0 25
      knowledgeman-service/src/main/java/com/diagbot/mapper/InformationMapper.java
  97. 12 2
      knowledgeman-service/src/main/java/com/diagbot/mapper/LexiconMapper.java
  98. 18 0
      knowledgeman-service/src/main/java/com/diagbot/mapper/LexiconRelationshipMapper.java
  99. 51 0
      knowledgeman-service/src/main/java/com/diagbot/mapper/LibraryDetailMapper.java
  100. 0 0
      knowledgeman-service/src/main/java/com/diagbot/mapper/LibraryInfoMapper.java

+ 20 - 0
aipt-service/src/main/java/com/diagbot/client/AIServiceClient.java

@@ -0,0 +1,20 @@
+package com.diagbot.client;
+
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseData;
+import com.diagbot.vo.SearchVo;
+import com.diagbot.client.hystrix.AIServiceHystrix;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/11/20 13:15
+ */
+@FeignClient(name = "AI", url = "${ai.server.address}", fallback = AIServiceHystrix.class)
+public interface AIServiceClient {
+    @PostMapping(value = "/push-web/algorithm/neural")
+    Response<ResponseData> bayesPageData(@RequestBody SearchVo searchVo);
+}

+ 53 - 0
aipt-service/src/main/java/com/diagbot/client/AlgorithmClassify.java

@@ -0,0 +1,53 @@
+package com.diagbot.client;
+
+/**
+ * @Auther: fyeman
+ * @Date: 2018/7/19/019 10:37
+ * @Description:
+ */
+public enum AlgorithmClassify {
+    NEURAL("0"), BAYES("1"), EMERGENCY_NEURAL("2"), OUTPATIENT_NEURAL("3"),
+    NEURAL_SYMPTOM("11"),
+    NEURAL_DIAG("21"),
+    NEURAL_VITAL("31"),
+    NEURAL_LIS("41"),
+    NEURAL_PACS("51"),
+    NEURAL_DIAG_SYMPTOM("111"),
+    NEURAL_DIAG_VITAL("131"),
+    NEURAL_DIAG_LIS("141"),
+    NEURAL_DIAG_PACS("151");
+
+    private String value;
+
+    AlgorithmClassify(String value) {
+        this.value = value;
+    }
+
+    public String toString() {
+        return value;
+    }
+
+    public static AlgorithmClassify parse(String value) {
+        switch (value) {
+            case "11":
+                return AlgorithmClassify.NEURAL_SYMPTOM;
+            case "21":
+                return AlgorithmClassify.NEURAL_DIAG;
+            case "31":
+                return AlgorithmClassify.NEURAL_VITAL;
+            case "41":
+                return AlgorithmClassify.NEURAL_LIS;
+            case "51":
+                return AlgorithmClassify.NEURAL_PACS;
+            case "111":
+                return AlgorithmClassify.NEURAL_DIAG_SYMPTOM;
+            case "131":
+                return AlgorithmClassify.NEURAL_DIAG_VITAL;
+            case "141":
+                return AlgorithmClassify.NEURAL_DIAG_LIS;
+            case "151":
+                return AlgorithmClassify.NEURAL_DIAG_PACS;
+        }
+        return AlgorithmClassify.NEURAL_DIAG;
+    }
+}

+ 202 - 0
aipt-service/src/main/java/com/diagbot/client/Feature.java

@@ -0,0 +1,202 @@
+package com.diagbot.client;
+
+import java.io.Serializable;
+
+/**
+ * @Title: Feature.java
+ * @Package: com.zjlantone.nlp.web.doc.dao.model
+ * @Description: 数据库操作接口类
+ * @author: 楼辉荣
+ * @date: 2016年8月8日 下午17:16:23
+ * @version: V1.0
+ */
+
+@SuppressWarnings("serial")
+public class Feature implements Serializable {
+    /****/
+    private Long id;
+    /****/
+    private String rdn = "";
+    /****/
+    private String sex;
+    /****/
+    private int age;
+
+    private String partbody = "";
+
+    /****/
+    private String featureName = "";
+
+    /****/
+    private String featureType = "";
+
+    //是否推送
+    private String isPush = "0";
+
+    /**
+     * 特征顺序号
+     **/
+    private int sn;
+
+    /****/
+    private String negative = "";
+
+    private float duration;
+
+    private String property;
+
+    /****/
+    private Float threshold;
+
+    /****/
+    private String tfIdf;
+
+    /**
+     * 区分住院门诊
+     **/
+    private String resourceType;
+
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return this.id;
+    }
+
+    public void setRdn(String rdn) {
+        this.rdn = rdn;
+    }
+
+    public String getRdn() {
+        return this.rdn;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public String getSex() {
+        return this.sex;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public int getAge() {
+        return this.age;
+    }
+
+    public void setFeatureName(String featureName) {
+        this.featureName = featureName;
+    }
+
+    public String getFeatureName() {
+        return this.featureName;
+    }
+
+    public void setFeatureType(String featureType) {
+        this.featureType = featureType;
+    }
+
+    public String getFeatureType() {
+        return this.featureType;
+    }
+
+    public String getIsPush() {
+        return isPush;
+    }
+
+    public void setIsPush(String isPush) {
+        this.isPush = isPush;
+    }
+
+    public int getSn() {
+        return sn;
+    }
+
+    public void setSn(int sn) {
+        this.sn = sn;
+    }
+
+    public void setNegative(String negative) {
+        this.negative = negative;
+    }
+
+    public String getNegative() {
+        return this.negative;
+    }
+
+    public String getPartbody() {
+        return partbody;
+    }
+
+    public void setPartbody(String partbody) {
+        this.partbody = partbody;
+    }
+
+    public float getDuration() {
+        return duration;
+    }
+
+    public void setDuration(float duration) {
+        this.duration = duration;
+    }
+
+    public String getProperty() {
+        return property;
+    }
+
+    public void setProperty(String property) {
+        this.property = property;
+    }
+
+    public void setThreshold(Float threshold) {
+        this.threshold = threshold;
+    }
+
+    public Float getThreshold() {
+        return this.threshold;
+    }
+
+    public void setTfIdf(String tfIdf) {
+        this.tfIdf = tfIdf;
+    }
+
+    public String getTfIdf() {
+        return this.tfIdf;
+    }
+
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        Feature feature = (Feature) o;
+        if (id != feature.id) {
+            return false;
+        }
+        return rdn.equals(feature.rdn) && partbody.equals(feature.partbody) && featureName.equals(feature.featureName)
+                && featureType.equals(feature.featureType) && negative.equals(feature.negative);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = id.hashCode();
+        result = 31 * result + rdn.hashCode() + partbody.hashCode() + featureName.hashCode() + featureType.hashCode() + negative.hashCode();
+        return result;
+    }
+}

+ 159 - 0
aipt-service/src/main/java/com/diagbot/client/bean/Constants.java

@@ -0,0 +1,159 @@
+/**
+ * @Company: 杭州朗通信息技术有限公司
+ * @Department: 系统软件部
+ * @Description: 朗通智能辅助诊疗系统
+ * @Address: 浙江省杭州市西湖区西斗门路3号 天堂软件园D-7B
+ */
+package com.diagbot.client.bean;
+
+/**
+ * @Title: Constants.java
+ * @Package org.diagbot.public
+ * @Description: 通用常数接口定义
+ * @author 楼辉荣(Fyeman)
+ * @date 2015年4月23日 下午11:25:37
+ * @version V1.0
+ */
+public interface Constants {
+    /**
+     * 操作名称
+     */
+    String OP_NAME = "op";
+    /**
+     * 消息key
+     */
+    String MESSAGE = "message";
+    /**
+     * 错误key
+     */
+    String ERROR = "error";
+    /**
+     * 上个页面地址
+     */
+    String BACK_URL = "BackURL";
+    String IGNORE_BACK_URL = "ignoreBackURL";
+    /**
+     * 当前请求的地址 带参数
+     */
+    String CURRENT_URL = "currentURL";
+    /**
+     * 当前请求的地址 不带参数
+     */
+    String NO_QUERYSTRING_CURRENT_URL = "noQueryStringCurrentURL";
+    /**
+     * 上下文
+     */
+    String CONTEXT_PATH = "ctx";
+    /**
+     * 当前登录的用户
+     */
+    String CURRENT_APPLICATION = "c_app";
+    String CURRENT_USER = "c_user";
+    String CURRENT_USERNAME = "username";
+    String USER_MENUS = "menus";
+
+    /**
+     * 管理控制台应用ID=0
+     */
+    long ADMIN_APPLICATION = 0;
+    /**
+     * 一级菜单grade标识
+     */
+    int FIRST_MENU = 1;
+    /**
+     * 二级菜单grade标识
+     */
+    int SECOND_MENU = 2;
+    /**
+     * 操作按钮等级标识
+     */
+    int MENU_GRADE = 3;
+    /**
+     * 最高级资源grade标识
+     */
+    int TOP_REC = 0;
+    /**
+     * 编码方式
+     */
+    String ENCODING = "UTF-8";
+    /**
+     * 系统用户状态--启用
+     */
+    int USER_STATUS_UNLOCK = 1;
+    /**
+     * 系统用户状态--禁用
+     */
+    int USER_STATUS_LOCK = 0;
+    /**
+     * 通用值0
+     */
+    int COMMON_INT_0 = 0;
+    /**
+     * 通用值1
+     */
+    int COMMON_INT_1 = 1;
+    /**
+     * 通用值-1
+     */
+    int COMMON_INT_NEG_1 = -1;
+    /**
+     * 通用值0
+     */
+    long COMMON_LONG_0 = 0L;
+    /**
+     * 通用值1
+     */
+    long COMMON_LONG_1 = 1L;
+    /**
+     * 通用值-1
+     */
+    long COMMON_LONG_NEG_1 = -1L;
+    /**
+     * 通用值"0"
+     */
+    String COMMON_STRING_0 = "0";
+    /**
+     * 通用值"1"
+     */
+    String COMMON_STRING_1 = "1";
+    /**
+     * 通用值"-1"
+     */
+    String COMMON_STRING_NEG_1 = "-1";
+
+    /**
+     * 通用值"-1"
+     */
+    String COMMON_STRING_99 = "99";
+    /**
+     * 登录页面
+     */
+    String LOGIN_URL = "/login";
+    /**
+     * 上传文件夹
+     */
+    String UPLOAD_FOLDER_NAME = "upload";
+    /**
+     * 临时文件夹
+     */
+    String TEMP_FOLDER_NAME = "temp";
+    /**
+     * 地域标示
+     */
+    public static final String DEFAULT_LOCALE = "zh_CN";
+    /**
+     * 缺省字符集
+     */
+    public static final String DEFAULT_ENCODE = "UTF-8";
+    /**
+     * 以下为接口返回公共属性定义常量
+     */
+    public static final String MSG_SUCCESS = "操作成功";    //操作成功
+    public static final String MSG_FALURE = "操作失败";    //操作失败
+
+    public static final long INVALIDATE_VALUE = -1;        //起止时间定义
+    public static final int RET_SUCCESS = 0;            //成功
+    public static final int RET_FAIL = 1;                //失败
+    public static final int RET_ERROR_PARAM = -1;        //参数校验失败
+    public static final int RET_NO_TOKEN = -2;    //用户token丢失
+}

+ 43 - 0
aipt-service/src/main/java/com/diagbot/client/bean/FeatureRate.java

@@ -0,0 +1,43 @@
+package com.diagbot.client.bean;
+
+/**
+ * Created by fyeman on 2018/1/17.
+ */
+public class FeatureRate {
+    private String featureName;
+    private String extraProperty;
+    private String desc;
+    private String rate;
+
+    public String getFeatureName() {
+        return featureName;
+    }
+
+    public void setFeatureName(String featureName) {
+        this.featureName = featureName;
+    }
+
+    public String getRate() {
+        return rate;
+    }
+
+    public void setRate(String rate) {
+        this.rate = rate;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public String getExtraProperty() {
+        return extraProperty;
+    }
+
+    public void setExtraProperty(String extraProperty) {
+        this.extraProperty = extraProperty;
+    }
+}

+ 190 - 0
aipt-service/src/main/java/com/diagbot/client/bean/Response.java

@@ -0,0 +1,190 @@
+package com.diagbot.client.bean;
+
+/**
+ * ClassName: org.diagbot.pub.api.Response
+ * Function: API接口提供标准返回数据包, 数据包格式如下:
+ * {
+ * status:"OK",
+ * startTime:8206448610408,
+ * endTime:8206448610418,
+ * version:"1.0",
+ * msg:"操作成功",
+ * ret:"0",
+ * timeConsum:10,
+ * data:{
+ * ..。
+ * }
+ * }
+ * date: 2015年7月6日 下午1:36:58
+ *
+ * @author 楼辉荣(Fyeman)
+ * @version 1.0
+ * @since JDK 1.7
+ */
+public class Response<T> implements java.io.Serializable {
+    private static final long serialVersionUID = 8206448610408409499L;
+    private Status status = Status.PENDING;  //状态
+    private long startTime = Constants.INVALIDATE_VALUE;                                  //起始时间
+    private long endTime = Constants.INVALIDATE_VALUE;                                    //结束时间
+    private String version = "1.0";
+    private String msg = Constants.MSG_SUCCESS;                                  //消息
+    private T data = null;                                                                //序列化后的结果数据
+    // 返回结果标志,默认成功0,失败 1 参数错误 -1 token丢失-2
+    private int ret = Constants.RET_SUCCESS;
+
+    private String token;
+    //耗时
+    private long timeConsum;
+
+    public int getRet() {
+        return ret;
+    }
+
+    public void setRet(int ret) {
+        this.ret = ret;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public long getTimeConsum() {
+        return timeConsum;
+    }
+
+    public void setTimeConsum(long timeConsum) {
+        this.timeConsum = timeConsum;
+    }
+
+    public Response() {
+        super();
+    }
+
+    public Status getStatus() {
+        return status;
+    }
+
+    /**
+     * 在调用end()方法时,会自动设置状态,因此,如果调用了end()方法,就不要调用这个方法
+     *
+     * @param status
+     */
+    public Response<T> setStatus(Status status) {
+        this.status = status;
+        return this;
+    }
+
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public long getStartTime() {
+        return startTime;
+    }
+
+    public Response<T> setStartTime(long startTime) {
+        this.startTime = startTime;
+        return this;
+    }
+
+    public long getEndTime() {
+        return endTime;
+    }
+
+    public Response<T> setEndTime(long endTime) {
+        this.endTime = endTime;
+        return this;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    /**
+     * 设置状态和起始时间,表示操作正在进行
+     */
+    public Response<T> start() {
+        this.setStatus(Status.RUNNING);
+        this.setStartTime(System.currentTimeMillis());
+        return this;
+    }
+
+    /**
+     * 设置状态和时间,表示操作结束,没有失败
+     */
+    public Response<T> end() {
+        this.setEndTime(System.currentTimeMillis());
+        this.setTimeConsum(this.endTime - this.startTime);
+        this.setStatus(Status.OK);
+        return this;
+    }
+
+    /**
+     * 设置状态和时间,表示操作结束,并且失败
+     */
+    public Response<T> endAndFailed() {
+        this.setStatus(Status.FAIL);
+        this.setEndTime(System.currentTimeMillis());
+        return this;
+    }
+
+    /**
+     * 非参数错误通用失败信息
+     */
+    public Response<T> failure(String msg) {
+        this.msg = msg;
+        this.ret = Constants.RET_FAIL;
+        this.end();
+        return this;
+    }
+
+    /**
+     * 参数错误信息
+     */
+    public Response<T> paramFailure(String msg) {
+        this.msg = msg;
+        this.ret = Constants.RET_ERROR_PARAM;
+        this.end();
+        return this;
+    }
+
+    /**
+     * 用户信息丢失
+     */
+    public Response<T> tokenFailure(String msg) {
+        this.msg = msg;
+        this.ret = Constants.RET_NO_TOKEN;
+        this.end();
+        return this;
+    }
+
+    /**
+     * 通用成功
+     */
+    public Response<T> success() {
+        this.end();
+        return this;
+    }
+
+}

+ 98 - 0
aipt-service/src/main/java/com/diagbot/client/bean/ResponseData.java

@@ -0,0 +1,98 @@
+package com.diagbot.client.bean;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by fyeman on 2018/2/2.
+ */
+public class ResponseData {
+    private String participleSymptom = "";
+
+    private List<FeatureRate> symptom = new ArrayList<>(10);
+    private List<FeatureRate> vitals = new ArrayList<>(10);
+    private List<FeatureRate> dis = new ArrayList<>(10);
+    private List<FeatureRate> labs = new ArrayList<>(10);
+    private List<FeatureRate> pacs = new ArrayList<>(10);
+    private List<FeatureRate> history=new ArrayList<>(10);
+    private Map<String, JSONObject> treat;
+
+    private Map<String, Map<String, String>> inputs = new HashMap<>(10, 0.5f);
+
+
+    public String getParticipleSymptom() {
+        return participleSymptom;
+    }
+
+    public void setParticipleSymptom(String participleSymptom) {
+        this.participleSymptom = participleSymptom;
+    }
+
+    public List<FeatureRate> getSymptom() {
+        return symptom;
+    }
+
+    public void setSymptom(List<FeatureRate> symptom) {
+        this.symptom = symptom;
+    }
+
+    public List<FeatureRate> getVitals() {
+        return vitals;
+    }
+
+    public void setVitals(List<FeatureRate> vitals) {
+        this.vitals = vitals;
+    }
+
+    public List<FeatureRate> getDis() {
+        return dis;
+    }
+
+    public void setDis(List<FeatureRate> dis) {
+        this.dis = dis;
+    }
+
+    public List<FeatureRate> getLabs() {
+        return labs;
+    }
+
+    public void setLabs(List<FeatureRate> labs) {
+        this.labs = labs;
+    }
+
+    public List<FeatureRate> getPacs() {
+        return pacs;
+    }
+
+    public void setPacs(List<FeatureRate> pacs) {
+        this.pacs = pacs;
+    }
+
+    public List<FeatureRate> getHistory() {
+        return history;
+    }
+
+    public void setHistory(List<FeatureRate> history) {
+        this.history = history;
+    }
+
+    public Map<String, JSONObject> getTreat() {
+        return treat;
+    }
+
+    public void setTreat(Map<String, JSONObject> treat) {
+        this.treat = treat;
+    }
+
+    public Map<String, Map<String, String>> getInputs() {
+        return inputs;
+    }
+
+    public void setInputs(Map<String, Map<String, String>> inputs) {
+        this.inputs = inputs;
+    }
+}

+ 273 - 0
aipt-service/src/main/java/com/diagbot/client/bean/SearchData.java

@@ -0,0 +1,273 @@
+package com.diagbot.client.bean;
+
+import com.diagbot.client.AlgorithmClassify;
+import com.diagbot.client.Feature;
+import com.diagbot.dto.LisResult;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by fyeman on 2018/1/31.
+ */
+public class SearchData {
+    private int length = 10;
+    private int age_start = 0;
+    private int age_end = 200;
+    private int age = 0;
+    private String sex;
+    // 搜索结果的贝叶斯阈值
+    private String threshold = "0";
+
+    private String symptom = "";
+    private String vital = "";
+    private String lis = "";
+    private String pacs = "";
+    private String diag = "";
+    private String past = "";
+    private String other = "";
+    private List<LisResult> lisArr;
+
+
+    //特征类别
+    private String featureType;
+    //特征类别对","进行分割后数据
+    private String[] featureTypes;
+    //门诊 住院分类
+    private String resourceType;
+    //模型
+    private AlgorithmClassify algorithmClassify[];
+    //模型
+    private String algorithmClassifyValue;
+    //外部系统编码 用于返回映射数据,如果sysCode为空或null,则返回kl_standard_info标准名称
+    private String sysCode;
+
+    private Map<String, Map<String, String>> inputs = new HashMap<>(10, 0.8f);
+
+
+    private List<Feature> symptomFeatureList = new ArrayList<>();
+    private List<Feature> vitalFeatureList = new ArrayList<>();
+    private List<Feature> lisFeatureList = new ArrayList<>();
+    private List<Feature> pacsFeatureList = new ArrayList<>();
+    private List<Feature> diagFeatureList = new ArrayList<>();
+    private List<Feature> symptompropertyFeatureList = new ArrayList<>();
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public int getAge_start() {
+        return age_start;
+    }
+
+    public void setAge_start(int age_start) {
+        this.age_start = age_start;
+    }
+
+    public int getAge_end() {
+        return age_end;
+    }
+
+    public void setAge_end(int age_end) {
+        this.age_end = age_end;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public String getSymptom() {
+        return symptom;
+    }
+
+    public void setSymptom(String symptom) {
+        this.symptom = symptom;
+    }
+
+    public String getVital() {
+        return vital;
+    }
+
+    public void setVital(String vital) {
+        this.vital = vital;
+    }
+
+    public String getLis() {
+        return lis;
+    }
+
+    public void setLis(String lis) {
+        this.lis = lis;
+    }
+
+    public String getPacs() {
+        return pacs;
+    }
+
+    public void setPacs(String pacs) {
+        this.pacs = pacs;
+    }
+
+    public String getDiag() {
+        return diag;
+    }
+
+    public void setDiag(String diag) {
+        this.diag = diag;
+    }
+
+    public String getPast() {
+        return past;
+    }
+
+    public void setPast(String past) {
+        this.past = past;
+    }
+
+    public String getOther() {
+        return other;
+    }
+
+    public void setOther(String other) {
+        this.other = other;
+    }
+
+    public String getFeatureType() {
+        return featureType;
+    }
+
+    public void setFeatureType(String featureType) {
+        this.featureType = featureType;
+    }
+
+    public String[] getFeatureTypes() {
+        return featureTypes;
+    }
+
+    public void setFeatureTypes(String[] featureTypes) {
+        this.featureTypes = featureTypes;
+    }
+
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    public String getSysCode() {
+        return sysCode;
+    }
+
+    public void setSysCode(String sysCode) {
+        this.sysCode = sysCode;
+    }
+
+    public void setThreshold(String threshold) {
+        this.threshold = threshold;
+    }
+
+    public float getThreshold() {
+        return Float.parseFloat(threshold);
+    }
+
+    public List<Feature> getSymptomFeatureList() {
+        return symptomFeatureList;
+    }
+
+    public void setSymptomFeatureList(List<Feature> symptomFeatureList) {
+        this.symptomFeatureList = symptomFeatureList;
+    }
+
+    public List<Feature> getVitalFeatureList() {
+        return vitalFeatureList;
+    }
+
+    public void setVitalFeatureList(List<Feature> vitalFeatureList) {
+        this.vitalFeatureList = vitalFeatureList;
+    }
+
+    public List<Feature> getLisFeatureList() {
+        return lisFeatureList;
+    }
+
+    public void setLisFeatureList(List<Feature> lisFeatureList) {
+        this.lisFeatureList = lisFeatureList;
+    }
+
+    public List<Feature> getPacsFeatureList() {
+        return pacsFeatureList;
+    }
+
+    public void setPacsFeatureList(List<Feature> pacsFeatureList) {
+        this.pacsFeatureList = pacsFeatureList;
+    }
+
+
+    public List<Feature> getSymptompropertyFeatureList() {
+        return symptompropertyFeatureList;
+    }
+
+    public void setSymptompropertyFeatureList(List<Feature> symptompropertyFeatureList) {
+        this.symptompropertyFeatureList = symptompropertyFeatureList;
+    }
+
+    public List<Feature> getDiagFeatureList() {
+        return diagFeatureList;
+    }
+
+    public void setDiagFeatureList(List<Feature> diagFeatureList) {
+        this.diagFeatureList = diagFeatureList;
+    }
+
+    public Map<String, Map<String, String>> getInputs() {
+        return inputs;
+    }
+
+    public void setInputs(Map<String, Map<String, String>> inputs) {
+        this.inputs = inputs;
+    }
+
+    public AlgorithmClassify[] getAlgorithmClassify() {
+        return algorithmClassify;
+    }
+
+    public void setAlgorithmClassify(AlgorithmClassify[] algorithmClassify) {
+        this.algorithmClassify = algorithmClassify;
+    }
+
+    public String getAlgorithmClassifyValue() {
+        return algorithmClassifyValue;
+    }
+
+    public void setAlgorithmClassifyValue(String algorithmClassifyValue) {
+        this.algorithmClassifyValue = algorithmClassifyValue;
+    }
+
+    public List<LisResult> getLisArr() {
+        return lisArr;
+    }
+
+    public void setLisArr(List<LisResult> lisArr) {
+        this.lisArr = lisArr;
+    }
+}

+ 132 - 0
aipt-service/src/main/java/com/diagbot/client/bean/Status.java

@@ -0,0 +1,132 @@
+package com.diagbot.client.bean;
+
+public enum Status {
+    /**
+     * <code>PENDING = 1;</code>
+     *
+     * <pre>
+     * 操作尚未开始
+     * </pre>
+     */
+    PENDING(1),
+    /**
+     * <code>RUNNING = 2;</code>
+     *
+     * <pre>
+     * 操作开始
+     * </pre>
+     */
+    RUNNING(2),
+    /**
+     * <code>OK = 3;</code>
+     *
+     * <pre>
+     * 操作正常结束
+     * </pre>
+     */
+    OK(3),
+    /**
+     * <code>WARN = 4;</code>
+     *
+     * <pre>
+     * 有警告,但是正常结束
+     * </pre>
+     */
+    WARN(4),
+    /**
+     * <code>ERROR = 5;</code>
+     *
+     * <pre>
+     * 有错误,但是完整结束
+     * </pre>
+     */
+    ERROR(5),
+    /**
+     * <code>FAIL = 6;</code>
+     *
+     * <pre>
+     * 操作失败
+     * </pre>
+     */
+    FAIL(6),
+    ;
+
+    /**
+     * <code>PENDING = 1;</code>
+     *
+     * <pre>
+     * 操作尚未开始
+     * </pre>
+     */
+    public static final int PENDING_VALUE = 1;
+    /**
+     * <code>RUNNING = 2;</code>
+     *
+     * <pre>
+     * 操作开始
+     * </pre>
+     */
+    public static final int RUNNING_VALUE = 2;
+    /**
+     * <code>OK = 3;</code>
+     *
+     * <pre>
+     * 操作正常结束
+     * </pre>
+     */
+    public static final int OK_VALUE = 3;
+    /**
+     * <code>WARN = 4;</code>
+     *
+     * <pre>
+     * 有警告,但是正常结束
+     * </pre>
+     */
+    public static final int WARN_VALUE = 4;
+    /**
+     * <code>ERROR = 5;</code>
+     *
+     * <pre>
+     * 有错误,但是完整结束
+     * </pre>
+     */
+    public static final int ERROR_VALUE = 5;
+    /**
+     * <code>FAIL = 6;</code>
+     *
+     * <pre>
+     * 操作失败
+     * </pre>
+     */
+    public static final int FAIL_VALUE = 6;
+
+    public final int getNumber() {
+        return value;
+    }
+
+    public static Status valueOf(int value) {
+        switch (value) {
+            case 1:
+                return PENDING;
+            case 2:
+                return RUNNING;
+            case 3:
+                return OK;
+            case 4:
+                return WARN;
+            case 5:
+                return ERROR;
+            case 6:
+                return FAIL;
+            default:
+                return null;
+        }
+    }
+
+    private final int value;
+
+    private Status(int value) {
+        this.value = value;
+    }
+
+}

+ 23 - 0
aipt-service/src/main/java/com/diagbot/client/hystrix/AIServiceHystrix.java

@@ -0,0 +1,23 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.AIServiceClient;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseData;
+import com.diagbot.vo.SearchVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/11/20 13:15
+ */
+@Component
+@Slf4j
+public class AIServiceHystrix implements AIServiceClient {
+    @Override
+    public Response<ResponseData> bayesPageData(SearchVo searchVo) {
+        log.error("【hystrix】调用{}异常", "bayesPageData");
+        return null;
+    }
+}

+ 22 - 0
aipt-service/src/main/java/com/diagbot/dto/LisResult.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:化验信息
+ * @Author:zhaops
+ * @time: 2018/12/19 14:03
+ */
+@Getter
+@Setter
+public class LisResult {
+    private String name;//套餐名称
+    private String detailName;//化验项名称
+    private String uniqueName;//公表名称
+    private Double value;//值
+    private Double maxValue;//最大值
+    private Double minValue;//最小值
+    private String units;//单位
+    private String otherValue;//其他结果,包括阴性阳性,文字描述等
+}

+ 53 - 0
aipt-service/src/main/java/com/diagbot/facade/ClinicalFacade.java

@@ -0,0 +1,53 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.LisResult;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+import com.diagbot.vo.SearchVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  数据处理业务层
+ * </p>
+ *
+ * @author Mark Huang
+ * @since 2019-03-04
+ */
+@Component
+public class ClinicalFacade {
+    /**
+     * 处理临床数据
+     *
+     * @param searchVo
+     * @return SearchVo
+     */
+    public SearchVo processClinicalData(@RequestBody SearchVo searchVo) {
+        SearchVo sData = searchVo;
+
+        sData.setLisArr(processLis(sData.getLisArr()));
+
+        return sData;
+    }
+
+    private List<LisResult> processLis(List<LisResult> lisArr) {
+
+        String Otherval = "";
+
+        for (int i=0; i<lisArr.size(); i++) {
+            LisResult lisres = lisArr.get(i);
+
+            Otherval = (lisres.getOtherValue().trim().length() > 0)? lisres.getOtherValue().trim()+"\n":"";
+
+            if (lisres.getMaxValue() != null && lisres.getValue() > lisres.getMaxValue()) {
+                lisres.setOtherValue(Otherval + "超出标准");
+            }
+            else if (lisres.getMinValue() != null && lisres.getValue() < lisres.getMinValue()) {
+                lisres.setOtherValue(Otherval + "低于标准");
+            }
+        }
+
+        return lisArr;
+    }
+}

+ 64 - 0
aipt-service/src/main/java/com/diagbot/vo/SearchVo.java

@@ -0,0 +1,64 @@
+package com.diagbot.vo;
+
+import com.diagbot.dto.LisResult;
+import lombok.Getter;
+import lombok.Setter;
+
+import com.diagbot.client.Feature;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/3/4 16:35
+ */
+@Getter
+@Setter
+public class SearchVo {
+    private String sex;
+    private int age;
+    private int age_start;
+    private int age_end;
+
+    private String symptom;
+    private String vital;
+    private String lis;
+    private String pacs;
+    private String other;
+    private String featureType;
+    private String diag;
+
+    private int length;
+
+
+    // 搜索结果的贝叶斯阈值
+    private String threshold;
+
+    private List<Feature> symptomFeatureList;
+    private List<Feature> lisFeatureList;
+    private List<Feature> pacsFeatureList;
+    private List<Feature> vitalFeatureList;
+    private List<Feature> symptompropertyFeatureList;
+
+    private List<LisResult> lisArr;
+    private List<Feature> diagFeatureList;
+    private Map<String, Map<String, String>> inputs;
+
+
+    /*
+    private String past;
+    //特征类别对","进行分割后数据
+    private String[] featureTypes;
+    //门诊 住院分类
+    private String resourceType;
+    //模型
+    private AlgorithmClassify algorithmClassify[];
+    //模型
+    private String algorithmClassifyValue;
+    //外部系统编码 用于返回映射数据,如果sysCode为空或null,则返回kl_standard_info标准名称
+    private String sysCode;
+    */
+
+}

+ 56 - 0
aipt-service/src/main/java/com/diagbot/web/ClinicalController.java

@@ -0,0 +1,56 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.client.AIServiceClient;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.ResponseData;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.ClinicalFacade;
+import com.diagbot.vo.SearchVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Mark Huang
+ * @since 2019-03-04
+ */
+@RestController
+@RequestMapping("/clinicaldata")
+@Api(value = "临床数据处理API", tags = { "临床数据处理API" })
+
+public class ClinicalController {
+    @Autowired
+    private ClinicalFacade clinicalFacade;
+
+    @Autowired
+    private AIServiceClient aiServiceClient;
+
+    @ApiOperation(value = "临床数据处理", notes = "")
+    @PostMapping("/processData")
+    @SysLogger("processData")
+    public RespDTO<ResponseData> processData(@Valid @RequestBody SearchVo searchVo) {
+
+        SearchVo sData = clinicalFacade.processClinicalData(searchVo);
+
+//        Response<ResponseData> res = aiServiceClient.bayesPageData(sData);
+
+        Response<SearchVo> res = new Response<>();
+        res.setData(sData);
+
+        return RespDTO.onSuc(res.getData());
+    }
+
+}

+ 3 - 0
config-server/src/main/resources/shared/aipt-service-dev.yml

@@ -92,3 +92,6 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+ai:
+  server:
+    address: http://192.168.2.234:5008

+ 3 - 0
config-server/src/main/resources/shared/aipt-service-local.yml

@@ -92,3 +92,6 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+ai:
+  server:
+    address: http://192.168.2.234:5008

+ 3 - 0
config-server/src/main/resources/shared/aipt-service-pro.yml

@@ -92,3 +92,6 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+ai:
+  server:
+    address: http://192.168.2.234:5008

+ 3 - 0
config-server/src/main/resources/shared/aipt-service-test.yml

@@ -92,3 +92,6 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     cache-enabled: false
 
+ai:
+  server:
+    address: http://192.168.2.234:5008

+ 6 - 0
config-server/src/main/resources/shared/knowledgeman-service-dev.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 5MB
+      max-request-size: 5MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/knowledgeman-service-local.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 5MB
+      max-request-size: 5MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/knowledgeman-service-pro.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 5MB
+      max-request-size: 5MB
+
   cloud:
     stream:
       bindings:

+ 6 - 0
config-server/src/main/resources/shared/knowledgeman-service-test.yml

@@ -47,6 +47,12 @@ spring:
         login-username: root
         login-password: root
 
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 5MB
+      max-request-size: 5MB
+
   cloud:
     stream:
       bindings:

+ 6 - 2
knowledge-service/src/main/java/com/diagbot/dto/ConceptDTO.java

@@ -48,7 +48,7 @@ public class ConceptDTO {
     /**
      * 术语基本信息
      */
-    private List<LibraryInfo> libraryInfo;
+    private LibraryInfo libraryInfo;
 
     /**
      * 术语相关医学知识
@@ -58,6 +58,10 @@ public class ConceptDTO {
     /**
      * 医学临床信息
      */
-    private Medical medicalInfo;
+    private List<Medical> medicalInfo;
 
+    /**
+     * 术语所有上级信息
+     */
+    private List<RelationDTO> relations;
 }

+ 5 - 0
knowledge-service/src/main/java/com/diagbot/dto/LibraryInfoDTO.java

@@ -51,6 +51,11 @@ public class LibraryInfoDTO {
      */
     private String name;
 
+    /**
+     * 类型
+     */
+    private String type;
+
     /**
      * 备注
      */

+ 3 - 13
knowledge-service/src/main/java/com/diagbot/dto/MedicalDTO.java

@@ -17,7 +17,7 @@ public class MedicalDTO {
     private Integer id;
 
     /**
-     * 术语名称
+     * 名称
      */
     private String name;
 
@@ -29,28 +29,18 @@ public class MedicalDTO {
     /**
      * 术语类型编号,对应类型库
      */
-    private Integer typeId;
+//    private Integer typeId;
 
     /**
      * 术语类型
      */
-    private String type;
+//    private String type;
 
     /**
      * 术语标准名
      */
     private String stdName;
 
-    /**
-     * 术语小类名称
-     */
-    private String cateName;
-
-    /**
-     * 术语类组
-     */
-    private String group;
-
     /**
      * 性别:1:男, 2:女, 3:通用
      */

+ 49 - 0
knowledge-service/src/main/java/com/diagbot/dto/RelationDTO.java

@@ -0,0 +1,49 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/1/31 16:53
+ */
+@Getter
+@Setter
+public class RelationDTO {
+    /**
+     * 主键
+     */
+    private Integer id;
+
+    /**
+     * 关系起点术语id
+     */
+    private Integer startId;
+
+    /**
+     * 关系起点术语名称
+     */
+    private String startName;
+
+    /**
+     * 关系id
+     */
+    private Integer relationId;
+
+    /**
+     * 关系名称
+     */
+    private String relationName;
+
+    /**
+     * 关系终点术语id
+     */
+    private Integer endId;
+
+    /**
+     * 关系终点术语名称
+     */
+    private String endName;
+
+}

+ 56 - 0
knowledge-service/src/main/java/com/diagbot/entity/LexiconRelationship.java

@@ -0,0 +1,56 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+public class LexiconRelationship implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private String name;
+
+    private String code;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    @Override
+    public String toString() {
+        return "LexiconRelationship{" +
+        "id=" + id +
+        ", name=" + name +
+        ", code=" + code +
+        "}";
+    }
+}

+ 196 - 0
knowledge-service/src/main/java/com/diagbot/entity/LibraryDetail.java

@@ -0,0 +1,196 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 提示信息明细
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public class LibraryDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+    /**
+     * 提示明细序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 显示位置(多选):1-推送展示,2-更多展示,3-一般治疗展示,4-手术治疗展示,5-药品说明书
+     */
+    private String position;
+
+    /**
+     * 是否诊断依据(1-是,0-否)
+     */
+    private Integer isReason;
+
+    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;
+    }
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+    public Integer getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(Integer orderNo) {
+        this.orderNo = orderNo;
+    }
+    public String getPosition() {
+        return position;
+    }
+
+    public void setPosition(String position) {
+        this.position = position;
+    }
+    public Integer getIsReason() {
+        return isReason;
+    }
+
+    public void setIsReason(Integer isReason) {
+        this.isReason = isReason;
+    }
+
+    @Override
+    public String toString() {
+        return "LibraryDetail{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", conceptId=" + conceptId +
+        ", title=" + title +
+        ", content=" + content +
+        ", text=" + text +
+        ", orderNo=" + orderNo +
+        ", position=" + position +
+        ", isReason=" + isReason +
+        "}";
+    }
+}

+ 171 - 0
knowledge-service/src/main/java/com/diagbot/entity/LibraryInfo.java

@@ -0,0 +1,171 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 提示信息
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public class LibraryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 概念id
+     */
+    private Integer conceptId;
+
+    /**
+     * 是否标准词,1:是,0:否
+     */
+    private Integer isConcept;
+
+    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;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+    public Integer getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Integer conceptId) {
+        this.conceptId = conceptId;
+    }
+    public Integer getIsConcept() {
+        return isConcept;
+    }
+
+    public void setIsConcept(Integer isConcept) {
+        this.isConcept = isConcept;
+    }
+
+    @Override
+    public String toString() {
+        return "LibraryInfo{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", name=" + name +
+        ", type=" + type +
+        ", remark=" + remark +
+        ", conceptId=" + conceptId +
+        ", isConcept=" + isConcept +
+        "}";
+    }
+}

+ 48 - 44
knowledge-service/src/main/java/com/diagbot/entity/Medical.java

@@ -2,6 +2,7 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.io.Serializable;
 
 /**
@@ -9,8 +10,8 @@ import java.io.Serializable;
  * 
  * </p>
  *
- * @author Weixuan Huang
- * @since 2019-01-31
+ * @author gaodm
+ * @since 2019-02-20
  */
 public class Medical implements Serializable {
 
@@ -20,24 +21,24 @@ public class Medical implements Serializable {
     private Integer id;
 
     /**
-     * 术语名称
+     * 术语概念id
      */
-//    private String name;
+    private Integer conceptId;
 
     /**
-     * 术语概念id
+     * 术语名称
      */
-    private Integer concept_id;
+    private String name;
 
     /**
      * 术语类型编号,对应类型库
      */
-    private Integer typeId;
+//    private Integer typeId;
 
     /**
      * 术语类型
      */
-    private String type;
+//    private String type;
 
     /**
      * 术语标准名
@@ -47,12 +48,12 @@ public class Medical implements Serializable {
     /**
      * 术语小类名称
      */
-//    private String cateName;
+    private String cateName;
 
     /**
      * 术语类组
      */
-//    private String group;
+    private String grp;
 
     /**
      * 性别:1:男, 2:女, 3:通用
@@ -106,20 +107,21 @@ public class Medical implements Serializable {
     public void setId(Integer id) {
         this.id = id;
     }
-//    public String getName() {
-//        return name;
-//    }
-//
-//    public void setName(String name) {
-//        this.name = name;
-//    }
-//    public Integer getConcept_id() {
-//        return concept_id;
-//    }
+    public Integer getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Integer conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getName() {
+        return name;
+    }
 
-    public void setConcept_id(Integer concept_id) {
-        this.concept_id = concept_id;
+    public void setName(String name) {
+        this.name = name;
     }
+    /*
     public Integer getTypeId() {
         return typeId;
     }
@@ -134,6 +136,7 @@ public class Medical implements Serializable {
     public void setType(String type) {
         this.type = type;
     }
+    */
     public String getStdName() {
         return stdName;
     }
@@ -141,23 +144,23 @@ public class Medical implements Serializable {
     public void setStdName(String stdName) {
         this.stdName = stdName;
     }
-//    public String getCateName() {
-//        return cateName;
-//    }
-//
-//    public void setCateName(String cateName) {
-//        this.cateName = cateName;
-//    }
-//    public String getGroup() {
-//        return group;
-//    }
-//
-//    public void setGroup(String group) {
-//        this.group = group;
-//    }
-//    public String getGender() {
-//        return gender;
-//    }
+    public String getCateName() {
+        return cateName;
+    }
+
+    public void setCateName(String cateName) {
+        this.cateName = cateName;
+    }
+    public String getGrp() {
+        return grp;
+    }
+
+    public void setGrp(String grp) {
+        this.grp = grp;
+    }
+    public String getGender() {
+        return gender;
+    }
 
     public void setGender(String gender) {
         this.gender = gender;
@@ -223,12 +226,13 @@ public class Medical implements Serializable {
     public String toString() {
         return "Medical{" +
         "id=" + id +
-//        ", name=" + name +
-        ", typeId=" + typeId +
-        ", type=" + type +
+        ", conceptId=" + conceptId +
+        ", name=" + name +
+//        ", typeId=" + typeId +
+//        ", type=" + type +
         ", stdName=" + stdName +
-//        ", cateName=" + cateName +
-//        ", group=" + group +
+        ", cateName=" + cateName +
+        ", grp=" + grp +
         ", gender=" + gender +
         ", minAge=" + minAge +
         ", maxAge=" + maxAge +

+ 78 - 0
knowledge-service/src/main/java/com/diagbot/entity/Relation.java

@@ -0,0 +1,78 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-31
+ */
+public class Relation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 关系起点术语id
+     */
+    private Integer startId;
+
+    /**
+     * 关系id
+     */
+    private Integer relationId;
+
+    /**
+     * 关系终点术语id
+     */
+    private Integer endId;
+
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public Integer getStartId() {
+        return startId;
+    }
+
+    public void setStartId(Integer startId) {
+        this.startId = startId;
+    }
+    public Integer getRelationId() {
+        return relationId;
+    }
+
+    public void setRelationId(Integer relationId) {
+        this.relationId = relationId;
+    }
+    public Integer getEndId() {
+        return endId;
+    }
+
+    public void setEndId(Integer endId) {
+        this.endId = endId;
+    }
+
+
+    @Override
+    public String toString() {
+        return "Relation{" +
+        "id=" + id +
+        ", startId=" + startId +
+        ", relationId=" + relationId +
+        ", endId=" + endId +
+        "}";
+    }
+}

+ 24 - 22
knowledge-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -1,9 +1,11 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.ConceptDTO;
 import com.diagbot.entity.LibraryInfo;
 import java.util.List;
 import com.diagbot.service.impl.ConceptServiceImpl;
+import com.diagbot.vo.MedicalVo;
 import com.diagbot.vo.TermVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -23,41 +25,41 @@ public class ConceptFacade extends ConceptServiceImpl {
     private LibraryDetailFacade libraryDetailFacade;
     @Autowired
     private MedicalFacade medicalFacade;
+    @Autowired
+    private RelationFacade relationFacade;
 
 
     /**
      * 获取医学术语信息
      *
      * @param termvo
-     * @return TermDTO
+     * @return ConceptDTO
      */
     public ConceptDTO getConceptInfo(@RequestBody TermVo termvo) {
 
         ConceptDTO conceptDTO = getConcept(termvo);
         // 获取与医学术语的基本信息
-        termvo.setId(conceptDTO.getLibId());
-        termvo.setConcept_id(conceptDTO.getId());
-        List<LibraryInfo> libraryInfo = libraryinfoFacade.getLibraryInfor(termvo);
-        for (LibraryInfo libinfo : libraryInfo) {
-            if (libinfo.getIsConcept() != null && libinfo.getIsConcept() == 1) {
-                conceptDTO.setName(libinfo.getName());
+        if (conceptDTO != null) {
+            termvo.setId(conceptDTO.getLibId());
+            termvo.setConcept_id(conceptDTO.getId());
+            termvo.setTerm(conceptDTO.getName());
+            LibraryInfo libraryInfo = libraryinfoFacade.getLibraryInfor(termvo);
+
+            if (libraryInfo.getIsConcept() != null && libraryInfo.getIsConcept() == 1) {
+                conceptDTO.setName(libraryInfo.getName());
             }
-        }
-        conceptDTO.setLibraryInfo(libraryInfo);
+            conceptDTO.setLibraryInfo(libraryInfo);
 
-        // 获取与术语相关的医学知识
-        conceptDTO.setInformation(libraryDetailFacade.getLibraryDetails(termvo));
-        // 获取与术语相关的临床医学信息
-        conceptDTO.setMedicalInfo(medicalFacade.getMedicalInfo(termvo));
-//        // 获取术语的所有上级信息
-//        List<LevelDTO> levelDTOList = levelFacade.getInfor(libraryDTO);
-//        for (LevelDTO item : levelDTOList) {
-//            while (item.getUplevel() != null) {
-//                item.setUplevel_val(getOne("id", item.getUplevel().toString()).getName());
-//                item.setGrpId_val(getOne("id", item.getGrpId().toString()).getName());
-//            }
-//        }
-//        termDTO.setLevelInfo(levelDTOList);
+            // 获取与术语相关的医学知识
+            conceptDTO.setInformation(libraryDetailFacade.getLibraryDetails(termvo));
+            // 获取与术语相关的临床医学信息
+            MedicalVo medicalVo = new MedicalVo();
+            medicalVo.setName(termvo.getTerm());
+            medicalVo.setConcept_id(conceptDTO.getId());
+            conceptDTO.setMedicalInfo(medicalFacade.getMedicalInfo(medicalVo));
+            // 获取术语的所有上级信息
+            conceptDTO.setRelations(relationFacade.getAllRelation(termvo));
+        }
 
         return conceptDTO;
     }

+ 17 - 3
knowledge-service/src/main/java/com/diagbot/facade/LibraryInfoFacade.java

@@ -25,10 +25,24 @@ public class LibraryInfoFacade extends LibraryInfoServiceImpl {
      * @param termVo
      * @result LibraryInfo
      */
-    public List<LibraryInfo> getLibraryInfor(TermVo termVo) {
+    public LibraryInfo getLibraryInfor(TermVo termVo) {
         QueryWrapper<LibraryInfo> wrapper = new QueryWrapper();
-        wrapper.eq("concept_id", termVo.getConcept_id());
-        List<LibraryInfo> libraryinfor = this.list(wrapper);
+
+        if (termVo.getConcept_id() != 0) {
+            wrapper.eq("concept_id", termVo.getConcept_id());
+        }
+        if (termVo.getId() != 0) {
+            wrapper.eq("id", termVo.getId());
+        }
+        if (termVo.getTerm() != null) {
+            wrapper.eq("name", termVo.getTerm());
+        }
+        if (termVo.getType() != null) {
+            wrapper.eq("type", termVo.getType());
+        }
+
+        LibraryInfo libraryinfor = this.getOne(wrapper);
         return libraryinfor;
     }
+
 }

+ 12 - 5
knowledge-service/src/main/java/com/diagbot/facade/MedicalFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.Medical;
 import com.diagbot.service.impl.MedicalServiceImpl;
+import com.diagbot.vo.MedicalVo;
 import com.diagbot.vo.TermVo;
 import org.springframework.stereotype.Component;
 
@@ -19,13 +20,19 @@ public class MedicalFacade extends MedicalServiceImpl {
     /**
      * 获取医学术语知识
      *
-     * @param termVo
-     * @result Medical
+     * @param medicalVo
+     * @result List<Medical>
      */
-    public Medical getMedicalInfo(TermVo termVo) {
+    public List<Medical> getMedicalInfo(MedicalVo medicalVo) {
         QueryWrapper<Medical> wrapper = new QueryWrapper<>();
-        wrapper.eq("concept_id", termVo.getConcept_id());
-        Medical medical = this.getOne(wrapper);
+        if (medicalVo.getName() != null && medicalVo.getName().trim().length()>0) {
+            wrapper.eq("name", medicalVo.getName());
+        }
+
+        if (medicalVo.getConcept_id() > 0) {
+            wrapper.eq("concept_id", medicalVo.getConcept_id());
+        }
+        List<Medical> medical = this.list(wrapper);
         return medical;
     }
 }

+ 140 - 0
knowledge-service/src/main/java/com/diagbot/facade/RelationFacade.java

@@ -0,0 +1,140 @@
+package com.diagbot.facade;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.entity.Library;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Relation;
+import com.diagbot.service.impl.RelationServiceImpl;
+import com.diagbot.vo.TermVo;
+import net.sf.jsqlparser.expression.WindowRange;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 术语知识查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/1/16 14:17
+ */
+@Component
+public class RelationFacade extends RelationServiceImpl {
+
+    @Autowired
+    private LibraryInfoFacade libraryInfoFacade;
+    @Autowired
+    private RelationshipFacade relationshipFacade;
+
+    /**
+     *
+     *
+     * 获取指定医学术语的所有信息
+     *
+     * @param termVo
+     * @result List<Relation>
+     */
+    public List<RelationDTO> getAllRelation(TermVo termVo) {
+        List<RelationDTO> relationDTOs = new ArrayList<>();
+
+        List<Relation> relations = new ArrayList<>();
+        relations = getList(relations, termVo.getConcept_id(), -1);
+        relationDTOs.addAll(ConvertListtoDTO(relations));
+
+        return relationDTOs;
+    }
+
+    public List<RelationDTO> ConvertListtoDTO (List<Relation> src) {
+        List<RelationDTO> dest = new ArrayList<>();
+        RelationDTO relationDTO;
+        TermVo termVo = new TermVo();
+//        LibraryInfo libraryInfo = null;
+//        QueryWrapper<LibraryInfo> wrapper = new QueryWrapper<>();
+
+        for (Relation relation:src) {
+            relationDTO = new RelationDTO();
+            BeanUtils.copyProperties(relation, relationDTO);
+
+            termVo.setConcept_id(relationDTO.getStartId());
+
+            LibraryInfo libraryInfo = libraryInfoFacade.getLibraryInfor(termVo);
+            relationDTO.setStartName(libraryInfo.getName());
+
+            termVo.setConcept_id(relationDTO.getEndId());
+
+            libraryInfo = libraryInfoFacade.getLibraryInfor(termVo);
+            relationDTO.setEndName(libraryInfo.getName());
+
+            LexiconRelationship lexiconRelationship = relationshipFacade.getLexiconRelationship(relationDTO);
+            relationDTO.setRelationName(lexiconRelationship.getName());
+
+            dest.add(relationDTO);
+        }
+
+        return dest;
+    }
+
+    /**
+     * 获取关系列表
+     * @param relations 关系列表
+     * @param con_id 起始术语id
+     * @param direct -1:向上, 1:向下
+     * @result List<Relation>
+     */
+    public List<Relation> getList(List<Relation> relations, Object con_id, int direct) {
+        List<Relation> rel_list = new ArrayList<>();
+
+
+        if (con_id != null && con_id instanceof Integer) {
+            QueryWrapper<Relation> wrapper = new QueryWrapper<>();
+
+            if (direct == -1) {
+                wrapper.eq("start_id", con_id);
+                rel_list = this.list(wrapper);
+            } else if (direct == 1) {
+                wrapper.eq("end_id", con_id);
+                rel_list = this.list(wrapper);
+            }
+
+            for (Relation item:rel_list) {
+                if (!isExist(relations, item))
+                    relations.add(item);
+                else {
+                    System.out.println("Conflicted items:\t" + JSON.toJSONString(item));
+                    return relations;
+                }
+            }
+
+            if (rel_list.size() > 0) {
+                for (Relation rel : rel_list) {
+                    getList(relations, rel.getEndId(), direct);
+                }
+            }
+        }
+
+        return relations;
+    }
+
+
+    /**
+     * 查询关系是否有循环,即新加关系的起点和终点与原有关系的终点和起点相等
+     *
+     * @param
+     */
+    public Boolean isExist(List<Relation> relations, Relation relation) {
+        Boolean Exist = false;
+
+        for (Relation item:relations) {
+            if (item.getStartId().intValue() == relation.getEndId().intValue() && item.getEndId().intValue() == relation.getStartId().intValue()) {
+                Exist = true;
+            }
+        }
+
+        return Exist;
+    }
+
+}

+ 31 - 0
knowledge-service/src/main/java/com/diagbot/facade/RelationshipFacade.java

@@ -0,0 +1,31 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.service.impl.LexiconRelationshipServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 实体间关系信息查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/2/1 16:07
+ */
+@Component
+public class RelationshipFacade extends LexiconRelationshipServiceImpl {
+
+    /**
+     * 获取术语间关系名称
+     *
+     * @param relationDTO
+     * @result LexiconRelationship
+     */
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO) {
+
+        QueryWrapper<LexiconRelationship> wrapper = new QueryWrapper<>();
+        wrapper.eq("id", relationDTO.getRelationId());
+        LexiconRelationship lexiconRelationship = this.getOne(wrapper);
+
+        return lexiconRelationship;
+    }
+}

+ 18 - 0
knowledge-service/src/main/java/com/diagbot/mapper/LexiconRelationshipMapper.java

@@ -0,0 +1,18 @@
+package com.diagbot.mapper;
+
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.facade.LibraryInfoFacade;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+public interface LexiconRelationshipMapper extends BaseMapper<LexiconRelationship> {
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO, LibraryInfoFacade libraryInfoFacade);
+}

+ 25 - 0
knowledge-service/src/main/java/com/diagbot/mapper/LibraryDetailMapper.java

@@ -0,0 +1,25 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.LibraryDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 提示信息明细 Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface LibraryDetailMapper extends BaseMapper<LibraryDetail> {
+    /**
+     * 获取术语知识
+     *
+     * @param termVo
+     * @return LibraryInfo
+     */
+    public List<LibraryDetail> getLibraryDetail(TermVo termVo);
+}

+ 25 - 0
knowledge-service/src/main/java/com/diagbot/mapper/LibraryInfoMapper.java

@@ -0,0 +1,25 @@
+package com.diagbot.mapper;
+
+import com.diagbot.vo.TermVo;
+import com.diagbot.dto.LibraryInfoDTO;
+import com.diagbot.entity.LibraryInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.LibraryInfo;
+
+/**
+ * <p>
+ * 提示信息 Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface LibraryInfoMapper extends BaseMapper<LibraryInfo> {
+    /**
+     * 获取术语基本信息
+     *
+     * @param termVo
+     * @return LibraryInfo
+     */
+    public LibraryInfo getLibraryInfo(TermVo termVo);
+}

+ 2 - 2
knowledge-service/src/main/java/com/diagbot/mapper/MedicalMapper.java

@@ -20,7 +20,7 @@ public interface MedicalMapper extends BaseMapper<Medical> {
      * 获取术语临床医学信息
      *
      * @param termVo
-     * @result Medical
+     * @result List<Medical>
      */
-    public Medical getMedicalInfo(TermVo termVo);
+    public List<Medical> getMedicalInfo(TermVo termVo);
 }

+ 26 - 0
knowledge-service/src/main/java/com/diagbot/mapper/RelationMapper.java

@@ -0,0 +1,26 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.Relation;
+import com.diagbot.dto.RelationDTO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-31
+ */
+public interface RelationMapper extends BaseMapper<Relation> {
+    /**
+     * 获取术语上级信息
+     *
+     * @param termVo
+     * @result List<RelationDTO>
+     */
+    public List<RelationDTO> getRelation(TermVo termVo);
+}

+ 18 - 0
knowledge-service/src/main/java/com/diagbot/service/LexiconRelationshipService.java

@@ -0,0 +1,18 @@
+package com.diagbot.service;
+
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.facade.LibraryInfoFacade;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+public interface LexiconRelationshipService extends IService<LexiconRelationship> {
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO, LibraryInfoFacade libraryInfoFacade);
+}

+ 19 - 0
knowledge-service/src/main/java/com/diagbot/service/LibraryDetailService.java

@@ -0,0 +1,19 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.LibraryDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 提示信息明细 服务类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface LibraryDetailService extends IService<LibraryDetail> {
+    public List<LibraryDetail> getLibraryDetail(TermVo termVo);
+}

+ 19 - 0
knowledge-service/src/main/java/com/diagbot/service/LibraryInfoService.java

@@ -0,0 +1,19 @@
+package com.diagbot.service;
+
+import com.diagbot.dto.LibraryInfoDTO;
+import com.diagbot.vo.TermVo;
+import com.diagbot.entity.LibraryInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.TermVo;
+
+/**
+ * <p>
+ * 提示信息 服务类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface LibraryInfoService extends IService<LibraryInfo> {
+    public LibraryInfo getLibraryInfo(TermVo termVo);
+}

+ 1 - 1
knowledge-service/src/main/java/com/diagbot/service/MedicalService.java

@@ -16,5 +16,5 @@ import java.util.List;
  * @since 2019-01-16
  */
 public interface MedicalService extends IService<Medical> {
-    public Medical getMedicalInfo(TermVo termVo);
+    public List<Medical> getMedicalInfo(TermVo termVo);
 }

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

@@ -0,0 +1,20 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.Relation;
+import com.diagbot.dto.RelationDTO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-31
+ */
+public interface RelationService extends IService<Relation> {
+    public List<RelationDTO> getRelation(TermVo termVo);
+}

+ 25 - 0
knowledge-service/src/main/java/com/diagbot/service/impl/LexiconRelationshipServiceImpl.java

@@ -0,0 +1,25 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.facade.LibraryInfoFacade;
+import com.diagbot.mapper.LexiconRelationshipMapper;
+import com.diagbot.service.LexiconRelationshipService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+@Service
+public class LexiconRelationshipServiceImpl extends ServiceImpl<LexiconRelationshipMapper, LexiconRelationship> implements LexiconRelationshipService {
+    @Override
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO, LibraryInfoFacade libraryInfoFacade) {
+        return baseMapper.getLexiconRelationship(relationDTO, libraryInfoFacade);
+    }
+}

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

@@ -0,0 +1,26 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.LibraryDetail;
+import com.diagbot.mapper.LibraryDetailMapper;
+import com.diagbot.service.LibraryDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.TermVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 提示信息明细 服务实现类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+@Service
+public class LibraryDetailServiceImpl extends ServiceImpl<LibraryDetailMapper, LibraryDetail> implements LibraryDetailService {
+    @Override
+    public List<LibraryDetail> getLibraryDetail(TermVo termVo) {
+        return baseMapper.getLibraryDetail(termVo);
+    }
+}

+ 25 - 0
knowledge-service/src/main/java/com/diagbot/service/impl/LibraryInfoServiceImpl.java

@@ -0,0 +1,25 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.LibraryInfoDTO;
+import com.diagbot.vo.TermVo;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.mapper.LibraryInfoMapper;
+import com.diagbot.service.LibraryInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 提示信息 服务实现类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+@Service
+public class LibraryInfoServiceImpl extends ServiceImpl<LibraryInfoMapper, LibraryInfo> implements LibraryInfoService {
+    @Override
+    public LibraryInfo getLibraryInfo(TermVo termVo) {
+        return baseMapper.getLibraryInfo(termVo);
+    }
+}

+ 1 - 1
knowledge-service/src/main/java/com/diagbot/service/impl/MedicalServiceImpl.java

@@ -21,7 +21,7 @@ import java.util.List;
  */
 @Service
 public class MedicalServiceImpl extends ServiceImpl<MedicalMapper, Medical> implements MedicalService {
-    public Medical getMedicalInfo(TermVo termVo) {
+    public List<Medical> getMedicalInfo(TermVo termVo) {
         return baseMapper.getMedicalInfo(termVo);
     }
 }

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

@@ -0,0 +1,26 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.Relation;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.mapper.RelationMapper;
+import com.diagbot.service.RelationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.TermVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-31
+ */
+@Service
+public class RelationServiceImpl extends ServiceImpl<RelationMapper, Relation> implements RelationService {
+    public List<RelationDTO> getRelation(TermVo termVo) {
+        return baseMapper.getRelation(termVo);
+    }
+}

+ 7 - 3
knowledgeman-service/src/main/java/com/diagbot/vo/AddLibraryVo.java

@@ -8,13 +8,17 @@ import javax.validation.constraints.NotNull;
 /**
  * @Description:
  * @author: Weixuan Huang
- * @time: 2019/1/17 16:13
+ * @time: 2019/2/15 17:21
  */
 @Getter
 @Setter
-public class AddLibraryVo {
+public class MedicalVo {
     @NotNull(message="请输入医学术语")
     private String name;
 
-    private int synony;
+//    private int type_id;
+
+    private int concept_id;
+
+//    private String type;
 }

+ 3 - 0
knowledge-service/src/main/java/com/diagbot/vo/TermVo.java

@@ -16,6 +16,9 @@ public class TermVo {
     @NotNull(message="请输入医学术语")
     private String term;
 
+    @NotNull(message = "请输入术语类型")
+    private String type;
+
     private int id;
 
     private int concept_id;

+ 1 - 1
knowledge-service/src/main/java/com/diagbot/web/ConceptController.java

@@ -36,7 +36,7 @@ public class ConceptController {
     private ConceptFacade conceptFacade;
 
     @ApiOperation(value = "术语信息查询",
-            notes = "Term:术语名称,必填<br>")
+            notes = "Term:术语名称,必填<br>Type:术语类型, 必填<br>")
     @PostMapping("/getConceptInfo")
     @SysLogger("getConceptInfo")
     public RespDTO<TermDTO> getConceptInfo(@Valid @RequestBody TermVo termvo) {

+ 3 - 3
knowledgeman-service/src/main/java/com/diagbot/web/InformationController.java

@@ -11,10 +11,10 @@ import org.springframework.stereotype.Controller;
  * </p>
  *
  * @author Weixuan Huang
- * @since 2019-01-14
+ * @since 2019-02-01
  */
 @Controller
-@RequestMapping("/information")
-public class InformationController {
+@RequestMapping("/lexiconRelationship")
+public class LexiconRelationshipController {
 
 }

+ 2 - 0
knowledge-service/src/main/java/com/diagbot/web/LibraryController.java

@@ -32,6 +32,7 @@ import javax.validation.Valid;
 @Api(value = "医学术语API", tags = { "医学术语API" })
 
 public class LibraryController {
+    /*
     @Autowired
     private LibraryFacade libraryFacade;
 
@@ -54,4 +55,5 @@ public class LibraryController {
 
         return RespDTO.onSuc(libraryDTO);
     }
+    */
 }

+ 20 - 0
knowledge-service/src/main/java/com/diagbot/web/LibraryDetailController.java

@@ -0,0 +1,20 @@
+package com.diagbot.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 提示信息明细 前端控制器
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+@Controller
+@RequestMapping("/libraryDetail")
+public class LibraryDetailController {
+
+}

+ 4 - 4
knowledgeman-service/src/main/java/com/diagbot/web/BodypartController.java

@@ -7,14 +7,14 @@ import org.springframework.stereotype.Controller;
 
 /**
  * <p>
- *  前端控制器
+ * 提示信息 前端控制器
  * </p>
  *
  * @author Weixuan Huang
- * @since 2019-01-14
+ * @since 2019-01-30
  */
 @Controller
-@RequestMapping("/bodypart")
-public class BodypartController {
+@RequestMapping("/libraryInfo")
+public class LibraryInfoController {
 
 }

+ 3 - 3
knowledgeman-service/src/main/java/com/diagbot/web/LexiconController.java

@@ -11,10 +11,10 @@ import org.springframework.stereotype.Controller;
  * </p>
  *
  * @author Weixuan Huang
- * @since 2019-01-14
+ * @since 2019-01-31
  */
 @Controller
-@RequestMapping("/lexicon")
-public class LexiconController {
+@RequestMapping("/relation")
+public class RelationController {
 
 }

+ 1 - 0
knowledge-service/src/main/resources/mapper/ConceptMapper.xml

@@ -16,4 +16,5 @@
         FROM concept a, library_info b
         WHERE a.id = b.concept_id and b.name = #{term}
     </select>
+
 </mapper>

+ 12 - 0
knowledge-service/src/main/resources/mapper/LexiconRelationshipMapper.xml

@@ -0,0 +1,12 @@
+<?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.LexiconRelationshipMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.LexiconRelationship">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="code" property="code" />
+    </resultMap>
+
+</mapper>

+ 22 - 0
knowledge-service/src/main/resources/mapper/LibraryDetailMapper.xml

@@ -0,0 +1,22 @@
+<?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.LibraryDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.LibraryDetail">
+        <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="title" property="title" />
+        <result column="content" property="content" />
+        <result column="text" property="text" />
+        <result column="order_no" property="orderNo" />
+        <result column="position" property="position" />
+        <result column="is_reason" property="isReason" />
+    </resultMap>
+
+</mapper>

+ 20 - 0
knowledge-service/src/main/resources/mapper/LibraryInfoMapper.xml

@@ -0,0 +1,20 @@
+<?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.LibraryInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.LibraryInfo">
+        <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="name" property="name" />
+        <result column="type" property="type" />
+        <result column="remark" property="remark" />
+        <result column="concept_id" property="conceptId" />
+        <result column="is_concept" property="isConcept" />
+    </resultMap>
+
+</mapper>

+ 4 - 6
knowledge-service/src/main/resources/mapper/MedicalMapper.xml

@@ -5,13 +5,10 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.Medical">
         <id column="id" property="id" />
-        <!--<result column="name" property="name" />-->
-        <result column="concept_id" property="concept_id" />
-        <result column="type_id" property="typeId" />
-        <result column="type" property="type" />
+        <result column="concept_id" property="conceptId" />
+        <result column="name" property="name" />
         <result column="std_name" property="stdName" />
-        <!--<result column="cate_name" property="cateName" />-->
-        <!--<result column="group" property="group" />-->
+        <result column="cate_name" property="cateName" />
         <result column="gender" property="gender" />
         <result column="min_age" property="minAge" />
         <result column="max_age" property="maxAge" />
@@ -23,4 +20,5 @@
         <result column="note" property="note" />
     </resultMap>
 
+
 </mapper>

+ 18 - 0
knowledge-service/src/main/resources/mapper/RelationMapper.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.RelationMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.Relation">
+        <id column="id" property="id" />
+        <result column="start_id" property="startId" />
+        <result column="relation_id" property="relationId" />
+        <result column="end_id" property="endId" />
+    </resultMap>
+
+    <select id="getRelation" parameterType="com.diagbot.dto.RelationDTO" resultType="com.diagbot.dto.RelationDTO">
+        SELECT id, start_id, relation_id, end_id
+        FROM relation
+        WHERE start_id = #{startId} AND end_id = #{endId}
+    </select>
+</mapper>

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

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

+ 11 - 0
knowledgeman-service/pom.xml

@@ -147,6 +147,17 @@
             <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.mongodb</groupId>
+            <artifactId>bson</artifactId>
+            <version>3.8.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.jexcelapi</groupId>
+            <artifactId>jxl</artifactId>
+            <version>2.6.10</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 76 - 76
knowledgeman-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -1,76 +1,76 @@
-package com.diagbot.aop;
-
-import com.diagbot.annotation.SysLogger;
-import com.diagbot.entity.SysLog;
-import com.diagbot.enums.SysTypeEnum;
-import com.diagbot.rabbit.MySender;
-import com.diagbot.util.GsonUtil;
-import com.diagbot.util.HttpUtils;
-import com.diagbot.util.StringUtil;
-import com.diagbot.util.UserUtils;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.lang.reflect.Method;
-import java.util.Date;
-
-/**
- * @Description: 日志拦截切面
- * @author: gaodm
- * @time: 2018/8/2 13:36
- */
-@Aspect
-@Component
-public class SysLoggerAspect {
-    @Autowired
-    private MySender mySender;
-
-    @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
-    public void loggerPointCut() {
-
-    }
-
-    @Before("loggerPointCut()")
-    public void saveSysLog(JoinPoint joinPoint) {
-        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
-        Method method = signature.getMethod();
-
-        SysLog sysLog = new SysLog();
-        SysLogger sysLogger = method.getAnnotation(SysLogger.class);
-        if (sysLogger != null) {
-            //注解上的描述
-            sysLog.setOperation(sysLogger.value());
-        }
-        //请求的方法名
-        String className = joinPoint.getTarget().getClass().getName();
-        String methodName = signature.getName();
-        sysLog.setMethod(className + "." + methodName + "()");
-        //请求的参数
-        Object[] args = joinPoint.getArgs();
-        String params = "";
-        for (Object o : args) {
-            params += GsonUtil.toJson(o);
-        }
-        if (!StringUtil.isEmpty(params)) {
-            sysLog.setParams(params);
-        }
-        //设置IP地址
-        sysLog.setIp(HttpUtils.getIpAddress());
-        //用户名
-        String username = UserUtils.getCurrentPrinciple();
-        if (!StringUtil.isEmpty(username)) {
-            sysLog.setUsername(username);
-        }
-        sysLog.setGmtCreate(new Date());
-        sysLog.setSysType(SysTypeEnum.KNOWLEDGEMAN_SERVICE.getKey());
-        //保存系统日志
-        mySender.outputLogSend(sysLog);
-    }
-
-}
-
+//package com.diagbot.aop;
+//
+//import com.diagbot.annotation.SysLogger;
+//import com.diagbot.entity.SysLog;
+//import com.diagbot.enums.SysTypeEnum;
+//import com.diagbot.rabbit.MySender;
+//import com.diagbot.util.GsonUtil;
+//import com.diagbot.util.HttpUtils;
+//import com.diagbot.util.StringUtil;
+//import com.diagbot.util.UserUtils;
+//import org.aspectj.lang.JoinPoint;
+//import org.aspectj.lang.annotation.Aspect;
+//import org.aspectj.lang.annotation.Before;
+//import org.aspectj.lang.annotation.Pointcut;
+//import org.aspectj.lang.reflect.MethodSignature;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.lang.reflect.Method;
+//import java.util.Date;
+//
+///**
+// * @Description: 日志拦截切面
+// * @author: gaodm
+// * @time: 2018/8/2 13:36
+// */
+//@Aspect
+//@Component
+//public class SysLoggerAspect {
+//    @Autowired
+//    private MySender mySender;
+//
+//    @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
+//    public void loggerPointCut() {
+//
+//    }
+//
+//    @Before("loggerPointCut()")
+//    public void saveSysLog(JoinPoint joinPoint) {
+//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+//        Method method = signature.getMethod();
+//
+//        SysLog sysLog = new SysLog();
+//        SysLogger sysLogger = method.getAnnotation(SysLogger.class);
+//        if (sysLogger != null) {
+//            //注解上的描述
+//            sysLog.setOperation(sysLogger.value());
+//        }
+//        //请求的方法名
+//        String className = joinPoint.getTarget().getClass().getName();
+//        String methodName = signature.getName();
+//        sysLog.setMethod(className + "." + methodName + "()");
+//        //请求的参数
+//        Object[] args = joinPoint.getArgs();
+//        String params = "";
+//        for (Object o : args) {
+//            params += GsonUtil.toJson(o);
+//        }
+//        if (!StringUtil.isEmpty(params)) {
+//            sysLog.setParams(params);
+//        }
+//        //设置IP地址
+//        sysLog.setIp(HttpUtils.getIpAddress());
+//        //用户名
+//        String username = UserUtils.getCurrentPrinciple();
+//        if (!StringUtil.isEmpty(username)) {
+//            sysLog.setUsername(username);
+//        }
+//        sysLog.setGmtCreate(new Date());
+//        sysLog.setSysType(SysTypeEnum.KNOWLEDGEMAN_SERVICE.getKey());
+//        //保存系统日志
+//        mySender.outputLogSend(sysLog);
+//    }
+//
+//}
+//

+ 458 - 0
knowledgeman-service/src/main/java/com/diagbot/api/ImportExcel.java

@@ -0,0 +1,458 @@
+package com.diagbot.api;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LibraryDetail;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Medical;
+import com.diagbot.entity.Relation;
+import com.diagbot.facade.*;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.TermVo;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ImportExcel {
+
+    private static ConceptFacade conceptFacade;
+
+    private static LibraryInfoFacade libraryinfoFacade;
+
+    private static LibraryDetailFacade libraryDetailFacade;
+
+    private static MedicalFacade medicalFacade;
+
+    private static RelationFacade relationFacade;
+
+    private static String[] catelist = {"症状","查体","化验","辅检","诊断","药品","其他史","治疗方案"};
+
+    public static void setConceptFacade(ConceptFacade conceptFacade) {
+        ImportExcel.conceptFacade = conceptFacade;
+    }
+
+    public static void setLibraryinfoFacade(LibraryInfoFacade libraryinfoFacade) {
+        ImportExcel.libraryinfoFacade = libraryinfoFacade;
+    }
+
+    public static void setLibraryDetailFacade(LibraryDetailFacade libraryDetailFacade) {
+        ImportExcel.libraryDetailFacade = libraryDetailFacade;
+    }
+
+    public static void setMedicalFacade(MedicalFacade medicalFacade) {
+        ImportExcel.medicalFacade = medicalFacade;
+    }
+
+    public static void setRelationFacade(RelationFacade relationFacade) {
+        ImportExcel.relationFacade = relationFacade;
+    }
+
+
+    /**
+     * 从文件批量导入术语信息
+     *
+     * @param file
+     * @return ConceptDTO
+     */
+    public static ConceptDTO importBatch(MultipartFile file) {
+        ConceptDTO conceptDTO = new ConceptDTO();
+        List<String> messages = new ArrayList<>();
+
+        InputStream inputStream = null;
+        Workbook wb = null;
+
+        AmendTermVo amendTermVo;
+        TermVo termVo;
+        Medical medical;
+        List<Medical> medlist;
+        RelationDTO relationDTO;
+        List<RelationDTO> rellist;
+
+        try {
+            if (!file.isEmpty()) {
+                inputStream = file.getInputStream();
+
+                if (inputStream.available() > 5120000) {
+                    messages.add("术语文件最大只支持5MB!");
+                } else {
+                    String fileName = file.getOriginalFilename();
+                    if (fileName.lastIndexOf(".") != -1) {
+                        String type = fileName.substring(fileName.lastIndexOf("."));
+                        if (type.equals(".xls")) {
+                            wb = new HSSFWorkbook(inputStream);
+                        } else if (type.equals(".xlsx")) {
+                            wb = new XSSFWorkbook(inputStream);
+                        }
+                        if (wb != null) {
+
+                            CleanupDB(fileName);
+
+                            Sheet sheet = wb.getSheetAt(0);
+                            int count = 0;
+                            String group, category, std_name, name, prop, prop1, minagestr, maxagestr;
+                            int diag_id = 0;
+                            int treat_id = 0;
+                            String diag = "";
+                            String treat = "";
+                            String diag_type = "";
+                            String treat_type = "";
+                            String gender = "";
+                            String dept = "";
+                            String note = "";
+                            int minage = 0;
+                            int maxage = 0;
+                            String grp_type = "";
+                            String cate_type = "";
+                            String std_type = "";
+
+                            if (fileName.indexOf(catelist[7]) == -1) {
+                                for (Row row : sheet) {
+                                    count++;
+
+                                    if (row != null) {
+                                        if (count == 1) {
+                                            grp_type = row.getCell(0).toString();
+                                            if (medicalFacade.getTypeInfo(grp_type) == null) {
+                                                System.out.println("术语类型-'" + grp_type + "'不存在!");
+                                                break;
+                                            }
+                                            cate_type = row.getCell(1).toString();
+                                            if (medicalFacade.getTypeInfo(cate_type) == null) {
+                                                System.out.println("术语类型-'" + cate_type + "'不存在!");
+                                                break;
+                                            }
+                                            std_type = row.getCell(2).toString().replace("标准名称", "");
+                                            if (medicalFacade.getTypeInfo(std_type) == null) {
+                                                System.out.println("术语类型-'" + std_type + "'不存在!");
+                                                break;
+                                            }
+                                        }
+
+                                        if (count > 1) {
+
+                                            group = (row.getCell(0) == null) ? "" : row.getCell(0).toString().trim();
+                                            category = (row.getCell(1) == null) ? "" : row.getCell(1).toString().trim();
+                                            std_name = (row.getCell(2) == null) ? "" : row.getCell(2).toString().trim();
+                                            name = (row.getCell(3) == null) ? "" : row.getCell(3).toString().trim();
+                                            prop = (row.getCell(4) == null) ? "" : row.getCell(4).toString().trim();
+                                            prop1 = (row.getCell(5) == null) ? "" : row.getCell(5).toString().trim();
+
+                                            System.out.println(group + "\t" + category + "\t" + std_name + "\t" +
+                                                    name + "\t" + prop + "\t" + prop1);
+
+                                            if (std_type.equals("症状")) {
+                                                gender = (row.getCell(8) == null) ? "" : row.getCell(8).toString();
+                                                gender = (gender.indexOf(".") == -1) ? gender : gender.substring(0, gender.indexOf("."));
+                                                minagestr = (row.getCell(9) == null) ? "0" : row.getCell(9).toString();
+                                                minage = Integer.valueOf((minagestr.indexOf(".") == -1) ?
+                                                        minagestr : minagestr.substring(0, minagestr.indexOf(".")));
+                                                maxagestr = (row.getCell(10) == null) ? "0" : row.getCell(10).toString();
+                                                maxage = Integer.valueOf((maxagestr.indexOf(".") == -1) ?
+                                                        maxagestr : maxagestr.substring(0, maxagestr.indexOf(".")));
+
+//                                            System.out.println(gender + "\t" + minage + "\t" + maxage);
+                                            } else if (std_type.equals("诊断")) {
+                                                dept = (row.getCell(7) == null) ? "" : row.getCell(7).toString();
+                                            } else if (std_type.equals("药品")) {
+                                                note = (row.getCell(7) == null) ? "" : row.getCell(7).toString();
+                                            }
+
+
+                                            // 设置实体
+                                            if (std_name.trim().length() > 0 && name.trim().length() > 0) {
+                                                amendTermVo = new AmendTermVo();
+                                                amendTermVo.setConcept(std_name);
+                                                amendTermVo.setNewterm(name);
+                                                amendTermVo.setOldterm("");
+                                                amendTermVo.setNewtype(std_type);
+
+                                                medical = new Medical();
+                                                medical.setName(name);
+                                                medical.setStdName(std_name);
+                                                medical.setCateName(category);
+                                                if (std_type.equals("症状")) {
+                                                    medical.setBodypart(prop);
+                                                    medical.setSubBodypart(prop1);
+                                                    medical.setGender(gender);
+                                                    medical.setMinAge(minage);
+                                                    medical.setMaxAge(maxage);
+                                                    medical.setGrp(group);
+                                                } else if (std_type.equals("诊断")) {
+                                                    medical.setDept(dept);
+                                                } else if (std_type.equals("药品")) {
+                                                    medical.setNote(note);
+                                                    String grpname = (group.length() > 0) ? group : "";
+                                                    String catename = (category.length() > 0) ? ("(" + category + ")") : "";
+                                                    medical.setFunction(grpname + catename);
+                                                }
+                                                medlist = new ArrayList<>();
+                                                medlist.add(medical);
+                                                amendTermVo.setMedicalInfo(medlist);
+//                                                amendTermVo.setMedicalInfo(medical);
+
+                                                conceptFacade.upsertConceptInfo(amendTermVo);
+                                                System.out.println(name + ":\t 已入库.");
+                                            }
+
+                                            if (category.length() > 0) {
+                                                // 设置套餐
+                                                amendTermVo = new AmendTermVo();
+                                                amendTermVo.setConcept(category);
+                                                amendTermVo.setNewterm(category);
+                                                amendTermVo.setOldterm("");
+                                                amendTermVo.setNewtype(cate_type);
+
+                                                medical = new Medical();
+                                                medical.setName(category);
+                                                medical.setStdName(category);
+                                                medical.setCateName(group);
+                                                medical.setCode("");
+                                                medical.setNote("");
+                                                medlist = new ArrayList<>();
+                                                medlist.add(medical);
+                                                amendTermVo.setMedicalInfo(medlist);
+//                                                amendTermVo.setMedicalInfo(medical);
+
+                                                conceptFacade.upsertConceptInfo(amendTermVo);
+
+                                                if (!std_name.equals(category)) {
+                                                    relationDTO = new RelationDTO();
+                                                    relationDTO.setStartId(conceptFacade.getConceptId(std_name, std_type));
+                                                    relationDTO.setStartName(std_name);
+                                                    relationDTO.setRelationId(1);
+                                                    relationDTO.setEndId(conceptFacade.getConceptId(category, cate_type));
+                                                    relationDTO.setEndName(category);
+                                                    rellist = new ArrayList<>();
+                                                    rellist.add(relationDTO);
+                                                    amendTermVo.setRelations(rellist);
+
+                                                    relationFacade.upsertRelationInfo(amendTermVo);
+                                                }
+
+                                                System.out.println(category + ":\t 已入库.");
+                                            }
+
+                                            if (group.length() > 0) {
+                                                // 设置大类
+                                                amendTermVo = new AmendTermVo();
+                                                amendTermVo.setConcept(group);
+                                                amendTermVo.setNewterm(group);
+                                                amendTermVo.setOldterm("");
+                                                amendTermVo.setNewtype(grp_type);
+
+                                                medical = new Medical();
+                                                medical.setName(group);
+                                                medical.setStdName(group);
+                                                medical.setCateName("");
+                                                medical.setCode("");
+                                                medical.setNote("");
+                                                medlist = new ArrayList<>();
+                                                medlist.add(medical);
+                                                amendTermVo.setMedicalInfo(medlist);
+//                                                amendTermVo.setMedicalInfo(medical);
+
+                                                conceptFacade.upsertConceptInfo(amendTermVo);
+
+                                                if (!category.equals(group)) {
+                                                    relationDTO = new RelationDTO();
+                                                    relationDTO.setStartId(conceptFacade.getConceptId(category, cate_type));
+                                                    relationDTO.setStartName(category);
+                                                    relationDTO.setRelationId(1);
+                                                    relationDTO.setEndId(conceptFacade.getConceptId(group, grp_type));
+                                                    relationDTO.setEndName(group);
+                                                    rellist = new ArrayList<>();
+                                                    rellist.add(relationDTO);
+                                                    amendTermVo.setRelations(rellist);
+
+                                                    relationFacade.upsertRelationInfo(amendTermVo);
+                                                }
+
+                                                System.out.println(group + ":\t 已入库.");
+                                            }
+
+//                                        if (count >= 20) break;
+                                        }
+                                    }
+                                    System.out.println(count + " 条记录添加入库.");
+                                }
+                            }
+                            else {
+                                for (Row row : sheet) {
+                                    count++;
+
+                                    if (row != null) {
+                                        if (count == 1) {
+                                            diag = row.getCell(0).toString().trim();
+                                            treat = row.getCell(3).toString().trim();
+                                            diag_type = "诊断";
+                                            treat_type = "药品";
+                                        }
+                                        else {
+                                            diag = row.getCell(0).toString().trim();
+                                            treat = row.getCell(3).toString().trim();
+
+                                            if (diag.length() > 0) {
+                                                diag_id = conceptFacade.getConceptId(diag, diag_type);
+                                                treat_id = conceptFacade.getConceptId(treat, treat_type);
+
+                                                if (diag_id > 0 && treat_id > 0) {
+                                                    amendTermVo = new AmendTermVo();
+
+                                                    relationDTO = new RelationDTO();
+                                                    relationDTO.setStartId(diag_id);
+                                                    relationDTO.setStartName(diag);
+                                                    relationDTO.setRelationId(11);
+                                                    relationDTO.setEndId(treat_id);
+                                                    relationDTO.setEndName(treat);
+                                                    rellist = new ArrayList<>();
+                                                    rellist.add(relationDTO);
+                                                    amendTermVo.setRelations(rellist);
+
+                                                    relationFacade.upsertRelationInfo(amendTermVo);
+
+                                                    System.out.println(diag + "\t治疗\t" + treat + ":\t 已入库.");
+//                                                    break;
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+
+                        } else {
+                            messages.add("非excel文件无法解析!");
+                        }
+                    } else {
+                        messages.add("未知文件无法解析!");
+                    }
+                }
+            } else {
+                messages.add("无文件上传!");
+            }
+        }
+        catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        finally {
+            conceptDTO.setMessage(messages);
+            try {
+
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+                if (wb != null) {
+                    wb.close();
+                }
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        return conceptDTO;
+    }
+
+    /**
+     * 批量导入数据前,删除相关表
+     *
+     * @param filename
+     *
+     */
+    public static void CleanupDB(String filename) {
+        String cate = "";
+        List<Integer> Ids;
+
+        try {
+            for (String item:catelist) {
+                if (filename.indexOf(item) >= 0) {
+                    cate = item;
+                    break;
+                }
+            }
+
+            if (cate.length() > 0 && !cate.equals(catelist[7])) {
+                System.out.println(cate);
+
+                // 从 LibraryInfo 中找出所有需要删除的Id
+                QueryWrapper<LibraryInfo> wrapper = new QueryWrapper<>();
+                wrapper.likeRight("type", cate);
+                List<LibraryInfo> libinfolist = libraryinfoFacade.list(wrapper);
+
+                // 删除术语信息
+                Ids = new ArrayList<>();
+                for (int i=0; i<libinfolist.size(); i++) {
+                    Ids.add(libinfolist.get(i).getId().intValue());
+//                    break;
+                }
+
+                if (Ids.size() > 0) {
+                    libraryinfoFacade.removeByIds(Ids);
+                }
+
+                // 删除术语详细信息
+                List<LibraryDetail> limbodetails = libraryDetailFacade.getLimboItems();
+                Ids = new ArrayList<>();
+                for (int i=0; i<limbodetails.size(); i++) {
+                    Ids.add(limbodetails.get(i).getId().intValue());
+//                    break;
+                }
+
+                if (Ids.size() > 0) {
+                    libraryDetailFacade.removeByIds(Ids);
+                }
+//            libraryDetailFacade.deleteDetail();
+
+                // 删除医学记录
+                List<Medical> limbomed = medicalFacade.getLimboItems();
+                Ids = new ArrayList<>();
+                for (int i=0; i<limbomed.size(); i++) {
+                    Ids.add(limbomed.get(i).getId().intValue());
+//                    break;
+                }
+
+                if (Ids.size() > 0) {
+                    medicalFacade.removeByIds(Ids);
+                }
+
+                // 删除概念
+                // 找出所有需要删除的概念
+                List<ConceptDTO> limboIds = conceptFacade.getLimboItems();
+                Ids = new ArrayList<>();
+                for (int i=0; i<limboIds.size(); i++) {
+                    Ids.add(limboIds.get(i).getId());
+                }
+
+                if (Ids.size() > 0) {
+                    conceptFacade.removeByIds(Ids);
+                }
+
+                // 删除关系
+                List<Relation> limboRelation = relationFacade.getLimboRelation();
+                Ids = new ArrayList<>();
+                for (int i=0; i<limboRelation.size(); i++) {
+                    Ids.add(limboRelation.get(i).getId());
+                }
+
+                if (Ids.size() > 0) {
+                    relationFacade.removeByIds(Ids);
+                }
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+}

+ 68 - 0
knowledgeman-service/src/main/java/com/diagbot/api/ImportWord.java

@@ -0,0 +1,68 @@
+package com.diagbot.api;
+
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+
+import java.io.FileInputStream;
+import java.util.Iterator;
+import java.util.List;
+
+public class ImportWord {
+    public static void main(String[] args) {
+        String filepath = "E:\\危重病人APACHE II评分表量表.docx";
+        parseWord(filepath);
+    }
+
+    /**
+     * 读取文档中表格
+     * @param filePath
+     */
+    public static void parseWord(String filePath){
+        try{
+            FileInputStream in = new FileInputStream(filePath);//载入文档
+            // 处理docx格式 即office2007以后版本
+            if(filePath.toLowerCase().endsWith("docx")){
+                //word 2007 图片不会被读取, 表格中的数据会被放在字符串的最后
+                XWPFDocument xwpf = new XWPFDocument(in);//得到word文档的信息
+                Iterator<XWPFTable> it = xwpf.getTablesIterator();//得到word中的表格
+                // 设置需要读取的表格  set是设置需要读取的第几个表格,total是文件中表格的总数
+                int set = 1, total = 4;
+                int num = set;
+                // 过滤前面不需要的表格
+//                for (int i = 0; i < set-1; i++) {
+//                    it.hasNext();
+//                    it.next();
+//                }
+                while(it.hasNext()){
+                    XWPFTable table = it.next();
+                    System.out.println("这是第" + num + "个表的数据");
+                    List<XWPFTableRow> rows = table.getRows();
+                    //读取每一行数据
+                    for (int i = 0; i < rows.size(); i++) {
+                        XWPFTableRow  row = rows.get(i);
+                        //读取每一列数据
+                        List<XWPFTableCell> cells = row.getTableCells();
+                        for (int j = 0; j < cells.size(); j++) {
+                            XWPFTableCell cell = cells.get(j);
+                            //输出当前的单元格的数据
+                            System.out.print(cell.getText() + "\t");
+                        }
+                        System.out.println();
+                    }
+                    // 过滤多余的表格
+                    while (num < total) {
+                        it.hasNext();
+                        it.next();
+                        num += 1;
+                    }
+                }
+            }
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
+}

+ 72 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/ConceptDTO.java

@@ -0,0 +1,72 @@
+package com.diagbot.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.diagbot.entity.LibraryDetail;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Medical;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/1/14 17:03
+ */
+@Getter
+@Setter
+public class ConceptDTO {
+     /**
+     * 概念id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 术语id
+     */
+    private Integer libId;
+
+    /**
+     * 术语名称
+     */
+    private String name;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime gmtCreated;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 术语基本信息
+     */
+    private List<LibraryInfo> libraryInfo;
+
+    /**
+     * 术语相关医学知识
+     */
+    private List<LibraryDetail> information;
+
+    /**
+     * 医学临床信息
+     */
+    private List<Medical> medicalInfo;
+
+    /**
+     * 术语所有上级信息
+     */
+    private List<RelationDTO> relations;
+
+    /**
+     * 提示信息
+     */
+    private List<String> message;
+}

+ 95 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/LibraryDetailDTO.java

@@ -0,0 +1,95 @@
+package com.diagbot.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author Weixuan Huang
+ * @since 2019-03-18
+ */
+@Getter
+@Setter
+public class LibraryDetailDTO {
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private char isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private String gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private String gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 概念名称
+     */
+    private String name;
+
+    /**
+     * 静态知识来源
+     */
+    private String source;
+
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+    /**
+     * 提示明细序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 显示位置(多选):1-推送展示,2-更多展示,3-一般治疗展示,4-手术治疗展示,5-药品说明书
+     */
+    private String position;
+
+    /**
+     * 是否诊断依据(1-是,0-否)
+     */
+    private Integer isReason;
+
+}

+ 80 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/LibraryInfoDTO.java

@@ -0,0 +1,80 @@
+package com.diagbot.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+@Getter
+@Setter
+public class LibraryInfoDTO {
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreated;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 同义词
+     */
+    private String synonymous;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 概念id
+     */
+    private Integer conceptId;
+
+    /**
+     * 是否标准词,1:是,0:否
+     */
+    private Integer isConcept;
+
+
+}

+ 27 - 7
knowledgeman-service/src/main/java/com/diagbot/dto/MedicalDTO.java

@@ -14,22 +14,32 @@ public class MedicalDTO {
     /**
      * 主键
      */
-//    private long id;
+    private Integer id;
 
     /**
-     * 术语名称
+     * 术语概念id
+     */
+    private Integer conceptId;
+
+    /**
+     * 名称
      */
     private String name;
 
     /**
-     * 标准类型名称
+     * 同义词
+     */
+    private String synonymous;
+
+    /**
+     * 术语类型编号,对应类型库
      */
-    private String typename;
+//    private Integer typeId;
 
     /**
-     * 类型名称
+     * 术语类型
      */
-    private String type;
+//    private String type;
 
     /**
      * 术语标准名
@@ -44,7 +54,12 @@ public class MedicalDTO {
     /**
      * 术语类组
      */
-    private String group;
+    private String grp;
+
+    /**
+     * 效用名称
+     */
+    private String function;
 
     /**
      * 性别:1:男, 2:女, 3:通用
@@ -91,4 +106,9 @@ public class MedicalDTO {
      */
     private String note;
 
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
 }

+ 64 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/RelationDTO.java

@@ -0,0 +1,64 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/1/31 16:53
+ */
+@Getter
+@Setter
+public class RelationDTO {
+    /**
+     * 主键
+     */
+    private Integer id;
+
+    /**
+     * 关系起点术语id
+     */
+    private Integer startId;
+
+    /**
+     * 关系起点术语名称
+     */
+    private String startName;
+
+    /**
+     * 关系起点术语类型
+     */
+    private String startType;
+
+    /**
+     * 关系id
+     */
+    private Integer relationId;
+
+    /**
+     * 关系名称
+     */
+    private String relationName;
+
+    /**
+     * 关系终点术语id
+     */
+    private Integer endId;
+
+    /**
+     * 关系终点术语名称
+     */
+    private String endName;
+
+    /**
+     * 关系终点术语类型
+     */
+    private String endType;
+
+    /**
+     * 其它信息
+     */
+    private String msg;
+
+}

+ 5 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/TermDTO.java

@@ -47,4 +47,9 @@ public class TermDTO {
      * 医学临床信息
      */
     private List<MedicalDTO> medicalInfo;
+
+    /**
+     * 术语层级关系
+     */
+//    private List<LevelDTO> levelInfo;
 }

+ 27 - 0
knowledgeman-service/src/main/java/com/diagbot/dto/TypeDTO.java

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: Weixuan Huang
+ * @time: 2019/2/15 15:43
+ */
+@Getter
+@Setter
+public class TypeDTO {
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 序列号
+     */
+    private int id;
+
+}

+ 80 - 0
knowledgeman-service/src/main/java/com/diagbot/entity/Concept.java

@@ -0,0 +1,80 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public class Concept implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 概念id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 术语id
+     */
+    private Integer libId;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime gmtCreated;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime gmtModified;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public Integer getLibId() {
+        return libId;
+    }
+
+    public void setLibId(Integer libId) {
+        this.libId = libId;
+    }
+    public LocalDateTime getGmtCreated() {
+        return gmtCreated;
+    }
+
+    public void setGmtCreated(LocalDateTime gmtCreated) {
+        this.gmtCreated = gmtCreated;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    @Override
+    public String toString() {
+        return "Concept{" +
+        "id=" + id +
+        ", libId=" + libId +
+        ", gmtCreated=" + gmtCreated +
+        ", gmtModified=" + gmtModified +
+        "}";
+    }
+}

+ 0 - 91
knowledgeman-service/src/main/java/com/diagbot/entity/Information.java

@@ -1,91 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author Weixuan Huang
- * @since 2019-01-14
- */
-public class Information implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 内容id
-     */
-//    @TableId(value = "id", type = IdType.AUTO)
-//    private Integer id;
-
-    /**
-     * 术语名称
-     */
-    private String name;
-
-    /**
-     * 对应术语id
-     */
-    private Integer libId;
-
-    /**
-     * 标题
-     */
-    private String title;
-
-    /**
-     * 内容
-     */
-    private String content;
-
-//    public Integer getId() {
-//        return id;
-//    }
-
-//    public void setId(Integer id) {
-//        this.id = id;
-//    }
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-    public Integer getLibId() {
-        return libId;
-    }
-
-    public void setLibId(Integer libId) {
-        this.libId = libId;
-    }
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    @Override
-    public String toString() {
-        return "Information{" +
-//        "id=" + id +
-        ", name=" + name +
-        ", libId=" + libId +
-        ", title=" + title +
-        ", content=" + content +
-        "}";
-    }
-}

+ 57 - 0
knowledgeman-service/src/main/java/com/diagbot/entity/LexiconRelationship.java

@@ -0,0 +1,57 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+public class LexiconRelationship implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private String name;
+
+    private String code;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    @Override
+    public String toString() {
+        return "LexiconRelationship{" +
+        "id=" + id +
+        ", name=" + name +
+        ", code=" + code +
+        "}";
+    }
+}

+ 0 - 53
knowledgeman-service/src/main/java/com/diagbot/entity/Library.java

@@ -1,53 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author Weixuan Huang
- * @since 2019-01-14
- */
-public class Library implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 术语id
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-
-    /**
-     * 术语名称
-     */
-    private String name;
-
-    /**
-     * 同义词id
-     */
-    private Integer synony;
-
-    public Integer getId() { return id; }
-
-    public void setId(Integer id) { this.id = id; }
-    public String getName() { return name; }
-
-    public void setName(String name) { this.name = name; }
-    public Integer getSynony() { return synony; }
-
-    public void setSynony(Integer synony) { this.synony = synony; }
-
-    @Override
-    public String toString() {
-        return "Library{" +
-        "id=" + id +
-        ", name=" + name +
-        ", synony=" + synony +
-        "}";
-    }
-}

+ 210 - 0
knowledgeman-service/src/main/java/com/diagbot/entity/LibraryDetail.java

@@ -0,0 +1,210 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 提示信息明细
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public class LibraryDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private char isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 静态知识来源
+     */
+    private String source;
+
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+    /**
+     * 提示明细序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 显示位置(多选):1-推送展示,2-更多展示,3-一般治疗展示,4-手术治疗展示,5-药品说明书
+     */
+    private String position;
+
+    /**
+     * 是否诊断依据(1-是,0-否)
+     */
+    private Integer isReason;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public char getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(char 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;
+    }
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+    public Integer getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(Integer orderNo) {
+        this.orderNo = orderNo;
+    }
+    public String getPosition() {
+        return position;
+    }
+
+    public void setPosition(String position) {
+        this.position = position;
+    }
+    public Integer getIsReason() {
+        return isReason;
+    }
+
+    public void setIsReason(Integer isReason) {
+        this.isReason = isReason;
+    }
+
+    @Override
+    public String toString() {
+        return "LibraryDetail{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", conceptId=" + conceptId +
+        ", source=" + source +
+        ", title=" + title +
+        ", content=" + content +
+        ", text=" + text +
+        ", orderNo=" + orderNo +
+        ", position=" + position +
+        ", isReason=" + isReason +
+        "}";
+    }
+}

+ 171 - 0
knowledgeman-service/src/main/java/com/diagbot/entity/LibraryInfo.java

@@ -0,0 +1,171 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 提示信息
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public class LibraryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreated;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 概念id
+     */
+    private Integer conceptId;
+
+    /**
+     * 是否标准词,1:是,0:否
+     */
+    private Integer isConcept;
+
+    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 getGmtCreated() {
+        return gmtCreated;
+    }
+
+    public void setGmtCreated(LocalDateTime gmtCreated) {
+        this.gmtCreated = gmtCreated;
+    }
+    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;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+    public Integer getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Integer conceptId) {
+        this.conceptId = conceptId;
+    }
+    public Integer getIsConcept() {
+        return isConcept;
+    }
+
+    public void setIsConcept(Integer isConcept) {
+        this.isConcept = isConcept;
+    }
+
+    @Override
+    public String toString() {
+        return "LibraryInfo{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreated +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", name=" + name +
+        ", type=" + type +
+        ", remark=" + remark +
+        ", conceptId=" + conceptId +
+        ", isConcept=" + isConcept +
+        "}";
+    }
+}

+ 57 - 39
knowledgeman-service/src/main/java/com/diagbot/entity/Medical.java

@@ -9,30 +9,25 @@ import java.io.Serializable;
  * 
  * </p>
  *
- * @author Weixuan Huang
- * @since 2019-01-16
+ * @author gaodm
+ * @since 2019-03-01
  */
 public class Medical implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-//    @TableId(value = "id", type = IdType.AUTO)
-//    private Integer id;
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
 
     /**
-     * 术语名称
-     */
-    private String name;
-
-    /**
-     * 标准类型名称
+     * 术语概念id
      */
-    private String typename;
+    private Integer conceptId;
 
     /**
-     * 术语类型
+     * 术语名称
      */
-    private String type;
+    private String name;
 
     /**
      * 术语标准名
@@ -47,7 +42,12 @@ public class Medical implements Serializable {
     /**
      * 术语类组
      */
-    private String group;
+    private String grp;
+
+    /**
+     * 作用名称
+     */
+    private String function;
 
     /**
      * 性别:1:男, 2:女, 3:通用
@@ -94,30 +94,32 @@ public class Medical implements Serializable {
      */
     private String note;
 
-//    public Integer getId() {
-//        return id;
-//    }
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
 
-//    public void setId(Integer id) {
-//        this.id = id;
-//    }
-    public String getName() {
-        return name;
+    public Integer getId() {
+        return id;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setId(Integer id) {
+        this.id = id;
     }
-    public String getTypename() {
-        return typename;
+    public Integer getConceptId() {
+        return conceptId;
     }
 
-    public void setTypename(String typename) {
-        this.typename = typename;
+    public void setConceptId(Integer conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getName() {
+        return name;
     }
-    public String getType() { return type; }
 
-    public void setType(String type) { this.type = type; }
+    public void setName(String name) {
+        this.name = name;
+    }
     public String getStdName() {
         return stdName;
     }
@@ -132,12 +134,19 @@ public class Medical implements Serializable {
     public void setCateName(String cateName) {
         this.cateName = cateName;
     }
-    public String getGroup() {
-        return group;
+    public String getGrp() {
+        return grp;
     }
 
-    public void setGroup(String group) {
-        this.group = group;
+    public void setGrp(String grp) {
+        this.grp = grp;
+    }
+    public String getFunction() {
+        return function;
+    }
+
+    public void setFunction(String function) {
+        this.function = function;
     }
     public String getGender() {
         return gender;
@@ -203,16 +212,24 @@ public class Medical implements Serializable {
         this.note = note;
     }
 
+    public String getIs_deleted() {
+        return isDeleted;
+    }
+
+    public void setIs_deleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
     @Override
     public String toString() {
-        return "Term{" +
-//        "id=" + id +
+        return "Medical{" +
+        "id=" + id +
+        ", conceptId=" + conceptId +
         ", name=" + name +
-        ", typename=" + typename +
-        ", type=" + type +
         ", stdName=" + stdName +
         ", cateName=" + cateName +
-        ", group=" + group +
+        ", grp=" + grp +
+        ", function=" + function +
         ", gender=" + gender +
         ", minAge=" + minAge +
         ", maxAge=" + maxAge +
@@ -222,6 +239,7 @@ public class Medical implements Serializable {
         ", dept=" + dept +
         ", code=" + code +
         ", note=" + note +
+        ", isDeleted=" + isDeleted +
         "}";
     }
 }

+ 102 - 0
knowledgeman-service/src/main/java/com/diagbot/entity/Relation.java

@@ -0,0 +1,102 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-31
+ */
+public class Relation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 关系起点术语id
+     */
+    private Integer startId;
+
+    /**
+     * 关系id
+     */
+    private Integer relationId;
+
+    /**
+     * 关系终点术语id
+     */
+    private Integer endId;
+
+    /**
+     * 子节点
+     */
+//    private Relation nextNode;
+
+    /**
+     * 父节点
+     */
+//    private Relation prevNode;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public Integer getStartId() {
+        return startId;
+    }
+
+    public void setStartId(Integer startId) {
+        this.startId = startId;
+    }
+    public Integer getRelationId() {
+        return relationId;
+    }
+
+    public void setRelationId(Integer relationId) {
+        this.relationId = relationId;
+    }
+    public Integer getEndId() {
+        return endId;
+    }
+
+    public void setEndId(Integer endId) {
+        this.endId = endId;
+    }
+    /*
+    public Relation next() {
+        return nextNode;
+    }
+    public void setNext(Relation node) {
+        nextNode = node;
+    }
+
+    public Relation prev() {
+        return prevNode;
+    }
+    public void setPrev(Relation node) {
+        prevNode = node;
+    }
+    */
+
+    @Override
+    public String toString() {
+        return "Relation{" +
+        "id=" + id +
+        ", startId=" + startId +
+        ", relationId=" + relationId +
+        ", endId=" + endId +
+        "}";
+    }
+}

+ 244 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -0,0 +1,244 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.*;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.api.ImportExcel;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.dto.LibraryInfoDTO;
+import com.diagbot.entity.*;
+import com.diagbot.service.impl.ConceptServiceImpl;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.ConceptVo;
+import com.diagbot.vo.TermVo;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.multipart.MultipartFile;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @Description: 术语查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/1/14 16:17
+ */
+@Component
+public class ConceptFacade extends ConceptServiceImpl {
+
+    @Autowired
+    private LibraryInfoFacade libraryinfoFacade;
+    @Autowired
+    private LibraryDetailFacade libraryDetailFacade;
+    @Autowired
+    private MedicalFacade medicalFacade;
+    @Autowired
+    private RelationFacade relationFacade;
+
+
+    /**
+     * 获取医学术语基本信息
+     *
+     * @param termvo
+     * @return List<ConceptDTO>
+     */
+    public List<ConceptDTO> getConceptInfo(@RequestBody TermVo termvo) {
+
+        List<ConceptDTO> conceptDTOs = new ArrayList<>();
+        ConceptDTO conceptDTO;
+        List<LibraryInfo> libraryinfos;
+
+        // 获取医学术语的基本信息
+        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+        query.like("name", termvo.getTerm());
+        query.eq("is_concept", 1);
+        List<LibraryInfo> libraryInfos = libraryinfoFacade.list(query);
+
+        for (LibraryInfo libraryInfo:libraryInfos) {
+            libraryinfos = new ArrayList<>();
+
+            conceptDTO = new ConceptDTO();
+            conceptDTO.setId(libraryInfo.getConceptId());
+            conceptDTO.setLibId(libraryInfo.getId().intValue());
+            conceptDTO.setName(libraryInfo.getName());
+
+            libraryinfos.add(libraryInfo);
+            conceptDTO.setLibraryInfo(libraryinfos);
+
+            conceptDTOs.add(conceptDTO);
+        }
+
+        return conceptDTOs;
+    }
+
+
+    /**
+     * 获取标准术语名称列表
+     *
+     * @param conceptVo
+     * @return IPage<LibraryDTO>
+     */
+    public IPage<LibraryInfoDTO> getAllConcepts(ConceptVo conceptVo) {
+
+        return libraryinfoFacade.getAllConcept(conceptVo);
+    }
+
+    /**
+     * 获取标准术语信息列表
+     *
+     * @param conceptVo
+     * @return IPage<LibraryDTO>
+     */
+    public IPage<LibraryInfoDTO> getAllInformation(ConceptVo conceptVo) {
+
+        return libraryinfoFacade.getAllInfor(conceptVo);
+    }
+
+
+    /**
+     * 更新医学术语信息
+     *
+     * @param amendTermVo
+     * @return ConceptDTO
+     */
+    public ConceptDTO upsertConceptInfo(@RequestBody AmendTermVo amendTermVo) {
+        ConceptDTO conceptDTO = new ConceptDTO();
+
+        TermVo termVo = new TermVo();
+        termVo.setTerm(amendTermVo.getNewterm());
+        termVo.setType(amendTermVo.getNewtype());
+
+        LibraryInfo libraryInfo = libraryinfoFacade.upsertLibraryInfo(amendTermVo);
+
+        QueryWrapper<Concept> query = new QueryWrapper<>();
+        query.eq("lib_id", libraryInfo.getId());
+        Concept concept = getOne(query);
+
+        if (concept == null) {
+            concept = new Concept();
+            concept.setLibId(libraryInfo.getId().intValue());
+            saveOrUpdate(concept);
+
+            concept = getOne(query);
+        }
+
+        libraryInfo.setConceptId(concept.getId());
+        libraryInfo.setIsConcept(1);
+        libraryinfoFacade.saveOrUpdate(libraryInfo);
+
+        if (amendTermVo.getLibraryInfo() != null && amendTermVo.getLibraryInfo().size() > 0) {
+            List<LibraryInfo> libraryInfos = amendTermVo.getLibraryInfo();
+            for (LibraryInfo libraryinfo:libraryInfos) {
+                libraryinfo.setConceptId(concept.getId());
+                libraryinfo.setIsConcept(0);
+                libraryinfo.setIsDeleted("N");
+                libraryinfoFacade.saveOrUpdate(libraryinfo);
+            }
+        }
+
+
+        query = new QueryWrapper<>();
+        query.eq("name", amendTermVo.getNewterm());
+        query.eq("type", amendTermVo.getNewtype());
+        concept = getOne(query);
+
+        BeanUtils.copyProperties(concept, conceptDTO);
+
+        QueryWrapper<LibraryInfo> conceptquery = new QueryWrapper<>();
+        conceptquery = new QueryWrapper<>();
+        conceptquery.eq("concept_id", concept.getId());
+        conceptquery.isNull("is_concept");
+        List<LibraryInfo> libraryInfos = libraryinfoFacade.list(conceptquery);
+
+        conceptDTO.setLibraryInfo(libraryInfos);
+
+        return conceptDTO;
+    }
+
+    /**
+     * 删除医学术语信息
+     *
+     * @param termVo
+     * @return ConceptDTO
+     *
+     */
+    public ConceptDTO removeConceptInfo(TermVo termVo) {
+
+        ConceptDTO conceptDTO = getConcept(termVo);
+
+        if (conceptDTO == null) {
+            conceptDTO = new ConceptDTO();
+            String msg = "概念\"" + termVo.getTerm() + "\"不存在!";
+            conceptDTO.setMessage(new ArrayList<String>());
+            conceptDTO.getMessage().add(msg);
+
+            return conceptDTO;
+        }
+        else {
+            conceptDTO = libraryDetailFacade.getConceptKnowledge(termVo);
+            if (conceptDTO.getInformation() != null && conceptDTO.getInformation().size() > 0) {
+                String msg = "概念\"" + termVo.getTerm() + "\"的静态知识还存在!";
+                conceptDTO.setMessage(new ArrayList<String>());
+                conceptDTO.getMessage().add(msg);
+
+                return conceptDTO;
+            }
+
+        }
+
+        return conceptDTO;
+    }
+
+
+
+
+    /**
+     * 获取概念Id
+     *
+     * @param term
+     * @return Integer
+     */
+    public int getConceptId(String term, String type) {
+        int id = 0;
+        TermVo termVo = new TermVo();
+
+        try {
+            termVo.setTerm(term);
+            termVo.setType(type);
+            ConceptDTO conceptDTO = getConcept(termVo);
+            if (conceptDTO != null) {
+                id = conceptDTO.getId();
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        finally {
+            return id;
+        }
+    }
+
+    /**
+     * 从文件批量导入术语信息
+     *
+     * @param file
+     * @return ConceptDTO
+     */
+    public ConceptDTO importBatch(MultipartFile file) {
+        ImportExcel.setConceptFacade(this);
+        ImportExcel.setLibraryinfoFacade(libraryinfoFacade);
+        ImportExcel.setLibraryDetailFacade(libraryDetailFacade);
+        ImportExcel.setMedicalFacade(medicalFacade);
+        ImportExcel.setRelationFacade(relationFacade);
+
+        ConceptDTO conceptDTO = ImportExcel.importBatch(file);
+
+        return conceptDTO;
+    }
+
+
+}

+ 0 - 28
knowledgeman-service/src/main/java/com/diagbot/facade/InformationFacade.java

@@ -1,28 +0,0 @@
-package com.diagbot.facade;
-
-import com.diagbot.dto.InforDTO;
-import com.diagbot.dto.LibraryDTO;
-import com.diagbot.service.impl.InformationServiceImpl;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * @Description: 术语知识查询业务层
- * @author: Weixuan Huang
- * @time: 2019/1/16 14:17
- */
-@Component
-public class InformationFacade extends InformationServiceImpl {
-
-    /**
-     * 获取医学术语知识
-     *
-     * @param LibraryDTO
-     * @result InforDTO
-     */
-    public List<InforDTO> getInfor(LibraryDTO libraryDTO) {
-        List<InforDTO> inforDTO = this.getInfomation(libraryDTO);
-        return inforDTO;
-    }
-}

+ 191 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/LibraryDetailFacade.java

@@ -0,0 +1,191 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.dto.LibraryDetailDTO;
+import com.diagbot.entity.Concept;
+import com.diagbot.entity.LibraryDetail;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.service.impl.LibraryDetailServiceImpl;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.ConceptVo;
+import com.diagbot.vo.TermVo;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 术语基本信息查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/1/16 14:17
+ */
+@Component
+public class LibraryDetailFacade extends LibraryDetailServiceImpl {
+
+    @Autowired
+    private ConceptFacade conceptFacade;
+
+    @Autowired
+    private LibraryInfoFacade libraryInfoFacade;
+
+
+    /**
+     * 获取所有术语静态知识列表
+     *
+     * @param conceptVo
+     * @return IPage<LibraryDetailDTO>
+     */
+    public IPage<LibraryDetailDTO> getAllLibraryDetail(ConceptVo conceptVo) {
+
+        return getAllKnowledge(conceptVo);
+    }
+
+
+
+
+    /**
+     * 获取医学术语静态信息
+     *
+     * @param termvo
+     * @return ConceptDTO
+     */
+    public ConceptDTO getConceptKnowledge(@RequestBody TermVo termvo) {
+
+        List<LibraryInfo> libraryInfos;
+        LibraryInfo libraryInfo;
+        List<LibraryDetail> libraryDetails;
+
+        ConceptDTO conceptDTO = conceptFacade.getConcept(termvo);
+
+        if (conceptDTO != null) {
+            // 获取与医学术语的基本信息
+            QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+            query.eq("concept_id", conceptDTO.getId());
+            query.eq("is_deleted", "N");
+            query.eq("is_concept", 1);
+            libraryInfos = libraryInfoFacade.list(query);
+
+            if (libraryInfos != null) {
+                libraryInfo = libraryInfos.get(0);
+                conceptDTO.setName(libraryInfo.getName());
+            }
+
+            // 获取与术语相关的静态知识
+            QueryWrapper<LibraryDetail> querydetail = new QueryWrapper<>();
+            querydetail.eq("concept_id", conceptDTO.getId());
+            querydetail.eq("is_deleted", "N");
+
+            libraryDetails = list(querydetail);
+
+            if (libraryDetails != null) {
+                conceptDTO.setInformation(libraryDetails);
+            }
+
+        }
+
+        return conceptDTO;
+    }
+
+
+    /**
+     * 更新或添加医学术语静态信息
+     *
+     * @param amendTermVo
+     * @return ConceptDTO
+     */
+    public ConceptDTO upsertConceptKnowledge(AmendTermVo amendTermVo) {
+
+        ConceptDTO conceptDTO = new ConceptDTO();
+
+        LibraryDetail libraryDetail;
+        List<LibraryDetail> libraryDetails;
+
+        conceptDTO.setName(amendTermVo.getNewterm());
+        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+        query.eq("name", amendTermVo.getNewterm());
+        query.eq("type", amendTermVo.getNewtype());
+        LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
+
+        if (amendTermVo.getInformation() != null && libraryInfo != null) {
+
+            conceptDTO.setLibId(libraryInfo.getId().intValue());
+            conceptDTO.setId(libraryInfo.getConceptId());
+            conceptDTO.setMedicalInfo(new ArrayList<>());
+
+            for (int i=0; i<amendTermVo.getInformation().size(); i++) {
+                libraryDetail = amendTermVo.getInformation().get(i);
+
+                QueryWrapper<LibraryDetail> detquery = new QueryWrapper<>();
+                detquery.eq("concept_id", libraryInfo.getConceptId());
+                libraryDetails = list(detquery);
+
+                if (libraryDetails.size() > 0) {
+                    LibraryDetail exist_medical = libraryDetails.get(0);
+                    libraryDetail.setId(exist_medical.getId());
+                }
+                else {
+                    libraryDetail.setConceptId(libraryInfo.getConceptId().longValue());
+                }
+
+                this.saveOrUpdate(libraryDetail);
+
+                conceptDTO.getInformation().add(libraryDetail);
+            }
+        }
+        else {
+            conceptDTO.setInformation(null);
+        }
+
+        return conceptDTO;
+    }
+
+    /**
+     * 删除术语医学信息
+     *
+     * @param termVo
+     * @return ConceptDTO
+     */
+    public Boolean removeConceptKnowledge(TermVo termVo) {
+
+        Boolean isdeleted = false;
+        List<LibraryDetail> libraryDetails;
+
+        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+        query.eq("name", termVo.getTerm());
+        query.eq("type", termVo.getType());
+        LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
+
+        if (libraryInfo != null) {
+            QueryWrapper<LibraryDetail> detquery = new QueryWrapper<>();
+            detquery.eq("concept_id", libraryInfo.getConceptId());
+            libraryDetails = list(detquery);
+
+            if (libraryDetails != null && libraryDetails.size() > 0) {
+                for (LibraryDetail libraryDetail:libraryDetails) {
+                    libraryDetail.setIsDeleted('Y');
+                    saveOrUpdate(libraryDetail);
+                }
+                isdeleted = true;
+            }
+        }
+
+        return isdeleted;
+    }
+
+    /**
+     * 清空医学术语知识表
+     *
+     */
+    public void deleteDetail() {
+        truncateDetail();
+    }
+}

+ 0 - 82
knowledgeman-service/src/main/java/com/diagbot/facade/LibraryFacade.java

@@ -1,82 +0,0 @@
-package com.diagbot.facade;
-
-import com.diagbot.dto.LibraryDTO;
-import com.diagbot.dto.TermDTO;
-import com.diagbot.entity.Library;
-import com.diagbot.service.impl.LibraryServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.vo.AddLibraryVo;
-import com.diagbot.vo.AddTermVo;
-import com.diagbot.vo.TermVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.RequestBody;
-
-/**
- * @Description: 术语查询业务层
- * @author: Weixuan Huang
- * @time: 2019/1/14 16:17
- */
-@Component
-public class LibraryFacade extends LibraryServiceImpl {
-
-    @Autowired
-    private InformationFacade informationFacade;
-    @Autowired
-    private MedicalFacade medicalFacade;
-
-
-    /**
-     * 获取医学术语信息
-     *
-     * @param TermVo
-     * @return TermDTO
-     */
-    public TermDTO getTermInfo(@RequestBody TermVo termvo) {
-
-        TermDTO termDTO = new TermDTO();
-        LibraryDTO libraryDTO = getLibrary(termvo);
-        // 获取与医学术语的基本信息
-        termDTO.setLibrary(libraryDTO);
-        // 获取与术语相关的医学知识
-        termDTO.setInformation(informationFacade.getInfor(libraryDTO));
-        // 获取与术语相关的临床医学信息
-        termDTO.setMedicalInfo(medicalFacade.getInfor(libraryDTO));
-
-        return termDTO;
-    }
-
-    /**
-     * 获取术语基本信息
-     *
-     * @param termVo
-     * @return
-     */
-    public LibraryDTO getTerm(@RequestBody TermVo termVo) {
-        LibraryDTO libraryDTO = getLibrary(termVo);
-
-        return  libraryDTO;
-    }
-
-    /**
-     * 添加术语信息
-     *
-     * @Param addLibraryVo
-     * @Return addLibraryVo
-     */
-    public Boolean addTerm(AddTermVo addTermVo) {
-
-        Boolean result = false;
-
-        AddLibraryVo addLibraryVo = addTermVo.getLibraryVo();
-
-        if (addLibraryVo != null) {
-            Library library = new Library();
-            BeanUtil.copyProperties(addLibraryVo, library);
-
-            result = this.save(library);
-        }
-
-        return result;
-    }
-}

+ 116 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/LibraryInfoFacade.java

@@ -0,0 +1,116 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Medical;
+import com.diagbot.service.impl.LibraryInfoServiceImpl;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.TermVo;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 术语基本信息查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/1/16 14:17
+ */
+@Component
+public class LibraryInfoFacade extends LibraryInfoServiceImpl {
+
+    private DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
+
+
+    /**
+     * 获取医学术语基本信息
+     *
+     * @param params
+     * @result LibraryInfo
+     */
+    public LibraryInfo getLibraryInfor(Map<String, Object> params) {
+        QueryWrapper<LibraryInfo> wrapper = new QueryWrapper();
+        LibraryInfo libraryinfor = null;
+
+        for (String key:params.keySet()) {
+            wrapper.eq(key, params.get(key));
+        }
+
+        libraryinfor = this.getOne(wrapper);
+
+        return libraryinfor;
+    }
+
+
+    /**
+     * 更新或添加医学术语基本信息
+     *
+     * @param amendTermVo
+     * @return LibraryInfo
+     */
+    public LibraryInfo upsertLibraryInfo(AmendTermVo amendTermVo) {
+
+        String oldterm = amendTermVo.getOldterm().trim();
+        String oldtype = amendTermVo.getOldtype().trim();
+        String newterm = amendTermVo.getNewterm().trim();
+        String newtype = amendTermVo.getNewtype().trim();
+        String concept = amendTermVo.getConcept().trim();
+        int concept_id = amendTermVo.getConcept_id();
+
+        QueryWrapper<LibraryInfo> queryWrapper;
+        LibraryInfo libraryInfo = null;
+
+        // 原先的术语名称不为空,则修改原先的术语
+        if (oldterm.length() > 0 && oldtype.length() > 0) {
+            queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("name", oldterm);
+            queryWrapper.eq("type", oldtype);
+
+            libraryInfo = getOne(queryWrapper);
+
+            if (libraryInfo != null) {
+                libraryInfo.setName(newterm);
+                libraryInfo.setType(newtype);
+
+                if (libraryInfo.getIsDeleted() == "Y") {
+                    libraryInfo.setIsDeleted("N");
+                }
+
+                saveOrUpdate(libraryInfo);
+            }
+        }
+        else {
+            queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("name", newterm);
+            queryWrapper.eq("type", newtype);
+
+            libraryInfo = getOne(queryWrapper);
+
+            // 新的术语不存在
+            if (libraryInfo == null) {
+                libraryInfo = new LibraryInfo();
+                libraryInfo.setName(newterm);
+                libraryInfo.setType(newtype);
+
+                saveOrUpdate(libraryInfo);
+            }
+            // 新的术语存在,但处于删除状态
+            else if (libraryInfo.getIsDeleted() == "Y") {
+                libraryInfo.setIsDeleted("N");
+                saveOrUpdate(libraryInfo);
+            }
+
+            libraryInfo = getOne(queryWrapper);
+        }
+
+        return libraryInfo;
+    }
+
+
+}

+ 185 - 7
knowledgeman-service/src/main/java/com/diagbot/facade/MedicalFacade.java

@@ -1,11 +1,27 @@
 package com.diagbot.facade;
 
-import com.diagbot.dto.LibraryDTO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.ConceptDTO;
 import com.diagbot.dto.MedicalDTO;
+import com.diagbot.dto.TypeDTO;
+import com.diagbot.entity.Concept;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Medical;
 import com.diagbot.service.impl.MedicalServiceImpl;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.ConceptVo;
+import com.diagbot.vo.TermVo;
+import com.diagbot.vo.TypeVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 术语临床信息查询业务层
@@ -15,14 +31,176 @@ import java.util.List;
 @Component
 public class MedicalFacade extends MedicalServiceImpl {
 
+    @Autowired
+    ConceptFacade conceptFacade;
+    @Autowired
+    LibraryInfoFacade libraryInfoFacade;
+
+
+    /**
+     * 获取术语医学知识
+     *
+     * @param termVo
+     * @result ConceptDTO
+     */
+    public ConceptDTO getMedicalInfo(@RequestBody TermVo termVo) {
+        List<LibraryInfo> libraryInfos;
+        LibraryInfo libraryInfo;
+        List<Medical> medicals;
+
+        ConceptDTO conceptDTO = conceptFacade.getConcept(termVo);
+
+        if (conceptDTO != null) {
+            // 获取与医学术语的基本信息
+            QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+            query.eq("concept_id", conceptDTO.getId());
+            query.eq("is_concept", 1);
+            libraryInfos = libraryInfoFacade.list(query);
+
+            if (libraryInfos != null) {
+                libraryInfo = libraryInfos.get(0);
+                conceptDTO.setName(libraryInfo.getName());
+
+                // 获取与术语相关的医学知识
+                QueryWrapper<Medical> querymed = new QueryWrapper<>();
+                querymed.eq("concept_id", conceptDTO.getId());
+
+                medicals = list(querymed);
+
+                if (medicals != null) {
+                    conceptDTO.setMedicalInfo(medicals);
+                }
+            }
+        }
+
+        return conceptDTO;
+    }
+
+
+    /**
+     * 更新或添加术语医学信息
+     *
+     * @param amendTermVo
+     * @return ConceptDTO
+     */
+    public ConceptDTO upsertMedicalInfo(AmendTermVo amendTermVo) {
+        ConceptDTO conceptDTO = new ConceptDTO();
+
+//        Map<String, Object> map;
+        Medical medical;
+        List<Medical> medicals;
+
+        conceptDTO.setName(amendTermVo.getNewterm());
+        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+        query.eq("name", amendTermVo.getNewterm());
+        query.eq("type", amendTermVo.getNewtype());
+        LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
+
+        if (amendTermVo.getMedicalInfo() != null && libraryInfo != null) {
+
+            conceptDTO.setLibId(libraryInfo.getId().intValue());
+            conceptDTO.setId(libraryInfo.getConceptId());
+            conceptDTO.setMedicalInfo(new ArrayList<>());
+
+            for (int i=0; i<amendTermVo.getMedicalInfo().size(); i++) {
+                medical = amendTermVo.getMedicalInfo().get(i);
+//                medical = amendTermVo.getMedicalInfo();
+
+//                map = new HashMap<>();
+//                map.put("name", amendTermVo.getNewterm());
+//                medicals = getMedicalInfo(map);
+
+                QueryWrapper<Medical> medquery = new QueryWrapper<>();
+                medquery.eq("name", amendTermVo.getNewterm());
+                medicals = list(medquery);
+
+                if (medicals.size() > 0) {
+                    Medical exist_medical = medicals.get(0);
+                    medical.setId(exist_medical.getId());
+                }
+                else {
+                    medical.setConceptId(libraryInfo.getConceptId());
+                }
+
+
+                this.saveOrUpdate(medical);
+
+//                amendTermVo.setMedicalInfo(medical);
+//                amendTermVo.getMedicalInfo().set(i, medical);
+                conceptDTO.getMedicalInfo().add(medical);
+            }
+        }
+
+        return conceptDTO;
+    }
+
+
+    /**
+     * 删除术语医学信息
+     *
+     * @param termVo
+     * @return ConceptDTO
+     */
+    public Boolean removeMedicalInfo(TermVo termVo) {
+
+        Boolean isdeleted = false;
+        List<Medical> medicals;
+
+        QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+        query.eq("name", termVo.getTerm());
+        query.eq("type", termVo.getType());
+        LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
+
+        if (libraryInfo != null) {
+            QueryWrapper<Medical> medquery = new QueryWrapper<>();
+            medquery.eq("name", termVo.getTerm());
+            medquery.eq("concept_id", libraryInfo.getConceptId());
+            medicals = list(medquery);
+
+            if (medicals != null && medicals.size() > 0) {
+                for (Medical medical:medicals) {
+                    medical.setIs_deleted("Y");
+                    saveOrUpdate(medical);
+                }
+                isdeleted = true;
+            }
+        }
+
+        return isdeleted;
+    }
+
+
+    /**
+     * 获取术语类型信息
+     *
+     * @param type
+     * @return TypeDTO
+     */
+    public TypeDTO getTypeInfo(String type) {
+        TypeDTO typeDTO = null;
+        TypeVo typeVo = new TypeVo();
+
+        try {
+            typeVo.setType(type);
+            List<TypeDTO> typelist = getTypeId(typeVo);
+
+            if (typelist.size() > 0) {
+                typeDTO = getTypeId(typeVo).get(0);
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        finally {
+            return typeDTO;
+        }
+    }
+
     /**
-     * 获取医学术语知识
+     * 清空医学术语信息表
      *
-     * @param LibraryDTO
-     * @result MedicalDTO
      */
-    public List<MedicalDTO> getInfor(LibraryDTO libraryDTO) {
-        List<MedicalDTO> medicalDTO = getMedicalInfo(libraryDTO);
-        return medicalDTO;
+    public void deleteMedical() {
+        truncateMedical();
     }
 }

+ 306 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/RelationFacade.java

@@ -0,0 +1,306 @@
+package com.diagbot.facade;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.Concept;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.entity.LibraryInfo;
+import com.diagbot.entity.Relation;
+import com.diagbot.service.impl.RelationServiceImpl;
+import com.diagbot.vo.AllRelationVo;
+import com.diagbot.vo.AmendTermVo;
+import com.diagbot.vo.RelationVo;
+import com.diagbot.vo.TermVo;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 术语知识查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/1/16 14:17
+ */
+@Component
+public class RelationFacade extends RelationServiceImpl {
+
+    @Autowired
+    private ConceptFacade conceptFacade;
+    @Autowired
+    private LibraryInfoFacade libraryInfoFacade;
+    @Autowired
+    private RelationshipFacade relationshipFacade;
+
+
+    /**
+     *
+     * 获取所有医学术语的关系
+     *
+     * @param allrelationVo
+     * @result IPage<RelationDTO>
+     */
+    public IPage<RelationDTO> getAllRelations(AllRelationVo allrelationVo) {
+
+        return getAllRelation(allrelationVo);
+    }
+
+
+    /**
+     * 获取指定医学术语的关联关系
+     *
+     * @param relation
+     *
+     * @return List<RelationDTO>
+     */
+    public List<RelationDTO> getRelationInfo(RelationDTO relation) {
+        List<RelationDTO> rellist = new ArrayList<>();
+
+        rellist = getRelation(relation);
+
+        return rellist;
+    }
+
+    /**
+     *
+     *
+     * 获取指定医学术语的所有上级关系
+     *
+     * @param relationVo
+     * @result List<Relation>
+     */
+    public List<RelationDTO> getRelations(RelationVo relationVo) {
+        List<RelationDTO> relationDTOs = new ArrayList<>();
+        RelationDTO relationDTO = new RelationDTO();
+        int concept_id = 0;
+
+        if (relationVo.getStart_term().length() > 0 && relationVo.getEnd_term().length() > 0) {
+            QueryWrapper<LibraryInfo> query = new QueryWrapper<>();
+            query.eq("name", relationVo.getStart_term());
+            query.eq("type", relationVo.getStart_type());
+
+            LibraryInfo libraryInfo = libraryInfoFacade.getOne(query);
+
+            if (libraryInfo == null) {
+                relationDTO.setMsg("术语 \"" + relationVo.getStart_term() + "\" 不存在!");
+                relationDTOs.add(relationDTO);
+
+                return relationDTOs;
+            }
+            concept_id = (libraryInfo == null) ? 0 : libraryInfo.getConceptId();
+        }
+        else if (relationVo.getStart_concept_id() > 0) {
+            concept_id = relationVo.getStart_concept_id();
+        }
+
+        if (concept_id > 0) {
+            List<Relation> relations = new ArrayList<>();
+            relations = getList(relations, concept_id, -1);
+            relationDTOs.addAll(ConvertListtoDTO(relations));
+        }
+
+        return relationDTOs;
+    }
+
+
+
+    public List<RelationDTO> ConvertListtoDTO (List<Relation> src) {
+        List<RelationDTO> dest = new ArrayList<>();
+        RelationDTO relationDTO;
+
+        for (Relation relation:src) {
+            relationDTO = new RelationDTO();
+            BeanUtils.copyProperties(relation, relationDTO);
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("concept_id", relationDTO.getStartId());
+            LibraryInfo libraryInfo = libraryInfoFacade.getLibraryInfor(map);
+
+            relationDTO.setStartName(libraryInfo.getName());
+
+            map.put("concept_id", relationDTO.getEndId());
+            libraryInfo = libraryInfoFacade.getLibraryInfor(map);
+
+            relationDTO.setEndName(libraryInfo.getName());
+
+            LexiconRelationship lexiconRelationship = relationshipFacade.getLexiconRelationship(relationDTO);
+            relationDTO.setRelationName(lexiconRelationship.getName());
+
+            dest.add(relationDTO);
+        }
+
+        return dest;
+    }
+
+    /**
+     * 获取关系列表
+     * @param relations 关系列表
+     * @param con_id 起始术语id
+     * @param direct -1:向上, 1:向下
+     * @result List<Relation>
+     */
+    public List<Relation> getList(List<Relation> relations, Object con_id, int direct) {
+        List<Relation> rel_list = new ArrayList<>();
+
+
+        if (con_id != null && con_id instanceof Integer) {
+            QueryWrapper<Relation> wrapper = new QueryWrapper<>();
+
+            if (direct == -1) {
+                wrapper.eq("start_id", con_id);
+                rel_list = this.list(wrapper);
+            } else if (direct == 1) {
+                wrapper.eq("end_id", con_id);
+                rel_list = this.list(wrapper);
+            }
+
+            for (Relation item:rel_list) {
+                if (!isExist(relations, item))
+                    relations.add(item);
+                else {
+                    System.out.println("Conflicted items:\t" + JSON.toJSONString(item));
+                    return relations;
+                }
+            }
+
+            if (rel_list.size() > 0) {
+                for (Relation rel : rel_list) {
+                    getList(relations, rel.getEndId(), direct);
+                }
+            }
+        }
+
+        return relations;
+    }
+
+
+    /**
+     * 查询关系是否有循环,即新加关系的起点和终点与原有关系的终点和起点相等
+     *
+     * @param
+     */
+    public Boolean isExist(List<Relation> relations, Relation relation) {
+        Boolean Exist = false;
+
+        for (Relation item:relations) {
+
+            if (item.getEndId().intValue() == relation.getStartId().intValue()
+                    && item.getStartId().intValue() == relation.getEndId().intValue()
+                    && item.getRelationId().intValue() == relation.getRelationId().intValue()) {
+                Exist = true;
+            }
+        }
+
+        return Exist;
+    }
+
+    /**
+     * 更新或添加医学术语关系信息
+     *
+     * @param amendTermVo
+     * @return
+     */
+    public void upsertRelationInfo(AmendTermVo amendTermVo) {
+        Relation relation = new Relation();
+        RelationDTO relnodeDTO;
+        RelationDTO relationDTO;
+        List<RelationDTO> rellist;
+        boolean updated = false;
+        int rel_id = 0;
+
+        if (amendTermVo.getRelations() != null && amendTermVo.getRelations().size() > 0) {
+            for (int i=0; i<amendTermVo.getRelations().size(); i++) {
+                updated = false;
+                relnodeDTO = amendTermVo.getRelations().get(i);
+                if (relnodeDTO.getStartId() > 0 && relnodeDTO.getEndId() > 0
+                        && relnodeDTO.getStartId() != relnodeDTO.getEndId()) {
+                    relationDTO = amendTermVo.getRelations().get(i);
+                    rel_id = relationDTO.getRelationId();
+
+                    rellist = getRelationInfo(relationDTO);
+
+                    if (rellist.size() > 0) {
+                        for (RelationDTO reldto:rellist) {
+                            if (reldto.getRelationId() == rel_id) {
+                                updated = true;
+
+                                break;
+                            }
+                        }
+                    }
+
+                    if (!updated) {
+                        BeanUtils.copyProperties(relationDTO, relation);
+                        this.saveOrUpdate(relation);
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     *
+     * 删除指定医学术语的关系
+     *
+     * @param relationVo
+     * @result RelationDTO
+     */
+    public RelationDTO removeRelations(RelationVo relationVo) {
+        RelationDTO relationDTO = new RelationDTO();
+        QueryWrapper<Relation> query;
+
+        int startid = relationVo.getStart_concept_id();
+        int relationid = relationVo.getRelation_id();
+        int endid = relationVo.getEnd_concept_id();
+        String startname = relationVo.getStart_term().trim();
+        String relationname = relationVo.getRelation_name().trim();
+        String endname = relationVo.getEnd_term().trim();
+
+        if (startid > 0 && relationid > 0 && endid > 0) {
+            query = new QueryWrapper<>();
+            query.eq("start_id", startid);
+            query.eq("relation_id", relationid);
+            query.eq("end_id", endid);
+
+            relationDTO.setMsg(String.valueOf(remove(query)));
+        }
+        else if (startname.length() > 0 && endname.length() > 0 && relationname.length() > 0) {
+            relationDTO = getRelationbyName(relationVo);
+
+            if (relationDTO != null) {
+                int id = relationDTO.getId();
+                query = new QueryWrapper<>();
+                query.eq("id", id);
+
+                relationDTO.setMsg(String.valueOf(remove(query)));
+            }
+            else {
+                relationDTO.setMsg("此关系不存在!");
+            }
+        }
+        else {
+            relationDTO.setMsg("此关系不存在!");
+        }
+
+        return relationDTO;
+    }
+
+
+    /**
+     * 清空医学术语关系表
+     *
+     */
+    public void deleteRelation() {
+        truncateRelation();
+    }
+
+
+}

+ 36 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/RelationshipFacade.java

@@ -0,0 +1,36 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.service.impl.LexiconRelationshipServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 实体间关系信息查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/2/1 16:07
+ */
+@Component
+public class RelationshipFacade extends LexiconRelationshipServiceImpl {
+
+    /**
+     * 获取术语间关系名称
+     *
+     * @param relationDTO
+     * @result LexiconRelationship
+     */
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO) {
+
+        QueryWrapper<LexiconRelationship> wrapper = new QueryWrapper<>();
+        LexiconRelationship lexiconRelationship = null;
+
+        if (relationDTO.getRelationId() != 0) {
+            wrapper.eq("id", relationDTO.getRelationId());
+        }
+
+        lexiconRelationship = this.getOne(wrapper);
+
+        return lexiconRelationship;
+    }
+}

+ 32 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/TypeFacade.java

@@ -0,0 +1,32 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.TypeDTO;
+import com.diagbot.service.impl.LexiconServiceImpl;
+import com.diagbot.vo.TypeVo;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+
+/**
+ * @Description: 术语查询业务层
+ * @author: Weixuan Huang
+ * @time: 2019/3/18 17:30
+ */
+@Component
+public class TypeFacade extends LexiconServiceImpl {
+
+    /**
+     * 获取术语类型信息
+     *
+     * @param typeVo
+     * @return IPage<TypeDTO>
+     */
+    public IPage<TypeDTO> getTypes(@RequestBody TypeVo typeVo) {
+
+        return getAllTypes(typeVo);
+    }
+
+}

+ 36 - 0
knowledgeman-service/src/main/java/com/diagbot/mapper/ConceptMapper.java

@@ -0,0 +1,36 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.ConceptDTO;
+import com.diagbot.dto.LibraryInfoDTO;
+import com.diagbot.entity.Concept;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface ConceptMapper extends BaseMapper<Concept> {
+    /**
+     * 获取术语概念信息
+     * @param termVo
+     * @return ConceptDTO
+     */
+    public ConceptDTO getConcept(TermVo termVo);
+
+
+    /**
+     * 获取所有没有实体关联的概念
+     *
+     * @result ConceptDTO
+     *
+     */
+    public List<ConceptDTO> getLimboItems();
+}

+ 0 - 25
knowledgeman-service/src/main/java/com/diagbot/mapper/InformationMapper.java

@@ -1,25 +0,0 @@
-package com.diagbot.mapper;
-
-import com.diagbot.dto.InforDTO;
-import com.diagbot.dto.LibraryDTO;
-import com.diagbot.entity.Information;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author Weixuan Huang
- * @since 2019-01-14
- */
-public interface InformationMapper extends BaseMapper<Information> {
-    /**
-     * 获取术语医学知识信息
-     * @param LibraryDTO
-     * @return InforDTO
-     */
-    public List<InforDTO> getInformation(LibraryDTO libraryDTO);
-}

+ 12 - 2
knowledgeman-service/src/main/java/com/diagbot/mapper/LexiconMapper.java

@@ -1,7 +1,11 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.TypeDTO;
 import com.diagbot.entity.Lexicon;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.TypeVo;
 
 /**
  * <p>
@@ -9,8 +13,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author Weixuan Huang
- * @since 2019-01-14
+ * @since 2019-03-18
  */
 public interface LexiconMapper extends BaseMapper<Lexicon> {
-
+    /**
+     * 获取所有术语信息
+     *
+     * @param typeVo
+     * @return IPage<TypeDTO>
+     */
+    public IPage<TypeDTO> getAllTypes(TypeVo typeVo);
 }

+ 18 - 0
knowledgeman-service/src/main/java/com/diagbot/mapper/LexiconRelationshipMapper.java

@@ -0,0 +1,18 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.RelationDTO;
+import com.diagbot.entity.LexiconRelationship;
+import com.diagbot.facade.LibraryInfoFacade;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-02-01
+ */
+public interface LexiconRelationshipMapper extends BaseMapper<LexiconRelationship> {
+    public LexiconRelationship getLexiconRelationship(RelationDTO relationDTO, LibraryInfoFacade libraryInfoFacade);
+}

+ 51 - 0
knowledgeman-service/src/main/java/com/diagbot/mapper/LibraryDetailMapper.java

@@ -0,0 +1,51 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.LibraryDetailDTO;
+import com.diagbot.entity.LibraryDetail;
+import com.diagbot.vo.ConceptVo;
+import com.diagbot.vo.TermVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 提示信息明细 Mapper 接口
+ * </p>
+ *
+ * @author Weixuan Huang
+ * @since 2019-01-30
+ */
+public interface LibraryDetailMapper extends BaseMapper<LibraryDetail> {
+    /**
+     * 获取所有术语静态知识
+     *
+     * @param conceptVo
+     * @return IPage<LibraryDetailDTO>
+     */
+    public IPage<LibraryDetailDTO> getAllKnowledge(ConceptVo conceptVo);
+
+    /**
+     * 获取术语知识
+     *
+     * @param termVo
+     * @return LibraryInfo
+     */
+    public List<LibraryDetail> getLibraryDetail(TermVo termVo);
+
+    /**
+     * 清空医学术语知识表
+     *
+     */
+    public void truncateDetail();
+
+    /**
+     * 获取所有没有实体关联的静态信息
+     *
+     * @result List<LibraryDetail>
+     *
+     */
+    public List<LibraryDetail> getLimboItems();
+}

+ 0 - 0
knowledgeman-service/src/main/java/com/diagbot/mapper/LibraryInfoMapper.java


部分文件因为文件数量过多而无法显示