Browse Source

关系维护修改

rgb 6 years ago
parent
commit
b474e1e1db

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

@@ -38,7 +38,6 @@ import com.diagbot.entity.Concept;
 import com.diagbot.entity.ConceptCommon;
 import com.diagbot.entity.Lexicon;
 import com.diagbot.entity.LibraryInfo;
-import com.diagbot.entity.Medical;
 import com.diagbot.entity.Relation;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.enums.IsDeleteEnum;
@@ -83,8 +82,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     private LibraryInfoFacade libraryinfoFacade;
     //    @Autowired
     //    private LibraryDetailFacade libraryDetailFacade;
-    @Autowired
-    private MedicalFacade medicalFacade;
+//    @Autowired
+//    private MedicalFacade medicalFacade;
     @Autowired
     private RelationFacade relationFacade;
     @Autowired
@@ -116,12 +115,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     public List<GetAllConceptDTO> getAllConcept(GetAllConceptVO getAllConceptVO) {
         QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
         libraryInfoQe.eq("is_deleted", "N");
-        if (getAllConceptVO.getIsConcept() != null) {
-            libraryInfoQe.eq("is_concept", getAllConceptVO.getIsConcept());
-        }
-        if (StringUtil.isNotBlank(getAllConceptVO.getName())) {
-            libraryInfoQe.like("name", getAllConceptVO.getName());
-        }
+        libraryInfoQe.eq(getAllConceptVO.getIsConcept() != null,"is_concept", getAllConceptVO.getIsConcept());
+        libraryInfoQe.like(StringUtil.isNotBlank(getAllConceptVO.getName()),"name", getAllConceptVO.getName());
         List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
 
         //过滤掉非概念术语
@@ -137,8 +132,8 @@ public class ConceptFacade extends ConceptServiceImpl {
             });
             libraryInfoList = libraryInfoList.stream().filter(i -> i.getIsDeleted().equals("N")).collect(Collectors.toList());
         }
-
-        //添加过术语医学属性的过滤掉
+        
+        /*//添加过术语医学属性的过滤掉
         if (getAllConceptVO.getIsMedical() != null && getAllConceptVO.getIsMedical() == 1) {
             QueryWrapper<Medical> medicalQe = new QueryWrapper<>();
             medicalQe.eq("is_deleted", "N");
@@ -151,7 +146,7 @@ public class ConceptFacade extends ConceptServiceImpl {
                     return false;
                 }
             }).collect(Collectors.toList());
-        }
+        }*/
 
         List<GetAllConceptDTO> getAllConceptDTOList = BeanUtil.listCopyTo(libraryInfoList, GetAllConceptDTO.class);
         getAllConceptDTOList.forEach(i -> {
@@ -197,7 +192,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     	}
     	
     	for(Concept i : conceptList){
-    		if(reCouMap.get(i.getId())!=null){
+    		if(reCouMap.get(i.getId())!=null
+    				||(getAllForRelationVO.getExcludedConceptIds()!=null&&getAllForRelationVO.getExcludedConceptIds().contains(i.getId()))){
     			continue;
     		}
     		GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
@@ -216,7 +212,7 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @return
      */
     public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
-    	IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
+    	IPage<GetAllInformationDTO> ipage = this.baseMapper.getAllInformation(getAllInformationVO);
         if (ipage.getRecords().size() > 0) {
             List<String> ids = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
             RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);

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

@@ -2,10 +2,7 @@ package com.diagbot.facade;
 
 import org.springframework.stereotype.Component;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.GetAllInformationDTO;
 import com.diagbot.service.impl.LibraryInfoServiceImpl;
-import com.diagbot.vo.GetAllInformationVO;
 
 /**
  * @Description: 术语基本信息查询业务层
@@ -15,13 +12,5 @@ import com.diagbot.vo.GetAllInformationVO;
 @Component
 public class LibraryInfoFacade extends LibraryInfoServiceImpl {
   
-    /**
-     * 获取医学术语命名列表
-     * @param conceptVo
-     * @return
-     */
-    public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
-        return baseMapper.getAllInformation(getAllInformationVO);
-    }
 
 }

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

@@ -3,12 +3,15 @@ package com.diagbot.mapper;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptWithOrderRes;
+import com.diagbot.dto.GetAllInformationDTO;
 import com.diagbot.dto.GetAllLisConceptDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
+import com.diagbot.vo.GetAllInformationVO;
 import com.diagbot.vo.GetAllLisConceptVO;
 import com.diagbot.vo.IndexVO;
 
@@ -21,6 +24,8 @@ import com.diagbot.vo.IndexVO;
  * @since 2019-01-30
  */
 public interface ConceptMapper extends BaseMapper<Concept> {
+	
+	IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO);
 
     /**
      * 获取所有化验公表项

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

@@ -1,10 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.GetAllInformationDTO;
 import com.diagbot.entity.LibraryInfo;
-import com.diagbot.vo.GetAllInformationVO;
 
 /**
  * <p>
@@ -16,6 +13,6 @@ import com.diagbot.vo.GetAllInformationVO;
  */
 public interface LibraryInfoMapper extends BaseMapper<LibraryInfo> {
 
-    IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO);
+    
    
 }

