|
@@ -0,0 +1,808 @@
|
|
|
|
+package com.diagbot.service.impl;
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+import com.lantone.entity.node.*;
|
|
|
|
+import com.lantone.entity.node.base.BaseNode;
|
|
|
|
+import com.lantone.entity.relationship.*;
|
|
|
|
+import com.lantone.repository.*;
|
|
|
|
+import com.lantone.service.GraphService;
|
|
|
|
+
|
|
|
|
+//import org.apache.commons.collections4.IteratorUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.neo4j.driver.types.Node;
|
|
|
|
+import org.neo4j.driver.types.Path;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class GraphServiceImpl implements GraphService {
|
|
|
|
+ Logger logger = LoggerFactory.getLogger(GraphServiceImpl.class);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DiseaseRepository diseaseRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SymptomRepository symptomRepository;
|
|
|
|
+ /*
|
|
|
|
+ @Autowired
|
|
|
|
+ private VitalRepository vitalRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PACSRepository pacsRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PACSResultRepository pacsResultRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SurgeryRepository surgeryRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private GenderRepository genderRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DiseaseAliasRepository diseaseAliasRepository;
|
|
|
|
+ *
|
|
|
|
+ @Autowired
|
|
|
|
+ private SymptomAliasRepository symptomAliasRepository;
|
|
|
|
+ /*
|
|
|
|
+ @Autowired
|
|
|
|
+ private InfectiousGroupRepository infectiousGroupRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private InfectionRouteRepository infectionRouteRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TreatmentCycleRepository treatmentCycleRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CureRateRepository cureRateRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private AgeRepository ageRepository;
|
|
|
|
+ *
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseNodeRepository baseNodeRepository;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ @Autowired
|
|
|
|
+ private ADRGRepository adrgRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PreMDCRepository preMDCRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private MDCRepository mdcRepository;
|
|
|
|
+ *
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICDRepository icdRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICD10Repository icd10Repository;
|
|
|
|
+ /*
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICD11Repository icd11Repository;
|
|
|
|
+ */
|
|
|
|
+ /*
|
|
|
|
+ @Autowired
|
|
|
|
+ private IncidenceRepository incidenceRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WardRepository wardRepository;
|
|
|
|
+ *
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseRelationRepository baseRelationRepository;
|
|
|
|
+
|
|
|
|
+ private List<BaseNode> baseNodes;
|
|
|
|
+
|
|
|
|
+ private Pageable pageable;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除所有节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void removeNodes() {
|
|
|
|
+ baseNodeRepository.removeNodes();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除所有preMDC节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void removePreMDC() {
|
|
|
|
+ baseNodeRepository.removePreMDC();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除所有MDC节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void removeMDC() {
|
|
|
|
+ baseNodeRepository.removeMDC();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除所有DRG节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void removeADRG() {
|
|
|
|
+ baseNodeRepository.removeADRG();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除所有ICD节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void removeICD() {
|
|
|
|
+ baseNodeRepository.removeICD();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理症状节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Symptom addSymptom(Symptom symptom) {
|
|
|
|
+ return symptomRepository.add(symptom.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Symptom findSymptombyName(String name) {
|
|
|
|
+ return symptomRepository.findbyNameIs(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Symptom> find(Symptom symptom) {
|
|
|
|
+ return symptomRepository.findbyNameLike(symptom.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ @Override
|
|
|
|
+ public void deleteOneSymptom(long id) {
|
|
|
|
+ symptomRepository.deleteById(id);
|
|
|
|
+ }
|
|
|
|
+ *
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Symptom> getAllSymptom() {
|
|
|
|
+// pageable = getPageable(pageVo);
|
|
|
|
+ return IteratorUtils.toList(symptomRepository.findAll().iterator());
|
|
|
|
+ }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理体征节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Vital addVital(Vital vital) {
|
|
|
|
+ return vitalRepository.add(vital.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Vital> find(Vital vital) {
|
|
|
|
+ return vitalRepository.find(vital.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理年龄节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Age addAge(Age age) {
|
|
|
|
+ return ageRepository.add(age.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Age find(Age age) {
|
|
|
|
+ return ageRepository.find(age.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理性别节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Gender addGender(Gender gender) { return genderRepository.add(gender.getName()); }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Gender> find(Gender gender) { return genderRepository.find(gender.getName()); }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease addDisease(Disease disease) {
|
|
|
|
+ return diseaseRepository.add(disease.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ @Override
|
|
|
|
+ public Disease findOneDisease(long id) {
|
|
|
|
+ return diseaseRepository.findById(id).get();
|
|
|
|
+ }
|
|
|
|
+ *
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Disease findDiseasebyName(String name) {
|
|
|
|
+ return diseaseRepository.findByNameIs(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ @Override
|
|
|
|
+ public List<Disease> find(Disease disease) {
|
|
|
|
+ return diseaseRepository.findByNameLike(disease.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void deleteOneDisease(long id) {
|
|
|
|
+ diseaseRepository.deleteById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理辅检节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public PACS addPACS(PACS pacs) {
|
|
|
|
+ return pacsRepository.add(pacs.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理辅检结果节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public PACSResult addPACSResult(PACSResult pacsResult) {
|
|
|
|
+ return pacsResultRepository.add(pacsResult.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理手术节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Surgery addSurgery(Surgery surgery) {
|
|
|
|
+ return surgeryRepository.save(surgery);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加先期处理节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public PreMDC addPreMDC(PreMDC preMDC) { return preMDCRepository.save(preMDC); }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加主要诊断大类节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public MDC addMDC(MDC mdc) { return mdcRepository.save(mdc); }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查找主要诊断大类节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public MDC findMDC(String code) { return mdcRepository.find(code); }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public MDC findMDC(String code, String name) { return mdcRepository.find(code, name); }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加诊断相关组节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public ADRG addADRG(ADRG adrg) { return adrgRepository.save(adrg); }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查找诊断相关组节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public ADRG findADRG(String code, String name) { return adrgRepository.find(code, name); }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加ICD节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public ICD addICD(ICD icd) { return icdRepository.add(icd.getName()); }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加ICD-10节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public ICD10 addICD10(ICD10 icd10) { return icd10Repository.add(icd10.getName()); }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加ICD-11节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public ICD11 addICD11(ICD11 icd11) { return icd11Repository.add(icd11.getName()); }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加科室节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Ward addWard(Ward ward) {
|
|
|
|
+ String name = ward.getName();
|
|
|
|
+ if (StringUtils.isNumeric(ward.getName().substring(0,1))) {
|
|
|
|
+ name = ward.getName().substring(1);
|
|
|
|
+ }
|
|
|
|
+ return wardRepository.add(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加疾病别名节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Alias addDiseaseAlias(Disease_Alias disease_alias) {
|
|
|
|
+ return diseaseAliasRepository.add(disease_alias.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加症状别名节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Symptom_Alias addSymptomAlias(Symptom_Alias symptom_alias) {
|
|
|
|
+ return symptomAliasRepository.add(symptom_alias.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加疾病易发人群节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public InfectiousGroup addInfectiousGroup(InfectiousGroup infectiousGroup) {
|
|
|
|
+ return infectiousGroupRepository.add(infectiousGroup.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理传染途径节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public InfectionRoute addInfectionRoute(InfectionRoute infectionRoute) {
|
|
|
|
+ return infectionRouteRepository.add(infectionRoute.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理治疗周期节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public TreatmentCycle addTreatmentCycle(TreatmentCycle treatmentCycle) {
|
|
|
|
+ return treatmentCycleRepository.add(treatmentCycle.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理治愈率节点相关的申请
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public CureRate addCureRate(CureRate cureRate) {
|
|
|
|
+ return cureRateRepository.add(cureRate.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到ICD10节点间关系
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public void connectDiseasetoICD10(Disease disease, ICD10 icd10, String relation) {
|
|
|
|
+ baseNodeRepository.connectDiseasetoICD10(disease.getName(), icd10.getName(), relation);
|
|
|
|
+ }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到ICD节点间关系
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_ICD DiseasetoICD(Disease disease, ICD icd, String relation) {
|
|
|
|
+ Disease_ICD disease_icd = baseRelationRepository.DiseasetoICD(disease.getName(), icd.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_icd) {
|
|
|
|
+ disease = disease_icd.getDisease();
|
|
|
|
+ icd = disease_icd.getIcd();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != icd) {
|
|
|
|
+ disease.setIcd(icd);
|
|
|
|
+ icd.setDisease(disease);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_icd;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到ICD10节点间关系
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_ICD10 DiseasetoICD10(Disease disease, ICD10 icd10, String relation) {
|
|
|
|
+ Disease_ICD10 disease_icd10 = baseRelationRepository.DiseasetoICD10(disease.getName(), icd10.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_icd10) {
|
|
|
|
+ disease = disease_icd10.getDisease();
|
|
|
|
+ icd10 = disease_icd10.getIcd10();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != icd10) {
|
|
|
|
+ disease.setIcd10(icd10);
|
|
|
|
+ icd10.setDisease(disease);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_icd10;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加发病率节点
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Incidence addIncidence(Incidence incidence) { return incidenceRepository.add(incidence.getName()); }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到发病率节点间的关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Incidence DiseasetoIncidence(Disease disease, Incidence incidence, String relation) {
|
|
|
|
+ Disease_Incidence disease_incidence =
|
|
|
|
+ baseRelationRepository.DiseasetoIncidence(disease.getName(), incidence.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_incidence) {
|
|
|
|
+ disease = disease_incidence.getDisease();
|
|
|
|
+ incidence = disease_incidence.getIncidence();
|
|
|
|
+
|
|
|
|
+ if (null != disease && incidence != null) {
|
|
|
|
+ disease.setIncidence(incidence);
|
|
|
|
+ incidence.setDisease(disease);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_incidence;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到症状的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Symptom DiseasetoSymptom(Disease disease, Symptom symptom, String relation) {
|
|
|
|
+ Disease_Symptom disease_symptom =
|
|
|
|
+ baseRelationRepository.DiseasetoSymptom(disease.getName(), symptom.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_symptom) {
|
|
|
|
+ disease = disease_symptom.getDisease();
|
|
|
|
+ symptom = disease_symptom.getSymptom();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != symptom) {
|
|
|
|
+ disease.setSymptom(symptom);
|
|
|
|
+ symptom.setDisease(disease);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_symptom;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到体征的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Vital DiseasetoVital(Disease disease, Vital vital, String relation) {
|
|
|
|
+ Disease_Vital disease_vital =
|
|
|
|
+ baseRelationRepository.DiseasetoVital(disease.getName(), vital.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_vital) {
|
|
|
|
+ disease = disease_vital.getDisease();
|
|
|
|
+ vital = disease_vital.getVital();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != vital) {
|
|
|
|
+ disease.setVital(vital);
|
|
|
|
+ vital.setDisease(disease);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_vital;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到性别的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Gender DiseasetoGender(Disease disease, Gender gender, String relation) {
|
|
|
|
+ Disease_Gender disease_gender =
|
|
|
|
+ baseRelationRepository.DiseasetoGender(disease.getName(), gender.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_gender) {
|
|
|
|
+ disease = disease_gender.getDisease();
|
|
|
|
+ gender = disease_gender.getGender();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_gender;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到疾病别名的节点之间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_DiseaseAlias DiseasetoDiseaseAlias(Disease disease, Disease_Alias disease_alias, String relation) {
|
|
|
|
+ Disease_DiseaseAlias disease_diseaseAlias =
|
|
|
|
+ baseRelationRepository.DiseasetoDiseaseAlias(disease.getName(), disease_alias.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_diseaseAlias) {
|
|
|
|
+ disease = disease_diseaseAlias.getDisease();
|
|
|
|
+ disease_alias = disease_diseaseAlias.getDisease_alias();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_diseaseAlias;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理症状节点到症状别名的节点之间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Symptom_SymptomAlias SymptomtoSymptomAlias(Symptom symptom, Symptom_Alias symptom_alias, String relation) {
|
|
|
|
+ Symptom_SymptomAlias symptom_symptomAlias =
|
|
|
|
+ baseRelationRepository.SymptomtoSymptomAlias(symptom.getName(), symptom_alias.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != symptom_symptomAlias) {
|
|
|
|
+ symptom = symptom_symptomAlias.getSymptom();
|
|
|
|
+ symptom_alias = symptom_symptomAlias.getSymptom_alias();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return symptom_symptomAlias;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到多发人群的节点之间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_InfectiousGroup DiseasetoInfectiousGroup(Disease disease, InfectiousGroup infectiousGroup, String relation) {
|
|
|
|
+ Disease_InfectiousGroup disease_infectiousGroup =
|
|
|
|
+ baseRelationRepository.DiseasetoInfectiousGroup(disease.getName(), infectiousGroup.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_infectiousGroup) {
|
|
|
|
+ disease = disease_infectiousGroup.getDisease();
|
|
|
|
+ infectiousGroup = disease_infectiousGroup.getInfectiousGroup();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_infectiousGroup;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到传染途径的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_InfectionRoute DiseasetoInfectionRoute(Disease disease, InfectionRoute route, String relation) {
|
|
|
|
+ Disease_InfectionRoute disease_infectionRoute =
|
|
|
|
+ baseRelationRepository.DiseasetoInfectionRoute(disease.getName(), route.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_infectionRoute) {
|
|
|
|
+ disease = disease_infectionRoute.getDisease();
|
|
|
|
+ route = disease_infectionRoute.getInfectionRoute();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_infectionRoute;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到治疗周期的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_TreatmentCycle DiseasetoTreatmentCycle(Disease disease, TreatmentCycle treatmentCycle, String relation) {
|
|
|
|
+ Disease_TreatmentCycle disease_treatmentCycle =
|
|
|
|
+ baseRelationRepository.DiseasetoTreatmentCycle(disease.getName(), treatmentCycle.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_treatmentCycle) {
|
|
|
|
+ disease = disease_treatmentCycle.getDisease();
|
|
|
|
+ treatmentCycle = disease_treatmentCycle.getTreatmentCycle();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_treatmentCycle;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到治愈率的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_CureRate DiseasetoCureRate(Disease disease, CureRate cureRate, String relation) {
|
|
|
|
+ Disease_CureRate disease_cureRate =
|
|
|
|
+ baseRelationRepository.DiseasetoCureRate(disease.getName(), cureRate.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_cureRate) {
|
|
|
|
+ disease = disease_cureRate.getDisease();
|
|
|
|
+ cureRate = disease_cureRate.getCureRate();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_cureRate;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到科室的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Ward DiseasetoWard(Disease disease, Ward ward, String relation) {
|
|
|
|
+ String rank = ward.getName().substring(0,1);
|
|
|
|
+ String ward_name = ward.getName().substring(1);
|
|
|
|
+// wardRepository.rename(ward.getName(), ward_name);
|
|
|
|
+ Disease_Ward disease_ward =
|
|
|
|
+ baseRelationRepository.DiseasetoWard(disease.getName(), ward_name, rank);
|
|
|
|
+
|
|
|
|
+ return disease_ward;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到标准科室的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_StdWard DiseasetoStdWard(Disease disease, Ward ward, String relation) {
|
|
|
|
+
|
|
|
|
+ Disease_StdWard disease_stdward =
|
|
|
|
+ baseRelationRepository.DiseasetoStdWard(disease.getName(), ward.getName(), relation);
|
|
|
|
+
|
|
|
|
+ return disease_stdward;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到鉴别诊断的节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Disease DiseasetoDisease(Disease disease, Disease diff, String relation) {
|
|
|
|
+ Disease_Disease disease_diff =
|
|
|
|
+ baseRelationRepository.DiseasetoDisease(disease.getName(), diff.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_diff) {
|
|
|
|
+ disease = disease_diff.getDisease();
|
|
|
|
+ diff = disease_diff.getDiff_disease();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != diff) {
|
|
|
|
+ disease.setDisease(diff);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_diff;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理疾病节点到年龄节点间关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public Disease_Age DiseasetoAge(Disease disease, Age age, String relation) {
|
|
|
|
+ Disease_Age disease_age =
|
|
|
|
+ baseRelationRepository.DiseasetoAge(disease.getName(), age.getName(), relation);
|
|
|
|
+
|
|
|
|
+ if (null != disease_age) {
|
|
|
|
+ disease = disease_age.getDisease();
|
|
|
|
+ age = disease_age.getAge();
|
|
|
|
+
|
|
|
|
+ if (null != disease && null != age) {
|
|
|
|
+ disease.setAge(age);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return disease_age;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ @Override
|
|
|
|
+ public List<BaseRelation> getRelation(Long start_id, String name) {
|
|
|
|
+ return relationRepository.getRelation(start_id, name);
|
|
|
|
+ }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据节点的名称查询
|
|
|
|
+ * @param name
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<BaseNode> getNodesbyName(String name) {
|
|
|
|
+ if (name.contains("*")) {
|
|
|
|
+ name = name.replaceAll("\\*",".\\*");
|
|
|
|
+ return baseNodeRepository.getNodesbyNameLike(name);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return baseNodeRepository.getNodesbyNameIs(name);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据起始节点的名称和关系查询终止节点
|
|
|
|
+// * @param name
|
|
|
|
+// * @param relation
|
|
|
|
+ * @return List<BaseNode>
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<BaseNode> getNodesbyName_Relation(String name, String relation) {
|
|
|
|
+ return baseNodeRepository.getNodesbyName_Relation(name, relation);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有标签
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<List<String>> getLabels() {
|
|
|
|
+ return baseNodeRepository.getLabels();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取单个症状,疾病和科室的关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getS_D_W_Relations(String symp) {
|
|
|
|
+ return baseRelationRepository.getS_D_WRelation(symp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取两个症状,疾病和科室的关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getS2_D_W_Relations(String symp1, String symp2) {
|
|
|
|
+ return baseRelationRepository.getS2_D_WRelation(symp1, symp2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取三个症状,疾病和科室的关系
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getS3_D_W_Relations(String symp1, String symp2, String symp3) {
|
|
|
|
+ return baseRelationRepository.getS3_D_WRelation(symp1, symp2, symp3);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据科室获取相关症状
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getRelatedSympsbyWard(String ward) {
|
|
|
|
+ return baseRelationRepository.getRelatedSympbyward(ward);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据科室及发病率获取相关诊断
|
|
|
|
+ *
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> getRelatedDiseasebyWard(List<String> wards) {
|
|
|
|
+ return baseRelationRepository.getRelatedDiseasebyward(wards);
|
|
|
|
+ }
|
|
|
|
+ *
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+ */
|