|
@@ -10,11 +10,13 @@ import com.diagbot.dto.GetQuestionInfoDTO;
|
|
|
import com.diagbot.dto.ModuleInfoDTO;
|
|
|
import com.diagbot.dto.ModuleInfoListDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.DeptInfo;
|
|
|
import com.diagbot.entity.DictionaryInfo;
|
|
|
import com.diagbot.entity.ModuleDetail;
|
|
|
import com.diagbot.entity.ModuleInfo;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.ModuleInfoTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.ModuleInfoServiceImpl;
|
|
@@ -57,6 +59,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
|
|
|
UserServiceClient userServiceClient;
|
|
|
@Autowired
|
|
|
DictionaryFacade dictionaryFacade;
|
|
|
+ @Autowired
|
|
|
+ DeptInfoFacade deptInfoFacade;
|
|
|
|
|
|
/**
|
|
|
* 根据id删除标签模板
|
|
@@ -201,9 +205,29 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
|
|
|
//获取模板信息
|
|
|
IPage<ModuleInfoListDTO> moduleInfoDTOIPage = this.getModuleInfoListByType(getModuleInfoVO);
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
+ List<Long> deptId = new ArrayList<>();
|
|
|
+ List<Long> disId = new ArrayList<>();
|
|
|
for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
|
|
|
ids.add(moduleInfoListDTO.getModifier());
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 1){
|
|
|
+ deptId.add(moduleInfoListDTO.getRelationId());
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 2){
|
|
|
+ disId.add(moduleInfoListDTO.getRelationId());
|
|
|
+ }
|
|
|
}
|
|
|
+ //获取科室名称
|
|
|
+ QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ deptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", deptId);
|
|
|
+ List<DeptInfo> deptInfoList = deptInfoFacade.list(deptInfoQueryWrapper);
|
|
|
+ Map<Long, DeptInfo> deptInfoMap = deptInfoList.stream().collect(Collectors.toMap(DeptInfo::getId,deptInfo -> deptInfo));
|
|
|
+ //获取疾病名称
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", deptId);
|
|
|
+ List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
+ Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
|
|
|
//获取模板类型名称
|
|
|
QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
|
|
|
dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
@@ -212,16 +236,27 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
|
|
|
.orderByDesc("order_no");
|
|
|
List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
|
|
|
Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
|
|
|
- //获取用户信息
|
|
|
- RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
- if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
- "获取用户信息失败");
|
|
|
- }
|
|
|
- //将用户信息放入实体
|
|
|
- for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
|
|
|
- moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
|
|
|
- moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfoListDTO.getType().intValue())).getName());
|
|
|
+ if(ListUtil.isNotEmpty(moduleInfoDTOIPage.getRecords())){
|
|
|
+ //获取用户信息
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
+ if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
+ "获取用户信息失败");
|
|
|
+ }
|
|
|
+ //将用户信息放入实体
|
|
|
+ for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
|
|
|
+ moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() != 3){
|
|
|
+ moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfoListDTO.getType().intValue())).getName());
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 1){
|
|
|
+ moduleInfoListDTO.setRelationName(deptInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ if(moduleInfoListDTO.getModuleType().intValue() == 2){
|
|
|
+ moduleInfoListDTO.setRelationName(questionInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
|
|
|
+ }
|
|
|
+ moduleInfoListDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(moduleInfoListDTO.getModuleType().intValue()));
|
|
|
+ }
|
|
|
}
|
|
|
return moduleInfoDTOIPage;
|
|
|
}
|