|
@@ -5,6 +5,7 @@ import com.diagbot.client.ChiefPresentSimilarityServiceClient;
|
|
|
import com.diagbot.client.StandConvertServiceClient;
|
|
|
import com.diagbot.dto.BillNeoDTO;
|
|
|
import com.diagbot.dto.PushDTO;
|
|
|
+import com.diagbot.dto.StandConvertCrfBatchDTO;
|
|
|
import com.diagbot.dto.StandConvertCrfDTO;
|
|
|
import com.diagbot.entity.node.Disease;
|
|
|
import com.diagbot.entity.node.Medicine_Code;
|
|
@@ -13,7 +14,17 @@ 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.util.StringUtil;
|
|
@@ -303,23 +314,23 @@ public class NeoFacade {
|
|
|
|
|
|
try {
|
|
|
List<String> clinicalList = standConvert.getClinicalList();
|
|
|
- Map<String, String> clinicalMap = getStandConvertMap(clinicalList, "symptom");
|
|
|
+ Map<String, String> clinicalMap = getStandConvertMapBathch(clinicalList, "symptom");
|
|
|
map.put(StandConvertEnum.clinical.getName(), clinicalMap);
|
|
|
|
|
|
List<String> operationList = standConvert.getOperationList();
|
|
|
- Map<String, String> operationMap = getStandConvertMap(operationList, "operation");
|
|
|
+ Map<String, String> operationMap = getStandConvertMapBathch(operationList, "operation");
|
|
|
map.put(StandConvertEnum.operation.getName(), operationMap);
|
|
|
|
|
|
List<String> drugList = standConvert.getDrugList();
|
|
|
- Map<String, String> drugMap = getStandConvertMap(drugList, "drug");
|
|
|
+ Map<String, String> drugMap = getStandConvertMapBathch(drugList, "drug");
|
|
|
map.put(StandConvertEnum.drug.getName(), drugMap);
|
|
|
|
|
|
List<String> vitalList = standConvert.getDrugList();
|
|
|
- Map<String, String> vitalMap = getStandConvertMap(vitalList, "vital");
|
|
|
+ Map<String, String> vitalMap = getStandConvertMapBathch(vitalList, "vital");
|
|
|
map.put(StandConvertEnum.vital.getName(), vitalMap);
|
|
|
|
|
|
List<String> diseaseList = standConvert.getDiaglList();
|
|
|
- Map<String, String> diseaseMap = getStandConvertMap(diseaseList, "disease");
|
|
|
+ Map<String, String> diseaseMap = getStandConvertMapBathch(diseaseList, "disease");
|
|
|
map.put(StandConvertEnum.disease.getName(), diseaseMap);
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -337,7 +348,7 @@ public class NeoFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String, String> getStandConvertMap(List<String> list, String type) {
|
|
|
- // long l1 = System.currentTimeMillis();
|
|
|
+ long l1 = System.currentTimeMillis();
|
|
|
Map<String, String> typeMap = redisUtil.getValueByType(type);
|
|
|
Map<String, String> standConvertMap = new LinkedHashMap<>();
|
|
|
List<String> notList = new ArrayList<>();
|
|
@@ -369,14 +380,73 @@ public class NeoFacade {
|
|
|
if (standConvertMap != null && !standConvertMap.isEmpty()) {
|
|
|
typeMap.putAll(standConvertMap);
|
|
|
}
|
|
|
- // long l2 = System.currentTimeMillis();
|
|
|
- // System.out.println("存放前" + type + ":" + (l2 - l1) / 1000.0);
|
|
|
+ long l2 = System.currentTimeMillis();
|
|
|
+ System.out.println("存放前" + type + ":" + (l2 - l1) / 1000.0);
|
|
|
redisUtil.updateValueByType(typeMap, type);
|
|
|
- // long l3 = System.currentTimeMillis();
|
|
|
- // System.out.println("存放" + type + ":" + (l3 - l2) / 1000.0);
|
|
|
+ long l3 = System.currentTimeMillis();
|
|
|
+ System.out.println("存放" + type + ":" + (l3 - l2) / 1000.0);
|
|
|
}
|
|
|
- // long l4 = System.currentTimeMillis();
|
|
|
- // System.out.println("共耗时:" + type + ":" + (l4 - l1) / 1000.0);
|
|
|
+ long l4 = System.currentTimeMillis();
|
|
|
+ System.out.println("共耗时:" + type + ":" + (l4 - l1) / 1000.0);
|
|
|
+ return typeMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 标准词转换
|
|
|
+ *
|
|
|
+ * @param list 原词
|
|
|
+ * @param type 类型
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, String> getStandConvertMapBathch(List<String> list, String type) {
|
|
|
+ long l1 = System.currentTimeMillis();
|
|
|
+ Map<String, String> typeMap = redisUtil.getValueByType(type);
|
|
|
+ Map<String, String> standConvertMap = new LinkedHashMap<>();
|
|
|
+ List<String> notList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (typeMap != null) {
|
|
|
+ for (String s : list) {
|
|
|
+ if (StringUtil.isBlank(typeMap.get(s))) {
|
|
|
+ notList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ typeMap = new LinkedHashMap<>();
|
|
|
+ notList = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StandConvertCrfVO> standConvertCrfVOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(notList)) {
|
|
|
+ for (String s : notList) {
|
|
|
+ StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
|
|
|
+ standConvertCrfVO.setWord_type(type);
|
|
|
+ standConvertCrfVO.setWord(s);
|
|
|
+ standConvertCrfVOList.add(standConvertCrfVO);
|
|
|
+ }
|
|
|
+ StandConvertCrfBatchDTO standConvertCrfBatchDTO = standConvertServiceClient.similarityBatch(standConvertCrfVOList);
|
|
|
+ if (standConvertCrfBatchDTO != null && standConvertCrfBatchDTO.getStatus()) {
|
|
|
+ Map<String, StandConvertCrfDTO> map1 = standConvertCrfBatchDTO.getData().get(type);
|
|
|
+ for (String s : notList) {
|
|
|
+ StandConvertCrfDTO standConvertCrfDTO = map1.get(s);
|
|
|
+ if (standConvertCrfDTO == null || ListUtil.isEmpty(standConvertCrfDTO.getStandard_words())) {
|
|
|
+ standConvertMap.put(s, s);
|
|
|
+ } else {
|
|
|
+ standConvertMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (standConvertMap != null && !standConvertMap.isEmpty()) {
|
|
|
+ typeMap.putAll(standConvertMap);
|
|
|
+ }
|
|
|
+ long l2 = System.currentTimeMillis();
|
|
|
+ System.out.println("存放前" + type + ":" + (l2 - l1) / 1000.0);
|
|
|
+ redisUtil.updateValueByType(typeMap, type);
|
|
|
+ long l3 = System.currentTimeMillis();
|
|
|
+ System.out.println("存放" + type + ":" + (l3 - l2) / 1000.0);
|
|
|
+ }
|
|
|
+ long l4 = System.currentTimeMillis();
|
|
|
+ System.out.println("共耗时:" + type + ":" + (l4 - l1) / 1000.0);
|
|
|
return typeMap;
|
|
|
}
|
|
|
}
|