package com.kcim.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kcim.dao.model.CostIncomeGroup;
import com.kcim.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 收入归集
 *
 * @author KCYG
 * @date 2021-08-03 16:15:20
 */
@Mapper
public interface CostIncomeGroupMapper extends BaseMapper<CostIncomeGroup> {
    /**
     * 按照开单科室  执行科室 成本项目进行筛选相同的金额汇总
     *
     * @param idList
     * @return
     */
    List<CostIncomeGroupAllAmountVO> countMoney(@Param("idList") List<Long> idList);

    /**
     * 获取收入归集分页列表
     *
     * @param startIndex 起始页
     * @param pageSize   页码数据大小
     * @param date       日期 yyyy-MM-dd
     * @param hospId     医院id
     * @return {@link CollectionVO}
     */
    List<CollectionVO> getCollections(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize,
                                      @Param("date") String date, @Param("hospId") Long hospId);

    /**
     * 获取收入归集分页列表
     *
     * @param date       日期 yyyy-MM-dd
     * @param hospId     医院id
     * @return 获取收入归集分页列表的总数
     */
    int getCollectionCount(@Param("date") String date, @Param("hospId") Long hospId);

    List<CostIncomeGroupAllAmountBO> selectListAndMoney(@Param("year") Integer year, @Param("month") Integer month, @Param("hospId") Long hospId);


    List<CommonDepartVo> getOpenDepartment(@Param("year") Integer year, @Param("month") Integer month, @Param("hospId") Long hospId,  @Param("departmentName") String departmentName);

    List<CommonDepartVo> getStartDepartment(@Param("year") Integer year, @Param("month") Integer month, @Param("hospId") Long hospId, @Param("departmentName")  String departmentName);

    List<CostIncomeGroup> selectHistoryList(@Param("hospId") Long hospId,@Param("id") Long id);

    void reducingHistory(@Param("id") Long id,@Param("hospId") Long hospId,@Param("list") List<Long> list);

    List<CostIncomeGroup>  getOrderDeptProductList(Page<PatientInfoVo> page, @Param("year") Integer year, @Param("month") Integer month, @Param("departmentCode") String departmentCode, @Param("hospId") Long hospId, @Param("filter") String filter);

    List<CostIncomeGroup> getExecDeptProductList(@Param("page") Page<PatientInfoVo> page, @Param("year") Integer year, @Param("month") Integer month, @Param("departmentCode") String departmentCode, @Param("hospId") Long hospId, @Param("filter") String filter);

    BigDecimal getTotalAmount(@Param("year") Integer year, @Param("month") Integer month, @Param("departmentCode") String departmentCode, @Param("hospId") Long hospId);

    BigDecimal getDeptTotalAmount(@Param("year") Integer year, @Param("month") Integer month, @Param("departmentCode") String departmentCode, @Param("hospId") Long hospId);
}
