zhoutg пре 6 година
родитељ
комит
fcd0bddc84
19 измењених фајлова са 191 додато и 59 уклоњено
  1. 19 0
      aipt-service/src/main/java/com/diagbot/dto/ScaleIndexDTO.java
  2. 11 0
      aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  3. 32 2
      aipt-service/src/main/java/com/diagbot/facade/DisScaleFacade.java
  4. 4 1
      aipt-service/src/main/java/com/diagbot/mapper/ConceptMapper.java
  5. 2 2
      aipt-service/src/main/java/com/diagbot/mapper/DisScaleMapper.java
  6. 12 1
      aipt-service/src/main/java/com/diagbot/service/ConceptService.java
  7. 2 2
      aipt-service/src/main/java/com/diagbot/service/DisScaleService.java
  8. 6 0
      aipt-service/src/main/java/com/diagbot/service/impl/ConceptServiceImpl.java
  9. 2 2
      aipt-service/src/main/java/com/diagbot/service/impl/DisScaleServiceImpl.java
  10. 2 0
      aipt-service/src/main/java/com/diagbot/vo/ScaleIndexVO.java
  11. 3 3
      aipt-service/src/main/java/com/diagbot/web/DisScaleController.java
  12. 8 0
      aipt-service/src/main/resources/mapper/ConceptMapper.xml
  13. 57 39
      aipt-service/src/main/resources/mapper/DisScaleMapper.xml
  14. 2 1
      icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java
  15. 2 1
      icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java
  16. 19 0
      icss-service/src/main/java/com/diagbot/dto/ScaleIndexDTO.java
  17. 3 3
      icss-service/src/main/java/com/diagbot/facade/ScaleContentFacade.java
  18. 2 0
      icss-service/src/main/java/com/diagbot/vo/ScaleIndexVO.java
  19. 3 2
      icss-service/src/main/java/com/diagbot/web/ScaleController.java

+ 19 - 0
aipt-service/src/main/java/com/diagbot/dto/ScaleIndexDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @description: 量表检索出参
+ * @author: zhoutg
+ * @date: 2019/7/8 11:27
+ */
+@Getter
+@Setter
+public class ScaleIndexDTO {
+    private Long conceptId; // 概念id
+    private String name;    //概念名称
+    private String searchName; // 检索名称
+    private Integer showType; // 显示类型
+    private Integer fromDis; // 结果是否来自诊断
+}

+ 11 - 0
aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -424,4 +424,15 @@ public class ConceptFacade extends ConceptServiceImpl {
         }
         return staticRetrievalList;
     }
+
+
+    /**
+     * 检索词库获取标准词
+     *
+     * @param conceptBaseVO
+     * @return
+     */
+    public List<ConceptBaseDTO> indexConceptFac(ConceptBaseVO conceptBaseVO) {
+        return this.indexConcept(conceptBaseVO);
+    }
 }

+ 32 - 2
aipt-service/src/main/java/com/diagbot/facade/DisScaleFacade.java

@@ -3,10 +3,13 @@ package com.diagbot.facade;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.DisScaleDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.enums.LexiconRSTypeEnum;
 import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.service.impl.DisScaleServiceImpl;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.DisScaleVO;
 import com.diagbot.vo.ScaleIndexVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +17,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 诊断量表
