|
@@ -1,16 +1,17 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.dto.NeoEntityDTO;
|
|
|
-import com.diagbot.entity.node.Symptom;
|
|
|
+import com.diagbot.dto.NeoRelationDTO;
|
|
|
+import com.diagbot.entity.node.*;
|
|
|
import com.diagbot.entity.node.base.BaseNode;
|
|
|
import com.diagbot.repository.*;
|
|
|
-//import com.diagbot.util.GenericNode;
|
|
|
+import com.diagbot.util.BeanMapUtils;
|
|
|
+import com.diagbot.util.GenericNode;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.*;
|
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
@@ -25,6 +26,7 @@ import java.util.*;
|
|
|
* @time: 2018/8/6 9:11
|
|
|
*/
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class EntityFacade {
|
|
|
|
|
|
@Autowired
|
|
@@ -34,11 +36,45 @@ public class EntityFacade {
|
|
|
SymptomNameRepository symptomNameRepository;
|
|
|
|
|
|
@Autowired
|
|
|
- LisNameRepository lisRepository;
|
|
|
+ VitalRepository vitalRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ DeptRepository deptRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LisNameRepository lisNameRepository;
|
|
|
|
|
|
@Autowired
|
|
|
LisSetRepository lisSetRepository;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ YiBaoDiseaseNameRepository icdDiseaseRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PacsNameRepository pacsNameRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PacsSubNameRepository pacsSubNameRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ GroupRepository groupRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ MedicineRepository medicineRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ YiBaoOperationNameRepository operationRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TransfusionRemindRepository transfusionRemindRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LisCriticalRepository lisCriticalRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LisAliasRepository lisAliasRepository;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
public List<String> getLabels() {
|
|
|
List<String> labels = baseNodeRepository.getLabels();
|
|
@@ -47,24 +83,209 @@ public class EntityFacade {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<BaseNode> getNodes(KgQueryVO kgQueryVO) {
|
|
|
-
|
|
|
- List<BaseNode> baseNodes = new ArrayList<>();
|
|
|
+ /**
|
|
|
+ * 查询节点信息
|
|
|
+ * @param kgQueryVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> getNodes(KgQueryVO kgQueryVO) {
|
|
|
|
|
|
String label = kgQueryVO.getStartLabel().trim();
|
|
|
String name = kgQueryVO.getStartName();
|
|
|
|
|
|
+ List<Map<String, Object>> baseNodes = getNodeList(label, name);
|
|
|
+ baseNodes = GenericNode.removeRelation(baseNodes);
|
|
|
+
|
|
|
+ return baseNodes;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新节点信息
|
|
|
+ * @param neoEntityVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public NeoEntityDTO updateNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
+
|
|
|
+ String name = neoEntityVO.getName();
|
|
|
+ String label = neoEntityVO.getLabel();
|
|
|
+ String newname = neoEntityVO.getNewname();
|
|
|
+ String newlabel = neoEntityVO.getNewlabel();
|
|
|
+ String user = neoEntityVO.getUser();
|
|
|
+ EntityProp entityProp = neoEntityVO.getEntityProp();
|
|
|
+
|
|
|
+ NeoEntityDTO neoEntityDTO = new NeoEntityDTO();
|
|
|
+ neoEntityDTO.getLabels().add(label);
|
|
|
+ neoEntityDTO.setName(name);
|
|
|
+
|
|
|
+ List<Map<String, Object>> nodes = getNodeList(label, name);
|
|
|
+
|
|
|
+ // 查找到一个原有节点
|
|
|
+ if (nodes.size()==1) {
|
|
|
+ List<Map<String, Object>> newnodes = getNodeList(newlabel, newname);
|
|
|
+ // 查找到待修改的新节点
|
|
|
+ if (newnodes.size()>0) {
|
|
|
+ neoEntityDTO.setMsg("有" + nodes.size() + "个同名的新节点已存在");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ updateNode(label, name, newlabel, newname, entityProp, nodes.get(0));
|
|
|
+ neoEntityDTO.setMsg(build_node_msg(user, label, name, newlabel, newname));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查找到多个原有节点
|
|
|
+ else if (nodes.size()>1) {
|
|
|
+ neoEntityDTO.setNodes(nodes);
|
|
|
+ neoEntityDTO.setMsg("有"+nodes.size()+"个重复信息的节点");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return neoEntityDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除节点信息
|
|
|
+ * @param neoEntityVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public NeoEntityDTO deleteNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
+
|
|
|
+ String name = neoEntityVO.getName();
|
|
|
+ String label = neoEntityVO.getLabel();
|
|
|
+ String user = neoEntityVO.getUser();
|
|
|
+
|
|
|
+ NeoEntityDTO neoEntityDTO = new NeoEntityDTO();
|
|
|
+ neoEntityDTO.setName(name);
|
|
|
+ neoEntityDTO.getLabels().add(label);
|
|
|
+
|
|
|
+ List<Map<String, Object>> nodes = getNodeList(label, name);
|
|
|
+
|
|
|
+ // 查找到一个原有节点
|
|
|
+ if (nodes.size()==1) {
|
|
|
+ removeNode(label, name, nodes.get(0));
|
|
|
+ neoEntityDTO.setMsg(remove_node_msg(user, label, name));
|
|
|
+ }
|
|
|
+ // 查找到多个原有节点
|
|
|
+ else if (nodes.size()>1) {
|
|
|
+ neoEntityDTO.setMsg("有"+nodes.size()+"个重复信息的节点");
|
|
|
+ }
|
|
|
+ // 找不到节点
|
|
|
+ else if (nodes.size()==0) {
|
|
|
+ neoEntityDTO.setMsg("此节点不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ return neoEntityDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除关系信息
|
|
|
+ */
|
|
|
+ public NeoRelationDTO deleteNeoRelation(NeoRelationVO neoRelationVO) {
|
|
|
+ return updateNeoRelation(neoRelationVO, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新关系信息
|
|
|
+ * @param neoRelationVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public NeoRelationDTO updateNeoRelation(NeoRelationVO neoRelationVO, Integer status) {
|
|
|
+
|
|
|
+ String s_name = neoRelationVO.getStartname();
|
|
|
+ String s_label = neoRelationVO.getStartlabel();
|
|
|
+ String relname = neoRelationVO.getRelname();
|
|
|
+ String e_name = neoRelationVO.getEndname();
|
|
|
+ String e_label = neoRelationVO.getEndabel();
|
|
|
+ String user = neoRelationVO.getUser();
|
|
|
+ Map<String, String> props = neoRelationVO.getProperty();
|
|
|
+
|
|
|
+ NeoRelationDTO neoRelationDTO = new NeoRelationDTO();
|
|
|
+ neoRelationDTO.setStartname(s_name);
|
|
|
+ neoRelationDTO.setStartlabel(s_label);
|
|
|
+ neoRelationDTO.setEndname(e_name);
|
|
|
+ neoRelationDTO.setEndlabel(e_label);
|
|
|
+
|
|
|
+ List<Map<String, Object>> s_nodes = getNodeList(s_label, s_name);
|
|
|
+ List<Map<String, Object>> e_nodes = getNodeList(e_label, e_name);
|
|
|
+
|
|
|
+ if (s_nodes.size()!=1) {
|
|
|
+ if (s_nodes.size()>0) {
|
|
|
+ neoRelationDTO.setMsg("有" + s_nodes.size() + "个名为\"" + s_name + "\"的起始节点已存在");
|
|
|
+ }
|
|
|
+ else if (s_nodes.size()==0) {
|
|
|
+ neoRelationDTO.setMsg("节点" + s_name + "(" + s_label+ ")不存在"); }
|
|
|
+ }
|
|
|
+ else if (e_nodes.size()!=1) {
|
|
|
+ if (e_nodes.size()>0) {
|
|
|
+ neoRelationDTO.setMsg("有" + e_nodes.size() + "个名为\"" + e_name + "\"的终点节点已存在");
|
|
|
+ }
|
|
|
+ else if (e_nodes.size()==0) {
|
|
|
+ neoRelationDTO.setMsg("节点" + e_name + "(" + e_label+ ")不存在"); }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Map<String, Object> s_node = s_nodes.get(0);
|
|
|
+ Map<String, Object> e_node = e_nodes.get(0);
|
|
|
+
|
|
|
+ List<?> e_nd_list = getEndNodeList(s_label, s_name, relname);
|
|
|
+
|
|
|
+ if (inlist(e_nd_list, e_node)) {
|
|
|
+ if (null!=status && status == 0) {
|
|
|
+ updateRelation(s_label, s_node, relname, status, e_name);
|
|
|
+ neoRelationDTO.setMsg(build_relation_msg(user, s_label, s_name, e_label, e_name, relname));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return neoRelationDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public List<Map<String, Object>> getNodeList(String label, String name) {
|
|
|
+
|
|
|
+ List<Map<String, Object>> baseNodes = new ArrayList<>();
|
|
|
+
|
|
|
+ GenericNode<?> gNode = new GenericNode<>();
|
|
|
+ List<?> nodes = new ArrayList<>();
|
|
|
+
|
|
|
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);
|
|
|
+ nodes = symptomNameRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Symptom>();
|
|
|
+ break;
|
|
|
+ case "体征":
|
|
|
+ nodes = vitalRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Vital>();
|
|
|
+ break;
|
|
|
+ case "禁忌人群":
|
|
|
+ nodes = groupRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Group>();
|
|
|
+ break;
|
|
|
+ case "实验室检查名称":
|
|
|
+ nodes = lisNameRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Lis>();
|
|
|
+ break;
|
|
|
+ case "实验室检查别名":
|
|
|
+ nodes = lisAliasRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<>();
|
|
|
+ break;
|
|
|
+ case "实验室检查套餐名":
|
|
|
+ nodes = lisSetRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Vital>();
|
|
|
+ break;
|
|
|
+ case "实验室检查危急值":
|
|
|
+ nodes = lisCriticalRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Vital>();
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+ baseNodes = gNode.fillNodeTree(nodes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -77,114 +298,303 @@ public class EntityFacade {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public List<?> getEndNodeList(String s_label, String s_name, String relname) {
|
|
|
|
|
|
- public NeoEntityDTO updateNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
+ BaseNode baseNode;
|
|
|
+ List<?> baseNodes = new ArrayList<>();
|
|
|
|
|
|
- List<String> keys;
|
|
|
- String name = neoEntityVO.getName();
|
|
|
- List<String> labels = neoEntityVO.getLabels();
|
|
|
- Map<String, String> props = neoEntityVO.getProperty();
|
|
|
+ try {
|
|
|
+ if (StringUtil.isNotBlank(s_label)) {
|
|
|
+ switch (s_label) {
|
|
|
+ case "辅助检查名称":
|
|
|
+ PacsNameNode pacsNameNode = new PacsNameNode();
|
|
|
+ baseNode = pacsNameRepository.findByNameIs(s_name).get(0);
|
|
|
+ baseNodes = pacsNameNode.getNodesbyRelation((PacsName)baseNode, relname);
|
|
|
+ break;
|
|
|
+ case "实验室检查名称":
|
|
|
+ LisNameNode lisNameNode = new LisNameNode();
|
|
|
+ baseNode = lisNameRepository.findByNameIs(s_name).get(0);
|
|
|
+ baseNodes = lisNameNode.getNodesbyRelation((LisName)baseNode, relname);
|
|
|
+ break;
|
|
|
+ /*
|
|
|
+ case "实验室检查别名":
|
|
|
+ nodes = lisAliasRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<>();
|
|
|
+ break;
|
|
|
+ */
|
|
|
+ case "实验室检查套餐名":
|
|
|
+ LisSetNode lisSetNode = new LisSetNode();
|
|
|
+ baseNode = lisSetRepository.findByNameIs(s_name).get(0);
|
|
|
+ baseNodes = lisSetNode.getNodesbyRelation((LisSet)baseNode, relname);
|
|
|
+ break;
|
|
|
+ /*
|
|
|
+ case "实验室检查危急值":
|
|
|
+ nodes = lisCriticalRepository.findByNameIs(name);
|
|
|
+ gNode = new GenericNode<Vital>();
|
|
|
+ break;
|
|
|
+ */
|
|
|
+ }
|
|
|
+// baseNodes = gNode.fillNodeTree(nodes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ return baseNodes;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- NeoEntityDTO neoEntityDTO = new NeoEntityDTO();
|
|
|
|
|
|
- Map<String, String> map = getMapping("node_mapping");
|
|
|
|
|
|
- String label = labels.get(0);
|
|
|
- if (null!=map.get(label)) {
|
|
|
- String clsname = map.get(label);
|
|
|
+ public Map<String, String> updateNode(String label, String name, String newlabel, String newname,
|
|
|
+ EntityProp entityProp, Map<String, Object> nodeinfo) {
|
|
|
|
|
|
- switch (clsname) {
|
|
|
- case "LisName":
|
|
|
- LisNameNode lisNode = new LisNameNode();
|
|
|
- keys = getKeys(baseNodeRepository.getLisNameKeys(), "name");
|
|
|
- neoEntityDTO = lisNode.updateEntity(name, props, keys, lisRepository);
|
|
|
- break;
|
|
|
- case "LisSet":
|
|
|
- LisSetNode lisPackNode = new LisSetNode();
|
|
|
- keys = getKeys(baseNodeRepository.getLisSetKeys(), "name");
|
|
|
- neoEntityDTO = lisPackNode.updateEntity(name, props, keys, lisSetRepository);
|
|
|
- break;
|
|
|
+ Map<String, String> node = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ long nd_id = Long.valueOf(nodeinfo.get("id").toString());
|
|
|
+ nodeinfo.remove("id");
|
|
|
+ nodeinfo = updateNodeInfo(nodeinfo, entityProp);
|
|
|
+
|
|
|
+ // 更新节点标签
|
|
|
+ if (StringUtil.isNotBlank(newlabel)) {
|
|
|
+ if (!newname.equals(name)) {
|
|
|
+ name = newname;
|
|
|
+ }
|
|
|
+ createNewNode(newlabel, nodeinfo);
|
|
|
+ }
|
|
|
+ // 更新节点名称
|
|
|
+ else if (StringUtil.isNotBlank(newname) && !newname.equals(name)) {
|
|
|
+ name = newname;
|
|
|
+ nodeinfo.put("name", name);
|
|
|
+ createNewNode(label, nodeinfo);
|
|
|
}
|
|
|
|
|
|
- neoEntityDTO.setLabels(labels);
|
|
|
+ DeactivateNode(nd_id, label, nodeinfo);
|
|
|
+
|
|
|
+ node.put(name, label);
|
|
|
+ }
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ return node;
|
|
|
}
|
|
|
|
|
|
- return neoEntityDTO;
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 获取图谱节点类型到节点类名的静态映射
|
|
|
- * @param fname
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Map<String, String> getMapping(String fname) {
|
|
|
- Map<String, String> mapping = new HashMap<>();
|
|
|
+
|
|
|
+ public Map<String, Object> updateNodeInfo(Map<String, Object> nodeinfo, EntityProp entityProp) {
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(entityProp.getVitalname())) {
|
|
|
+ nodeinfo.put("vitalname", entityProp.getVitalname());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null!=entityProp.getMinval()) {
|
|
|
+ nodeinfo.put("minval", entityProp.getMinval());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null!=entityProp.getMaxval()) {
|
|
|
+ nodeinfo.put("maxval", entityProp.getMaxval());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null!=entityProp.getUnit()) {
|
|
|
+ nodeinfo.put("unit", entityProp.getUnit());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null!=entityProp.getRange()) {
|
|
|
+ nodeinfo.put("range", entityProp.getRange());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(entityProp.getPycode())) {
|
|
|
+ nodeinfo.put("pycode", entityProp.getPycode());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(entityProp.getKnowledge())) {
|
|
|
+ nodeinfo.put("knowledge", entityProp.getKnowledge());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null!=entityProp.getIs_kl()) {
|
|
|
+ nodeinfo.put("is_kl", entityProp.getIs_kl());
|
|
|
+ }
|
|
|
+
|
|
|
+ return nodeinfo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, String> removeNode(String label, String name, Map<String, Object> nodeinfo) {
|
|
|
+
|
|
|
+ Map<String, String> node = new HashMap<>();
|
|
|
+
|
|
|
try {
|
|
|
+ long nd_id = Long.valueOf(nodeinfo.get("id").toString());
|
|
|
|
|
|
- ClassPathResource classPathResource = new ClassPathResource(fname);
|
|
|
+ DeactivateNode(nd_id, label, nodeinfo);
|
|
|
|
|
|
- File file = classPathResource.getFile();
|
|
|
- BufferedReader br = new BufferedReader(new FileReader(file));
|
|
|
- String line;
|
|
|
- String[] pair;
|
|
|
- while ((line=br.readLine())!=null) {
|
|
|
- if (line.contains(":")) {
|
|
|
- pair = line.split(":");
|
|
|
- mapping.put(pair[0].trim(), pair[1].trim());
|
|
|
- }
|
|
|
- }
|
|
|
+ node.put(name, label);
|
|
|
}
|
|
|
- catch (IOException ioe) {
|
|
|
- ioe.printStackTrace();
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ return node;
|
|
|
}
|
|
|
|
|
|
- return mapping;
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 获取节点的属性列表
|
|
|
- * @param keylist
|
|
|
- * @param exclude
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<String> getKeys(List<List<String>> keylist, String exclude) {
|
|
|
- List<String> finalkeys = new ArrayList<>();
|
|
|
|
|
|
- for (List<String> keys : keylist) {
|
|
|
- for (String key : keys) {
|
|
|
- if (!key.equals(exclude) && !finalkeys.contains(key)) {
|
|
|
- finalkeys.add(key);
|
|
|
- }
|
|
|
+ public void createNewNode(String label, Map<String, Object> nodeinfo) {
|
|
|
+ saveNode(label, nodeinfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void DeactivateNode(Long id, String label, Map<String, Object> nodeinfo) {
|
|
|
+ nodeinfo.put("id", id);
|
|
|
+ nodeinfo.put("status", 0);
|
|
|
+ saveNode(label, nodeinfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void saveNode(String label, Map<String, Object> nodeinfo) {
|
|
|
+ try {
|
|
|
+ switch (label) {
|
|
|
+ case "症状":
|
|
|
+ Symptom symptom = BeanMapUtils.mapToBean(nodeinfo, Symptom.class);
|
|
|
+ symptomNameRepository.save(symptom);
|
|
|
+ break;
|
|
|
+ case "体征":
|
|
|
+ Vital vital = BeanMapUtils.mapToBean(nodeinfo, Vital.class);
|
|
|
+ vitalRepository.save(vital);
|
|
|
+ break;
|
|
|
+ case "实验室检查名称":
|
|
|
+ LisName lisName = BeanMapUtils.mapToBean(nodeinfo, LisName.class);
|
|
|
+ lisNameRepository.save(lisName);
|
|
|
+ break;
|
|
|
+ case "实验室检查别名":
|
|
|
+ LisAlias lisAlias = BeanMapUtils.mapToBean(nodeinfo, LisAlias.class);
|
|
|
+ lisAliasRepository.save(lisAlias);
|
|
|
+ break;
|
|
|
+ case "实验室检查套餐名":
|
|
|
+ LisSet lisSet = BeanMapUtils.mapToBean(nodeinfo, LisSet.class);
|
|
|
+ lisSetRepository.save(lisSet);
|
|
|
+ break;
|
|
|
+ case "实验室检查危急值":
|
|
|
+ break;
|
|
|
+ case "辅助检查名称":
|
|
|
+ PacsName pacsName = BeanMapUtils.mapToBean(nodeinfo, PacsName.class);
|
|
|
+ pacsNameRepository.save(pacsName);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称":
|
|
|
+ PacsSubName pacsSubName = BeanMapUtils.mapToBean(nodeinfo, PacsSubName.class);
|
|
|
+ pacsSubNameRepository.save(pacsSubName);
|
|
|
+ break;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return finalkeys;
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 删除节点
|
|
|
- * @param neoEntityVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public int deleteNeoNode(NeoEntityVO neoEntityVO) {
|
|
|
- int cnt = 0;
|
|
|
+
|
|
|
+ public boolean inlist(List<?> nodelist, Map<String, Object> node) {
|
|
|
+
|
|
|
+ boolean isin = false;
|
|
|
+ String key = "name";
|
|
|
|
|
|
try {
|
|
|
- if (null != neoEntityVO.getID()) {
|
|
|
- long id = neoEntityVO.getID();
|
|
|
- BaseNode node = baseNodeRepository.findById(id);
|
|
|
- cnt = 1;
|
|
|
-// baseNodeRepository.delete(node);
|
|
|
+ for (Object nd : nodelist) {
|
|
|
+ Map<String, Object> nd_map = BeanMapUtils.beanToMap(nd);
|
|
|
+ String nd_map_name = nd_map.get(key).toString();
|
|
|
+ String node_name = node.get(key).toString();
|
|
|
+ if (nd_map_name.equals(node_name)) {
|
|
|
+ isin = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
finally {
|
|
|
- return cnt;
|
|
|
+ return isin;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void updateRelation(String s_label, Map<String, Object> s_node, String relname, Integer status, String e_name) {
|
|
|
+ try {
|
|
|
+ switch (s_label) {
|
|
|
+ case "辅助检查名称":
|
|
|
+ PacsName pacsName = BeanMapUtils.mapToBean(s_node, PacsName.class);
|
|
|
+ PacsNameNode pacsNameNode = new PacsNameNode();
|
|
|
+ pacsNameNode.updateRelation(pacsName, relname, status, e_name, pacsNameRepository);
|
|
|
+ break;
|
|
|
+ case "实验室检查名称":
|
|
|
+ LisName lisName = BeanMapUtils.mapToBean(s_node, LisName.class);
|
|
|
+ LisNameNode lisNameNode = new LisNameNode();
|
|
|
+ lisNameNode.updateRelation(lisName, relname, status, e_name, lisNameRepository);
|
|
|
+ break;
|
|
|
+ case "实验室检查套餐名":
|
|
|
+ LisSet lisSet = BeanMapUtils.mapToBean(s_node, LisSet.class);
|
|
|
+ LisSetNode lisSetNode = new LisSetNode();
|
|
|
+ lisSetNode.updateRelation(lisSet, relname, status, e_name, lisSetRepository);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public String build_node_msg(String user, String label, String name, String newlbl, String newname) {
|
|
|
+ String msg = "\n";
|
|
|
+
|
|
|
+ msg += "操作用户:\t" + user + "\n";
|
|
|
+ msg += "初始节点:\t" + name + "(" + label + ")\n";
|
|
|
+ msg += "更新为:\t" + newname + "(" + newlbl + ")\n";
|
|
|
+
|
|
|
+ log.error(msg);
|
|
|
+
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String remove_node_msg(String user, String label, String name) {
|
|
|
+ String msg = "\n";
|
|
|
+
|
|
|
+ msg += "操作用户:\t" + user + "\n";
|
|
|
+ msg += "初始节点:\t" + name + "(" + label + ")\n";
|
|
|
+ msg += "更新状态为:\t删除\n";
|
|
|
+
|
|
|
+ log.error(msg);
|
|
|
+
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String build_relation_msg(String user, String s_label, String s_name, String e_label, String e_name, String relname) {
|
|
|
+ String msg = "\n";
|
|
|
+
|
|
|
+ msg += "操作用户:\t" + user + "\n";
|
|
|
+ msg += "起始节点:\t" + s_name + "(" + s_label + ")\n";
|
|
|
+ msg += "终止节点:\t" + e_name + "(" + e_label + ")\n";
|
|
|
+ msg += "删除关系名称为:\t" + relname + "\n";
|
|
|
+
|
|
|
+ log.error(msg);
|
|
|
+
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
}
|