Browse Source

Merge remote-tracking branch 'origin/master' into standWordMan

zhaops 4 năm trước cách đây
mục cha
commit
32d2207fb6

+ 27 - 0
src/main/java/com/diagbot/client/StandConvertNewServiceClient.java

@@ -0,0 +1,27 @@
+package com.diagbot.client;
+
+import com.diagbot.dto.StandConvertCrfBatchDTO;
+import com.diagbot.dto.StandConvertCrfDTO;
+import com.diagbot.vo.StandConvertCrfVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import java.util.List;
+
+/**
+ * @description: 标准词转换
+ * @author: zhoutg
+ * @date: 2020/8/12 10:41
+ */
+@FeignClient(value = "StandConvertNew-service", url="${StandConvertNew.url}")
+public interface StandConvertNewServiceClient {
+
+    @PostMapping(value = "/api/similarity")
+    StandConvertCrfDTO similarity(StandConvertCrfVO standConvertCrfVO);
+
+    @PostMapping(value = "/api/similarity_batch")
+    StandConvertCrfBatchDTO similarityBatch(List<StandConvertCrfVO> standConvertCrfVOList);
+}
+
+
+

+ 27 - 0
src/main/java/com/diagbot/client/hystrix/StandConvertNewServiceHystrix.java

@@ -0,0 +1,27 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.StandConvertNewServiceClient;
+import com.diagbot.dto.StandConvertCrfBatchDTO;
+import com.diagbot.dto.StandConvertCrfDTO;
+import com.diagbot.vo.StandConvertCrfVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+@Slf4j
+public class StandConvertNewServiceHystrix implements StandConvertNewServiceClient {
+
+    @Override
+    public StandConvertCrfDTO similarity(StandConvertCrfVO standConvertCrfVO) {
+        log.error("【hystrix】调用{}异常", "similarity");
+        return null;
+    }
+
+    @Override
+    public StandConvertCrfBatchDTO similarityBatch(List<StandConvertCrfVO> standConvertCrfVOList) {
+        log.error("【hystrix】调用{}异常", "similarityBatch");
+        return null;
+    }
+}

+ 10 - 0
src/main/java/com/diagbot/entity/TestwordRes.java

