|
@@ -1,16 +1,21 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.entity.KlConcept;
|
|
|
import com.diagbot.entity.KlConceptCommon;
|
|
|
import com.diagbot.entity.KlDisease;
|
|
|
import com.diagbot.entity.KlLibraryInfo;
|
|
|
+import com.diagbot.entity.KlRelation;
|
|
|
import com.diagbot.entity.node.ExportNode;
|
|
|
+import com.diagbot.entity.node.ExportRelation;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.repository.ExportNodeRepository;
|
|
|
import com.diagbot.repository.ExportRelationRepository;
|
|
|
import com.diagbot.service.KlConceptCommonService;
|
|
|
import com.diagbot.service.KlConceptService;
|
|
|
import com.diagbot.service.KlDiseaseService;
|
|
|
import com.diagbot.service.KlLibraryInfoService;
|
|
|
+import com.diagbot.service.KlRelationService;
|
|
|
import com.diagbot.util.Cn2SpellUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,12 +44,12 @@ public class ExportFacade {
|
|
|
private KlConceptCommonService klConceptCommonService;
|
|
|
@Autowired
|
|
|
private KlDiseaseService klDiseaseService;
|
|
|
+ @Autowired
|
|
|
+ private KlRelationService klRelationService;
|
|
|
|
|
|
- public Boolean gdbExport() {
|
|
|
+ public Boolean gdbExportNode() {
|
|
|
//图谱数据节点处理
|
|
|
graphNodeDeal();
|
|
|
- //图谱关系处理
|
|
|
- graphRelationDeal();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -193,7 +198,53 @@ public class ExportFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Boolean gdbExportRelation() {
|
|
|
+ //图谱关系处理
|
|
|
+ graphRelationDeal();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private void graphRelationDeal() {
|
|
|
+ List<KlConcept> klConcepts
|
|
|
+ = klConceptService.list(new QueryWrapper<KlConcept>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ );
|
|
|
+ Map<String, KlConcept> map
|
|
|
+ = EntityUtil.makeEntityMapByKeys(klConcepts, "_", "libName", "libType");
|
|
|
+ //药品化学物质类别树形结构
|
|
|
+ List<ExportRelation> exportRelations = exportRelationRepository.getDrugRelationA();
|
|
|
+ import2MySqlR(exportRelations, 301, 101, map);
|
|
|
+ //药品治疗学类别树形结构
|
|
|
+ exportRelations.clear();
|
|
|
+ exportRelations = exportRelationRepository.getDrugRelationB();
|
|
|
+ import2MySqlR(exportRelations, 302, 101, map);
|
|
|
+ //药品药理学类别树形结构
|
|
|
+ exportRelations.clear();
|
|
|
+ exportRelations = exportRelationRepository.getDrugRelationC();
|
|
|
+ import2MySqlR(exportRelations, 303, 101, map);
|
|
|
+ //药品解剖学类别树形结构
|
|
|
+ exportRelations.clear();
|
|
|
+ exportRelations = exportRelationRepository.getDrugRelationD();
|
|
|
+ import2MySqlR(exportRelations, 304, 101, map);
|
|
|
+ //实验室检查类别树形结构
|
|
|
+ exportRelations.clear();
|
|
|
+ exportRelations = exportRelationRepository.getLisRelation();
|
|
|
+ import2MySqlR(exportRelations, 107, 108, map);
|
|
|
+ //辅助检查类别树形结构
|
|
|
+ exportRelations.clear();
|
|
|
+ exportRelations = exportRelationRepository.getPacsRelation();
|
|
|
+ import2MySqlR(exportRelations, 109, 110, map);
|
|
|
+ }
|
|
|
|
|
|
+ private void import2MySqlR(List<ExportRelation> exportRelations, Integer stype, Integer etype, Map<String, KlConcept> map) {
|
|
|
+ List<KlRelation> klRelations = new ArrayList<>();
|
|
|
+ for (ExportRelation exportRelation : exportRelations) {
|
|
|
+ KlRelation klRelation = new KlRelation();
|
|
|
+ klRelation.setStartId(map.get(exportRelation.getSname() + "_" + stype).getId());
|
|
|
+ klRelation.setEndId(map.get(exportRelation.getEname() + "_" + etype).getId());
|
|
|
+ klRelation.setRelationId(600);
|
|
|
+ klRelations.add(klRelation);
|
|
|
+ }
|
|
|
+ klRelationService.saveBatch(klRelations);
|
|
|
}
|
|
|
}
|