Browse Source

Merge remote-tracking branch 'origin/master'

MarkHuang 4 years ago
parent
commit
a97721292e

+ 98 - 70
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -9,11 +9,30 @@ import com.diagbot.dto.LisBillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.StandConvertCrfDTO;
-import com.diagbot.entity.node.*;
+import com.diagbot.entity.node.Disease;
+import com.diagbot.entity.node.LIS;
+import com.diagbot.entity.node.LISPack;
+import com.diagbot.entity.node.Medicine;
+import com.diagbot.entity.node.Medicine_Code;
+import com.diagbot.entity.node.OralMedicine;
+import com.diagbot.entity.node.PACS;
 import com.diagbot.enums.StandConvertEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.model.ai.ModelAI;
-import com.diagbot.repository.*;
+import com.diagbot.repository.DiseaseNode;
+import com.diagbot.repository.DiseaseRepository;
+import com.diagbot.repository.LISNode;
+import com.diagbot.repository.LISPackNode;
+import com.diagbot.repository.LisPackRepository;
+import com.diagbot.repository.LisRepository;
+import com.diagbot.repository.MedicineCodeRepository;
+import com.diagbot.repository.MedicineNode;
+import com.diagbot.repository.MedicineRepository;
+import com.diagbot.repository.PACSNode;
+import com.diagbot.repository.PacsRepository;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.RedisUtil;
 import com.diagbot.vo.BillNeoVO;
 import com.diagbot.vo.PushNeoVO;
 import com.diagbot.vo.StandConvert;