@@ -68,6 +68,16 @@ public class TestwordRes implements Serializable {
      */
     private String convertWord;
 
+    /**
+     * 词转换
+     */
+    private String newConvertWord;
+
+    /**
+     * 执行时间
+     */
+    private String dealTime;
+
     /**
      * 是否处理,0:未使用,1:已处理
      */

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

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.client.StandConvertNewServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.StandConvertCrfBatchDTO;
@@ -61,6 +62,8 @@ public class TestFacade {
     @Autowired
     StandConvertServiceClient standConvertServiceClient;
     @Autowired
+    StandConvertNewServiceClient standConvertNewServiceClient;
+    @Autowired
     RedisUtil redisUtil;
     @Autowired
     CacheFacade cacheFacade;
@@ -767,6 +770,17 @@ public class TestFacade {
         return standConvertCrfDTO;
     }
 
+    /**
+     * 标准词转换【新版】
+     *
+     * @param standConvertCrfVO
+     * @return
+     */
+    public StandConvertCrfDTO testStandConvertNew(StandConvertCrfVO standConvertCrfVO) {
+        StandConvertCrfDTO standConvertCrfDTO = standConvertNewServiceClient.similarity(standConvertCrfVO);
+        return standConvertCrfDTO;
+    }
+
     /**
      * 标准词转换(批量)
      *
@@ -778,6 +792,17 @@ public class TestFacade {
         return standConvertCrfBatchDTO;
     }
 
+    /**
+     * 标准词转换(批量)【新版】
+     *
+     * @param standConvertCrfVOList
+     * @return
+     */
+    public StandConvertCrfBatchDTO testStandConvertBatchNew(List<StandConvertCrfVO> standConvertCrfVOList) {
+        StandConvertCrfBatchDTO standConvertCrfBatchDTO = standConvertNewServiceClient.similarityBatch(standConvertCrfVOList);
+        return standConvertCrfBatchDTO;
+    }
+
     /**
      * 复杂高危手术测试API
      *

+ 107 - 0
src/main/java/com/diagbot/facade/TestwordInfoFacade.java

@@ -28,6 +28,7 @@ import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.SearchData;
 import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.SymptomFeatureVO;
+import com.diagbot.vo.TestStandVO;
 import com.diagbot.vo.TestwordInfoVO;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -324,6 +325,96 @@ public class TestwordInfoFacade extends TestwordInfoServiceImpl {
         stringList.removeAll(setList);
     }
 
+    /**
+     * 同义词转换【新版】
+     */
+    public void wordConvertNew(TestStandVO testStandVO) {
+        QueryWrapper queryWrapper = new QueryWrapper<TestwordRes>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("is_deal", "0")
+                .in(ListUtil.isNotEmpty(testStandVO.getTypeList()), "type", testStandVO.getTypeList())
+                .orderByAsc("id");
+        List<TestwordRes> testwordInfoList = testwordResService.page(new Page<>(1, 1), queryWrapper).getRecords();
+
+        while(ListUtil.isNotEmpty(testwordInfoList)) {
+            List<StandConvertCrfVO> convertCrfVOList = new ArrayList<>();
+            for (TestwordRes testwordRes : testwordInfoList) {
+                StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+                standConvertCrfVO.setWord(testwordRes.getWord());
+                standConvertCrfVO.setNumber(3);
+                switch (testwordRes.getType()) {
+                    case "症状":
+                        standConvertCrfVO.setWord_type("symptom");
+                        convertCrfVOList.add(standConvertCrfVO);
+                        break;
+                    // case "诊断":
+                    //     standConvertCrfVO.setWord_type("disease");
+                    //     convertCrfVOList.add(standConvertCrfVO);
+                    //     break;
+                    // case "药品":
+                    //     standConvertCrfVO.setWord_type("drug");
+                    //     convertCrfVOList.add(standConvertCrfVO);
+                    //     break;
+                    // case "手术":
+                    //     standConvertCrfVO.setWord_type("operation");
+                    //     convertCrfVOList.add(standConvertCrfVO);
+                    //     break;
+                    // case "查体":
+                    //     standConvertCrfVO.setWord_type("vital");
+                    //     convertCrfVOList.add(standConvertCrfVO);
+                    //     break;
+                    // // case "辅检结果":
+                    // //     standConvertCrfVO.setWord_type("pacs");
+                    // //     convertCrfVOList.add(standConvertCrfVO);
+                    // //     break;
+                    // case "化验":
+                    //     standConvertCrfVO.setWord_type("lis");
+                    //     convertCrfVOList.add(standConvertCrfVO);
+                    //     break;
+                    default:
+                        break;
+                }
+            }
+            long t1 = System.currentTimeMillis();
+            StandConvertCrfBatchDTO standConvertCrfBatchDTO = testFacade.testStandConvertBatchNew(convertCrfVOList);
+            String dealTime = String.valueOf((System.currentTimeMillis() - t1)/ 1000.0);
+            Date date = DateUtil.now();
+            for (TestwordRes testwordRes : testwordInfoList) {
+                testwordRes.setDealTime(dealTime);
+                switch (testwordRes.getType()) {
+                    case "症状":
+                        wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "symptom");
+                        break;
+                    // case "诊断":
+                    //     wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "disease");
+                    //     break;
+                    // case "药品":
+                    //     wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "drug");
+                    //     break;
+                    // case "手术":
+                    //     wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "operation");
+                    //     break;
+                    // case "查体":
+                    //     wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "vital");
+                    //     break;
+                    // // case "辅检结果":
+                    // //     wordStandConvert(standConvertCrfBatchDTO, testwordRes, "pacs");
+                    // //     break;
+                    // case "化验":
+                    //     wordStandConvertNew(standConvertCrfBatchDTO, testwordRes, "lis");
+                    //     break;
+                    default:
+                        break;
+                }
+                testwordRes.setIsDeal(1);
+                testwordRes.setGmtModified(date);
+            }
+            testwordResService.saveOrUpdateBatch(testwordInfoList);
+
+            testwordInfoList = testwordResService.page(new Page<>(1, 1), queryWrapper).getRecords();
+        }
+    }
+
     /**
      * 同义词转换
      */
@@ -426,6 +517,22 @@ public class TestwordInfoFacade extends TestwordInfoServiceImpl {
         }
     }
 
