|
@@ -1,9 +1,14 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.dto.NeoEntityDTO;
|
|
|
+import com.diagbot.entity.node.Symptom;
|
|
|
+import com.diagbot.entity.node.base.BaseNode;
|
|
|
import com.diagbot.repository.*;
|
|
|
+import com.diagbot.util.GenericNode;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.*;
|
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -25,6 +30,9 @@ public class EntityFacade {
|
|
|
@Autowired
|
|
|
BaseNodeRepository baseNodeRepository;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SymptomNameRepository symptomNameRepository;
|
|
|
+
|
|
|
@Autowired
|
|
|
LisNameRepository lisRepository;
|
|
|
|
|
@@ -39,11 +47,37 @@ public class EntityFacade {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void initEntity() {
|
|
|
- List<String> labels = getLabels();
|
|
|
+ public List<BaseNode> getNodes(KgQueryVO kgQueryVO) {
|
|
|
+
|
|
|
+ List<BaseNode> baseNodes = new ArrayList<>();
|
|
|
+
|
|
|
+ String label = kgQueryVO.getStartLabel().trim();
|
|
|
+ String name = kgQueryVO.getStartName();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (StringUtil.isNotBlank(label) && StringUtil.isNotBlank(name)) {
|
|
|
+ if (Constants.node_Labels.contains(label)) {
|
|
|
+ switch (label) {
|
|
|
+ case "症状":
|
|
|
+ List<Symptom> symptoms = symptomNameRepository.findByNameIs(name);
|
|
|
+ GenericNode<Symptom> sNodes = new GenericNode<>();
|
|
|
+ baseNodes = sNodes.fillNodeTree(symptoms);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ return baseNodes;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
public NeoEntityDTO updateNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
|
|
|
List<String> keys;
|
|
@@ -130,4 +164,27 @@ public class EntityFacade {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除节点
|
|
|
+ * @param neoEntityVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public int deleteNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
+ int cnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (null != neoEntityVO.getID()) {
|
|
|
+ long id = neoEntityVO.getID();
|
|
|
+ BaseNode node = baseNodeRepository.findById(id);
|
|
|
+ cnt = 1;
|
|
|
+// baseNodeRepository.delete(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ return cnt;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|