package com.yihu.wlyy.repository.patient;

import com.yihu.wlyy.entity.patient.PatientEvent;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;


public interface PatientEventDao extends PagingAndSortingRepository<PatientEvent, Long>, JpaSpecificationExecutor<PatientEvent> {

      @Query("select a from PatientEvent a where a.patient = ?1 order by a.eventDate desc")
      List<PatientEvent> findByPatient(String patient) throws Exception;

      @Query("select a from PatientEvent a where a.patient = ?1 and a.eventType = ?2 order by a.eventDate desc")
      List<PatientEvent> findByPatientAndEventType(String patient,String type) throws Exception;
}