+    public void wordStandConvertNew(StandConvertCrfBatchDTO standConvertCrfBatchDTO, TestwordRes testwordRes, String type) {
+        Set<String> typeList = new LinkedHashSet<>();
+        Map<String, StandConvertCrfDTO> convertCrfDTOMap = standConvertCrfBatchDTO.getData().get(type);
+        if (convertCrfDTOMap != null && convertCrfDTOMap.get(testwordRes.getWord()) != null) {
+            List<Map<String,String>> listMap = convertCrfDTOMap.get(testwordRes.getWord()).getStandard_words();
+            int size = 0;
+            for (Map<String,String> map : listMap) {
+                if (size < 3 && StringUtil.isNotBlank(map.get("standard_words"))) {
+                    typeList.add(map.get("standard_words"));
+                }
+                size++;
+            }
+            testwordRes.setNewConvertWord(StringUtils.join(typeList, ";"));
+        }
+    }
+
     /**
      * 筛选对象列表中“uniqueName”字段为空的数据,返回targetProperty字段列表
      *

+ 4 - 6
src/main/java/com/diagbot/repository/MedRegNameNode.java

@@ -9,8 +9,6 @@ import com.diagbot.entity.node.MedCodeName;
 import com.diagbot.entity.node.MedRegName;
 import com.diagbot.entity.node.Medicine;
 import com.diagbot.entity.node.Vital;
-import com.diagbot.entity.relationship.MedCodeNameMedRegName;
-import com.diagbot.entity.relationship.MedCodeNameMedicine;
 import com.diagbot.entity.relationship.MedRegNameGroup;
 import com.diagbot.entity.relationship.MedRegNameMedAllergen;
 import com.diagbot.entity.relationship.MedRegNameMedRegName;
@@ -48,7 +46,7 @@ public class MedRegNameNode {
         List<MedCodeName> medcdnames;
 //        MedRegName medreg;
 
-        Long t1 = System.currentTimeMillis();
+        // Long t1 = System.currentTimeMillis();
 
         for (Drug drug : druglist) {
             highRiskNeoDTO = new HighRiskNeoDTO();
@@ -76,9 +74,9 @@ public class MedRegNameNode {
                 }
             }
         }
-        Long t2 = System.currentTimeMillis();
-
-        System.out.println((t2-t1)/1000.0);
+        // Long t2 = System.currentTimeMillis();
+        //
+        // System.out.println((t2-t1)/1000.0);
 
         return highRiskNeoDTOS;
     }

+ 20 - 0
src/main/java/com/diagbot/vo/TestStandVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description: 测试同义词转换
+ * @author: zhoutg
+ * @date: 2020/12/11 16:56
+ */
+@Data
+public class TestStandVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    List<String> typeList = new ArrayList<>();
+}

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

@@ -120,12 +120,24 @@ public class TestController {
         return RespDTO.onSuc(testFacade.testStandConvert(standConvertCrfVO));
     }
 
