package com.yihu.jw.hospital.prescription.dao;

import com.yihu.jw.entity.hospital.prescription.WlyyPatientRegisterDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Date;
import java.util.List;

/**
 * Created by Trick on 2019/8/23.
 */
public interface PatientRegisterDao extends PagingAndSortingRepository<WlyyPatientRegisterDO, String>, JpaSpecificationExecutor<WlyyPatientRegisterDO> {

    List<WlyyPatientRegisterDO> findByPatientAndDate(String patient,String date);
    @Query("select a from WlyyPatientRegisterDO a where a.patient = ?1 and a.date =?2 and a.doctor=?3 and a.del=?4 ")
    List<WlyyPatientRegisterDO> findByPatientAndDateAndDoctorAndDel(String patient,String date,String doctor,Integer del);
    @Query("select a from WlyyPatientRegisterDO a where a.patient = ?1 and a.createTime=?2 and a.del=?3 ")
    List<WlyyPatientRegisterDO> findByPatientAndCreateTimeAndDel(String patient, Date createTime,Integer del);
    @Query("select a from WlyyPatientRegisterDO a where a.registerNo = ?1 and a.del=1 ")
    WlyyPatientRegisterDO findByRegisterNo(String registerNo);
}
