Merge remote-tracking branch 'origin/dev_2.1.0' into dev_2.1.0

dev_2.1.0
xueqingkun 1 year ago
commit b165c2eb3e

@ -1,9 +1,11 @@
package com.supervision.controller;
import com.supervision.service.GraphNebulaService;
import com.supervision.vo.GraphVO;
import com.supervision.vo.TreeNodeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -16,15 +18,25 @@ public class GraphNebulaController {
private final GraphNebulaService graphNebulaService;
@ApiOperation("创建图谱")
@GetMapping("createGraph")
public void createGraph(String processId) {
graphNebulaService.creatGraphByNebula(processId);
}
@ApiOperation("查询图谱")
@GetMapping("queryGraph")
public List<NgSubgraph<String>> queryGraph(String processId) {
public GraphVO queryGraph(String processId) {
return graphNebulaService.queryGraph(processId);
}
@ApiOperation("查询树形结构图")
@GetMapping("queryTreeGraph")
public List<TreeNodeVO> queryTreeGraph(String processId) {
return graphNebulaService.queryTreeGraph(processId);
}
}

@ -16,6 +16,6 @@ public class AllergyHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class AncillaryResultVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class AncillaryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class DiagnosisVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class FamilyHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class IllnessHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class MarriageChildHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -12,6 +12,6 @@ public class MedicalRecVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class OperationHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -14,6 +14,6 @@ public class PatientVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class PersonalHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class PhysicalResultVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class PhysicalVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class PreviousHistoryVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -12,5 +12,5 @@ public class ProcessMedicalVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -12,5 +12,5 @@ public class SelfDescVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -16,5 +16,5 @@ import javax.persistence.Table;
public class SinglePropertyEdge {
private String name;
private String edgeValue;
}

@ -15,5 +15,5 @@ public class SymptomsVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -15,5 +15,5 @@ public class TreatmentPlanVertex {
@Id
private String id;
private String name;
private String nodeValue;
}

@ -0,0 +1,64 @@
package com.supervision.enums;
public enum TagEnum {
medical_rec("病例", 1, "#00B8F5"),
process_medical("电子病历", 2, "#00B8F5"),
self_desc("主诉", 3, "#00B8F5"),
previous_history("既往病史", 3, "#00B8F5"),
illness_history("现病史", 3, "#00B8F5"),
personal_history("个人史", 3, "#00B8F5"),
allergy_history("过敏史", 3, "#00B8F5"),
family_history("家族史", 3, "#00B8F5"),
marriage_child_history("婚育史", 3, "#00B8F5"),
operation_history("手术史", 3, "#00B8F5"),
symptoms("症状", 2, "#00B8F5"),
patient("患者信息", 2, "#00B8F5"),
physical("体格检查", 2, "#00B8F5"),
physical_result("体格检查结果", 2, "#00B8F5"),
ancillary("辅助检查", 2, "#00B8F5"),
ancillary_result("辅助检查结果", 2, "#00B8F5"),
treatment_plan("处置计划", 2, "#00B8F5"),
diagnosis("诊断", 2, "#00B8F5");
private final String type;
private final Integer level;
private final String colour;
TagEnum(String type, Integer level, String colour) {
this.type = type;
this.level = level;
this.colour = colour;
}
public String getType() {
return type;
}
public Integer getLevel() {
return level;
}
public String getColour() {
return colour;
}
}

@ -1,6 +1,7 @@
package com.supervision.service;
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
import com.supervision.vo.GraphVO;
import com.supervision.vo.TreeNodeVO;
import java.util.List;
@ -8,6 +9,8 @@ public interface GraphNebulaService {
void creatGraphByNebula(String processId);
List<NgSubgraph<String>> queryGraph(String processId);
GraphVO queryGraph(String processId);
List<TreeNodeVO> queryTreeGraph(String processId);
}

@ -1,5 +1,7 @@
package com.supervision.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
@ -7,20 +9,26 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.supervision.dao.*;
import com.supervision.domain.*;
import com.supervision.enums.TagEnum;
import com.supervision.exception.BusinessException;
import com.supervision.model.Process;
import com.supervision.model.*;
import com.supervision.service.*;
import com.supervision.vo.EdgeVO;
import com.supervision.vo.GraphVO;
import com.supervision.vo.NodeVO;
import com.supervision.vo.TreeNodeVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nebula.contrib.ngbatis.models.data.NgEdge;
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
import org.nebula.contrib.ngbatis.models.data.NgVertex;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -78,21 +86,21 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 首先创建一个病历
MedicalRecVertex medicalRecVertex = new MedicalRecVertex();
medicalRecVertex.setName((disposalMethod == 0 ? "门诊" : "住院") + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")");
medicalRecVertex.setNodeValue((disposalMethod == 0 ? "门诊" : "住院") + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")");
medicalRecDao.insert(medicalRecVertex);
log.info("病历图谱ID:{}", medicalRecVertex.getId());
// 根据processId找到电子病历
ProcessMedical processMedical = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, processId).oneOpt().orElseThrow(() -> new BusinessException("未找到电子病历"));
ProcessMedicalVertex processMedicalVertex = new ProcessMedicalVertex();
processMedicalVertex.setName("病历(" + DateUtil.format(processMedical.getCreateTime(), "yyyy-MM-dd") + ")");
processMedicalVertex.setNodeValue("病历(" + DateUtil.format(processMedical.getCreateTime(), "yyyy-MM-dd") + ")");
processMedicalDao.insert(processMedicalVertex);
medicalRecDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), processMedicalVertex);
// 创建主诉节点
if (StrUtil.isNotBlank(processMedical.getPatientSelfDesc())) {
SelfDescVertex selfDescVertex = new SelfDescVertex();
selfDescVertex.setName("主诉:" + processMedical.getPatientSelfDesc());
selfDescVertex.setNodeValue(processMedical.getPatientSelfDesc());
selfDescDao.insert(selfDescVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), selfDescVertex);
@ -100,7 +108,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建现病史节点
if (StrUtil.isNotBlank(processMedical.getIllnessHistory())) {
IllnessHistoryVertex illnessHistoryVertex = new IllnessHistoryVertex();
illnessHistoryVertex.setName("现病史:" + processMedical.getIllnessHistory());
illnessHistoryVertex.setNodeValue(processMedical.getIllnessHistory());
illnessHistoryDao.insert(illnessHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), illnessHistoryVertex);
@ -108,7 +116,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建个人史节点
if (StrUtil.isNotBlank(processMedical.getPersonalHistory())) {
PersonalHistoryVertex personalHistoryVertex = new PersonalHistoryVertex();
personalHistoryVertex.setName("个人史:" + processMedical.getPersonalHistory());
personalHistoryVertex.setNodeValue(processMedical.getPersonalHistory());
personalHistoryDao.insert(personalHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), personalHistoryVertex);
@ -116,7 +124,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建过敏史节点
if (ObjectUtil.isNotEmpty(processMedical.getAllergyHistoryFlag()) && 1 == processMedical.getAllergyHistoryFlag() && StrUtil.isNotBlank(processMedical.getAllergyHistory())) {
AllergyHistoryVertex allergyHistoryVertex = new AllergyHistoryVertex();
allergyHistoryVertex.setName("过敏史:" + processMedical.getAllergyHistory());
allergyHistoryVertex.setNodeValue(processMedical.getAllergyHistory());
allergyHistoryDao.insert(allergyHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), allergyHistoryVertex);
@ -124,7 +132,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建既往史节点
if (ObjectUtil.isNotEmpty(processMedical.getPreviousHistoryFlag()) && 1 == processMedical.getPreviousHistoryFlag() && StrUtil.isNotBlank(processMedical.getPreviousHistory())) {
PreviousHistoryVertex previousHistoryVertex = new PreviousHistoryVertex();
previousHistoryVertex.setName("既往史:" + processMedical.getPreviousHistory());
previousHistoryVertex.setNodeValue(processMedical.getPreviousHistory());
previousHistoryDao.insert(previousHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), previousHistoryVertex);
@ -132,7 +140,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建家族史节点
if (ObjectUtil.isNotEmpty(processMedical.getFamilyHistoryFlag()) && 1 == processMedical.getFamilyHistoryFlag() && StrUtil.isNotBlank(processMedical.getFamilyHistory())) {
FamilyHistoryVertex familyHistoryVertex = new FamilyHistoryVertex();
familyHistoryVertex.setName("家族史:" + processMedical.getFamilyHistory());
familyHistoryVertex.setNodeValue(processMedical.getFamilyHistory());
familyHistoryDao.insert(familyHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), familyHistoryVertex);
@ -140,7 +148,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建手术史节点
if (ObjectUtil.isNotEmpty(processMedical.getOperationHistory()) && 1 == processMedical.getOperationHistoryFlag() && StrUtil.isNotBlank(processMedical.getOperationHistory())) {
OperationHistoryVertex operationHistoryVertex = new OperationHistoryVertex();
operationHistoryVertex.setName("手术史:" + processMedical.getOperationHistory());
operationHistoryVertex.setNodeValue(processMedical.getOperationHistory());
operationHistoryDao.insert(operationHistoryVertex);
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), operationHistoryVertex);
@ -148,7 +156,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 创建患者节点
MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历"));
PatientVertex patientVertex = new PatientVertex();
patientVertex.setName("患者:" + medicalRec.getPatientName());
patientVertex.setNodeValue(medicalRec.getPatientName());
patientDao.insert(patientVertex);
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), patientVertex);
@ -165,7 +173,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
}
if (ObjectUtil.isNotEmpty(tool)) {
PhysicalVertex physicalVertex = new PhysicalVertex();
physicalVertex.setName("体格检查:" + tool.getToolName() + (location != null ? ("-" + location.getLocationName()) : ""));
physicalVertex.setNodeValue(tool.getToolName() + (location != null ? ("-" + location.getLocationName()) : ""));
physicalDao.insert(physicalVertex);
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), physicalVertex);
// 如果是证实诊断依据,添加到证实诊断依据里面去
@ -183,13 +191,13 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
ConfigAncillaryItem configAncillaryItem = configAncillaryItemService.getById(diagnosisAncillaryRecord.getItemId());
if (ObjectUtil.isNotEmpty(configAncillaryItem)) {
AncillaryVertex ancillaryVertex = new AncillaryVertex();
ancillaryVertex.setName("辅助检查:" + configAncillaryItem.getItemName());
ancillaryVertex.setNodeValue(configAncillaryItem.getItemName());
ancillaryDao.insert(ancillaryVertex);
// 保存病历和辅助检查连线
medicalRecDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), ancillaryVertex);
// 结果节点
AncillaryResultVertex ancillaryResultVertex = new AncillaryResultVertex();
ancillaryResultVertex.setName(diagnosisAncillaryRecord.getResult());
ancillaryResultVertex.setNodeValue(diagnosisAncillaryRecord.getResult());
ancillaryResultDao.insert(ancillaryResultVertex);
// 保存检查结果连线
ancillaryDao.insertEdge(ancillaryVertex, new SinglePropertyEdge("结果"), ancillaryResultVertex);
@ -207,7 +215,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
Disease disease = diseaseService.getById(diagnosisPrimary.getPrimaryDiagnosisId());
if (ObjectUtil.isNotEmpty(disease)) {
DiagnosisVertex diagnosisVertex = new DiagnosisVertex();
diagnosisVertex.setName("诊断:" + disease.getDiseaseNameAlias());
diagnosisVertex.setNodeValue(disease.getDiseaseNameAlias());
diagnosisDao.insert(diagnosisVertex);
diagnosisDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("诊断"), diagnosisVertex);
diagnosisMap.put(diagnosisPrimary.getId(), diagnosisVertex);
@ -237,10 +245,96 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
@Override
public List<NgSubgraph<String>> queryGraph(String processId) {
public GraphVO queryGraph(String processId) {
Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到对应的问诊流程"));
return medicalRecDao.selectSubgraph(process.getGraphId());
List<NgSubgraph<String>> subgraphList = medicalRecDao.selectSubgraph(process.getGraphId());
List<NodeVO> nodeList = new ArrayList<>();
List<EdgeVO> edgeList = new ArrayList<>();
for (NgSubgraph<String> subgraph : subgraphList) {
// 首先构建点
List<NgVertex<String>> vertexes = subgraph.getVertexes();
for (NgVertex<String> vertex : vertexes) {
NodeVO nodeVO = new NodeVO();
String vid = vertex.getVid();
nodeVO.setId(vid);
Map<String, Object> properties = vertex.getProperties();
for (Map.Entry<String, Object> entry : properties.entrySet()) {
String key = entry.getKey();
TagEnum tagEnum = TagEnum.valueOf(key);
if (ObjectUtil.isNotEmpty(tagEnum)) {
nodeVO.setNodeType(tagEnum.name());
nodeVO.setNodeDesc(tagEnum.getType());
nodeVO.setNodeColour(tagEnum.getColour());
nodeVO.setNodeLevel(tagEnum.getLevel());
}
Object value = entry.getValue();
if (value instanceof Map) {
Map<?, ?> map = (Map<?, ?>) value;
Object nodeValue = map.get("nodeValue");
if (ObjectUtil.isNotEmpty(nodeValue)) {
nodeVO.setNodeValue(String.valueOf(nodeValue));
}
map.forEach((k, v) -> {
if (ObjectUtil.isNotEmpty(k)) {
nodeVO.getParams().put(String.valueOf(k), v);
}
});
}
}
nodeList.add(nodeVO);
}
// 构建边
List<NgEdge<String>> edges = subgraph.getEdges();
for (NgEdge<String> edge : edges) {
EdgeVO edgeVO = new EdgeVO();
edgeVO.setSource(edge.getSrcID());
edgeVO.setTarget(edge.getDstID());
Map<String, Object> properties = edge.getProperties();
Object nameObject = properties.get("edgeValue");
if (ObjectUtil.isNotEmpty(nameObject)) {
edgeVO.setName(String.valueOf(nameObject));
}
edgeVO.setParams(properties);
edgeList.add(edgeVO);
}
}
return new GraphVO(nodeList, edgeList);
}
@Override
public List<TreeNodeVO> queryTreeGraph(String processId) {
GraphVO graphVO = queryGraph(processId);
List<TreeNodeVO> treeNodeList = graphVO.getNodes().stream().map(node -> BeanUtil.toBean(node, TreeNodeVO.class)).collect(Collectors.toList());
// 首先找到第一级节点
List<TreeNodeVO> firstNodeList = treeNodeList.stream().filter(node -> node.getNodeLevel() == 1).collect(Collectors.toList());
if (CollUtil.isEmpty(firstNodeList)) {
return null;
}
// treeNodeList转换为map,key为节点ID,value为节点对象
Map<String, TreeNodeVO> treeNodeMap = treeNodeList.stream().collect(Collectors.toMap(TreeNodeVO::getId, Function.identity()));
for (TreeNodeVO nodeVO : firstNodeList) {
recursionBuildTree(nodeVO, treeNodeMap, graphVO.getEdges());
}
return firstNodeList;
}
private void recursionBuildTree(TreeNodeVO preNode, Map<String, TreeNodeVO> treeNodeMap, List<EdgeVO> edgeList) {
// 通过preNode的ID找到所有的子节点
List<TreeNodeVO> childNode = new ArrayList<>();
for (EdgeVO edgeVO : edgeList) {
if (StrUtil.equals(edgeVO.getSource(), preNode.getId())) {
TreeNodeVO treeNodeVO = treeNodeMap.get(edgeVO.getTarget());
if (ObjectUtil.isNotEmpty(treeNodeVO)) {
childNode.add(treeNodeVO);
}
;
}
}
preNode.setChildNodeList(childNode);
for (TreeNodeVO treeNodeVO : childNode) {
recursionBuildTree(treeNodeVO, treeNodeMap, edgeList);
}
}
}

