package com.diagbot.facade;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.diagbot.client.TranServiceClient;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.HospitalDept;
import com.diagbot.exception.CommonErrorCode;
import com.diagbot.exception.CommonException;

/**
 * @author rgb
 * @Description
 * @time 2018年12月11日上午11:32:13
 */
@Component
public class HospitalDeptFacade {
	
	@Autowired
    private TranServiceClient tranServiceClient;
	
	/**
     * 根据ids获取科室信息map
     * @param ids 科室ids
     * @return 科室信息
     */
    public Map<Long, HospitalDept> hospitalDeptInfoMapByIds(List<Long> ids) {
    	 RespDTO<Map<Long, HospitalDept>> retData = tranServiceClient.hospitalDeptInfoMapByIds(ids);
         if (retData == null
                 || !CommonErrorCode.OK.getCode().equals(retData.code)) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取科室信息失败");
         }
         return retData.data;
    }

}
