package com.docus.server.his.service.impl;

import com.docus.server.constants.DSKeyConstants;
import com.docus.server.his.infrastructure.mapper.HisDeptMapper;
import com.docus.server.his.infrastructure.mapper.HisTBasicMapper;
import com.docus.server.his.infrastructure.mapper.HisUserMapper;
import com.docus.server.his.service.IHisService;
import com.docus.server.record.common.pojo.dto.TBasicDTO;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
import com.docus.server.sys.common.pojo.dto.UserDTO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component(DSKeyConstants.HIS_DS_KEY + "ServiceImpl")
@AllArgsConstructor
public class HisServiceImpl implements IHisService {

    private final HisDeptMapper hisDeptMapper;
    private final HisUserMapper hisUserMapper;
    private final HisTBasicMapper hisTBasicMapper;

    @Override
    public List<DeptDTO> getDeptListView(Date startDate, Date endDate, int pageNum, int pageSize) {
        return hisDeptMapper.getDeptListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
    }


    @Override
    public List<UserDTO> getUserListView(Date startDate, Date endDate, int pageNum, int pageSize) {
        return hisUserMapper.getUserListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, int pageNum, int pageSize) {
        return hisTBasicMapper.getTBasicListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
    }

}
