gaodm 4 年 前
コミット
4baccf0f01

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/dto/TreeAllDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/10 17:02
+ */
+@Getter
+@Setter
+public class TreeAllDTO {
+    private List<Long> types;
+    private TreeDTO treeDTO;
+}

+ 15 - 4
cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java

@@ -1,6 +1,7 @@
 package com.diagbot.facade;
 
 import com.diagbot.dto.RelationDTO;
+import com.diagbot.dto.TreeAllDTO;
 import com.diagbot.dto.TreeDTO;
 import com.diagbot.service.impl.KlRelationServiceImpl;
 import com.diagbot.util.EntityUtil;
@@ -20,8 +21,7 @@ import java.util.Map;
  */
 @Component
 public class KlRelationFacade extends KlRelationServiceImpl {
-    public TreeDTO getTree(TreeVO treeVO) {
-        TreeDTO treeDTO = new TreeDTO();
+    public TreeAllDTO getTree(TreeVO treeVO) {
         List<Long[]> pList = new ArrayList<>();
         pList.add(new Long[] { 402L, 600L, 301L, 600L, 101L });//药品化学物质类别
         pList.add(new Long[] { 403L, 600L, 302L, 600L, 101L });//药品治疗学类别
@@ -32,9 +32,15 @@ public class KlRelationFacade extends KlRelationServiceImpl {
         pList.add(new Long[] { 408L, 600L, 107L, 600L, 108L });//实验室检查类别
         pList.add(new Long[] { 409L, 600L, 109L, 600L, 110L });//实验室检查类别
 
+        Integer index = treeVO.getType() - 1;
+        List<Long> types = new ArrayList<>();
+        types.add(pList.get(index)[0]);
+        types.add(pList.get(index)[1]);
+        types.add(pList.get(index)[2]);
+        types.add(pList.get(index)[3]);
+        types.add(pList.get(index)[4]);
 
         RelationVO relationVO = new RelationVO();
-        Integer index = treeVO.getType() - 1;
         relationVO.setSType(pList.get(index)[0]);
         relationVO.setRId(pList.get(index)[1]);
         relationVO.setEType(pList.get(index)[2]);
@@ -47,6 +53,7 @@ public class KlRelationFacade extends KlRelationServiceImpl {
         List<RelationDTO> sub = this.getRelations(relationVO2);
         Map<Long, List<RelationDTO>> map = EntityUtil.makeEntityListMap(sub, "sId");
 
+        TreeDTO treeDTO = new TreeDTO();
         treeDTO.setId(root.get(0).getSId());
         treeDTO.setName(root.get(0).getSName());
         for (RelationDTO relationDTO : root) {
@@ -64,6 +71,10 @@ public class KlRelationFacade extends KlRelationServiceImpl {
             }
             treeDTO.getNextTree().add(treeDTO2);
         }
-        return treeDTO;
+
+        TreeAllDTO treeAllDTO = new TreeAllDTO();
+        treeAllDTO.setTypes(types);
+        treeAllDTO.setTreeDTO(treeDTO);
+        return treeAllDTO;
     }
 }

+ 2 - 1
cdssman-service/src/main/java/com/diagbot/web/TreeContactController.java

@@ -4,6 +4,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.RelationNodeDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.TreeAllDTO;
 import com.diagbot.dto.TreeDTO;
 import com.diagbot.facade.KlConceptFacade;
 import com.diagbot.facade.KlRelationFacade;
@@ -51,7 +52,7 @@ public class TreeContactController {
     @ApiOperation(value = "知识库标准化-树形结构维护相关API-详情(根据类别查询)[by:kongwz]")
     @PostMapping("/getTree")
     @SysLogger("getTree")
-    public RespDTO<TreeDTO> getTree(@RequestBody TreeVO treeVO) {
+    public RespDTO<TreeAllDTO> getTree(@RequestBody TreeVO treeVO) {
         return RespDTO.onSuc(klRelationFacade.getTree(treeVO));
     }