|
@@ -2,22 +2,21 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.client.AiptServiceClient;
|
|
|
import com.diagbot.dto.ConceptBaseDTO;
|
|
|
+import com.diagbot.dto.ConceptRetrievalDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
-import com.diagbot.dto.SymptomSearchDTO;
|
|
|
import com.diagbot.entity.Symptom;
|
|
|
import com.diagbot.entity.SymptomWrapper;
|
|
|
-import com.diagbot.enums.ShowTypeEnum;
|
|
|
import com.diagbot.service.impl.SymptomServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.vo.ConceptUsualVO;
|
|
|
+import com.diagbot.vo.RetrievalVO;
|
|
|
import com.diagbot.vo.SymptomSearchVO;
|
|
|
import com.diagbot.vo.SymptomUsualVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -66,33 +65,25 @@ public class SymptomFacade extends SymptomServiceImpl{
|
|
|
* @param symptomSearchVO
|
|
|
* @return 检索的症状
|
|
|
*/
|
|
|
- public List<SymptomSearchDTO> searchFac(SymptomSearchVO symptomSearchVO) {
|
|
|
- List<SymptomSearchDTO> res = new ArrayList<>();
|
|
|
- Map paramMap = new HashMap();
|
|
|
- paramMap.put("name", symptomSearchVO.getName());
|
|
|
- paramMap.put("sexType", symptomSearchVO.getSexType());
|
|
|
- paramMap.put("age", symptomSearchVO.getAge());
|
|
|
- List<SymptomSearchDTO> symptomSearchDTOList = this.search(paramMap);
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
- //获取所有的本体,添加返回结果,因为sql语句返回时同义词有可能排前面,而本体排后面
|
|
|
- for(SymptomSearchDTO bean : symptomSearchDTOList) {
|
|
|
- if(ShowTypeEnum.ITSELF.getKey() == bean.getShowType()) { //本体
|
|
|
- ids.add(bean.getId());
|
|
|
- }
|
|
|
+ public List<Symptom> searchFac(SymptomSearchVO symptomSearchVO) {
|
|
|
+ //调用aipt-service服务
|
|
|
+ RetrievalVO retrievalVO = new RetrievalVO();
|
|
|
+ retrievalVO.setType(1);
|
|
|
+ retrievalVO.setInputStr(symptomSearchVO.getName());
|
|
|
+ retrievalVO.setAge(symptomSearchVO.getAge());
|
|
|
+ retrievalVO.setSexType(symptomSearchVO.getSexType());
|
|
|
+ RespDTO<List<ConceptRetrievalDTO>> condeptRerievalS = aiptServiceClient.retrivelConceptInfo(retrievalVO);
|
|
|
+ RespDTOUtil.respNGDeal(condeptRerievalS,"获取标签失败");
|
|
|
+ List<Symptom> symptomList = new ArrayList<>();
|
|
|
+ Symptom symptom = new Symptom();
|
|
|
+ //封装
|
|
|
+ for (ConceptRetrievalDTO conceptRetrievalDTO : condeptRerievalS.data) {
|
|
|
+ symptom = new Symptom();
|
|
|
+ symptom.setConceptId(conceptRetrievalDTO.getSelfId());
|
|
|
+ symptom.setName(conceptRetrievalDTO.getSelfName());
|
|
|
+ symptomList.add(symptom);
|
|
|
}
|
|
|
- for(SymptomSearchDTO bean : symptomSearchDTOList) {
|
|
|
- //如果是本体,直接返回
|
|
|
- if(ShowTypeEnum.ITSELF.getKey() == bean.getShowType()) {
|
|
|
- res.add(bean);
|
|
|
- } else {
|
|
|
- //如果是同义词,判断是否已添加,有多个同义词任意取一个
|
|
|
- if(!ids.contains(bean.getId())) {
|
|
|
- ids.add(bean.getId());
|
|
|
- res.add(bean);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return res;
|
|
|
+ return symptomList;
|
|
|
}
|
|
|
|
|
|
}
|