@@ -58,10 +62,36 @@ public class DisScaleFacade extends DisScaleServiceImpl {
      * @param scaleIndexVO 参数
      * @return
      */
-    public List<ConceptBaseDTO> indexFac(ScaleIndexVO scaleIndexVO) {
+    public List<ScaleIndexDTO> indexFac(ScaleIndexVO scaleIndexVO) {
+        ConceptBaseVO conceptBaseVO = new ConceptBaseVO();
+        conceptBaseVO.setName(scaleIndexVO.getName());
+        conceptBaseVO.setLibType(LexiconTypeEnum.DIAGNOSIS.getKey());
+        List<ConceptBaseDTO> conceptBaseDTOS = conceptFacade.indexConceptFac(conceptBaseVO);
+        // 设置诊断名称
+        if (ListUtil.isNotEmpty(conceptBaseDTOS)) {
+            scaleIndexVO.setDisName(conceptBaseDTOS.stream().map(row -> row.getName()).collect(Collectors.toList()));
+        }
         scaleIndexVO.setStartType(LexiconTypeEnum.DIAGNOSIS.getKey());
         scaleIndexVO.setRelationType(LexiconRSTypeEnum.ORDER_BY.getKey());
         scaleIndexVO.setEndType(LexiconTypeEnum.GAUGE.getKey());
-        return this.indexScale(scaleIndexVO);
+        List<ScaleIndexDTO> data = this.indexScale(scaleIndexVO);
+        List<ScaleIndexDTO> res = new ArrayList<>();
+        List<Long> selfList = new ArrayList<>(); // 本体
+        for (ScaleIndexDTO bean : data) {
+            if (bean.getShowType().intValue() == 1) { // 本体
+                selfList.add(bean.getConceptId());
+            }
+        }
+        for (ScaleIndexDTO bean : data) {
+            if (bean.getShowType().intValue() == 1) { // 本体
+                res.add(bean);
+            } else if (bean.getShowType().intValue() == 0) { //同义词或者诊断关联的量表,只取一个
+                if(!selfList.contains(bean.getConceptId())) {
+                    selfList.add(bean.getConceptId());
+                    res.add(bean);
+                }
+            }
+        }
+        return res;
     }
 }

+ 4 - 1
aipt-service/src/main/java/com/diagbot/mapper/ConceptMapper.java

@@ -3,10 +3,11 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
-import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.ConceptRetrievalDTO;
+import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
+import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.RetrievalVO;
 
@@ -61,4 +62,6 @@ public interface ConceptMapper extends BaseMapper<Concept> {
      * @return
      */
     List<String> getStandWord();
+
+    public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
 }

+ 2 - 2
aipt-service/src/main/java/com/diagbot/mapper/DisScaleMapper.java

@@ -1,7 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.DisScale;
 import com.diagbot.vo.ScaleIndexVO;
 
@@ -17,5 +17,5 @@ import java.util.List;
  */
 public interface DisScaleMapper extends BaseMapper<DisScale> {
 
-    public List<ConceptBaseDTO> indexScale(ScaleIndexVO scaleIndexVO);
+    public List<ScaleIndexDTO> indexScale(ScaleIndexVO scaleIndexVO);
 }

+ 12 - 1
aipt-service/src/main/java/com/diagbot/service/ConceptService.java

@@ -3,10 +3,11 @@ package com.diagbot.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
-import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.ConceptRetrievalDTO;
+import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
+import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.RetrievalVO;
 
@@ -62,4 +63,14 @@ public interface ConceptService extends IService<Concept> {
      * @return
      */
     List<String> getStandWord();
+
+
+    /**
+     * 检索词库获取标准词
+     *
+     * @param conceptBaseVO 入参
+     * @return
+     */
+    public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
+
 }

+ 2 - 2
aipt-service/src/main/java/com/diagbot/service/DisScaleService.java

@@ -1,7 +1,7 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.DisScale;
 import com.diagbot.vo.ScaleIndexVO;
 
@@ -17,5 +17,5 @@ import java.util.List;
  */
 public interface DisScaleService extends IService<DisScale> {
 
-    public List<ConceptBaseDTO> indexScale(ScaleIndexVO scaleIndexVO);
+    public List<ScaleIndexDTO> indexScale(ScaleIndexVO scaleIndexVO);
 }

+ 6 - 0
aipt-service/src/main/java/com/diagbot/service/impl/ConceptServiceImpl.java

@@ -9,6 +9,7 @@ import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.mapper.ConceptMapper;
 import com.diagbot.service.ConceptService;
+import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.RetrievalVO;
 import org.springframework.stereotype.Service;
@@ -83,4 +84,9 @@ public class ConceptServiceImpl extends ServiceImpl<ConceptMapper, Concept> impl
     public List<String> getStandWord() {
         return baseMapper.getStandWord();
     }
+
+    @Override
+    public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO) {
+        return baseMapper.indexConcept(conceptBaseVO);
+    }
 }

+ 2 - 2
aipt-service/src/main/java/com/diagbot/service/impl/DisScaleServiceImpl.java

@@ -1,7 +1,7 @@
 package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.ConceptBaseDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.DisScale;
 import com.diagbot.mapper.DisScaleMapper;
 import com.diagbot.service.DisScaleService;
