瀏覽代碼

Merge remote-tracking branch 'origin/dev/KLBstand' into dev/KLBstand

zhoutg 6 年之前
父節點
當前提交
ee4a98f151

+ 2 - 3
aipt-service/src/main/java/com/diagbot/enums/LexiconRSTypeEnum.java

@@ -11,7 +11,7 @@ import lombok.Setter;
 public enum LexiconRSTypeEnum implements KeyedNamed {
     IS_A(1,"是"),
     EQUAL_TO(2,"同义于"),
-    BELONG_TO(3,"属于"),
+    INCLUDE_OF(3,"包含"),
     ASSOCIATED_WITH(4,"与相关"),
     CAUSE(5,"引起"),
     LOCATED_AT(6,"位于"),
@@ -26,7 +26,7 @@ public enum LexiconRSTypeEnum implements KeyedNamed {
     SPEC(15,"规格"),
     HAS(16,"有"),
     ORDER_BY(17,"包含排列于"),
-    SUBITEM(18,"属于子项");
+    SUBITEM(18,"包含子项");
 
     @Setter
     private Integer key;
@@ -63,4 +63,3 @@ public enum LexiconRSTypeEnum implements KeyedNamed {
         return name;
     }
 }
-

+ 147 - 145
knowledgeman-service/src/main/java/com/diagbot/entity/Relation.java

@@ -1,145 +1,147 @@
-package com.diagbot.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author gaodm
- * @since 2019-03-26
- */
-public class Relation implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 是否删除,N:未删除,Y:删除
-     */
-    private String isDeleted;
-
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreated;
-
-    /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
-     */
-    private Date gmtModified;
-
-    /**
-     * 创建人,0表示无创建人值
-     */
-    private String creator;
-
-    /**
-     * 修改人,如果为0则表示纪录未修改
-     */
-    private String modifier;
-
-    /**
-     * 关系起点术语id
-     */
-    private Long startId;
-
-    /**
-     * 关系id
-     */
-    private Long relationId;
-
-    /**
-     * 关系终点术语id
-     */
-    private Long endId;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreated() {
-        return gmtCreated;
-    }
-
-    public void setGmtCreated(Date gmtCreated) {
-        this.gmtCreated = gmtCreated;
-    }
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public Long getStartId() {
-        return startId;
-    }
-
-    public void setStartId(Long startId) {
-        this.startId = startId;
-    }
-    public Long getRelationId() {
-        return relationId;
-    }
-
-    public void setRelationId(Long relationId) {
-        this.relationId = relationId;
-    }
-    public Long getEndId() {
-        return endId;
-    }
-
-    public void setEndId(Long endId) {
-        this.endId = endId;
-    }
-
-    @Override
-    public String toString() {
-        return "Relation{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreated=" + gmtCreated +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", startId=" + startId +
-        ", relationId=" + relationId +
-        ", endId=" + endId +
-        "}";
-    }
-}
+package com.diagbot.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+/**
+ * <p>
+ * 术语关系表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2019-05-16
+ */
+@TableName("kl_relation")
+public class Relation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 关系起点术语id
+     */
+    private Long startId;
+
+    /**
+     * 关系id
+     */
+    private Long relationId;
+
+    /**
+     * 关系终点术语id
+     */
+    private Long endId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getStartId() {
+        return startId;
+    }
+
+    public void setStartId(Long startId) {
+        this.startId = startId;
+    }
+    public Long getRelationId() {
+        return relationId;
+    }
+
+    public void setRelationId(Long relationId) {
+        this.relationId = relationId;
+    }
+    public Long getEndId() {
+        return endId;
+    }
+
+    public void setEndId(Long endId) {
+        this.endId = endId;
+    }
+
+    @Override
+    public String toString() {
+        return "Relation{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", startId=" + startId +
+        ", relationId=" + relationId +
+        ", endId=" + endId +
+        "}";
+    }
+}

+ 2 - 2
knowledgeman-service/src/main/java/com/diagbot/enums/LexiconRSTypeEnum.java

