package com.bonus.boot.manager.manager.service.impl;

import com.bonus.boot.manager.basic.entity.MapBean;
import com.bonus.boot.manager.manager.dao.UtilDao;
import com.bonus.boot.manager.manager.service.UtilService;
import com.bonus.boot.manager.manager.utils.UserUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Service("utilService")
public class UtilServiceImpl implements UtilService {


    @Resource
    private UtilDao utilDao;


    @Override
    public int determineIfExists(String tableName, String filedId, String filedValue, String id) {
        return utilDao.determineIfExists(tableName,filedId,filedValue,id);
    }

    @Override
    public List<MapBean> getHospitalSelect(MapBean bean) {
        String hospiral = UserUtil.getLoginUser().getHospitalId();
        bean.setValue(hospiral);
        return utilDao.getHospitalSelect(bean);
    }

    @Override
    public List<MapBean> getPackageType() {
        return utilDao.getPackageType();
    }

    @Override
    public List<MapBean> getPersonType() {
        return utilDao.getPersonType();
    }

    @Override
    public List<MapBean> getSpecialPost() {
        return utilDao.getSpecialPost();
    }

    @Override
    public List<MapBean> getRole() {
        return utilDao.getRole();
    }

    @Override
    public List<MapBean> getSetMeal(MapBean bean) {
        return utilDao.getSetMeal(bean);
    }

    @Override
    public List<MapBean> getHazard() {
        return utilDao.getHazard();
    }

    @Override
    public List<MapBean> getExaminationHospital() {
        return utilDao.getExaminationHospital();
    }

    /**
     * @param bean
     * @return
     */
    @Override
    public List<MapBean> getNewHospitalSelect(MapBean bean) {
        String hospiral = UserUtil.getLoginUser().getHospitalId();
        bean.setHospitalId(hospiral);
        return utilDao.getNewHospitalSelect(bean);
    }
}