@@ -22,7 +22,7 @@ import java.util.List;
 public class DisScaleServiceImpl extends ServiceImpl<DisScaleMapper, DisScale> implements DisScaleService {
 
     @Override
-    public List<ConceptBaseDTO> indexScale(ScaleIndexVO scaleIndexVO) {
+    public List<ScaleIndexDTO> indexScale(ScaleIndexVO scaleIndexVO) {
         return baseMapper.indexScale(scaleIndexVO);
     }
 }

+ 2 - 0
aipt-service/src/main/java/com/diagbot/vo/ScaleIndexVO.java

@@ -26,4 +26,6 @@ public class ScaleIndexVO {
     @ApiModelProperty(hidden = true)
     private Integer relationType;
     private List<String> filterName; //过滤已选名称
+    @ApiModelProperty(hidden = true)
+    private List<String> disName; // 诊断名称
 }

+ 3 - 3
aipt-service/src/main/java/com/diagbot/web/DisScaleController.java

@@ -1,9 +1,9 @@
 package com.diagbot.web;
 
 
-import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.facade.DisScaleFacade;
 import com.diagbot.vo.DisScaleVO;
 import com.diagbot.vo.ScaleIndexVO;
@@ -47,8 +47,8 @@ public class DisScaleController {
     @ApiOperation(value = "知识库标准化-量表搜索[by:zhoutg]",
             notes = "")
     @PostMapping("/index")
-    public RespDTO<List<DisScaleDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
-        List<ConceptBaseDTO> data = disScaleFacade.indexFac(scaleVO);
+    public RespDTO<List<ScaleIndexDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
+        List<ScaleIndexDTO> data = disScaleFacade.indexFac(scaleVO);
         return RespDTO.onSuc(data);
     }
 }

+ 8 - 0
aipt-service/src/main/resources/mapper/ConceptMapper.xml

@@ -738,4 +738,12 @@
     <select id="getStandWord" resultType="java.lang.String">
         SELECT lib_name FROM kl_concept WHERE is_deleted = 'N' AND lib_type = 33
     </select>