@@ -11,7 +11,7 @@ import lombok.Setter;
 public enum LexiconRSTypeEnum implements KeyedNamed {
     IS_A(1,"是"),
     EQUAL_TO(2,"同义于"),
-    BELONG_TO(3,"属于"),
+    INCLUDE_OF(3,"包含"),
     ASSOCIATED_WITH(4,"与相关"),
     CAUSE(5,"引起"),
     LOCATED_AT(6,"位于"),
@@ -26,7 +26,7 @@ public enum LexiconRSTypeEnum implements KeyedNamed {
     SPEC(15,"规格"),
     HAS(16,"有"),
     ORDER_BY(17,"包含排列于"),
-    SUBITEM(18,"属于子项");
+    SUBITEM(18,"包含子项");
 
     @Setter
     private Integer key;

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

@@ -827,7 +827,7 @@ public class ConceptFacade extends ConceptServiceImpl {
     private List<ConceptBaseDTO> getConceptChronic() {
         ConceptWrapper conceptWrapper = new ConceptWrapper();
         conceptWrapper.setStartType(LexiconTypeEnum.DIAGNOSIS.getKey());
-        conceptWrapper.setRelationType(LexiconRSTypeEnum.BELONG_TO.getKey());
+        conceptWrapper.setRelationType(LexiconRSTypeEnum.INCLUDE_OF.getKey());
         conceptWrapper.setEndName("慢病");
         List<ConceptRes> list = this.getConcept(conceptWrapper);
         List<ConceptBaseDTO> res = ListUtil.newArrayList();

+ 3 - 3
knowledgeman-service/src/main/java/com/diagbot/facade/RelationContactFacade.java

@@ -96,7 +96,7 @@ public class RelationContactFacade extends RelationServiceImpl {
         relationGroupList.forEach(i->{
         	i.forEach(j->{
         		j.setCreator(currentUser);
-            	j.setGmtCreated(now);
+            	j.setGmtCreate(now);
             	j.setModifier(currentUser);
             	j.setGmtModified(now);
             	relationList.add(j);
@@ -136,7 +136,7 @@ public class RelationContactFacade extends RelationServiceImpl {
 		List<Long> relationIdList = new ArrayList<>();
 		
 		QueryWrapper<Relation> relationQe = new QueryWrapper<>();
-		relationQe.eq("end_id", conceptId);
+		relationQe.eq("start_id", conceptId);
 		relationQe.eq(relationId!=null,"relation_id", relationId);
 		List<Relation> relationList = list(relationQe);
 		
@@ -239,7 +239,7 @@ public class RelationContactFacade extends RelationServiceImpl {
 	 */
 	private void repairRelationDataForDel(Long conceptId,Long relationId,String isDeleted,String currentUser,Date now){
 		QueryWrapper<Relation> relationQe = new QueryWrapper<>();
-		relationQe.eq("end_id", conceptId);
+		relationQe.eq("start_id", conceptId);
 		relationQe.eq(relationId!=null,"relation_id", relationId);
 		List<Relation> relationList = list(relationQe);
 		

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

@@ -263,7 +263,7 @@ public class RelationFacade extends RelationServiceImpl {
 			relation.setEndId(endConcept.getId());
 			relation.setRelationId(lexiconRelationship.getId());
 			relation.setCreator(currentUser);
-			relation.setGmtCreated(now);
+			relation.setGmtCreate(now);
 		}
 		
 		relation.setModifier(currentUser);

+ 1 - 1
knowledgeman-service/src/main/java/com/diagbot/service/impl/EnumsDataServiceImpl.java

@@ -29,7 +29,7 @@ public class EnumsDataServiceImpl implements EnumsDataService {
         Map<String, List<EnumEntriesBuilder.Entry>> enumMap = new EnumEntriesBuilder()
                 .addEnums("disclaimerCodeEnum", DisclaimerCodeEnum.values())
                 .addEnums("positionTypeEnum", PositionTypeEnum.values())
-                .addEnums("lexiconRSTypeEnum", LexiconRSTypeEnum.values())
+                .addEnums("lexiconRSTypeEnum", LexiconRSTypeEnum.INCLUDE_OF)
                 .build();
         return enumMap;
     }

+ 23 - 23
knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

@@ -52,10 +52,10 @@
     
     <select id="getRelationNodeDTOs" resultType="com.diagbot.dto.RelationNodeDTO">
     	SELECT
-			c.id AS conceptId,
-			c.lib_name AS conceptName,
-			d.id AS parentConceptId,
-			d.lib_name AS parentConceptName,
+			d.id AS conceptId,
+			d.lib_name AS conceptName,
+			c.id AS parentConceptId,
+			c.lib_name AS parentConceptName,
 			e.id AS relationId,
 			e.`name` AS relationName
 		FROM kl_relation a LEFT JOIN kl_relation_order b ON a.id=b.t_relation_id
@@ -67,7 +67,7 @@
  		AND c.is_deleted='N'
  		AND d.is_deleted='N'
  		AND e.is_deleted='N'
- 		AND a.end_id=#{conceptId} 
+ 		AND a.start_id=#{conceptId} 
  		<if test="relationId!=null">
  			AND a.relation_id=#{relationId}
  		</if>
@@ -79,11 +79,11 @@
 			*
 		FROM
 		(SELECT
-		t3.id AS conceptId,
-		t3.lib_name AS libName,
+		t2.id AS conceptId,
+		t2.lib_name AS libName,
 		t4.name AS libType,
-		CONCAT(t3.lib_name,'(',t4.name,')') AS libNameType,
-		GROUP_CONCAT(t2.lib_name ORDER BY t1.gmt_modified DESC) AS otherNames,
+		CONCAT(t2.lib_name,'(',t4.name,')') AS libNameType,
+		GROUP_CONCAT(t3.lib_name ORDER BY t1.gmt_modified DESC) AS otherNames,
 		t1.modifier AS operName,
 		MAX(t1.gmt_modified) AS operTime,
 		t1.is_deleted AS isDeleted
@@ -94,15 +94,15 @@
 		(SELECT * FROM kl_relation WHERE relation_id=17) a
 		LEFT JOIN kl_relation_order b ON a.id=b.t_relation_id
 		LEFT JOIN (SELECT * FROM kl_relation WHERE relation_id=17) c
-		ON a.start_id=c.end_id
+		ON a.end_id=c.start_id
 		LEFT JOIN (SELECT * FROM kl_relation WHERE relation_id=17) d
-		ON a.end_id=d.start_id
+		ON a.start_id=d.end_id
 		WHERE b.id IS NULL AND c.id IS NULL AND d.id IS NULL) t1
 		JOIN kl_concept t2 ON t1.start_id=t2.id
 		JOIN kl_concept t3 ON t1.end_id=t3.id
 		JOIN kl_lexicon t4 ON t3.lib_type=t4.id
 		where t2.is_deleted='N' AND t3.is_deleted='N' AND t4.is_deleted='N'
-		GROUP BY t3.id) tab
+		GROUP BY t2.id) tab
 		where 1=1
 		<if test="name!=null and name!=''">
 			and libNameType like concat('%',#{name},'%')
@@ -115,11 +115,11 @@
 			*
 		FROM
 		(SELECT
-		t3.id AS conceptId,
-		t3.lib_name AS libName,
+		t2.id AS conceptId,
+		t2.lib_name AS libName,
 		t4.name AS libType,
-		CONCAT(t3.lib_name,'(',t4.name,')') AS libNameType,
-		GROUP_CONCAT(t2.lib_name ORDER BY t5.order_no DESC,t1.gmt_modified DESC) AS otherNames,
+		CONCAT(t2.lib_name,'(',t4.name,')') AS libNameType,
+		GROUP_CONCAT(t3.lib_name ORDER BY t5.order_no DESC,t1.gmt_modified DESC) AS otherNames,
 		t1.modifier AS operName,
 		MAX(t1.gmt_modified) AS operTime,
 		t1.is_deleted AS isDeleted
@@ -130,14 +130,14 @@
 		(SELECT * FROM kl_relation WHERE relation_id=17) a
 		JOIN kl_relation_order b ON a.id=b.t_relation_id
 		LEFT JOIN (SELECT * FROM kl_relation WHERE relation_id=17) c
-		ON a.end_id=c.start_id
+		ON a.start_id=c.end_id
 		WHERE c.id IS NULL) t1
 		JOIN kl_concept t2 ON t1.start_id=t2.id
 		JOIN kl_concept t3 ON t1.end_id=t3.id
 		JOIN kl_lexicon t4 ON t3.lib_type=t4.id
 		LEFT JOIN kl_relation_order t5 ON t1.id=t5.t_relation_id
 		where t2.is_deleted='N' AND t3.is_deleted='N' AND t4.is_deleted='N'
-		GROUP BY t3.id) tab
+		GROUP BY t2.id) tab
 		where 1=1
 		<if test="name!=null and name!=''">
 			and libNameType like concat('%',#{name},'%')
@@ -150,11 +150,11 @@
 			*
 		FROM
 		(SELECT  
-		t3.id AS conceptId,
-		t3.lib_name AS libName,
+		t2.id AS conceptId,
+		t2.lib_name AS libName,
 		t4.name AS libType,
-		CONCAT(t3.lib_name,'(',t4.name,')') AS libNameType,
-		GROUP_CONCAT(t2.lib_name ORDER BY t5.order_no DESC,t1.gmt_modified DESC) AS otherNames,
+		CONCAT(t2.lib_name,'(',t4.name,')') AS libNameType,
+		GROUP_CONCAT(t3.lib_name ORDER BY t5.order_no DESC,t1.gmt_modified DESC) AS otherNames,
 		t1.modifier AS operName,
 		MAX(t1.gmt_modified) AS operTime,
 		t1.is_deleted AS isDeleted
@@ -165,7 +165,7 @@
 		LEFT JOIN kl_relation_order t5 ON t1.id=t5.t_relation_id
 		WHERE t2.is_deleted='N' AND t3.is_deleted='N' AND t4.is_deleted='N'
 		AND t1.relation_id=18
-		GROUP BY t3.id) tab
+		GROUP BY t2.id) tab
 		where 1=1
 		<if test="name!=null and name!=''">
 			and libNameType like concat('%',#{name},'%')

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

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