+    @ApiOperation(value = "标准词转换API【新版】[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital")
+    @PostMapping("/testStandConvertNew")
+    public RespDTO<StandConvertCrfDTO> testStandConvertNew(@RequestBody StandConvertCrfVO standConvertCrfVO) {
+        return RespDTO.onSuc(testFacade.testStandConvertNew(standConvertCrfVO));
+    }
+
     @ApiOperation(value = "标准词批量转换API[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital")
     @PostMapping("/testStandConvertBatch")
     public RespDTO<StandConvertCrfBatchDTO> testStandConvertBatch(@RequestBody List<StandConvertCrfVO> standConvertCrfVOList) {
         return RespDTO.onSuc(testFacade.testStandConvertBatch(standConvertCrfVOList));
     }
 
+    @ApiOperation(value = "标准词批量转换【新版】API[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital")
+    @PostMapping("/testStandConvertBatchNew")
+    public RespDTO<StandConvertCrfBatchDTO> testStandConvertBatchNew(@RequestBody List<StandConvertCrfVO> standConvertCrfVOList) {
+        return RespDTO.onSuc(testFacade.testStandConvertBatch(standConvertCrfVOList));
+    }
+
     @ApiOperation(value = "复杂高危手术测试API[zhoutg]",
             notes = "idNum:指定行测试<br>" +
                     "sheetIndex:sheet的下标,默认为0,表示第一个sheet")

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

@@ -4,6 +4,7 @@ package com.diagbot.web;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.TestwordInfoFacade;
 import com.diagbot.vo.SymptomFeatureVO;
+import com.diagbot.vo.TestStandVO;
 import com.diagbot.vo.TestwordInfoVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -47,6 +48,14 @@ public class TestwordInfoController {
         return RespDTO.onSuc("执行完毕");
     }
 
+    @ApiOperation(value = "提词转换【新版】API[zhoutg]",
+            notes = "提词转换【新版】API")
+    @PostMapping("/wordConvertNew")
+    public RespDTO<String> wordConvertNew(@RequestBody TestStandVO testStandVO) {
+        testwordInfoFacade.wordConvertNew(testStandVO);
+        return RespDTO.onSuc("执行完毕");
+    }
+
     @ApiOperation(value = "症状生成API[zhoutg]",
             notes = "症状生成API")
     @PostMapping("/getSymptom")

+ 4 - 0
src/main/resources/application-dev.yml

@@ -156,6 +156,10 @@ StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
+StandConvertNew:
+  url: http://192.168.3.150:9205
+  rate: 0.9
+
 IcssPush:
   url: http://192.168.2.234:5008
 

+ 4 - 0
src/main/resources/application-local.yml

@@ -156,6 +156,10 @@ StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
+StandConvertNew:
+  url: http://192.168.3.150:9205
+  rate: 0.9
+
 IcssPush:
   url: http://192.168.2.234:5008
 

+ 4 - 0
src/main/resources/application-pre.yml

@@ -156,6 +156,10 @@ StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
+StandConvertNew:
+  url: http://192.168.3.150:9205
+  rate: 0.9
+
 IcssPush:
   url: http://192.168.2.186:5008
 

+ 4 - 0
src/main/resources/application-pro.yml

@@ -158,6 +158,10 @@ StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
+StandConvertNew:
+  url: http://192.168.3.150:9205
+  rate: 0.9
+
 IcssPush:
   url: http://192.168.2.123:5008
 

+ 4 - 0
src/main/resources/application-test.yml

@@ -156,6 +156,10 @@ StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
+StandConvertNew:
+  url: http://192.168.3.150:9205
+  rate: 0.9
+
 IcssPush:
   url: http://192.168.2.241:5008
 

+ 2 - 0
src/main/resources/mapper/TestwordResMapper.xml

@@ -13,6 +13,8 @@
         <result column="word" property="word" />
         <result column="type" property="type" />
         <result column="convert_word" property="convertWord" />
+        <result column="new_convert_word" property="newConvertWord" />
+        <result column="deal_time" property="dealTime" />
         <result column="is_deal" property="isDeal" />
     </resultMap>