/*
 * Copyright ©2023 CJB-CNIT Team. All rights reserved
 */
package com.openhis.web.outpatientmanage.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.common.dto.PerformRecordDto;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;

@Repository
public interface OutpatientTreatmentAppMapper {

    /**
     * 就诊病人列表分页查询
     *
     * @param page 分页
     * @param queryWrapper 查询条件
     * @param amb 就诊类型：门诊
     * @param completed 请求状态：已完成
     * @param cancelled 请求状态：取消
     * @return 就诊病人列表
     */
    Page<OutpatientTreatmentEncounterDto> selectEncounterInfoListPage(
        @Param("page") Page<OutpatientTreatmentEncounterDto> page,
        @Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper, @Param("amb") Integer amb,
        @Param("completed") Integer completed, @Param("cancelled") Integer cancelled);

    /**
     * 处置项目查询
     * 
     * @param page 分页
     * @param queryWrapper 查询条件
     * @param reqCompleted 请求状态:已完成
     * @param draft 发放状态:草稿
     * @param worServiceRequest 请求所在表:服务请求
     * @param worDeviceRequest 请求所在表:耗材请求
     * @param medMedicationRequest 请求所在表:药品请求
     * @return 处置单
     */
    Page<OutpatientTreatmentInfoDto> selectTreatmentInfoPage(@Param("page") Page<OutpatientTreatmentInfoDto> page,
        @Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper,
        @Param("reqCompleted") Integer reqCompleted, @Param("draft") Integer draft,
        @Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest,
        @Param("medMedicationRequest") String medMedicationRequest);

    /**
     * 查询执行记录
     *
     * @param reqIds 项目ids
     * @return 执行记录列表
     */
    List<PerformRecordDto> selectPerformRecordList(@Param("reqIds") List<Long> reqIds);

    /**
     * 输血贴查询
     *
     * @param requestId 请求id
     * @return 输血贴
     */
    BloodTransfusionPatchDto getBloodTransfusionPatch(@Param("requestId") Long requestId);
}
