|
@@ -1,6 +1,11 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.diagbot.client.UserServiceClient;
|
|
|
+import com.diagbot.dto.GetDeptInfoDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.QuestionUsual;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.UsualEnum;
|
|
@@ -12,13 +17,17 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.DeleteQuestionUsualVO;
|
|
|
+import com.diagbot.vo.GetDeptInfoVO;
|
|
|
import com.diagbot.vo.QuestionUsualVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @Description:
|
|
@@ -27,11 +36,11 @@ import java.util.List;
|
|
|
*/
|
|
|
@Component
|
|
|
public class QuestionUsualFacade extends QuestionUsualServiceImpl {
|
|
|
- @Autowired
|
|
|
- private QuestionInfoFacade questionInfoFacade ;
|
|
|
@Autowired
|
|
|
private DeptInfoFacade deptInfoFacade;
|
|
|
@Autowired
|
|
|
+ private UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
@Qualifier("questionUsualServiceImpl")
|
|
|
private QuestionUsualService questionUsualService;
|
|
|
|
|
@@ -92,4 +101,46 @@ public class QuestionUsualFacade extends QuestionUsualServiceImpl {
|
|
|
this.update(new QuestionUsual(),queryWrapper);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取科室信息
|
|
|
+ * @param getDeptInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<GetDeptInfoDTO> getDeptInfos(GetDeptInfoVO getDeptInfoVO){
|
|
|
+ //获取标签修改时间和修改人
|
|
|
+ QueryWrapper<QuestionUsual> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey());
|
|
|
+ List<QuestionUsual> questionUsualList = this.list(queryWrapper);
|
|
|
+ Map<Long, QuestionUsual> map = new HashMap<>();
|
|
|
+ if (ListUtil.isNotEmpty(questionUsualList)){
|
|
|
+ for (QuestionUsual questionUsual: questionUsualList){
|
|
|
+ map.put(questionUsual.getDeptId(), questionUsual);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //分页查询科室
|
|
|
+ IPage<GetDeptInfoDTO> iPage = deptInfoFacade.getAllDeptInfo(getDeptInfoVO);
|
|
|
+ //将科室的修改人替换成常用标签的修改人
|
|
|
+ for (GetDeptInfoDTO getDeptInfoDTO:iPage.getRecords()) {
|
|
|
+ if(map.get(getDeptInfoDTO.getId()) != null){
|
|
|
+ getDeptInfoDTO.setModifier(map.get(getDeptInfoDTO.getId()).getModifier());
|
|
|
+ getDeptInfoDTO.setGmtModified(map.get(getDeptInfoDTO.getId()).getGmtModified());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取用户信息
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ for (GetDeptInfoDTO getDeptInfoDTO:iPage.getRecords()) {
|
|
|
+ ids.add(getDeptInfoDTO.getModifier());
|
|
|
+ }
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
+ if (respDTO == null || !"0".equals(respDTO.code)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
+ "获取用户信息失败");
|
|
|
+ }
|
|
|
+ //将用户信息放入实体
|
|
|
+ for (GetDeptInfoDTO getDeptInfoDTO:iPage.getRecords()) {
|
|
|
+ getDeptInfoDTO.setUserName(respDTO.data.get(getDeptInfoDTO.getModifier()));
|
|
|
+ }
|
|
|
+ return iPage;
|
|
|
+ }
|
|
|
}
|