package com.diagbot.facade;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.stereotype.Component;

import com.diagbot.dto.DoctorInfoDTO;
import com.diagbot.entity.DoctorInfo;
import com.diagbot.service.impl.DoctorInfoServiceImpl;
import com.diagbot.vo.DoctorInfoVO;

/**
 * @Description:
 * @author: wangyu
 * @time: 2018/11/19 19:49
 */
@Component
public class DoctorInfoFacade extends DoctorInfoServiceImpl {

    /**
     * 获取医生信息
     *
     * @param doctorInfoVo
     * @return
     */
    public List<DoctorInfoDTO> getDoctorInfo(DoctorInfoVO doctorInfoVo) {
        List<DoctorInfoDTO> doctorInfoDTOList = this.getDoctorInfos(doctorInfoVo.getDoctorCode(), doctorInfoVo.getHosptialCode(), doctorInfoVo.getDeptCode());
        return doctorInfoDTOList;
    }
    
    /**
     * 根据ids获取医生信息map
     * @param ids 医生ids
     * @return 医生信息
     */
    public Map<Long, DoctorInfo> doctorInfoMapByIds(List<Long> ids) {
    	Map<Long, DoctorInfo> doctorInfoMap = this.listByIds(ids).stream().filter(i -> i.getIsDeleted().equals("N")).collect(Collectors.toMap(DoctorInfo::getId, i -> i));
        return doctorInfoMap;
    }
}