+ 8 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/GetAllForRelationVO.java

@@ -1,5 +1,7 @@
 package com.diagbot.vo;
 
+import java.util.List;
+
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
@@ -43,4 +45,10 @@ public class GetAllForRelationVO {
     @ApiModelProperty(value="关系类型id")
     private Long relationId;
     
+    /**
+     * 需要排除的概念id集合
+     */
+    @ApiModelProperty(value="需要排除的概念id集合")
+    private List<Long> excludedConceptIds;
+    
 }

+ 2 - 0
knowledgeman-service/src/main/java/com/diagbot/web/RelationController.java

@@ -25,6 +25,7 @@ import com.diagbot.vo.RemoveRelationInfoVO;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * <p>
@@ -61,6 +62,7 @@ public class RelationController {
     @ApiOperation(value = "知识库标准化-获取医学术语关系详情[by:rengb]")
     @PostMapping("/getRelationInfoDetail")
     @SysLogger("getRelationInfoDetail")
+    @ApiIgnore
     public RespDTO<GetRelationInfoDetailDTO> getRelationInfoDetail(@Valid @RequestBody GetRelationInfoDetailVO getRelationInfoDetailVO) {
         return RespDTO.onSuc(relationFacade.getRelationInfoDetail(getRelationInfoDetailVO));
     }

+ 28 - 0
knowledgeman-service/src/main/resources/mapper/ConceptMapper.xml

@@ -66,6 +66,34 @@
 		ORDER BY taocanNum ASC,zixiangNum ASC
     </select>
     
+    <select id="getAllInformation" resultType="com.diagbot.dto.GetAllInformationDTO">
+    	SELECT
+		*
+		FROM
+		(SELECT
+		a.id as conceptId,
+		a.lib_name AS libName,
+		c.`name` AS libType,
+		GROUP_CONCAT(b.`name` ORDER BY b.id ASC SEPARATOR '、') as otherNames,
+		a.modifier as operName,
+		a.gmt_modified as operTime,
+		a.is_deleted as isDeleted
+		FROM kl_concept a JOIN kl_library_info b ON a.id=b.concept_id
+		LEFT JOIN kl_lexicon c ON a.lib_type=c.id 
+		GROUP BY a.id) t
+		where 1=1
+		<if test="name!=null and name!=''">
+			 AND otherNames like concat('%',#{name},'%')	
+		</if>
+		<if test="type!=null and type!=''">
+            AND libType = #{type}
+        </if>
+        <if test="isDeleted!=null and isDeleted!=''">
+        	AND isDeleted=#{isDeleted}
+        </if>
+		ORDER BY isDeleted ASC,operTime DESC
+    </select>
+    
 	<select id="getConcept" resultType="com.diagbot.dto.ConceptRes" parameterType="com.diagbot.entity.wrapper.ConceptWrapper">
 		SELECT
 		t1.id AS startId,

+ 0 - 28
knowledgeman-service/src/main/resources/mapper/LibraryInfoMapper.xml

@@ -18,32 +18,4 @@
         <result column="remark" property="remark" />
     </resultMap>
 
-    <select id="getAllInformation" resultType="com.diagbot.dto.GetAllInformationDTO">
-    	SELECT
-		*
-		FROM
-		(SELECT
-		a.id as conceptId,
-		a.lib_name AS libName,
-		c.`name` AS libType,
-		GROUP_CONCAT(b.`name` ORDER BY b.id ASC SEPARATOR '、') as otherNames,
-		a.modifier as operName,
-		a.gmt_modified as operTime,
-		a.is_deleted as isDeleted
-		FROM kl_concept a JOIN kl_library_info b ON a.id=b.concept_id
-		LEFT JOIN kl_lexicon c ON a.lib_type=c.id 
-		GROUP BY a.id) t
-		where 1=1
-		<if test="name!=null and name!=''">
-			 AND otherNames like concat('%',#{name},'%')	
-		</if>
-		<if test="type!=null and type!=''">
-            AND libType = #{type}
-        </if>
-        <if test="isDeleted!=null and isDeleted!=''">
-        	AND isDeleted=#{isDeleted}
-        </if>
-		ORDER BY isDeleted ASC,operTime DESC
-    </select>
-
 </mapper>

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

@@ -19,21 +19,21 @@
     	SELECT * FROM 
 		(SELECT
 		a.id,
-		(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,
+		b.id AS startId,
+		b.lib_name AS startName,
+		(SELECT `name` FROM kl_lexicon WHERE id=b.lib_type) AS startType,
+		c.id AS endId,
+		c.lib_name AS endName,
+		(SELECT `name` FROM kl_lexicon WHERE id=c.lib_type) AS endType,
 		a.relation_id as relationId,
-		(SELECT name FROM lexicon_relationship where id=a.relation_id and is_deleted='N') as relationName,
+		(SELECT name FROM kl_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 kl_relation a) t
+		FROM kl_relation a 
+		JOIN kl_concept b on a.start_id=b.id
+		JOIN kl_concept c on a.end_id=c.id) t
 		where 1=1 
-		and startId is not null 
-		and endId is not null
 		<if test="isDeleted!=null and isDeleted!=''">
 			and isDeleted=#{isDeleted}
 		</if>