浏览代码

批量获取静态知识

zhaops 5 年之前
父节点
当前提交
9de561b349

+ 22 - 1
aipt-service/src/main/java/com/diagbot/facade/ConceptDetailFacade.java

@@ -19,6 +19,7 @@ import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptIntroduceVO;
 import com.diagbot.vo.ExistListByConceptIdsVO;
+import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -38,7 +39,7 @@ public class ConceptDetailFacade extends ConceptDetailServiceImpl {
     private ConceptFacade conceptFacade;
 
     /**
-     * 获取提示信息
+     * 单条获取静态知识
      *
      * @param conceptIntroduceVO
      * @return
@@ -86,6 +87,26 @@ public class ConceptDetailFacade extends ConceptDetailServiceImpl {
         return conceptIntroduceDTO;
     }
 
+    /**
+     * 批量取静态知识
+     *
+     * @param conceptIntroduceVOList
+     * @return
+     */
+    public List<ConceptIntroduceDTO> getConceptDetails(List<ConceptIntroduceVO> conceptIntroduceVOList) {
+        List<ConceptIntroduceDTO> conceptIntroduceDTOList = Lists.newLinkedList();
+        if (ListUtil.isNotEmpty(conceptIntroduceVOList)) {
+            for (ConceptIntroduceVO conceptIntroduceVO : conceptIntroduceVOList) {
+                ConceptIntroduceDTO conceptIntroduceDTO = getConceptDetail(conceptIntroduceVO);
+                if (conceptIntroduceDTO != null) {
+                    conceptIntroduceDTOList.add(conceptIntroduceDTO);
+                }
+
+            }
+        }
+        return conceptIntroduceDTOList;
+    }
+
     /**
      * 是否存在提示信息
      *

+ 12 - 0
aipt-service/src/main/java/com/diagbot/web/ConceptDetailController.java

@@ -46,6 +46,18 @@ public class ConceptDetailController {
         return RespDTO.onSuc(data);
     }
 
+    @ApiOperation(value = "知识库标准化-批量获取提示信息[by:zhaops]",
+            notes = "name: 标签名称,必填<br>" +
+                    "titles: 标题,数组选填<br>" +
+                    "type:标签类型(1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标),单选必填<br>" +
+                    "position:1-摘要,2-全文,5-药品说明书,6-不良反应,单选选填")
+    @PostMapping("/getConceptDetails")
+    @SysLogger("getConceptDetails")
+    public RespDTO<List<ConceptIntroduceDTO>> getConceptDetails(@Valid @RequestBody List<ConceptIntroduceVO> conceptIntroduceVOList) {
+        List<ConceptIntroduceDTO> data = conceptDetailFacade.getConceptDetails(conceptIntroduceVOList);
+        return RespDTO.onSuc(data);
+    }
+
     @ApiOperation(value = "知识库标准化-获取提示信息存在性[by:zhaops]",
             notes = "name: 标签名称,必填<br>" +
                     "type:标签类型(1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标),单选必填<br>")

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

@@ -79,6 +79,15 @@ public interface AiptServiceClient {
     @PostMapping(value = "/conceptDetail/getConceptDetail")
     RespDTO<ConceptIntroduceDTO> getConceptDetail(@Valid @RequestBody ConceptIntroduceVO conceptIntroduceVO);
 
+    /**
+     * 批量获取提示信息
+     *
+     * @param conceptIntroduceVOList
+     * @return
+     */
+    @PostMapping(value = "/conceptDetail/getConceptDetails")
+    RespDTO<List<ConceptIntroduceDTO>> getConceptDetails(@Valid @RequestBody List<ConceptIntroduceVO> conceptIntroduceVOList);
+
     /**
      * 获取版本信息
      */

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

@@ -97,6 +97,18 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
     }
 
+    /**
+     * 批量获取提示信息
+     *
+     * @param conceptIntroduceVOList
+     * @return
+     */
+    @Override
+    public RespDTO<List<ConceptIntroduceDTO>> getConceptDetails(@Valid @RequestBody List<ConceptIntroduceVO> conceptIntroduceVOList) {
+        log.error("【hystrix】调用{}异常", "getConceptDetails");
+        return null;
+    }
+
     /**
      * 获取版本信息
      */

+ 22 - 2
data-service/src/main/java/com/diagbot/facade/ConceptDetailFacade.java

@@ -8,6 +8,8 @@ import com.diagbot.vo.ConceptIntroduceVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * @Description:
  * @Author:zhaops
@@ -18,9 +20,27 @@ public class ConceptDetailFacade {
     @Autowired
     private AiptServiceClient aiptServiceClient;
 
+    /**
+     * 获取提示信息
+     *
+     * @param conceptIntroduceVO
+     * @return
+     */
     public ConceptIntroduceDTO getConceptDetail(ConceptIntroduceVO conceptIntroduceVO) {
         RespDTO<ConceptIntroduceDTO> res = aiptServiceClient.getConceptDetail(conceptIntroduceVO);
-        RespDTOUtil.respNGDeal(res, "获取提示信息失败");
+        RespDTOUtil.respNGDeal(res, "获取静态知识失败");
+        return res.data;
+    }
+
+    /**
+     * 批量获取提示信息
+     *
+     * @param conceptIntroduceVOList
+     * @return
+     */
+    public List<ConceptIntroduceDTO> getConceptDetails(List<ConceptIntroduceVO> conceptIntroduceVOList) {
+        RespDTO<List<ConceptIntroduceDTO>> res = aiptServiceClient.getConceptDetails(conceptIntroduceVOList);
+        RespDTOUtil.respNGDeal(res, "获取静态知识失败");
         return res.data;
     }
-}
+}

+ 13 - 0
data-service/src/main/java/com/diagbot/web/ConceptDetailController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * @Description:
@@ -39,4 +40,16 @@ public class ConceptDetailController {
         ConceptIntroduceDTO data = conceptDetailFacade.getConceptDetail(conceptIntroduceVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "批量获取提示信息[by:zhaops]",
+            notes = "name: 标签名称,必填<br>" +
+                    "type:标签类型(1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标),单选必填<br>" +
+                    "titles:提示信息标题列表,数组选填<br>" +
+                    "position:1-摘要,2-全文,5-药品说明书,6-不良反应,单选选填")
+    @PostMapping("/getConceptDetails")
+    @SysLogger("getConceptDetails")
+    public RespDTO<List<ConceptIntroduceDTO>> getConceptDetails(@Valid @RequestBody List<ConceptIntroduceVO> conceptIntroduceVOList) {
+        List<ConceptIntroduceDTO> data = conceptDetailFacade.getConceptDetails(conceptIntroduceVOList);
+        return RespDTO.onSuc(data);
+    }
 }