package com.xinelu.manage.mapper.appointmentorder;


import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
import com.xinelu.manage.domain.nursestationpersoncertificate.NurseStationPersonCertificate;
import com.xinelu.manage.vo.RefundOrderInfoVO;
import com.xinelu.manage.vo.orderDetails.AppointmentOrderAndDetails;
import com.xinelu.manage.vo.AppointOrderAndDetailsInfo;
import com.xinelu.manage.vo.appointmentorder.AppointmentOrderInfoVO;
import com.xinelu.manage.vo.appointmentorder.AppointmentOrderVO;
import com.xinelu.manage.vo.appointmentorder.PersonAndDepartmentVO;
import com.xinelu.manage.vo.stationmessagepush.WaitReceiveMessagePushVO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 预约订单信息Mapper接口
 *
 * @author 纪寒
 * @date 2022-09-05
 */
public interface AppointmentOrderMapper {
    /**
     * 查询预约订单信息
     *
     * @param id      预约订单信息主键
     * @param orderNo 预约订单信息
     * @return 预约订单信息
     */
    AppointmentOrder selectAppointmentOrderById(@Param("id") Long id, @Param("orderNo") String orderNo);

    /**
     * 查询预约订单信息列表
     *
     * @param appointmentOrderVO 预约订单信息
     * @return 预约订单信息集合
     */
    List<AppointmentOrderVO> selectAppointmentOrderList(AppointmentOrderVO appointmentOrderVO);

    /**
     * 查询预约订单信息列表
     *
     * @param appointmentOrderVO 预约订单编号集合
     * @return 预约订单信息集合
     */
    List<AppointmentOrderVO> selectNameByOrderNoList(AppointmentOrderVO appointmentOrderVO);

    /**
     * 新增预约订单信息
     *
     * @param appointmentOrder 预约订单信息
     * @return 结果
     */
    int insertAppointmentOrder(AppointmentOrder appointmentOrder);

    /**
     * 修改预约订单信息
     *
     * @param appointmentOrder 预约订单信息
     * @return 结果
     */
    int updateAppointmentOrder(AppointmentOrder appointmentOrder);

    /**
     * 删除预约订单信息
     *
     * @param id 预约订单信息主键
     * @return 结果
     */
    int deleteAppointmentOrderById(Long id);

    /**
     * 逻辑批量删除预约订单信息
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int updateAppointmentOrderByIds(Long[] ids);

    /**
     * 根据id查询预约订单信息
     *
     * @param ids 预约订单id
     * @return java.util.List<com.xinyilu.base.domain.appointmentorder.AppointmentOrder>
     **/
    List<AppointmentOrder> getAppointmentOrderByIds(Long[] ids);

    /**
     * 查询护理站人员信息列表
     *
     * @param personAndDepartment 预约订单信息id
     * @return 护理站人员名称集合
     */
    List<PersonAndDepartmentVO> selectNurseStationPersonNameList(PersonAndDepartmentVO personAndDepartment);

    /**
     * 查询护理站人员证书列表
     *
     * @param nurseStationPersonId 信息id
     * @return 护理站人员
     */
    List<NurseStationPersonCertificate> selectNurseStationPersonCertificateList(Long nurseStationPersonId);

    /**
     * 修改预约订单信息，派单
     *
     * @param appointmentOrder 预约订单信息
     * @return 护理站人员名称集合
     */
    int updateAppointmentOrderDispatchStatus(AppointmentOrder appointmentOrder);

    /**
     * 根据订单编号查询预约订单信息列表
     *
     * @param orderNo 预约订单信息
     * @return 预约订单信息集合
     */
    AppointmentOrder getAppointmentOrderByOrderNo(String orderNo);

    /**
     * 修改预约订单状态
     *
     * @param orderStatus 订单状态
     * @param orderNo     订单编号
     * @return 数量
     */
    int updateAppointmentOrderStatus(@Param("orderStatus") String orderStatus, @Param("orderNo") String orderNo);

    /**
     * 查询下单时间超过2小时但未支付的订单信息
     *
     * @param localDateTime 时间
     * @return 订单集合
     */
    List<AppointOrderAndDetailsInfo> getWaitPayAppointmentOrderList(@Param("time") LocalDateTime localDateTime);

