rgb пре 6 година
родитељ
комит
f817ec6fa8

+ 13 - 8
knowledgeman-service/src/main/java/com/diagbot/dto/RelationContactListDTO.java

@@ -19,27 +19,32 @@ public class RelationContactListDTO {
 	
     
     /**
-     * 概念id
+     * 医学标准术语id
      */
-	@ApiModelProperty(value="概念id")
+	@ApiModelProperty(value="医学标准术语id")
     private Long conceptId;
     
     /**
-     * 医学标准术语
+     * 医学标准术语名称
      */
-	@ApiModelProperty(value="医学标准术语")
+	@ApiModelProperty(value="医学标准术语名称")
     private String libName;
     
     /**
-     * 术语类型
+     * 医学标准术语类型
      */
-	@ApiModelProperty(value="术语类型")
+	@ApiModelProperty(value="医学标准术语类型")
     private String libType;
+	
+	/**
+	 * 医学标准术语名称(医学标准术语类型)
+	 */
+	private String libNameType;
     
     /**
-     * 同义词
+     * 关联术语
      */
-	@ApiModelProperty(value="同义词")
+	@ApiModelProperty(value="关联术语")
     private String otherNames;
     
     /**

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

@@ -19,18 +19,18 @@
     	SELECT * FROM 
 		(SELECT
 		a.id,
-		(SELECT id FROM concept where id=a.start_id and is_deleted='N') as startId,
-		(SELECT name FROM library_info where concept_id=a.start_id and is_concept=1) as startName,
-		(SELECT type FROM library_info where concept_id=a.start_id and is_concept=1) as startType,
-		(SELECT id FROM concept where id=a.end_id and is_deleted='N') as endId,
-		(SELECT name FROM library_info where concept_id=a.end_id and is_concept=1) as endName,
-		(SELECT type FROM library_info where concept_id=a.end_id and is_concept=1) as endType,
+		(SELECT id FROM kl_concept where id=a.start_id and is_deleted='N') as startId,
+		(SELECT name FROM kl_library_info where concept_id=a.start_id and is_concept=1) as startName,
+		(SELECT type FROM kl_library_info where concept_id=a.start_id and is_concept=1) as startType,
+		(SELECT id FROM kl_concept where id=a.end_id and is_deleted='N') as endId,
+		(SELECT name FROM kl_library_info where concept_id=a.end_id and is_concept=1) as endName,
+		(SELECT type FROM kl_library_info where concept_id=a.end_id and is_concept=1) as endType,
 		a.relation_id as relationId,
 		(SELECT name FROM lexicon_relationship where id=a.relation_id and is_deleted='N') as relationName,
 		a.gmt_modified as operTime,
 		a.modifier as operName,
 		a.is_deleted as isDeleted
-		from relation a) t
+		from kl_relation a) t
 		where 1=1 
 		and startId is not null 
 		and endId is not null
@@ -73,5 +73,38 @@
  		</if>
 		ORDER BY b.order_no DESC,a.id ASC
     </select>
+    
+    <select id="relationContactList" resultType="com.diagbot.dto.RelationContactListDTO">
+    	SELECT
+			*
+		FROM
+		(SELECT
+		t3.id AS conceptId,
+		t3.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,
+		t1.modifier AS operName,
+		MAX(t1.gmt_modified) AS operTime,
+		t1.is_deleted AS isDeleted
+		FROM
+		(SELECT
+		a.*
+		FROM
+		(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
+		WHERE b.id IS NULL AND 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
+		GROUP BY t3.id) tab
+		where 1=1
+		<if test="name!=null and name!=''">
+			and libNameType like concat('%',#{name},'%')
+		</if>
+		ORDER BY isDeleted ASC,operTime DESC
+    </select>
 
 </mapper>