集成知识图谱到项目中
parent
90025163a7
commit
6ff12672e8
@ -0,0 +1,22 @@
|
||||
package com.supervision.annotations;
|
||||
|
||||
// Copyright (c) 2022 All project authors. All rights reserved.
|
||||
//
|
||||
// This source code is licensed under Apache 2.0 License.
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author yeweicheng
|
||||
* @since 2022-11-29 22:19
|
||||
* <br>Now is history!
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ValueType {
|
||||
|
||||
Class<?> value();
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.supervision.config;
|
||||
|
||||
// Copyright (c) 2022 All project authors. All rights reserved.
|
||||
//
|
||||
// This source code is licensed under Apache 2.0 License.
|
||||
|
||||
import com.supervision.annotations.ValueType;
|
||||
import com.vesoft.nebula.Value;
|
||||
import org.nebula.contrib.ngbatis.binding.Setter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yeweicheng
|
||||
* @since 2022-11-29 20:38
|
||||
* <br> Now is history!
|
||||
*/
|
||||
@Component
|
||||
public class BigDecimalSetter implements Setter<BigDecimal> {
|
||||
|
||||
@Override
|
||||
public Object set(BigDecimal param) {
|
||||
return param.doubleValue();
|
||||
}
|
||||
|
||||
public Object set(BigDecimal param, Field field) {
|
||||
ValueType annotation = field.getAnnotation(ValueType.class);
|
||||
Class<?> valueType = annotation.value();
|
||||
return valueType == Byte.class ? Value.iVal(param.byteValue())
|
||||
: valueType == Short.class ? Value.iVal(param.shortValue())
|
||||
: valueType == Integer.class ? Value.iVal(param.intValue())
|
||||
: valueType == Long.class ? Value.iVal(param.longValue())
|
||||
: valueType == Float.class ? Value.fVal(param.floatValue())
|
||||
: Value.fVal(param.doubleValue());
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.config;
|
||||
|
||||
// Copyright (c) 2022 All project authors. All rights reserved.
|
||||
//
|
||||
// This source code is licensed under Apache 2.0 License.
|
||||
|
||||
import org.nebula.contrib.ngbatis.PkGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 主键生成样例
|
||||
*
|
||||
* @author yeweicheng
|
||||
* @since 2022-06-14 12:32
|
||||
* <br>Now is history!
|
||||
*/
|
||||
@Configuration
|
||||
public class PkGeneratorConfig {
|
||||
|
||||
@Bean
|
||||
public PkGenerator pkGenerator() {
|
||||
return new SnowflakePKGenerator();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.supervision.config;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import org.nebula.contrib.ngbatis.PkGenerator;
|
||||
|
||||
public class SnowflakePKGenerator implements PkGenerator {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public <T> T generate(String tagName, Class<T> pkType) {
|
||||
if (pkType == String.class) {
|
||||
return (T) IdUtil.getSnowflakeNextIdStr();
|
||||
}
|
||||
return (T) Long.valueOf(IdUtil.getSnowflakeNextIdStr());
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.supervision.controller;
|
||||
|
||||
import com.supervision.service.GraphNebulaService;
|
||||
import io.swagger.annotations.Api;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "Nebula图谱")
|
||||
@RestController("nebulaGraph")
|
||||
@RequiredArgsConstructor
|
||||
public class GraphNebulaController {
|
||||
|
||||
private final GraphNebulaService graphNebulaService;
|
||||
|
||||
@GetMapping("createGraph")
|
||||
public void createGraph(String processId) {
|
||||
graphNebulaService.creatGraphByNebula(processId);
|
||||
}
|
||||
|
||||
@GetMapping("queryGraph")
|
||||
public List<NgSubgraph<String>> queryGraph(String processId) {
|
||||
return graphNebulaService.queryGraph(processId);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.AllergyHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface AllergyHistoryDao extends NebulaDaoBasic<AllergyHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.AncillaryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface AncillaryDao extends NebulaDaoBasic<AncillaryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.AncillaryResultVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface AncillaryResultDao extends NebulaDaoBasic<AncillaryResultVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.DiagnosisVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface DiagnosisDao extends NebulaDaoBasic<DiagnosisVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.FamilyHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface FamilyHistoryDao extends NebulaDaoBasic<FamilyHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.IllnessHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface IllnessHistoryDao extends NebulaDaoBasic<IllnessHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.MarriageChildHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface MarriageChildHistoryDao extends NebulaDaoBasic<MarriageChildHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.MedicalRecVertex;
|
||||
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MedicalRecDao extends NebulaDaoBasic<MedicalRecVertex, String> {
|
||||
|
||||
List<NgSubgraph<String>> selectSubgraph(@Param("processGraphId") String medicalRecVid);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.OperationHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface OperationHistoryDao extends NebulaDaoBasic<OperationHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.PatientVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface PatientDao extends NebulaDaoBasic<PatientVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.PersonalHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface PersonalHistoryDao extends NebulaDaoBasic<PersonalHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.PhysicalVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface PhysicalDao extends NebulaDaoBasic<PhysicalVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.PhysicalResultVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface PhysicalResultDao extends NebulaDaoBasic<PhysicalResultVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.PreviousHistoryVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface PreviousHistoryDao extends NebulaDaoBasic<PreviousHistoryVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.ProcessMedicalVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface ProcessMedicalDao extends NebulaDaoBasic<ProcessMedicalVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.SelfDescVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface SelfDescDao extends NebulaDaoBasic<SelfDescVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.SymptomsVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface SymptomsDao extends NebulaDaoBasic<SymptomsVertex, String> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.supervision.dao;
|
||||
|
||||
import com.supervision.domain.TreatmentPlanVertex;
|
||||
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
|
||||
|
||||
public interface TreatmentPlanDao extends NebulaDaoBasic<TreatmentPlanVertex, String> {
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 过敏史
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "allergy_history")
|
||||
public class AllergyHistoryVertex {
|
||||
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 辅助检查结果
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "ancillary_result")
|
||||
public class AncillaryResultVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 体格检查节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "ancillary")
|
||||
public class AncillaryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 诊断(疾病)节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "diagnosis")
|
||||
public class DiagnosisVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 家族史
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "family_history")
|
||||
public class FamilyHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 现病史节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "illness_history")
|
||||
public class IllnessHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 婚育史
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "marriage_child_history")
|
||||
public class MarriageChildHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "medical_rec")
|
||||
public class MedicalRecVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 无属性节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "no_property_edge")
|
||||
public class NoPropertyEdge {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 手术史
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "operation_history")
|
||||
public class OperationHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 患者信息
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "patient")
|
||||
public class PatientVertex {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 个人史
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "personal_history")
|
||||
public class PersonalHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 辅助检查结果信息
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "physical_result")
|
||||
public class PhysicalResultVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 体格检查节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "physical")
|
||||
public class PhysicalVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 既往病史节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "previous_history")
|
||||
public class PreviousHistoryVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "process_medical")
|
||||
public class ProcessMedicalVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "process_medical")
|
||||
public class SelfDescVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 单一属性节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "single_property_edge")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SinglePropertyEdge {
|
||||
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 症状
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "symptoms")
|
||||
public class SymptomsVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 治疗计划节点
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "treatment_plan")
|
||||
public class TreatmentPlanVertex {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName: UserDto
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel("用户入参")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDto {
|
||||
|
||||
@ApiModelProperty(value = "用户名", required = true, example = "test")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "test")
|
||||
private String password;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("创建tag edge入参")
|
||||
public class GraphCreateTag {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi")
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge名称", example = "demo")
|
||||
private String tagEdgeName;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge描述", example = "备注")
|
||||
private String tagEdgeComment;
|
||||
|
||||
@ApiModelProperty(value = "属性集合")
|
||||
private List<PropertyBean> propertyList;
|
||||
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String color;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("删除空间实体")
|
||||
public class GraphDeleteSpace {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.supervision.service;
|
||||
|
||||
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GraphNebulaService {
|
||||
|
||||
void creatGraphByNebula(String processId);
|
||||
|
||||
List<NgSubgraph<String>> queryGraph(String processId);
|
||||
|
||||
}
|
@ -0,0 +1,246 @@
|
||||
package com.supervision.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.supervision.dao.*;
|
||||
import com.supervision.domain.*;
|
||||
import com.supervision.exception.BusinessException;
|
||||
import com.supervision.model.Process;
|
||||
import com.supervision.model.*;
|
||||
import com.supervision.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GraphNebulaServiceImpl implements GraphNebulaService {
|
||||
|
||||
private final ProcessService processService;
|
||||
private final TreatmentPlanRecordService treatmentPlanRecordService;
|
||||
private final ProcessMedicalService processMedicalService;
|
||||
private final MedicalRecService medicalRecService;
|
||||
private final DiagnosisPrimaryService diagnosisPrimaryService;
|
||||
private final DiagnosisAncillaryRecordService diagnosisAncillaryRecordService;
|
||||
private final DiagnosisPhysicalRecordService diagnosisPhysicalRecordService;
|
||||
private final ConfigPhysicalToolService configPhysicalToolService;
|
||||
private final ConfigPhysicalLocationService configPhysicalLocationService;
|
||||
private final ConfigAncillaryItemService configAncillaryItemService;
|
||||
private final DiseaseService diseaseService;
|
||||
private final DiagnosisPrimaryRelationService diagnosisPrimaryRelationService;
|
||||
@Resource
|
||||
private MedicalRecDao medicalRecDao;
|
||||
@Resource
|
||||
private ProcessMedicalDao processMedicalDao;
|
||||
@Resource
|
||||
private SelfDescDao selfDescDao;
|
||||
@Resource
|
||||
private IllnessHistoryDao illnessHistoryDao;
|
||||
@Resource
|
||||
private PersonalHistoryDao personalHistoryDao;
|
||||
@Resource
|
||||
private AllergyHistoryDao allergyHistoryDao;
|
||||
@Resource
|
||||
private PreviousHistoryDao previousHistoryDao;
|
||||
@Resource
|
||||
private FamilyHistoryDao familyHistoryDao;
|
||||
@Resource
|
||||
private OperationHistoryDao operationHistoryDao;
|
||||
@Resource
|
||||
private PatientDao patientDao;
|
||||
@Resource
|
||||
private PhysicalDao physicalDao;
|
||||
@Resource
|
||||
private AncillaryDao ancillaryDao;
|
||||
@Resource
|
||||
private DiagnosisDao diagnosisDao;
|
||||
@Resource
|
||||
private AncillaryResultDao ancillaryResultDao;
|
||||
|
||||
@Override
|
||||
public void creatGraphByNebula(String processId) {
|
||||
Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到流程,创建图谱失败"));
|
||||
// 根据processId找到对应的诊疗计划,如果没有找到,说明治疗流程未完成,诊断失败
|
||||
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
|
||||
Assert.notEmpty(treatmentPlanRecordList, () -> new BusinessException("治疗计划为空,请先完成治疗计划"));
|
||||
Integer disposalMethod = treatmentPlanRecordList.stream().findAny().orElseThrow(() -> new BusinessException("治疗计划为空,请先完成治疗计划")).getDisposalMethod();
|
||||
|
||||
// 首先创建一个病历
|
||||
MedicalRecVertex medicalRecVertex = new MedicalRecVertex();
|
||||
medicalRecVertex.setName((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") + ")");
|
||||
processMedicalDao.insert(processMedicalVertex);
|
||||
|
||||
medicalRecDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), processMedicalVertex);
|
||||
// 创建主诉节点
|
||||
if (StrUtil.isNotBlank(processMedical.getPatientSelfDesc())) {
|
||||
SelfDescVertex selfDescVertex = new SelfDescVertex();
|
||||
selfDescVertex.setName("主诉:" + processMedical.getPatientSelfDesc());
|
||||
selfDescDao.insert(selfDescVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), selfDescVertex);
|
||||
}
|
||||
// 创建现病史节点
|
||||
if (StrUtil.isNotBlank(processMedical.getIllnessHistory())) {
|
||||
IllnessHistoryVertex illnessHistoryVertex = new IllnessHistoryVertex();
|
||||
illnessHistoryVertex.setName("现病史:" + processMedical.getIllnessHistory());
|
||||
illnessHistoryDao.insert(illnessHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), illnessHistoryVertex);
|
||||
}
|
||||
// 创建个人史节点
|
||||
if (StrUtil.isNotBlank(processMedical.getPersonalHistory())) {
|
||||
PersonalHistoryVertex personalHistoryVertex = new PersonalHistoryVertex();
|
||||
personalHistoryVertex.setName("个人史:" + processMedical.getPersonalHistory());
|
||||
personalHistoryDao.insert(personalHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), personalHistoryVertex);
|
||||
}
|
||||
// 创建过敏史节点
|
||||
if (ObjectUtil.isNotEmpty(processMedical.getAllergyHistoryFlag()) && 1 == processMedical.getAllergyHistoryFlag() && StrUtil.isNotBlank(processMedical.getAllergyHistory())) {
|
||||
AllergyHistoryVertex allergyHistoryVertex = new AllergyHistoryVertex();
|
||||
allergyHistoryVertex.setName("过敏史:" + processMedical.getAllergyHistory());
|
||||
allergyHistoryDao.insert(allergyHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), allergyHistoryVertex);
|
||||
}
|
||||
// 创建既往史节点
|
||||
if (ObjectUtil.isNotEmpty(processMedical.getPreviousHistoryFlag()) && 1 == processMedical.getPreviousHistoryFlag() && StrUtil.isNotBlank(processMedical.getPreviousHistory())) {
|
||||
PreviousHistoryVertex previousHistoryVertex = new PreviousHistoryVertex();
|
||||
previousHistoryVertex.setName("既往史:" + processMedical.getPreviousHistory());
|
||||
previousHistoryDao.insert(previousHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), previousHistoryVertex);
|
||||
}
|
||||
// 创建家族史节点
|
||||
if (ObjectUtil.isNotEmpty(processMedical.getFamilyHistoryFlag()) && 1 == processMedical.getFamilyHistoryFlag() && StrUtil.isNotBlank(processMedical.getFamilyHistory())) {
|
||||
FamilyHistoryVertex familyHistoryVertex = new FamilyHistoryVertex();
|
||||
familyHistoryVertex.setName("家族史:" + processMedical.getFamilyHistory());
|
||||
familyHistoryDao.insert(familyHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), familyHistoryVertex);
|
||||
}
|
||||
// 创建手术史节点
|
||||
if (ObjectUtil.isNotEmpty(processMedical.getOperationHistory()) && 1 == processMedical.getOperationHistoryFlag() && StrUtil.isNotBlank(processMedical.getOperationHistory())) {
|
||||
OperationHistoryVertex operationHistoryVertex = new OperationHistoryVertex();
|
||||
operationHistoryVertex.setName("手术史:" + processMedical.getOperationHistory());
|
||||
operationHistoryDao.insert(operationHistoryVertex);
|
||||
// 保存节点之间的关系
|
||||
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), operationHistoryVertex);
|
||||
}
|
||||
// 创建患者节点
|
||||
MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历"));
|
||||
PatientVertex patientVertex = new PatientVertex();
|
||||
patientVertex.setName("患者:" + medicalRec.getPatientName());
|
||||
patientDao.insert(patientVertex);
|
||||
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), patientVertex);
|
||||
|
||||
// 创建体格检查节点(physicalId不为空,即为只查配置了检查结果的结果)
|
||||
List<DiagnosisPhysicalRecord> physicalRecordList = diagnosisPhysicalRecordService.lambdaQuery()
|
||||
.isNotNull(DiagnosisPhysicalRecord::getPhysicalId)
|
||||
.eq(DiagnosisPhysicalRecord::getProcessId, processId).list();
|
||||
Map<String, PhysicalVertex> physicalConfirmMap = new HashMap<>();
|
||||
for (DiagnosisPhysicalRecord physicalRecord : physicalRecordList) {
|
||||
ConfigPhysicalTool tool = configPhysicalToolService.getById(physicalRecord.getToolId());
|
||||
ConfigPhysicalLocation location = null;
|
||||
if (StrUtil.isNotBlank(physicalRecord.getLocationId())) {
|
||||
location = configPhysicalLocationService.getById(physicalRecord.getLocationId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(tool)) {
|
||||
PhysicalVertex physicalVertex = new PhysicalVertex();
|
||||
physicalVertex.setName("体格检查:" + tool.getToolName() + (location != null ? location.getLocationName() : ""));
|
||||
physicalDao.insert(physicalVertex);
|
||||
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), physicalVertex);
|
||||
// 如果是证实诊断依据,添加到证实诊断依据里面去
|
||||
if (NumberUtil.equals(1, physicalRecord.getBasisConfirmFlag())) {
|
||||
physicalConfirmMap.put(physicalRecord.getId(), physicalVertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 创建辅助检查节点
|
||||
List<DiagnosisAncillaryRecord> ancillaryRecordList = diagnosisAncillaryRecordService.lambdaQuery()
|
||||
.isNotNull(DiagnosisAncillaryRecord::getAncillaryId)
|
||||
.eq(DiagnosisAncillaryRecord::getProcessId, processId).list();
|
||||
Map<String, AncillaryVertex> ancillaryConfirmMap = new HashMap<>();
|
||||
for (DiagnosisAncillaryRecord diagnosisAncillaryRecord : ancillaryRecordList) {
|
||||
ConfigAncillaryItem configAncillaryItem = configAncillaryItemService.getById(diagnosisAncillaryRecord.getItemId());
|
||||
if (ObjectUtil.isNotEmpty(configAncillaryItem)) {
|
||||
AncillaryVertex ancillaryVertex = new AncillaryVertex();
|
||||
ancillaryVertex.setName("辅助检查:" + configAncillaryItem.getItemName());
|
||||
ancillaryDao.insert(ancillaryVertex);
|
||||
// 保存病历和辅助检查连线
|
||||
medicalRecDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), ancillaryVertex);
|
||||
// 结果节点
|
||||
AncillaryResultVertex ancillaryResultVertex = new AncillaryResultVertex();
|
||||
ancillaryResultVertex.setName(diagnosisAncillaryRecord.getResult());
|
||||
ancillaryResultDao.insert(ancillaryResultVertex);
|
||||
// 保存检查结果连线
|
||||
ancillaryDao.insertEdge(ancillaryVertex, new SinglePropertyEdge("结果"), ancillaryResultVertex);
|
||||
// 如果是证实诊断依据,添加到证实诊断依据里面去
|
||||
if (NumberUtil.equals(1, diagnosisAncillaryRecord.getBasisConfirmFlag())) {
|
||||
ancillaryConfirmMap.put(diagnosisAncillaryRecord.getId(), ancillaryVertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 创建诊断节点(这个诊断是最终诊断)
|
||||
List<DiagnosisPrimary> diagnosisPrimaryList = diagnosisPrimaryService.lambdaQuery().eq(DiagnosisPrimary::getProcessId, processId).eq(DiagnosisPrimary::getExcludeFlag, 1).list();
|
||||
Map<String, DiagnosisVertex> diagnosisMap = new HashMap<>();
|
||||
for (DiagnosisPrimary diagnosisPrimary : diagnosisPrimaryList) {
|
||||
Disease disease = diseaseService.getById(diagnosisPrimary.getPrimaryDiagnosisId());
|
||||
if (ObjectUtil.isNotEmpty(disease)) {
|
||||
DiagnosisVertex diagnosisVertex = new DiagnosisVertex();
|
||||
diagnosisVertex.setName("诊断:" + disease.getDiseaseNameAlias());
|
||||
diagnosisDao.insert(diagnosisVertex);
|
||||
diagnosisDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("诊断"), diagnosisVertex);
|
||||
diagnosisMap.put(diagnosisPrimary.getId(), diagnosisVertex);
|
||||
}
|
||||
}
|
||||
// 获取诊断和体格检查及辅助检查之间的关联关系
|
||||
List<DiagnosisPrimaryRelation> relationList = diagnosisPrimaryRelationService.lambdaQuery().eq(DiagnosisPrimaryRelation::getProcessId, processId).list();
|
||||
for (DiagnosisPrimaryRelation relation : relationList) {
|
||||
// 根据关系找到对应的疾病诊断节点
|
||||
DiagnosisVertex diagnosisVertex = diagnosisMap.get(relation.getPrimaryId());
|
||||
if (ObjectUtil.isNotEmpty(diagnosisVertex)) {
|
||||
// 如果疾病诊断不为空,则根据relationId,查询对应的体格检查节点
|
||||
PhysicalVertex physicalVertex = physicalConfirmMap.get(relation.getRelationId());
|
||||
if (ObjectUtil.isNotEmpty(physicalVertex)) {
|
||||
physicalDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("依据"), physicalVertex);
|
||||
}
|
||||
// 再尝试找辅助检查
|
||||
AncillaryVertex ancillaryVertex = ancillaryConfirmMap.get(relation.getRelationId());
|
||||
if (ObjectUtil.isNotEmpty(ancillaryVertex)) {
|
||||
ancillaryDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("依据"), ancillaryVertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("病历图谱ID:{}", medicalRecVertex.getId());
|
||||
processService.lambdaUpdate().set(Process::getGraphId, medicalRecVertex.getId()).eq(Process::getId, processId).update();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<NgSubgraph<String>> queryGraph(String processId) {
|
||||
Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到对应的问诊流程"));
|
||||
return medicalRecDao.selectSubgraph(process.getGraphId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.AllergyHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.AncillaryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.AncillaryResultDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.DiagnosisDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.FamilyHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.IllnessHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.MarriageChildHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<mapper namespace="com.supervision.dao.MedicalRecDao">
|
||||
|
||||
<select id="selectSubgraph" resultType="org.nebula.contrib.ngbatis.models.data.NgSubgraph">
|
||||
GET SUBGRAPH WITH PROP 100 STEPS FROM '${processGraphId}' YIELD VERTICES AS nodes, EDGES AS relationships
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.OperationHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.PatientDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.PersonalHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.PhysicalDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.PhysicalResultDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.PreviousHistoryDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.ProcessMedicalDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.SelfDescDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.SymptomsDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,3 @@
|
||||
<mapper namespace="com.supervision.dao.TreatmentPlanDao">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,53 @@
|
||||
DROP SPACE IF EXISTS virtual_patient; // 如果存在先删除图空间
|
||||
|
||||
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 process_medical(name string);
|
||||
// 创建主诉节点
|
||||
CREATE TAG IF NOT EXISTS self_desc(name string);
|
||||
// 创建既往病史节点
|
||||
CREATE TAG IF NOT EXISTS previous_history(name string);
|
||||
// 创建现病史节点
|
||||
CREATE TAG IF NOT EXISTS illness_history(name string);
|
||||
// 创建个人史节点
|
||||
CREATE TAG IF NOT EXISTS personal_history(name string);
|
||||
// 创建过敏史节点
|
||||
CREATE TAG IF NOT EXISTS allergy_history(name string);
|
||||
// 创建家族史节点
|
||||
CREATE TAG IF NOT EXISTS family_history(name string);
|
||||
// 创建婚育史节点
|
||||
CREATE TAG IF NOT EXISTS marriage_child_history(name string);
|
||||
// 创建手术史节点
|
||||
CREATE TAG IF NOT EXISTS operation_history(name string);
|
||||
// 创建症状节点
|
||||
CREATE TAG IF NOT EXISTS symptoms(name string);
|
||||
// 创建患者信息节点
|
||||
CREATE TAG IF NOT EXISTS patient(name string);
|
||||
// 创建体格检查节点
|
||||
CREATE TAG IF NOT EXISTS physical(name string);
|
||||
// 创建体格检查结果节点
|
||||
CREATE TAG IF NOT EXISTS physical_result(name string);
|
||||
// 创建辅助检查节点
|
||||
CREATE TAG IF NOT EXISTS ancillary(name string);
|
||||
// 创建辅助检查结果节点
|
||||
CREATE TAG IF NOT EXISTS ancillary_result(name string);
|
||||
// 创建处置节点
|
||||
CREATE TAG IF NOT EXISTS treatment_plan(name string);
|
||||
// 创建诊断(疾病)节点
|
||||
CREATE TAG IF NOT EXISTS diagnosis(name string);
|
||||
|
||||
// 创建无属性的边
|
||||
CREATE EDGE IF NOT EXISTS no_property_edge();
|
||||
// 创建单个属性的边
|
||||
CREATE EDGE IF NOT EXISTS single_property_edge(name string);
|
||||
|
||||
// 创建病历索引
|
||||
CREATE TAG INDEX medical_rec_index ON medical_rec (name(64))
|
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.supervision;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GenerateXml {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String sourcePath = "/Users/flevance/Java/virtual-patient/virtual-patient-graph/src/main/java/com/supervision/dao";
|
||||
String targetPath = "/Users/flevance/Java/virtual-patient/virtual-patient-graph/src/main/resources/nebulaMapper/";
|
||||
String packageName = "com.supervision.dao.";
|
||||
List<String> sourceFileList = FileUtil.listFileNames(sourcePath);
|
||||
for (String sourceFile : sourceFileList) {
|
||||
String newFileName = sourceFile.replace(".java", ".xml");
|
||||
/**
|
||||
* <mapper namespace="com.supervision.dao.MedicalRecDao">
|
||||
*
|
||||
* </mapper>
|
||||
*/
|
||||
if (!FileUtil.exist(targetPath + newFileName)) {
|
||||
File file = FileUtil.newFile(targetPath + newFileName);
|
||||
List<Object> lineList = new ArrayList<>();
|
||||
lineList.add("<mapper namespace=\"" + packageName + newFileName.replace(".xml", "") + "\">");
|
||||
lineList.add("");
|
||||
lineList.add("</mapper>");
|
||||
FileUtil.writeLines(lineList, file, Charset.defaultCharset());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue