package com.jasamedika.medifirst2000.dao;

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

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.PasienDiRujukKeIntExt;

/**
 * Repository class for Pegawai
 * 
 * @author Askur
 */
@Repository("PasienDiRujukKeIntExtDao")
public interface PasienDiRujukKeIntExtDao extends PagingAndSortingRepository<PasienDiRujukKeIntExt, String>{
	@Query("select coalesce(max(p.noAntrianTujuan),0) from PasienDiRujukKeIntExt p "
			+ "where date(p.tglDirujuk)=:dateNow and p.ruanganTujuan.id=:idRuangan")
	Integer getCountByMonthAndYearBilik(@Param("dateNow") Date dateNow,@Param("idRuangan") Integer idRuangan);
	
	@Query("select model from PasienDiRujukKeIntExt model where model.noRegistrasi.noRec=:noRec")
	public List<PasienDiRujukKeIntExt> findAllByNoRecAntrian(@Param("noRec") String noRec);


}
