Explorar el Código

更新医学知识库术语服务查询接口

MarkHuang hace 6 años
padre
commit
666c4b2e7d

+ 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:通用
      */

+ 15 - 1
knowledge-service/src/main/java/com/diagbot/entity/LibraryInfo.java

@@ -2,8 +2,9 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+
 import java.io.Serializable;
+import java.time.LocalDateTime;
 
 /**
  * <p>
@@ -53,6 +54,11 @@ public class LibraryInfo implements Serializable {
      */
     private String name;
 
+    /**
+     * 类型
+     */
+    private String type;
+
     /**
      * 备注
      */
@@ -117,6 +123,13 @@ public class LibraryInfo implements Serializable {
     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;
     }
@@ -149,6 +162,7 @@ public class LibraryInfo implements Serializable {
         ", creator=" + creator +
         ", modifier=" + modifier +
         ", name=" + name +
+        ", type=" + type +
         ", remark=" + remark +
         ", conceptId=" + conceptId +
         ", isConcept=" + isConcept +

+ 30 - 26
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;
 
     /**
      * 术语标准名
@@ -52,7 +53,7 @@ public class Medical implements Serializable {
     /**
      * 术语类组
      */
-//    private String group;
+    private String grp;
 
     /**
      * 性别:1:男, 2:女, 3:通用
@@ -106,6 +107,13 @@ public class Medical implements Serializable {
     public void setId(Integer id) {
         this.id = id;
     }
+    public Integer getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Integer conceptId) {
+        this.conceptId = conceptId;
+    }
     public String getName() {
         return name;
     }
@@ -113,13 +121,7 @@ public class Medical implements Serializable {
     public void setName(String name) {
         this.name = name;
     }
-    public Integer getConcept_id() {
-        return concept_id;
-    }
-
-    public void setConcept_id(Integer concept_id) {
-        this.concept_id = concept_id;
-    }
+    /*
     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;
     }
@@ -148,13 +151,13 @@ public class Medical implements Serializable {
     public void setCateName(String cateName) {
         this.cateName = cateName;
     }
-//    public String getGroup() {
-//        return group;
-//    }
-//
-//    public void setGroup(String group) {
-//        this.group = group;
-//    }
+    public String getGrp() {
+        return grp;
+    }
+
+    public void setGrp(String grp) {
+        this.grp = grp;
+    }
     public String getGender() {
         return gender;
     }
@@ -223,12 +226,13 @@ public class Medical implements Serializable {
     public String toString() {
         return "Medical{" +
         "id=" + id +
+        ", conceptId=" + conceptId +
         ", name=" + name +
-        ", typeId=" + typeId +
-        ", type=" + type +
+//        ", typeId=" + typeId +
+//        ", type=" + type +
         ", stdName=" + stdName +
         ", cateName=" + cateName +
-//        ", group=" + group +
+        ", grp=" + grp +
         ", gender=" + gender +
         ", minAge=" + minAge +
         ", maxAge=" + maxAge +

+ 19 - 16
knowledge-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -39,24 +39,27 @@ public class ConceptFacade extends ConceptServiceImpl {
 
         ConceptDTO conceptDTO = getConcept(termvo);
         // 获取与医学术语的基本信息
-        QueryWrapper<LibraryInfo> wrapper = new QueryWrapper<>();
-        termvo.setId(conceptDTO.getLibId());
-        termvo.setConcept_id(conceptDTO.getId());
-        LibraryInfo libraryInfo = libraryinfoFacade.getLibraryInfor(termvo);
-        if (libraryInfo.getIsConcept() != null && libraryInfo.getIsConcept() == 1) {
-            conceptDTO.setName(libraryInfo.getName());
-        }
+        if (conceptDTO != null) {
+            termvo.setId(conceptDTO.getLibId());
+            termvo.setConcept_id(conceptDTO.getId());
+            termvo.setTerm(conceptDTO.getName());
+            LibraryInfo libraryInfo = libraryinfoFacade.getLibraryInfor(termvo);
 
-        conceptDTO.setLibraryInfo(libraryInfo);
+            if (libraryInfo.getIsConcept() != null && libraryInfo.getIsConcept() == 1) {
+                conceptDTO.setName(libraryInfo.getName());
+            }
+            conceptDTO.setLibraryInfo(libraryInfo);
 
-        // 获取与术语相关的医学知识
-        conceptDTO.setInformation(libraryDetailFacade.getLibraryDetails(termvo));
-        // 获取与术语相关的临床医学信息
-        MedicalVo medicalVo = new MedicalVo();
-        medicalVo.setName(termvo.getTerm());
-        conceptDTO.setMedicalInfo(medicalFacade.getMedicalInfo(medicalVo));
-        // 获取术语的所有上级信息
-        conceptDTO.setRelations(relationFacade.getRelation(termvo));
+            // 获取与术语相关的医学知识
+            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;
     }

+ 14 - 1
knowledge-service/src/main/java/com/diagbot/facade/LibraryInfoFacade.java

@@ -27,7 +27,20 @@ public class LibraryInfoFacade extends LibraryInfoServiceImpl {
      */
     public LibraryInfo getLibraryInfor(TermVo termVo) {
         QueryWrapper<LibraryInfo> wrapper = new QueryWrapper();
-        wrapper.eq("concept_id", termVo.getConcept_id());
+
+        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;
     }

+ 0 - 4
knowledge-service/src/main/java/com/diagbot/facade/MedicalFacade.java

@@ -29,10 +29,6 @@ public class MedicalFacade extends MedicalServiceImpl {
             wrapper.eq("name", medicalVo.getName());
         }
 
-        if (medicalVo.getType() != null && medicalVo.getType().trim().length() > 0) {
-            wrapper.eq("type", medicalVo.getType());
-        }
-
         if (medicalVo.getConcept_id() > 0) {
             wrapper.eq("concept_id", medicalVo.getConcept_id());
         }

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

@@ -31,12 +31,14 @@ public class RelationFacade extends RelationServiceImpl {
     private RelationshipFacade relationshipFacade;
 
     /**
-     * 获取医学术语上级信息
+     *
+     *
+     * 获取指定医学术语的所有信息
      *
      * @param termVo
      * @result List<Relation>
      */
-    public List<RelationDTO> getRelation(TermVo termVo) {
+    public List<RelationDTO> getAllRelation(TermVo termVo) {
         List<RelationDTO> relationDTOs = new ArrayList<>();
 
         List<Relation> relations = new ArrayList<>();
@@ -50,7 +52,7 @@ public class RelationFacade extends RelationServiceImpl {
         List<RelationDTO> dest = new ArrayList<>();
         RelationDTO relationDTO;
         TermVo termVo = new TermVo();
-        LibraryInfo libraryInfo = null;
+//        LibraryInfo libraryInfo = null;
 //        QueryWrapper<LibraryInfo> wrapper = new QueryWrapper<>();
 
         for (Relation relation:src) {
@@ -58,13 +60,11 @@ public class RelationFacade extends RelationServiceImpl {
             BeanUtils.copyProperties(relation, relationDTO);
 
             termVo.setConcept_id(relationDTO.getStartId());
-//            wrapper.eq("concept_id", relationDTO.getStartId());
 
-            libraryInfo = libraryInfoFacade.getLibraryInfor(termVo);
+            LibraryInfo libraryInfo = libraryInfoFacade.getLibraryInfor(termVo);
             relationDTO.setStartName(libraryInfo.getName());
 
             termVo.setConcept_id(relationDTO.getEndId());
-//            wrapper.eq("concept_id", relationDTO.getEndId());
 
             libraryInfo = libraryInfoFacade.getLibraryInfor(termVo);
             relationDTO.setEndName(libraryInfo.getName());

+ 2 - 2
knowledge-service/src/main/java/com/diagbot/vo/MedicalVo.java

@@ -16,9 +16,9 @@ public class MedicalVo {
     @NotNull(message="请输入医学术语")
     private String name;
 
-    private int type_id;
+//    private int type_id;
 
     private int concept_id;
 
-    private String type;
+//    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) {

+ 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>

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

@@ -11,6 +11,7 @@
         <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" />

+ 2 - 4
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="concept_id" property="conceptId" />
         <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="std_name" property="stdName" />
         <result column="cate_name" property="cateName" />
-        <!--<result column="group" property="group" />-->
         <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>

+ 5 - 0
knowledge-service/src/main/resources/mapper/RelationMapper.xml

@@ -10,4 +10,9 @@
         <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>