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 UnionDoctorRepository extends JpaRepository<UnionDoctor, Integer> {


    /**
     * 根据doctorId和union_doctor_id得到当前关联的具体医生
     *
     * @param userId
     * @param doctorId
     * @return
     */
    @Query(value = "SELECT * FROM union_doctor WHERE ((doctor_id = ? and  union_doctor_id = ?) OR (doctor_id = ? and  union_doctor_id = ?))  and is_deleted = 0 limit 2",nativeQuery = true)
    List<UnionDoctor> getUnionDoctorByUserId(Integer userId, Integer doctorId, Integer doctorId2, Integer userId2);
}
