|
@@ -5,19 +5,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.DeptInfoDTO;
|
|
|
import com.diagbot.dto.GetDeptInfoDTO;
|
|
|
+import com.diagbot.dto.GetQuestionUsualAndTypeDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.DeptInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.QuestionTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.DeptInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddDeptInfoVO;
|
|
|
import com.diagbot.vo.DeleteDeptInfoVO;
|
|
|
import com.diagbot.vo.GetDeptInfoDetialsVO;
|
|
|
import com.diagbot.vo.GetDeptInfoVO;
|
|
|
+import com.diagbot.vo.GetQuestionUsualAndTypeVO;
|
|
|
import com.diagbot.vo.UpdateDeptInfoVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -37,7 +41,10 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
|
private UserServiceClient userServiceClient;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private QuestionUsualFacade questionUsualFacade;
|
|
|
+ @Autowired
|
|
|
+ private QuestionFacade questionFacade;
|
|
|
/**
|
|
|
* 添加科室信息
|
|
|
*
|
|
@@ -140,8 +147,49 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public List<DeptInfoDTO> getAllDeptInfo() {
|
|
|
- List<DeptInfoDTO> deptInfoList = this.getDeptName();
|
|
|
- return deptInfoList;
|
|
|
+ //查询所有科室
|
|
|
+ QueryWrapper<DeptInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey());
|
|
|
+ List<DeptInfo> deptInfoList = this.list(queryWrapper);
|
|
|
+ List<DeptInfoDTO> deptInfoDTOList = BeanUtil.listCopyTo(deptInfoList,DeptInfoDTO.class);
|
|
|
+ List<Long> deptIds = new ArrayList<>();
|
|
|
+ deptInfoList.stream().forEach(deptInfoDTO -> deptIds.add(deptInfoDTO.getId()));
|
|
|
+ //在常用标签中查询所有相关标签
|
|
|
+ GetQuestionUsualAndTypeVO getQuestionUsualAndTypeVO = new GetQuestionUsualAndTypeVO();
|
|
|
+ getQuestionUsualAndTypeVO.setDeptIds(deptIds);
|
|
|
+ List<GetQuestionUsualAndTypeDTO> getQuestionUsualAndTypeDTOS = questionUsualFacade.getQuestionUsualByDeptIds(getQuestionUsualAndTypeVO);
|
|
|
+ List<GetQuestionUsualAndTypeDTO> questionUsuals = new ArrayList<>();
|
|
|
+ List<Integer> typeList = new ArrayList<>();
|
|
|
+ List<DeptInfoDTO> deptInfoDTOS = new ArrayList<>();
|
|
|
+ //将标签明细放入科室信息中,并排除类型
|
|
|
+ for (DeptInfoDTO deptInfoDTO : deptInfoDTOList) {
|
|
|
+ typeList = new ArrayList<>();
|
|
|
+ questionUsuals = new ArrayList<>();
|
|
|
+ for (GetQuestionUsualAndTypeDTO getQuestionUsualAndTypeDTO : getQuestionUsualAndTypeDTOS) {
|
|
|
+ if (deptInfoDTO.getId().intValue() == getQuestionUsualAndTypeDTO.getDeptId().intValue()){
|
|
|
+ questionUsuals.add(getQuestionUsualAndTypeDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ deptInfoDTO.setQuestionUsuals(questionUsuals);
|
|
|
+ List<Integer> questionType = new ArrayList<>();
|
|
|
+ deptInfoDTO.getQuestionUsuals().forEach(getQuestionUsualAndTypeDTO -> questionType.add(getQuestionUsualAndTypeDTO.getType()));
|
|
|
+ //对类型进行筛选,已经添加过得类型不再显示
|
|
|
+ if(!questionType.contains(QuestionTypeEnum.Symptom.getKey())){
|
|
|
+ typeList.add(QuestionTypeEnum.Symptom.getKey());
|
|
|
+ }
|
|
|
+ if(!questionType.contains(QuestionTypeEnum.Lis.getKey())){
|
|
|
+ typeList.add(QuestionTypeEnum.Lis.getKey());
|
|
|
+ }
|
|
|
+ if(!questionType.contains(QuestionTypeEnum.Pacs.getKey())){
|
|
|
+ typeList.add(QuestionTypeEnum.Pacs.getKey());
|
|
|
+ }
|
|
|
+ deptInfoDTO.setType(typeList);
|
|
|
+ //对总体类型进行筛选,若该科室已经添加过疾病,化验,复检的常用标签,则该科室不再显示
|
|
|
+ if(ListUtil.isNotEmpty(deptInfoDTO.getType())){
|
|
|
+ deptInfoDTOS.add(deptInfoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return deptInfoDTOS;
|
|
|
}
|
|
|
|
|
|
/**
|