|
@@ -1,5 +1,6 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.diagbot.dto.DictionaryInfoDTO;
|
|
|
import com.diagbot.dto.DiseaseInfoDTO;
|
|
|
import com.diagbot.dto.DrugInfoDTO;
|
|
|
import com.diagbot.dto.IndexDTO;
|
|
@@ -8,6 +9,7 @@ import com.diagbot.dto.OperationInfoDTO;
|
|
|
import com.diagbot.dto.RetrievalDTO;
|
|
|
import com.diagbot.dto.StaticKnowledgeIndexDTO;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.MedRetrievalVO;
|
|
@@ -19,7 +21,9 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -31,6 +35,8 @@ import java.util.stream.Collectors;
|
|
|
public class MedRetrievalFacade {
|
|
|
@Autowired
|
|
|
private KlConceptFacade klConceptFacade;
|
|
|
+ @Autowired
|
|
|
+ private DictionaryFacade dictionaryFacade;
|
|
|
|
|
|
/**
|
|
|
* 检索
|
|
@@ -154,6 +160,10 @@ public class MedRetrievalFacade {
|
|
|
|
|
|
List<Integer> types = staticKnowledgeIndexVO.getTypes();
|
|
|
|
|
|
+ List<DictionaryInfoDTO> dicType = dictionaryFacade.getListByGroupType(10);
|
|
|
+ Map<String, String> dicTypeMap = EntityUtil.makeMapWithKeyValue(dicType, "name", "val");
|
|
|
+ List<DictionaryInfoDTO> dicTypeName = dictionaryFacade.getListByGroupType(13);
|
|
|
+
|
|
|
//检索类型(多选):0-全部、1-诊断、2-药品、3-检验、4-检查、5-手术和操作
|
|
|
if (ListUtil.isEmpty(types)
|
|
|
|| (ListUtil.isNotEmpty(types) && types.contains(0))) {
|
|
@@ -179,6 +189,36 @@ public class MedRetrievalFacade {
|
|
|
}
|
|
|
|
|
|
List<StaticKnowledgeIndexDTO> retList = klConceptFacade.staticIndex(staticKnowledgeIndexVO);
|
|
|
+
|
|
|
+ retList.forEach(i -> {
|
|
|
+ i.setTypeName(convertTypeName(i.getTypeName(), 2, dicTypeName));
|
|
|
+ if (dicTypeMap.containsKey(i.getTypeName())) {
|
|
|
+ i.setType(Integer.valueOf(dicTypeMap.get(i.getTypeName())));
|
|
|
+ }
|
|
|
+ });
|
|
|
return retList;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面显示词性和标准词性转换
|
|
|
+ *
|
|
|
+ * @param typeName
|
|
|
+ * @param flag 1-页面词性转标准词性,2- 标准词性转页面词性
|
|
|
+ * @param dicList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String convertTypeName(String typeName, Integer flag, List<DictionaryInfoDTO> dicList) {
|
|
|
+ if (ListUtil.isNotEmpty(dicList)) {
|
|
|
+ Map<String, String> nameValMap = new HashMap<>();
|
|
|
+ if (flag.equals(1)) {
|
|
|
+ nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "name", "val");
|
|
|
+ } else if (flag.equals(2)) {
|
|
|
+ nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "val", "name");
|
|
|
+ }
|
|
|
+ if (nameValMap.containsKey(typeName)) {
|
|
|
+ return nameValMap.get(typeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return typeName;
|
|
|
+ }
|
|
|
}
|