|
@@ -10,6 +10,7 @@ import com.diagbot.entity.KlConceptStatic;
|
|
|
import com.diagbot.entity.KlDisease;
|
|
|
import com.diagbot.entity.KlLibraryInfo;
|
|
|
import com.diagbot.entity.KlRelation;
|
|
|
+import com.diagbot.entity.KlRelationOrder;
|
|
|
import com.diagbot.entity.KlRule;
|
|
|
import com.diagbot.entity.KlRuleBase;
|
|
|
import com.diagbot.entity.KlRuleCondition;
|
|
@@ -26,6 +27,7 @@ import com.diagbot.service.KlConceptService;
|
|
|
import com.diagbot.service.KlConceptStaticService;
|
|
|
import com.diagbot.service.KlDiseaseService;
|
|
|
import com.diagbot.service.KlLibraryInfoService;
|
|
|
+import com.diagbot.service.KlRelationOrderService;
|
|
|
import com.diagbot.service.KlRelationService;
|
|
|
import com.diagbot.service.KlRuleBaseService;
|
|
|
import com.diagbot.service.KlRuleConditionService;
|
|
@@ -82,6 +84,9 @@ public class ExportFacade {
|
|
|
@Qualifier("klRelationServiceImpl")
|
|
|
private KlRelationService klRelationService;
|
|
|
@Autowired
|
|
|
+ @Qualifier("klRelationOrderServiceImpl")
|
|
|
+ private KlRelationOrderService klRelationOrderService;
|
|
|
+ @Autowired
|
|
|
private TestFacade testFacade;
|
|
|
@Autowired
|
|
|
@Qualifier("klRuleServiceImpl")
|
|
@@ -321,29 +326,52 @@ public class ExportFacade {
|
|
|
Map<String, KlConcept> map = getConceptMap();
|
|
|
//药品化学物质类别树形结构
|
|
|
List<ExportRelation> exportRelations = exportRelationRepository.getDrugRelationA();
|
|
|
+ rootImport2MySqlR("药品化学物质类别", exportRelations, 402, 301, map);
|
|
|
import2MySqlR(exportRelations, 301, 101, map);
|
|
|
//药品治疗学类别树形结构
|
|
|
exportRelations.clear();
|
|
|
exportRelations = exportRelationRepository.getDrugRelationB();
|
|
|
+ rootImport2MySqlR("药品治疗学类别", exportRelations, 403, 302, map);
|
|
|
import2MySqlR(exportRelations, 302, 101, map);
|
|
|
//药品药理学类别树形结构
|
|
|
exportRelations.clear();
|
|
|
exportRelations = exportRelationRepository.getDrugRelationC();
|
|
|
+ rootImport2MySqlR("药品药理学类别", exportRelations, 404, 303, map);
|
|
|
import2MySqlR(exportRelations, 303, 101, map);
|
|
|
//药品解剖学类别树形结构
|
|
|
exportRelations.clear();
|
|
|
exportRelations = exportRelationRepository.getDrugRelationD();
|
|
|
+ rootImport2MySqlR("药品解剖学类别", exportRelations, 405, 304, map);
|
|
|
import2MySqlR(exportRelations, 304, 101, map);
|
|
|
//实验室检查类别树形结构
|
|
|
exportRelations.clear();
|
|
|
exportRelations = exportRelationRepository.getLisRelation();
|
|
|
+ rootImport2MySqlR("实验室检查", exportRelations, 408, 107, map);
|
|
|
import2MySqlR(exportRelations, 107, 108, map);
|
|
|
//辅助检查类别树形结构
|
|
|
exportRelations.clear();
|
|
|
exportRelations = exportRelationRepository.getPacsRelation();
|
|
|
+ rootImport2MySqlR("辅助检查", exportRelations, 409, 109, map);
|
|
|
import2MySqlR(exportRelations, 109, 110, map);
|
|
|
}
|
|
|
|
|
|
+ private void rootImport2MySqlR(String rootName, List<ExportRelation> exportRelations, Integer stype, Integer etype, Map<String, KlConcept> map) {
|
|
|
+ List<ExportRelation> rootRelations = new ArrayList<>();
|
|
|
+ List<String> sNames = new ArrayList<>();
|
|
|
+ for (ExportRelation exportRelation : exportRelations) {
|
|
|
+ if (!sNames.contains(exportRelation.getSname())) {
|
|
|
+ sNames.add(exportRelation.getSname());
|
|
|
+ ExportRelation rootRelation = new ExportRelation();
|
|
|
+ rootRelation.setSname(rootName);
|
|
|
+ rootRelation.setEname(exportRelation.getSname());
|
|
|
+ rootRelations.add(rootRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(rootRelations)){
|
|
|
+ import2MySqlR(rootRelations, stype, etype, 600, map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void import2MySqlR(List<ExportRelation> exportRelations, Integer stype, Integer etype, Map<String, KlConcept> map) {
|
|
|
import2MySqlR(exportRelations, stype, etype, 600, map);
|
|
|
}
|
|
@@ -361,6 +389,16 @@ public class ExportFacade {
|
|
|
}
|
|
|
}
|
|
|
klRelationService.saveBatch(klRelations);
|
|
|
+ Integer orderNo = 1;
|
|
|
+ List<KlRelationOrder> klRelationOrders = new ArrayList<>();
|
|
|
+ for (KlRelation klRelation : klRelations) {
|
|
|
+ KlRelationOrder klRelationOrder = new KlRelationOrder();
|
|
|
+ klRelationOrder.settRelationId(klRelation.getId());
|
|
|
+ klRelationOrder.setOrderNo(orderNo);
|
|
|
+ klRelationOrders.add(klRelationOrder);
|
|
|
+ orderNo++;
|
|
|
+ }
|
|
|
+ klRelationOrderService.saveBatch(klRelationOrders);
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> importExcelGraphDB() {
|