zhoutg 6 år sedan
förälder
incheckning
9165b6d825

+ 16 - 0
aipt-service/src/main/java/com/diagbot/facade/DisScaleFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.entity.wrapper.ConceptWrapper;
@@ -7,6 +8,7 @@ import com.diagbot.enums.LexiconRSTypeEnum;
 import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.service.impl.DisScaleServiceImpl;
 import com.diagbot.vo.DisScaleVO;
+import com.diagbot.vo.ScaleIndexVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -48,4 +50,18 @@ public class DisScaleFacade extends DisScaleServiceImpl {
         }
         return res;
     }
+
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO 参数
+     * @return
+     */
+    public List<ConceptBaseDTO> indexFac(ScaleIndexVO scaleIndexVO) {
+        scaleIndexVO.setStartType(LexiconTypeEnum.DIAGNOSIS.getKey());
+        scaleIndexVO.setRelationType(LexiconRSTypeEnum.ORDER_BY.getKey());
+        scaleIndexVO.setEndType(LexiconTypeEnum.GAUGE.getKey());
+        return this.indexScale(scaleIndexVO);
+    }
 }

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

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

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

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

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

@@ -1,11 +1,15 @@
 package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.entity.DisScale;
 import com.diagbot.mapper.DisScaleMapper;
 import com.diagbot.service.DisScaleService;
+import com.diagbot.vo.ScaleIndexVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 诊断量表映射表 服务实现类
@@ -17,4 +21,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class DisScaleServiceImpl extends ServiceImpl<DisScaleMapper, DisScale> implements DisScaleService {
 
+    @Override
+    public List<ConceptBaseDTO> indexScale(ScaleIndexVO scaleIndexVO) {
+        return baseMapper.indexScale(scaleIndexVO);
+    }
 }

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

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * @Description: 量表检索
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+@ApiModel
+public class ScaleIndexVO {
+    @NotBlank(message = "名称不能为空")
+    private String name;
+    @ApiModelProperty(hidden = true)
+    private Integer startType;
+    @ApiModelProperty(hidden = true)
+    private Integer endType;
+    @ApiModelProperty(hidden = true)
+    private Integer relationType;
+    private List<String> filterName; //过滤已选名称
+}

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

@@ -1,10 +1,12 @@
 package com.diagbot.web;
 
 
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.DisScaleFacade;
 import com.diagbot.vo.DisScaleVO;
+import com.diagbot.vo.ScaleIndexVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,4 +43,12 @@ public class DisScaleController {
         return RespDTO.onSuc(data);
     }
 
+
+    @ApiOperation(value = "知识库标准化-量表搜索[by:zhoutg]",
+            notes = "")
+    @PostMapping("/index")
+    public RespDTO<List<DisScaleDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
+        List<ConceptBaseDTO> data = disScaleFacade.indexFac(scaleVO);
+        return RespDTO.onSuc(data);
+    }
 }

+ 59 - 0
aipt-service/src/main/resources/mapper/DisScaleMapper.xml

@@ -2,4 +2,63 @@
 <!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
+        FROM
+        (
+            (
+            SELECT
+                t3.id AS concept_id,
+                t3.lib_name AS name,
+                t4.order_no AS orderNo
+                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 = #{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>
+                ORDER BY
+                t4.order_no
+            )
+        UNION
+            (
+                SELECT
+                c.id AS concept_id,
+                c.lib_name AS name,
+                9999 orderNo
+                FROM
+                kl_concept c
+                WHERE
+                c.lib_name LIKE  concat ('%',#{name},'%')
+                AND c.lib_type = #{endType} order by c.gmt_modified desc
+            )
+        ) s
+        where 1 = 1
+        <if test="filterName != null and filterName.size > 0">
+            and s.name not in
+            <foreach item="item" collection="filterName" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        ORDER BY s.orderNo ASC
+    </select>
 </mapper>

+ 4 - 0
icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -37,6 +37,7 @@ import com.diagbot.vo.IndexConfigdiseaseNameVO;
 import com.diagbot.vo.IndexDataFindVO;
 import com.diagbot.vo.IndexDataSaveVO;
 import com.diagbot.vo.RetrievalVO;
+import com.diagbot.vo.ScaleIndexVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -65,6 +66,9 @@ public interface AiptServiceClient {
     @PostMapping(value = "/scale/getList")
     RespDTO<List<DisScaleDTO>> getList(@RequestBody DisScaleVO scaleVO);
 
+    @PostMapping(value = "/scale/index")
+    RespDTO<List<ConceptBaseDTO>> index(@RequestBody ScaleIndexVO scaleIndexVO);
+
     @PostMapping(value = "/disType/getDisType")
     RespDTO<DisTypeDTO> getDisType();
 

+ 8 - 0
icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -37,6 +37,7 @@ import com.diagbot.vo.IndexConfigdiseaseNameVO;
 import com.diagbot.vo.IndexDataFindVO;
 import com.diagbot.vo.IndexDataSaveVO;
 import com.diagbot.vo.RetrievalVO;
+import com.diagbot.vo.ScaleIndexVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -78,6 +79,13 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
     }
 
+    @Override
+    public RespDTO<List<ConceptBaseDTO>> index(ScaleIndexVO scaleIndexVO) {
+        log.error("【hystrix】调用{}异常", "index");
+        return null;
+    }
+
+
     @Override
     public RespDTO<DisTypeDTO> getDisType() {
         log.error("【hystrix】调用{}异常", "getDisType");

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

@@ -2,10 +2,12 @@ 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.entity.ScaleContent;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.PushVO;
+import com.diagbot.vo.ScaleIndexVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -35,4 +37,17 @@ public class ScaleContentFacade {
         return res.data;
     }
 
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO 参数
+     * @return
+     */
+    public List<ConceptBaseDTO> indexFac(ScaleIndexVO scaleIndexVO) {
+        RespDTO<List<ConceptBaseDTO>> res = aiptServiceClient.index(scaleIndexVO);
+        RespDTOUtil.respNGDeal(res, "远程调用量表搜索失败");
+        return res.data;
+    }
+
 }

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

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * @Description: 量表检索
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+@ApiModel
+public class ScaleIndexVO {
+    @NotBlank(message = "名称不能为空")
+    private String name;
+    @ApiModelProperty(hidden = true)
+    private Integer startType;
+    @ApiModelProperty(hidden = true)
+    private Integer endType;
+    @ApiModelProperty(hidden = true)
+    private Integer relationType;
+    private List<String> filterName; //过滤已选名称
+}

+ 11 - 0
icss-service/src/main/java/com/diagbot/web/ScaleController.java

@@ -1,6 +1,7 @@
 package com.diagbot.web;
 
 
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.DisScaleDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.ScaleContent;
@@ -8,6 +9,7 @@ import com.diagbot.facade.DisScaleFacade;
 import com.diagbot.facade.ScaleContentFacade;
 import com.diagbot.vo.DisScaleVO;
 import com.diagbot.vo.PushVO;
+import com.diagbot.vo.ScaleIndexVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -52,4 +55,12 @@ public class ScaleController {
         List<ScaleContent> data = scaleContentFacade.getContent(pushVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "知识库标准化-量表搜索[by:zhoutg]",
+            notes = "")
+    @PostMapping("/index")
+    public RespDTO<List<DisScaleDTO>> index(@Valid @RequestBody ScaleIndexVO scaleVO) {
+        List<ConceptBaseDTO> data = scaleContentFacade.indexFac(scaleVO);
+        return RespDTO.onSuc(data);
+    }
 }