    /**
     * 批量更新订单状态
     *
     * @param orderNoList 订单列表信息
     * @param orderStatus 订单状态
     * @return 更新数量
     */
    int updateBatchAppointmentOrderStatus(@Param("orderNoList") List<String> orderNoList, @Param("orderStatus") String orderStatus);

    /**
     * 批量更新订单状态及护理员Id
     *
     * @param orderNoList 订单列表信息
     * @param orderStatus 订单状态
     * @return 更新数量
     */
    int updateBatchAppointmentOrderStatusAndPerson(@Param("orderNoList") List<String> orderNoList, @Param("orderStatus") String orderStatus);

    /**
     * 查询未支付的订单信息
     *
     * @param orderStatus 订单状态
     * @return 订单集合
     */
    List<AppointmentOrder> getWaitPayStatusAppointmentOrderList(@Param("orderStatus") String orderStatus);

    /**
     * 查询待退款的预约订单信息
     *
     * @param orderStatus         订单状态
     * @param refundStatus        退款状态
     * @param confirmRefundStatus 确认退款状态
     * @return 待退款的定单信息集合
     */
    List<RefundOrderInfoVO> getRefundAppointmentOrderInfo(@Param("orderStatus") String orderStatus,
                                                          @Param("refundStatus") String refundStatus,
                                                          @Param("confirmRefundStatus") String confirmRefundStatus);

    /**
     * PC端确认订单取消
     *
     * @param appointmentOrder 订单信息
     * @return 结果
     */
    int updateAppointmentOrderByOrderId(AppointmentOrder appointmentOrder);

    /**
     * 根据订单编号查询订单主表和订单明细表信息
     *
     * @param orderNo 预约订单编号
     * @return 订单主表和订单明细表信息
     */
    AppointOrderAndDetailsInfo getAppointOrderAndDetailsInfo(String orderNo);

    /**
     * 更新订单编号修改确认退款状态
     *
     * @param orderNo             订单编号
     * @param confirmRefundStatus 确认退款状态
     * @return 数量
     */
    int updateAppointConfirmRefundStatus(@Param("orderNo") String orderNo, @Param("confirmRefundStatus") String confirmRefundStatus);

    /**
     * 查询待支付的订单数量
     *
     * @param orderNoList 订单编号
     * @return 订单集合
     */
    List<AppointOrderAndDetailsInfo> getWaitPayAppointList(@Param("orderNoList") List<String> orderNoList);

    /**
     * 查询时间段的预约订单
     *
     * @param beforeTime  之前10分钟
     * @param time        现在时间
     * @param orderStatus 订单状态
     * @return List<GoodsOrder>
     */
    List<AppointmentOrderAndDetails> selectAppointmentOrderByTime(@Param("beforeTime") LocalDateTime beforeTime, @Param("time") LocalDateTime time, @Param("orderStatus") String orderStatus);

    /**
     * 根据订单编号查询预约订单信息列表
     *
     * @param orderNo 预约订单信息
     * @return 预约订单信息集合
     */
    AppointmentOrderInfoVO getAppointmentOrderInfoByOrderNo(String orderNo);

    /**
     * 查询订单明细
     *
     * @param orderNo 订单编号
     * @return DispatchMessagePushVO
     */
    WaitReceiveMessagePushVO selectOrderDetailsAndPatientBy(String orderNo);

    /**
     * 查询某时间段的预约订单
     *
     * @param beforeTime  之前10分钟
     * @param time        现在时间
     * @param orderStatus 订单状态
     * @return List<GoodsOrder>
     */
    List<WaitReceiveMessagePushVO> selectWaitReceiveOrderByTime(@Param("beforeTime") LocalDateTime beforeTime, @Param("time") LocalDateTime time, @Param("orderStatus") String orderStatus);

    /**
     * 查询某时间段的预约订单
     *
     * @param time        现在时间
     * @param orderStatus 订单状态
     * @return List<GoodsOrder>
     */
    List<WaitReceiveMessagePushVO> selectWaitReceiveOrderByUpdateTime(@Param("time") LocalDateTime time, @Param("orderStatus") String orderStatus);
}