@ -0,0 +1,17 @@
package com.supervision.vo;
import lombok.Data;
import java.util.Map;
@Data
public class EdgeVO {
private String source;
private String target;
private String name;
private Map<String, Object> params;
}

@ -0,0 +1,17 @@
package com.supervision.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GraphVO {
private List<NodeVO> nodes;
private List<EdgeVO> edges;
}

@ -0,0 +1,24 @@
package com.supervision.vo;
import lombok.Data;
import java.util.LinkedHashMap;
import java.util.Map;
@Data
public class NodeVO {
private String id;
private String nodeValue;
private String nodeColour;
private Integer nodeLevel;
private String nodeType;
private String nodeDesc;
private Map<String, Object> params = new LinkedHashMap<>();
}

@ -0,0 +1,7 @@
package com.supervision.vo;
import lombok.Data;
@Data
public class TreeGraphVO {
}

@ -0,0 +1,30 @@
package com.supervision.vo;
import lombok.Data;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Data
public class TreeNodeVO {
private String id;
private String nodeValue;
private String nodeColour;
private Integer nodeLevel;
private String nodeType;
private String nodeDesc;
private Map<String, Object> params = new LinkedHashMap<>();
/**
*
*/
private List<TreeNodeVO> childNodeList;
}

@ -5,49 +5,49 @@ CREATE SPACE IF NOT EXISTS virtual_patient (vid_type=FIXED_STRING(64)) comment=
USE virtual_patient; // 切换图空间
// 创建病历节点
CREATE TAG IF NOT EXISTS medical_rec(name String);
CREATE TAG IF NOT EXISTS medical_rec(nodeValue string);
// 创建电子病历节点
CREATE TAG IF NOT EXISTS process_medical(name string);
CREATE TAG IF NOT EXISTS process_medical(nodeValue string);
// 创建主诉节点
CREATE TAG IF NOT EXISTS self_desc(name string);
CREATE TAG IF NOT EXISTS self_desc(nodeValue string);
// 创建既往病史节点
CREATE TAG IF NOT EXISTS previous_history(name string);
CREATE TAG IF NOT EXISTS previous_history(nodeValue string);
// 创建现病史节点
CREATE TAG IF NOT EXISTS illness_history(name string);
CREATE TAG IF NOT EXISTS illness_history(nodeValue string);
// 创建个人史节点
CREATE TAG IF NOT EXISTS personal_history(name string);
CREATE TAG IF NOT EXISTS personal_history(nodeValue string);
// 创建过敏史节点
CREATE TAG IF NOT EXISTS allergy_history(name string);
CREATE TAG IF NOT EXISTS allergy_history(nodeValue string);
// 创建家族史节点
CREATE TAG IF NOT EXISTS family_history(name string);
CREATE TAG IF NOT EXISTS family_history(nodeValue string);
// 创建婚育史节点
CREATE TAG IF NOT EXISTS marriage_child_history(name string);
CREATE TAG IF NOT EXISTS marriage_child_history(nodeValue string);
// 创建手术史节点
CREATE TAG IF NOT EXISTS operation_history(name string);
CREATE TAG IF NOT EXISTS operation_history(nodeValue string);
// 创建症状节点
CREATE TAG IF NOT EXISTS symptoms(name string);
CREATE TAG IF NOT EXISTS symptoms(nodeValue string);
// 创建患者信息节点
CREATE TAG IF NOT EXISTS patient(name string);
CREATE TAG IF NOT EXISTS patient(nodeValue string);
// 创建体格检查节点
CREATE TAG IF NOT EXISTS physical(name string);
CREATE TAG IF NOT EXISTS physical(nodeValue string);
// 创建体格检查结果节点
CREATE TAG IF NOT EXISTS physical_result(name string);
CREATE TAG IF NOT EXISTS physical_result(nodeValue string);
// 创建辅助检查节点
CREATE TAG IF NOT EXISTS ancillary(name string);
CREATE TAG IF NOT EXISTS ancillary(nodeValue string);
// 创建辅助检查结果节点
CREATE TAG IF NOT EXISTS ancillary_result(name string);
CREATE TAG IF NOT EXISTS ancillary_result(nodeValue string);
// 创建处置节点
CREATE TAG IF NOT EXISTS treatment_plan(name string);
CREATE TAG IF NOT EXISTS treatment_plan(nodeValue string);
// 创建诊断(疾病)节点
CREATE TAG IF NOT EXISTS diagnosis(name string);
CREATE TAG IF NOT EXISTS diagnosis(nodeValue string);
// 创建无属性的边
CREATE EDGE IF NOT EXISTS no_property_edge();
// 创建单个属性的边
CREATE EDGE IF NOT EXISTS single_property_edge(name string);
CREATE EDGE IF NOT EXISTS single_property_edge(edgeValue string);
// 创建病历索引
CREATE TAG INDEX medical_rec_index ON medical_rec (name(64))
CREATE TAG INDEX medical_rec_index ON medical_rec (nodeValue(64))

Loading…
Cancel
Save