package com.diagbot.facade;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.diagbot.dto.HospitalInfoDTO;
import com.diagbot.entity.HospitalInfo;
import com.diagbot.enums.IsDeleteEnum;
import com.diagbot.enums.StatusEnum;
import com.diagbot.service.impl.HospitalInfoServiceImpl;
import com.diagbot.vo.HospitalInfoVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description:
 * @author: wangyu
 * @time: 2018/11/22 13:43
 */
@Component
public class HospitalInfoFacade extends HospitalInfoServiceImpl {

    /**
     * 获取医院信息
     *
     * @param hospitalInfoVO
     * @return
     */
    public List<HospitalInfoDTO> getHospitalInfo(HospitalInfoVO hospitalInfoVO) {
        List<HospitalInfoDTO> hospitalInfoDTOList = this.getHospitalInfos(hospitalInfoVO);
        return hospitalInfoDTOList;
    }

    /**
     * 通过医院编码获取医院信息
     *
     * @param code 医院编码
     * @return
     */
    public HospitalInfo getHospitalByCode(String code) {
        QueryWrapper<HospitalInfo> queryWrapper = new QueryWrapper<HospitalInfo>();
        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
        queryWrapper.eq("code", code);
        queryWrapper.eq("status", StatusEnum.Enable.getKey());
        return this.getOne(queryWrapper);
    }

}
