Преглед изворни кода

数据服务模式量表和静态知识库检索

gaodm пре 5 година
родитељ
комит
b04271377b

+ 22 - 0
data-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -8,8 +8,12 @@ import com.diagbot.dto.ConceptIntroduceDTO;
 import com.diagbot.dto.DisclaimerInformationDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptIntroduceVO;
+import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.ScaleIndexVO;
 import com.diagbot.vo.VersionVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -80,4 +84,22 @@ public interface AiptServiceClient {
      */
     @PostMapping("/versionInfo/getVersionInfoAlls")
     RespDTO<VersionWrapperDTO> getVersionInfoAlls(@RequestBody VersionVO versionVO);
+
+    /**
+     * 静态知识检索
+     *
+     * @param getStaticKnowledgeVO
+     * @return
+     */
+    @PostMapping("/concept/getStaticKnowledge")
+    RespDTO<List<RetrievalDTO>> getStaticKnowledge(@RequestBody GetStaticKnowledgeVO getStaticKnowledgeVO);
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO
+     * @return
+     */
+    @PostMapping(value = "/scale/index")
+    RespDTO<List<ScaleIndexDTO>> index(@RequestBody ScaleIndexVO scaleIndexVO);
 }

+ 28 - 0
data-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -8,8 +8,12 @@ import com.diagbot.dto.ConceptIntroduceDTO;
 import com.diagbot.dto.DisclaimerInformationDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptIntroduceVO;
+import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.ScaleIndexVO;
 import com.diagbot.vo.VersionVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -101,4 +105,28 @@ public class AiptServiceHystrix implements AiptServiceClient {
         log.error("【hystrix】调用{}异常", "getVersionInfoAlls");
         return null;
     }
+
+    /**
+     * 静态知识检索
+     *
+     * @param getStaticKnowledgeVO
+     * @return
+     */
+    @Override
+    public RespDTO<List<RetrievalDTO>> getStaticKnowledge(GetStaticKnowledgeVO getStaticKnowledgeVO) {
+        log.error("【hystrix】调用{}异常", "getStaticKnowledge");
+        return null;
+    }
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO
+     * @return
+     */
+    @Override
+    public RespDTO<List<ScaleIndexDTO>> index(@RequestBody ScaleIndexVO scaleIndexVO) {
+        log.error("【hystrix】调用{}异常", "index");
+        return null;
+    }
 }

+ 34 - 0
data-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -0,0 +1,34 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/27 14:58
+ */
+@Getter
+@Setter
+public class RetrievalDTO {
+    //标签名称
+    private String name;
+    //标签id
+    private Long questionId;
+    //显示类型(静态知识出参时:0.同义词 1.本体 11.子项推出父项 21.(父项--子项)公表名)
+    private Long showType;
+    //Tag名称
+    private String retrievalName;
+    //概念id
+    private Long conceptId;
+    //标签类型id
+    private Long libTypeId;
+    //标签类型名称
+    private String libTypeName;
+    //icss标签type
+    private Integer type;
+    //公表名称
+    private String uniqueName;
+    //公表ID
+    private Long uniqueId;
+}

+ 19 - 0
data-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; // 结果是否来自诊断
+}

+ 54 - 0
data-service/src/main/java/com/diagbot/facade/SearchFacade.java

@@ -0,0 +1,54 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.AiptServiceClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.GetStaticVO;
+import com.diagbot.vo.ScaleIndexVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/10/10 9:05
+ */
+@Component
+public class SearchFacade {
+    @Autowired
+    private AiptServiceClient aiptServiceClient;
+
+    /**
+     * 静态知识检索
+     *
+     * @param getStaticVO
+     * @return
+     */
+    public List<RetrievalDTO> getStaticKnowledge(GetStaticVO getStaticVO) {
+        GetStaticKnowledgeVO getStaticKnowledgeVO = new GetStaticKnowledgeVO();
+        BeanUtil.copyProperties(getStaticVO, getStaticKnowledgeVO);
+        RespDTO<List<RetrievalDTO>> res
+                = aiptServiceClient.getStaticKnowledge(getStaticKnowledgeVO);
+        RespDTOUtil.respNGDeal(res, "获取静态知识失败");
+        return res.data;
+    }
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO
+     * @return
+     */
+    public List<ScaleIndexDTO> index(ScaleIndexVO scaleIndexVO) {
+        RespDTO<List<ScaleIndexDTO>> res =
+                aiptServiceClient.index(scaleIndexVO);
+        RespDTOUtil.respNGDeal(res, "搜索量表失败");
+        return res.data;
+    }
+}

+ 24 - 0
data-service/src/main/java/com/diagbot/vo/GetStaticKnowledgeVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/5/24 9:23
+ */
+@Getter
+@Setter
+public class GetStaticKnowledgeVO {
+    //检索内容
+    @NotBlank(message = "请输入检索内容")
+    private String InputStr;
+    //需要去重的id
+    private List<Long> inputIds;
+    //指定类型
+    private List<Integer> types;
+}

+ 22 - 0
data-service/src/main/java/com/diagbot/vo/GetStaticVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/6/27 13:35
+ */
+@Getter
+@Setter
+public class GetStaticVO {
+    //检索内容
+    @NotBlank(message = "请输入检索内容")
+    private String InputStr;
+//    //需要去重的id
+//    private List<Long> inputIds;
+}

+ 31 - 0
data-service/src/main/java/com/diagbot/vo/ScaleIndexVO.java

@@ -0,0 +1,31 @@
+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; //过滤已选名称
+    @ApiModelProperty(hidden = true)
+    private List<String> disName; // 诊断名称
+}

+ 64 - 0
data-service/src/main/java/com/diagbot/web/SearchController.java

@@ -0,0 +1,64 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.RetrievalDTO;
+import com.diagbot.dto.ScaleIndexDTO;
+import com.diagbot.facade.ConceptDetailFacade;
+import com.diagbot.facade.SearchFacade;
+import com.diagbot.vo.GetStaticKnowledgeVO;
+import com.diagbot.vo.GetStaticVO;
+import com.diagbot.vo.ScaleIndexVO;
+import io.micrometer.core.instrument.search.Search;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+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;
+
+/**
+ * @Description:
+ * @Author: gaodm
+ * @time: 2019/5/14 9:51
+ */
+@RestController
+@RequestMapping("/search")
+@Api(value = "检索API", tags = { "数据服务模式-检索API" })
+@SuppressWarnings("unchecked")
+public class SearchController {
+    @Autowired
+    private SearchFacade searchFacade;
+
+    /**
+     * 静态知识检索
+     *
+     * @param getStaticVO
+     * @return
+     */
+    @ApiOperation(value = "静态知识检索[by:zhoutg]",
+            notes = "inputStr:检索内容,必填<br>" +
+                    "inputIds:需要去重的id<br>")
+    @PostMapping("/getStaticKnowledge")
+    @SysLogger("getStaticKnowledge")
+    public RespDTO<List<RetrievalDTO>> getStaticKnowledge(@Valid @RequestBody GetStaticVO getStaticVO){
+        return RespDTO.onSuc(searchFacade.getStaticKnowledge(getStaticVO));
+    }
+
+    /**
+     * 量表搜索
+     *
+     * @param scaleIndexVO
+     * @return
+     */
+    @ApiOperation(value = "量表搜索[by:zhoutg]",
+            notes = "")
+    @PostMapping(value = "/getScale")
+    public RespDTO<List<ScaleIndexDTO>> index(@Valid @RequestBody ScaleIndexVO scaleIndexVO){
+        return RespDTO.onSuc(searchFacade.index(scaleIndexVO));
+    }
+}