12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.diagbot.facade;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.diagbot.client.TranServiceClient;
- import com.diagbot.dto.DeptInfoDTO;
- import com.diagbot.dto.HospitalDeptInfoDTO;
- import com.diagbot.dto.RespDTO;
- import com.diagbot.entity.DeptInfo;
- import com.diagbot.enums.IsDeleteEnum;
- import com.diagbot.exception.CommonErrorCode;
- import com.diagbot.exception.CommonException;
- import com.diagbot.service.impl.DeptInfoServiceImpl;
- import com.diagbot.util.BeanUtil;
- import com.diagbot.vo.DeptInfoVO;
- import com.diagbot.vo.HospitalDeptInfoVO;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- /**
- * @Description:
- * @author: wangyu
- * @time: 2018/11/19 19:21
- */
- @Component
- public class DeptInfoFacade extends DeptInfoServiceImpl {
- @Autowired
- TranServiceClient tranServiceClient;
- /**
- * 获取科室信息
- *
- * @param deptInfoVO
- * @return
- */
- public DeptInfoDTO getDeptInfo(DeptInfoVO deptInfoVO) {
- HospitalDeptInfoVO hospitalDeptInfoVO = new HospitalDeptInfoVO();
- BeanUtil.copyProperties(deptInfoVO,hospitalDeptInfoVO);
- RespDTO<HospitalDeptInfoDTO> hospitalDeptInfoDTORespDTO = tranServiceClient.getHospitalDeptInfo(hospitalDeptInfoVO);
- if (hospitalDeptInfoDTORespDTO == null
- || !CommonErrorCode.OK.getCode().equals(hospitalDeptInfoDTORespDTO.code)) {
- throw new CommonException(CommonErrorCode.RPC_ERROR,
- "获取科室信息失败");
- }
- QueryWrapper<DeptInfo> deptInfoDTOQueryWrapper = new QueryWrapper<>();
- deptInfoDTOQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
- .eq("id",hospitalDeptInfoDTORespDTO.data.getDeptId());
- DeptInfo deptInfo = this.getOne(deptInfoDTOQueryWrapper);
- DeptInfoDTO deptInfoDTO = new DeptInfoDTO();
- BeanUtil.copyProperties(deptInfo,deptInfoDTO);
- return deptInfoDTO;
- }
- }
|