+
+    <select id="indexConcept" resultType="com.diagbot.dto.ConceptBaseDTO">
+        SELECT DISTINCT b.id concept_id,b.lib_name name  FROM `kl_library_info` a, kl_concept b
+        where a.is_deleted = 'N' and b.is_deleted = 'N'
+        and a.concept_id = b.id
+        and a.`name` like concat('%',#{name},'%') and a.type_id = #{libType} and b.lib_type = #{libType}
+    </select>
+
 </mapper>

+ 57 - 39
aipt-service/src/main/resources/mapper/DisScaleMapper.xml

@@ -2,51 +2,69 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.diagbot.mapper.DisScaleMapper">
 
-    <select id="indexScale"  resultType="com.diagbot.dto.ConceptBaseDTO">
-        SELECT DISTINCT concept_id,name
+    <select id="indexScale"  resultType="com.diagbot.dto.ScaleIndexDTO">
+        SELECT  concept_id,name,search_name,show_type, from_dis
         FROM
         (
+
+            (
+                SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
+                FROM `kl_library_info` a, kl_concept b
+                where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
+                and a.`name` = #{name}
+                and b.lib_type = #{endType}
+            )
+            union
             (
-                SELECT
-                t3.id AS concept_id,
-                t3.lib_name AS name
-                FROM
-                `kl_concept` t1,
-                `kl_relation` t2,
-                `kl_concept` t3,
-                `kl_relation_order` t4
-                WHERE
-                t1.is_deleted = 'N'
-                AND t2.is_deleted = 'N'
-                AND t3.is_deleted = 'N'
-                AND t4.is_deleted = 'N'
-                AND t1.id = t2.start_id
-                AND t3.id = t2.end_id
-                AND t2.id = t4.t_relation_id
-                <if test="name != null and name != ''">
-                    AND t1.lib_name LIKE  concat ('%',#{name},'%')
-                </if>
-                <if test="startType != null">
-                    AND t1.lib_type = #{startType}
-                </if>
-                <if test="relationType != null">
-                    AND t2.relation_id = #{relationType}
-                </if>
-                <if test="endType != null">
-                    AND t3.lib_type = #{endType}
-                </if>
+            SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
+            FROM `kl_library_info` a, kl_concept b
+            where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
+            and a.`name` like concat (#{name},'%')
+            and b.lib_type = #{endType}
             )
-        UNION
+            union
             (
-                SELECT
-                c.id AS concept_id,
-                c.lib_name AS name
-                FROM
-                kl_concept c
-                WHERE
-                c.lib_name LIKE  concat ('%',#{name},'%')
-                AND c.lib_type = #{endType}
+            SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
+            FROM `kl_library_info` a, kl_concept b
+            where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
+            and a.`name` like concat ('%',#{name},'%')
+            and b.lib_type = #{endType}
             )
+
+            <if test="disName != null and disName.size() > 0">
+                union
+                (
+
+                    SELECT
+                    t1.lib_name search_name,
+                    t3.id AS concept_id,
+                    t3.lib_name AS name,
+                    0 as show_type,
+                    1 as from_dis
+                    FROM
+                    `kl_concept` t1,
+                    `kl_relation` t2,
+                    `kl_concept` t3
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t3.is_deleted = 'N'
+                    AND t1.id = t2.start_id
+                    AND t3.id = t2.end_id
+                    <if test="name != null and name != ''">
+                        AND t1.lib_name LIKE  concat ('%',#{name},'%')
+                    </if>
+                    <if test="startType != null">
+                        AND t1.lib_type = #{startType}
+                    </if>
+                    <if test="relationType != null">
+                        AND t2.relation_id = #{relationType}
+                    </if>
+                    <if test="endType != null">
+                        AND t3.lib_type = #{endType}
+                    </if>
+                )
+            </if>
         ) s
         where 1 = 1
         <if test="filterName != null and filterName.size > 0">

+ 2 - 1
icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -23,6 +23,7 @@ import com.diagbot.dto.IndexConfigDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptIntroduceVO;
@@ -68,7 +69,7 @@ public interface AiptServiceClient {
     RespDTO<List<DisScaleDTO>> getList(@RequestBody DisScaleVO scaleVO);
 
     @PostMapping(value = "/scale/index")
-    RespDTO<List<ConceptBaseDTO>> index(@RequestBody ScaleIndexVO scaleIndexVO);
+    RespDTO<List<ScaleIndexDTO>> index(@RequestBody ScaleIndexVO scaleIndexVO);
 
     @PostMapping(value = "/disType/getDisType")
     RespDTO<DisTypeDTO> getDisType();

+ 2 - 1
icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -23,6 +23,7 @@ import com.diagbot.dto.IndexConfigDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptIntroduceVO;
@@ -81,7 +82,7 @@ public class AiptServiceHystrix implements AiptServiceClient {
     }
 
     @Override
-    public RespDTO<List<ConceptBaseDTO>> index(ScaleIndexVO scaleIndexVO) {
+    public RespDTO<List<ScaleIndexDTO>> index(ScaleIndexVO scaleIndexVO) {
         log.error("【hystrix】调用{}异常", "index");
         return null;
     }

+ 19 - 0
icss-service/src/main/java/com/diagbot/dto/ScaleIndexDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @description: 量表检索出参
+ * @author: zhoutg
+ * @date: 2019/7/8 11:27
+ */
+@Getter
+@Setter
+public class ScaleIndexDTO {
+    private Long conceptId; // 概念id
+    private String name;    //概念名称
+    private String searchName; // 检索名称
+    private Integer showType; // 显示类型
+    private Integer fromDis; // 结果是否来自诊断
+}

+ 3 - 3
icss-service/src/main/java/com/diagbot/facade/ScaleContentFacade.java

@@ -2,8 +2,8 @@ package com.diagbot.facade;
 
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.bean.SearchData;
-import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.PushVO;
@@ -44,8 +44,8 @@ public class ScaleContentFacade {
      * @param scaleIndexVO 参数
      * @return
      */
-    public List<ConceptBaseDTO> indexFac(ScaleIndexVO scaleIndexVO) {
-        RespDTO<List<ConceptBaseDTO>> res = aiptServiceClient.index(scaleIndexVO);
+    public List<ScaleIndexDTO> indexFac(ScaleIndexVO scaleIndexVO) {
+        RespDTO<List<ScaleIndexDTO>> res = aiptServiceClient.index(scaleIndexVO);
         RespDTOUtil.respNGDeal(res, "远程调用量表搜索失败");
         return res.data;
     }

+ 2 - 0
icss-service/src/main/java/com/diagbot/vo/ScaleIndexVO.java

@@ -26,4 +26,6 @@ public class ScaleIndexVO {
     @ApiModelProperty(hidden = true)
     private Integer relationType;
     private List<String> filterName; //过滤已选名称
+    @ApiModelProperty(hidden = true)
+    private List<String> disName; // 诊断名称
 }

+ 3 - 2
icss-service/src/main/java/com/diagbot/web/ScaleController.java

@@ -4,6 +4,7 @@ package com.diagbot.web;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.entity.ScaleContent;
 import com.diagbot.facade.DisScaleFacade;
 import com.diagbot.facade.ScaleContentFacade;
@@ -59,8 +60,8 @@ public class ScaleController {
     @ApiOperation(value = "ICSS三期-量表搜索[by:zhoutg]",
             notes = "")
     @PostMapping("/index")
-    public RespDTO<List<DisScaleDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
-        List<ConceptBaseDTO> data = scaleContentFacade.indexFac(scaleVO);
+    public RespDTO<List<ScaleIndexDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
+        List<ScaleIndexDTO> data = scaleContentFacade.indexFac(scaleVO);
         return RespDTO.onSuc(data);
     }
 }