diff --git a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java index 77da4a15..4eb0cf5e 100644 --- a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java +++ b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java @@ -89,10 +89,11 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { List treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list(); Assert.notEmpty(treatmentPlanRecordList, () -> new BusinessException("治疗计划为空,请先完成治疗计划")); Integer disposalMethod = treatmentPlanRecordList.stream().findAny().orElseThrow(() -> new BusinessException("治疗计划为空,请先完成治疗计划")).getDisposalMethod(); - + MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历")); // 首先创建一个病历 MedicalRecVertex medicalRecVertex = new MedicalRecVertex(); - medicalRecVertex.setNodeValue((disposalMethod == 0 ? "门诊" : "住院") + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")"); + // 格式:患者名称-门诊(时间) + medicalRecVertex.setNodeValue((disposalMethod == 0 ? "门诊" : "住院") + "-" + medicalRec.getPatientName() + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")"); medicalRecDao.insert(medicalRecVertex); log.info("病历图谱ID:{}", medicalRecVertex.getId()); // 根据processId找到电子病历 @@ -159,13 +160,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { // 保存节点之间的关系 processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), operationHistoryVertex); } - // 创建患者节点 - MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历")); - PatientVertex patientVertex = new PatientVertex(); - patientVertex.setNodeValue(medicalRec.getPatientName()); - patientDao.insert(patientVertex); - processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), patientVertex); - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("问诊"), patientVertex); + // 创建体格检查节点(physicalId不为空,即为只查配置了检查结果的结果) List physicalRecordList = diagnosisPhysicalRecordService.lambdaQuery() diff --git a/virtual-patient-graph/src/main/resources/virtual-patient.nGQL b/virtual-patient-graph/src/main/resources/virtual-patient.nGQL index 09512f1d..e06f93b5 100644 --- a/virtual-patient-graph/src/main/resources/virtual-patient.nGQL +++ b/virtual-patient-graph/src/main/resources/virtual-patient.nGQL @@ -26,8 +26,6 @@ CREATE TAG IF NOT EXISTS marriage_child_history(nodeValue string); CREATE TAG IF NOT EXISTS operation_history(nodeValue string); // 创建症状节点 CREATE TAG IF NOT EXISTS symptoms(nodeValue string); -// 创建患者信息节点 -CREATE TAG IF NOT EXISTS patient(nodeValue string); // 创建体格检查节点 CREATE TAG IF NOT EXISTS physical(nodeValue string); // 创建体格检查结果节点