@@ -58,6 +77,8 @@ public class NeoFacade {
     NeoFacade self;
     @Autowired
     StandConvertServiceClient standConvertServiceClient;
+    @Autowired
+    RedisUtil redisUtil;
 
     /**
      * 返回药品缓存信息
@@ -307,82 +328,89 @@ public class NeoFacade {
     public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
         Map<String, Map<String, String>> map = new LinkedHashMap<>();
 
-        Map<String, String> clinicalMap = new LinkedHashMap<>();
-        List<String> clinicalList = standConvert.getClinicalList();
-        for (String s : clinicalList) {
-            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
-            standConvertCrfVO.setWord_type("symptom");
-            standConvertCrfVO.setWord(s);
-            StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
-            System.out.println(standConvertCrfDTO);
-            if(ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())){
-                clinicalMap.put(s, s);
+        try {
+            Map<String, String> clinicalMap = new LinkedHashMap<>();
+            List<String> clinicalList = standConvert.getClinicalList();
+            for (String s : clinicalList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord_type("symptom");
+                standConvertCrfVO.setWord(s);
+                StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                if (ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
+                    clinicalMap.put(s, s);
+                } else {
+                    clinicalMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                }
+
             }
-            clinicalMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
-        }
-        map.put(StandConvertEnum.clinical.getName(), clinicalMap);
+            map.put(StandConvertEnum.clinical.getName(), clinicalMap);
+
+            Map<String, String> operationMap = new LinkedHashMap<>();
+            List<String> operationList = standConvert.getOperationList();
+            for (String s : operationList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord_type("operation");
+                standConvertCrfVO.setWord(s);
+                StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                if (ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
+                    operationMap.put(s, s);
+                } else {
+                    operationMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                }
 
-        Map<String, String> operationMap = new LinkedHashMap<>();
-        List<String> operationList = standConvert.getOperationList();
-        for (String s : operationList) {
-            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
-            standConvertCrfVO.setWord_type("operation");
-            standConvertCrfVO.setWord(s);
-            StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
-            System.out.println(standConvertCrfDTO);
-            if(ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())){
-                operationMap.put(s, s);
             }
-            operationMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
-        }
-        map.put(StandConvertEnum.operation.getName(), operationMap);
+            map.put(StandConvertEnum.operation.getName(), operationMap);
+
+            Map<String, String> drugMap = new LinkedHashMap<>();
+            List<String> drugList = standConvert.getDrugList();
+            for (String s : drugList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord_type("drug");
+                standConvertCrfVO.setWord(s);
+                StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                if (ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
+                    drugMap.put(s, s);
+                } else {
+                    drugMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                }
 
-        Map<String, String> drugMap = new LinkedHashMap<>();
-        List<String> drugList = standConvert.getDrugList();
-        for (String s : drugList) {
-            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
-            standConvertCrfVO.setWord_type("drug");
-            standConvertCrfVO.setWord(s);
-            StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
-            System.out.println(standConvertCrfDTO);
-            if(ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())){
-                drugMap.put(s, s);
             }
-            drugMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
-        }
-        map.put(StandConvertEnum.drug.getName(), drugMap);
-
-        Map<String, String> vitalMap = new LinkedHashMap<>();
-        List<String> vitalList = standConvert.getDrugList();
-        for (String s : vitalList) {
-            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
-            standConvertCrfVO.setWord_type("vital");
-            standConvertCrfVO.setWord(s);
-            StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
-            System.out.println(standConvertCrfDTO);
-            if(ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())){
-                vitalMap.put(s, s);
+            map.put(StandConvertEnum.drug.getName(), drugMap);
+
+            Map<String, String> vitalMap = new LinkedHashMap<>();
+            List<String> vitalList = standConvert.getDrugList();
+            for (String s : vitalList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord_type("vital");
+                standConvertCrfVO.setWord(s);
+                StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                if (ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
+                    vitalMap.put(s, s);
+                } else {
+                    vitalMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                }
+
             }
-            vitalMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
-        }
-        map.put(StandConvertEnum.vital.getName(), vitalMap);
-
-        Map<String, String> diseaseMap = new LinkedHashMap<>();
-        List<String> diseaseList = standConvert.getDiaglList();
-        for (String s : diseaseList) {
-            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
-            standConvertCrfVO.setWord_type("disease");
-            standConvertCrfVO.setWord(s);
-            StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
-            System.out.println(standConvertCrfDTO);
-            if(ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())){
-                diseaseMap.put(s, s);
+            map.put(StandConvertEnum.vital.getName(), vitalMap);
+
+            Map<String, String> diseaseMap = new LinkedHashMap<>();
+            List<String> diseaseList = standConvert.getDiaglList();
+            for (String s : diseaseList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord_type("disease");
+                standConvertCrfVO.setWord(s);
+                StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                if (ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
+                    diseaseMap.put(s, s);
+                } else {
+                    diseaseMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                }
             }
-            diseaseMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
-        }
-        map.put(StandConvertEnum.disease.getName(), diseaseMap);
+            map.put(StandConvertEnum.disease.getName(), diseaseMap);
 
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换服务出错!【找毕金良】" + e.getMessage());
+        }
         return map;
     }
-
 }

+ 16 - 0
src/main/java/com/diagbot/facade/TestFacade.java

@@ -1,11 +1,14 @@
 package com.diagbot.facade;
 
 import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.client.StandConvertServiceClient;
 import com.diagbot.dto.IndicationDTO;
+import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.IndicationPushVO;
+import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.TestIndicationVO;
 import com.diagbot.vo.TestLineVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +30,8 @@ public class TestFacade {
 
     @Autowired
     IndicationFacade indicationFacade;
+    @Autowired
+    StandConvertServiceClient standConvertServiceClient;
 
     /**
      * 开单项数据测试
@@ -131,4 +136,15 @@ public class TestFacade {
         return map;
     }
 
+
+    /**
+     * 标准词转换
+     *
+     * @param standConvertCrfVO
+     * @return
+     */
+    public StandConvertCrfDTO testStandConvert(StandConvertCrfVO standConvertCrfVO) {
+        StandConvertCrfDTO standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+        return standConvertCrfDTO;
+    }
 }

+ 9 - 0
src/main/java/com/diagbot/web/TestController.java

@@ -1,12 +1,15 @@
 package com.diagbot.web;
 
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.facade.TestFacade;
+import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.TestLineVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -34,5 +37,11 @@ public class TestController {
         return RespDTO.onSuc(testFacade.importExcel(file, testLineVO));
     }
 
+
+    @ApiOperation(value = "标准词转换API[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital")
+    @PostMapping("/testStandConvert")
+    public RespDTO<StandConvertCrfDTO> testStandConvert(@RequestBody StandConvertCrfVO standConvertCrfVO) {
+        return RespDTO.onSuc(testFacade.testStandConvert(standConvertCrfVO));
+    }
 }