|
@@ -6,12 +6,16 @@ import com.diagbot.dto.GetDiseaseIcdDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.QuestionTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.vo.GetDiseaseIcdVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -36,23 +40,34 @@ public class TranDiseaseIcdFacade {
|
|
|
*/
|
|
|
public List<GetDiseaseIcdDTO> getDiseaseIcds(GetDiseaseIcdVO getDiseaseIcdVO) {
|
|
|
RespDTO<List<GetDiseaseIcdDTO>> getDiseaseIcdsList = tranServiceClient.getDiseaseIcds(getDiseaseIcdVO);
|
|
|
- if (getDiseaseIcdsList == null
|
|
|
- || !CommonErrorCode.OK.getCode().equals(getDiseaseIcdsList.code)) {
|
|
|
+ if (RespDTOUtil.respIsNG(getDiseaseIcdsList)) {
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
"获取icd编码失败");
|
|
|
}
|
|
|
- List<String> questionNames = getDiseaseIcdsList.data.stream().map(getDiseaseIcdDTO -> getDiseaseIcdDTO.getIcssQuestionName()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<GetDiseaseIcdDTO> res = new ArrayList<>();
|
|
|
+
|
|
|
+ List<String> questionNames
|
|
|
+ = getDiseaseIcdsList.data.stream().map(getDiseaseIcdDTO -> getDiseaseIcdDTO.getIcssQuestionName()).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(questionNames)){
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("name",questionNames);
|
|
|
- List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
- for (GetDiseaseIcdDTO getDiseaseIcdDTO: getDiseaseIcdsList.data) {
|
|
|
- for (QuestionInfo questionInfo: questionInfoList) {
|
|
|
- if(getDiseaseIcdDTO.getIcssQuestionName().equals(questionInfo.getName())){
|
|
|
- getDiseaseIcdDTO.setQuestionId(questionInfo.getId());
|
|
|
+ .eq("type", QuestionTypeEnum.Disease.getKey())
|
|
|
+ .in("name",questionNames);
|
|
|
+
|
|
|
+ List<String> icssQuestionNames
|
|
|
+ = questionFacade.list(questionInfoQueryWrapper).stream()
|
|
|
+ .map(r -> r.getName()).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(icssQuestionNames)){
|
|
|
+ for (GetDiseaseIcdDTO getDiseaseIcdDTO: getDiseaseIcdsList.data) {
|
|
|
+ if (icssQuestionNames.contains(getDiseaseIcdDTO.getIcssQuestionName())){
|
|
|
+ res.add(getDiseaseIcdDTO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return getDiseaseIcdsList.data;
|
|
|
+ return res;
|
|
|
}
|
|
|
}
|