package com.bonus.boot.manager.statistics.service.Impl;

import com.bonus.boot.manager.basic.entity.MapBean;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.manager.entity.LoginUser;
import com.bonus.boot.manager.manager.utils.UserUtil;
import com.bonus.boot.manager.statistics.dao.ResStatisticsDao;
import com.bonus.boot.manager.statistics.service.ResStatisticsService;
import org.springframework.stereotype.Service;

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

/**
 * @author xliu
 * @date 2023/6/10 10:12
 */
@Service("resStatisticsService")
public class ResStatisticsServiceImpl implements ResStatisticsService {

    @Resource
    private ResStatisticsDao dao;


    @Override
    public List<MapBean> getList(MapBean bean) {
        String userId = String.valueOf(UserUtil.getLoginUser().getId());
        bean.setUserId(userId);
        return dao.getList(bean);
    }

    @Override
    public List<PersonnelLibraryBean> getChildList(PersonnelLibraryBean bean) {
//        String phone = UserUtil.getLoginUser().getPhone();
//        bean.setPhone(phone);
//        String hospitalId = dao.getHospitalIds(phone);
//        bean.setHospitalId(hospitalId);
        LoginUser loginUser = UserUtil.getLoginUser();
        String hospid = UserUtil.getLoginUser().getHospitalId();
        bean.setHospId(hospid);
        String userId = String.valueOf(UserUtil.getLoginUser().getId());
        bean.setUserId(userId);
        return dao.getChildList(bean);
    }
}
