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 DoctorSignRepository extends JpaRepository<DoctorSign, Integer> {
    @Query(value = "select * from doctor_sign where doctor_id = ? and deleted = 0 order by create_time desc;", nativeQuery = true)
    List<DoctorSign> getDoctorSignList(int doctorId);

    @Query(value = "select * from doctor_sign where id = ? and deleted = 0 order by create_time desc limit 1;", nativeQuery = true)
    DoctorSign getDoctorSignById(int id);

    /**
     * 根据医生ID得到最新的签名对象
     * @param doctorId
     * @return
     */
    @Query(value = "select * from doctor_sign where doctor_id = ? and deleted = 0 order by create_time desc limit 1;", nativeQuery = true)
    DoctorSign getDoctorSignByDoctorId(int doctorId);


}
