|
@@ -1,16 +1,22 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.client.AIServiceClient;
|
|
import com.diagbot.client.AIServiceClient;
|
|
|
|
+import com.diagbot.client.bean.FeatureRate;
|
|
import com.diagbot.client.bean.Response;
|
|
import com.diagbot.client.bean.Response;
|
|
import com.diagbot.client.bean.ResponseData;
|
|
import com.diagbot.client.bean.ResponseData;
|
|
import com.diagbot.client.bean.SearchData;
|
|
import com.diagbot.client.bean.SearchData;
|
|
import com.diagbot.dto.AIDTO;
|
|
import com.diagbot.dto.AIDTO;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
|
+import com.diagbot.util.StringUtil;
|
|
import com.diagbot.vo.AIVO;
|
|
import com.diagbot.vo.AIVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @Description: 调用AI服务业务实现
|
|
* @Description: 调用AI服务业务实现
|
|
* @author: gaodm
|
|
* @author: gaodm
|
|
@@ -48,7 +54,7 @@ public class AIFacade {
|
|
searchData.setLength(10);
|
|
searchData.setLength(10);
|
|
break;
|
|
break;
|
|
case "7":
|
|
case "7":
|
|
- searchData.setLength(2);
|
|
|
|
|
|
+ searchData.setLength(10);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
Response<ResponseData> res = aiServiceClient.bayesPageData(searchData);
|
|
Response<ResponseData> res = aiServiceClient.bayesPageData(searchData);
|
|
@@ -61,7 +67,28 @@ public class AIFacade {
|
|
aidto.setItems(res.getData().getSymptom());
|
|
aidto.setItems(res.getData().getSymptom());
|
|
break;
|
|
break;
|
|
case "7":
|
|
case "7":
|
|
- aidto.setItems(res.getData().getDis());
|
|
|
|
|
|
+ List<FeatureRate> items = new ArrayList<>();
|
|
|
|
+ if (ListUtil.isNotEmpty(res.getData().getDis())){
|
|
|
|
+ List<String> depts = new ArrayList<>();
|
|
|
|
+ FeatureRate item;
|
|
|
|
+ for (FeatureRate featureRate: res.getData().getDis()){
|
|
|
|
+ if (Double.valueOf(featureRate.getRate()) > 0.2d){
|
|
|
|
+ if (StringUtil.isNotBlank(featureRate.getExtraProperty())){
|
|
|
|
+ if (!depts.contains(featureRate.getExtraProperty())){
|
|
|
|
+ depts.add(featureRate.getExtraProperty());
|
|
|
|
+ item = new FeatureRate();
|
|
|
|
+ item.setExtraProperty(featureRate.getExtraProperty());
|
|
|
|
+ items.add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (ListUtil.isEmpty(items)){
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请再详细描述不适的症状(例如:不适程度、持续时间等)");
|
|
|
|
+ }
|
|
|
|
+ aidto.setItems(items);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
return aidto;
|
|
return aidto;
|