package com.ywt.outpatient.domain.entity.center;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ConsultOrderViewRepository extends JpaRepository<ConsultOrderView, Integer> {
    List<ConsultOrderView> getListByDoctorIdAndUserId(int doctorId, int userId);


    @Query(value = "select * from ywt_center.consult_order_view where doctor_id = ? and user_id = ? and ((consult_status & 4) = 4) order by consult_id desc limit 1 ;", nativeQuery = true)
    ConsultOrderView getLatestAcceptedConsultOrder(int doctorId, int userId);
}
