package thyyxxk.webserver.service.medicalinsurance.costcontrol;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import thyyxxk.webserver.dao.his.medicalinsurance.costcontrol.BedDaysDao;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicalinsurance.costcontrol.YbkfShareDto;
import thyyxxk.webserver.utils.DateUtil;
import thyyxxk.webserver.utils.ResultVoUtil;

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

/**
 * @ClassName BedDaysService
 * @Description 管床日数统计
 * @Author hsh
 * @Date 2022/8/24 9:11
 **/
@Service
public class BedDaysService {

    private final BedDaysDao dao;

    @Autowired
    public BedDaysService(BedDaysDao dao) {
        this.dao = dao;
    }

    public ResultVo<List<Map>> selectBedDays(YbkfShareDto dto) {
        String beginTime = dto.getStartTime();
        String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
        List<Map> list = dao.selectBedDays(beginTime, endTime);
        return ResultVoUtil.success(list);
    }

    public ResultVo<List<Map>> selectYsDaysDetails(YbkfShareDto dto) {
        String beginTime = dto.getStartTime();
        String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
        String deptId = dto.getDeptId();
        List<Map> list = dao.selectYsDaysDetails(beginTime, endTime, deptId);
        return ResultVoUtil.success(list);
    }

}
