瀏覽代碼

从图谱导入诊断关联

gaodm 4 年之前
父節點
當前提交
fc8f730c1b

+ 50 - 1
src/main/java/com/diagbot/facade/ExportFacade.java

@@ -328,6 +328,10 @@ public class ExportFacade {
     }
 
     private void import2MySqlR(List<ExportRelation> exportRelations, Integer stype, Integer etype, Map<String, KlConcept> map) {
+        import2MySqlR(exportRelations, stype, etype, 600, map);
+    }
+
+    private void import2MySqlR(List<ExportRelation> exportRelations, Integer stype, Integer etype, Integer rType, Map<String, KlConcept> map) {
         List<KlRelation> klRelations = new ArrayList<>();
         for (ExportRelation exportRelation : exportRelations) {
             if (null != map.get(exportRelation.getSname() + "_" + stype)
@@ -335,13 +339,58 @@ public class ExportFacade {
                 KlRelation klRelation = new KlRelation();
                 klRelation.setStartId(map.get(exportRelation.getSname() + "_" + stype).getId());
                 klRelation.setEndId(map.get(exportRelation.getEname() + "_" + etype).getId());
-                klRelation.setRelationId(600);
+                klRelation.setRelationId(rType);
                 klRelations.add(klRelation);
             }
         }
         klRelationService.saveBatch(klRelations);
     }
 
+    public Map<String, Object> importExcelGraphDB() {
+        graphRelationDealdiagnose();
+        return null;
+    }
+
+    private void graphRelationDealdiagnose() {
+        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.symptomMainPush();
+        import2MySqlR(exportRelations, 100, 103, 501, map);
+        //次症状
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.symptomSecPush();
+        import2MySqlR(exportRelations, 100, 103, 502, map);
+        //体格检查结果
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.vitalPush();
+        import2MySqlR(exportRelations, 100, 105, 503, map);
+        //实验室检查套餐
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.lisPush();
+        import2MySqlR(exportRelations, 100, 107, 504, map);
+        //辅助检查项目
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.pacsPush();
+        import2MySqlR(exportRelations, 100, 109, 505, map);
+        //药品通用名
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.drugPush();
+        import2MySqlR(exportRelations, 100, 101, 506, map);
+        //手术和操作
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.operationPush();
+        import2MySqlR(exportRelations, 100, 106, 507, map);
+        //鉴别诊断
+        exportRelations.clear();
+        exportRelations = exportRelationRepository.diffDiagnosePush();
+        import2MySqlR(exportRelations, 100, 100, 508, map);
+    }
+
     public Map<String, Object> importExcel(MultipartFile file) {
         List<ImportDataVO> data = ExcelUtils.importExcel(file, 0, 1, ImportDataVO.class);
         List<KlConcept> klConcepts

+ 26 - 1
src/main/java/com/diagbot/repository/ExportRelationRepository.java

@@ -9,7 +9,7 @@ import org.springframework.data.neo4j.repository.Neo4jRepository;
 import java.util.List;
 
 public interface ExportRelationRepository extends Neo4jRepository<ExportRelationInfo, Long> {
-
+    //=======层级结构导入=======
     @Query("MATCH (c:药品化学物质类别)<-[r:药品相关药品化学物质类别]-(y:药品代码通用名)-[r1:药品相关药品通用名称]->(m:药品通用名称)  RETURN DISTINCT trim(c.name) as sname,trim(m.name) as ename")
     List<ExportRelation> getDrugRelationA();
 
@@ -27,4 +27,29 @@ public interface ExportRelationRepository extends Neo4jRepository<ExportRelation
 
     @Query("MATCH (n:`辅助检查名称`)-[r:辅助检查名称包含辅助检查子项目名称]->(m:`辅助检查子项目名称`) RETURN DISTINCT trim(n.name) as sname,trim(m.name) as ename")
     List<ExportRelation> getPacsRelation();
+
+    //============诊断依据导入=======
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关典型症状]->(k:症状) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> symptomMainPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关伴随症状]->(k:症状) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> symptomSecPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关体征]->(k:体征) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> vitalPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关化验套餐名称]->(k:化验套餐名称) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> lisPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关辅助检查名称]->(k:辅助检查名称) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> pacsPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关药物治疗]->(k:药物治疗) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> drugPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关医保手术和操作名称]->(k:医保手术和操作名称) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> operationPush();
+
+    @Query("match(d:医保疾病名称)-[r:医保疾病名称相关鉴别诊断]->(k:鉴别诊断) return DISTINCT trim(d.name) as sname,trim(k.name) as ename")
+    List<ExportRelation> diffDiagnosePush();
 }

+ 10 - 0
src/main/java/com/diagbot/web/ExportController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.Map;
 
@@ -41,9 +42,18 @@ public class ExportController {
         return RespDTO.onSuc(exportFacade.gdbExportRelation());
     }
 
+    @ApiOperation(value = "诊断依据从图谱导入[gaodm]",
+            notes = "")
+    @PostMapping("/importExcelGraphDB")
+    public RespDTO<Map<String, Object>> importExcelGraphDB() {
+        return RespDTO.onSuc(exportFacade.importExcelGraphDB());
+    }
+
     @ApiOperation(value = "诊断依据导入[gaodm]",
             notes = "")
     @PostMapping("/diagnoseImport")
+    @ApiIgnore
+    @Deprecated
     public RespDTO<Map<String, Object>> diagnoseImport(@RequestParam("file") MultipartFile file) {
         return RespDTO.onSuc(exportFacade.importExcel(file));
     }