|
@@ -1,11 +1,15 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+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.vo.SymptomSearchVO;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -16,11 +20,12 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Component
|
|
|
public class SymptomFacade extends SymptomServiceImpl{
|
|
|
-
|
|
|
- public List<Symptom> getList() {
|
|
|
- QueryWrapper<Symptom> qw1 = new QueryWrapper<>();
|
|
|
- List<Symptom> list = this.list(qw1);
|
|
|
- return list;
|
|
|
+ /**
|
|
|
+ * 获取常用症状
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Symptom> getUsualFac() {
|
|
|
+ return this.getUsual();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -33,4 +38,39 @@ public class SymptomFacade extends SymptomServiceImpl{
|
|
|
return this.getByPartIds(map);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 症状检索
|
|
|
+ * @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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|