Browse Source

获取树形结构接口

gaodm 5 years ago
parent
commit
f974980209
1 changed files with 40 additions and 4 deletions
  1. 40 4
      ltkg-service/src/main/java/com/diagbot/facade/KgFacade.java

+ 40 - 4
ltkg-service/src/main/java/com/diagbot/facade/KgFacade.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.TreeDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KgServiceImpl;
+import com.diagbot.util.FastJsonUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.KgQueryVO;
 import com.diagbot.vo.KgTreeVO;
@@ -48,14 +49,49 @@ public class KgFacade extends KgServiceImpl {
     public TreeDTO getTreeFac(KgTreeVO kgTreeVO) {
         TreeDTO treeDTO = new TreeDTO();
         if (kgTreeVO.getType() == 1 && kgTreeVO.getSubType() == 1) {
-            addNode(treeDTO);
+            treeDTO = FastJsonUtils.getJsonToBean(jsonStr, TreeDTO.class);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR);
         }
         return treeDTO;
     }
 
-    private void addNode(TreeDTO treeDTO) {
-
-    }
+    private static final String jsonStr = "{\n" +
+            "    \"icdCode\": \"1\",\n" +
+            "    \"label\": null,\n" +
+            "    \"name\": \"疾病\",\n" +
+            "    \"snode\": [\n" +
+            "      {\n" +
+            "\t\t\"icdCode\": \"A\",\n" +
+            "\t\t\"label\": \"\",\n" +
+            "\t\t\"name\": \"A\",\n" +
+            "\t\t\"snode\": [\n" +
+            "\t\t  {\n" +
+            "\t\t\t\"icdCode\": \"A1\",\n" +
+            "\t\t\t\"label\": \"\",\n" +
+            "\t\t\t\"name\": \"A1\",\n" +
+            "\t\t\t\"snode\": [\n" +
+            "\t\t\t  null\n" +
+            "\t\t\t]\n" +
+            "\t\t  },\n" +
+            "\t\t  {\n" +
+            "\t\t\t\"icdCode\": \"A2\",\n" +
+            "\t\t\t\"label\": \"\",\n" +
+            "\t\t\t\"name\": \"A2\",\n" +
+            "\t\t\t\"snode\": [\n" +
+            "\t\t\t  null\n" +
+            "\t\t\t]\n" +
+            "\t\t  }\n" +
+            "\t\t]\n" +
+            "\t  },\n" +
+            "\t  {\n" +
+            "\t\t\"icdCode\": \"B\",\n" +
+            "\t\t\"label\": \"\",\n" +
+            "\t\t\"name\": \"B\",\n" +
+            "\t\t\"snode\": [\n" +
+            "\t\t  null\n" +
+            "\t\t]\n" +
+            "\t  }\n" +
+            "    ]\n" +
+            "}";
 }