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.PapRiwayatImunisasi;

/**
 * Repository class for PapRiwayatImunisasi
 * 
 * @author Askur
 */
@Repository("PapRiwayatImunisasiDao")
public interface PapRiwayatImunisasiDao extends PagingAndSortingRepository<PapRiwayatImunisasi, String> {
	@Query("select model from PapRiwayatImunisasi model where model.pasien.noRec=:noRec and model.tglInput=:tglInput")
	public PapRiwayatImunisasi findPapRiwayatImunisasiByNoCmAndTglInput(@Param("noRec") String noCm,@Param("tglInput") Date tglInput);
	
	@Query("select a.pasien.pasienDaftar.pasien.noCm, b.imunisasi.imunisasi from PapRiwayatImunisasi a,PapImunisasiDetail b where b.papRiwayatImunisasiId = a.noRec and a.pasien.pasienDaftar.pasien.noCm =:noCm and to_char(a.tglInput,'yyyy-MM-dd')=:tglInput")
	public List<Object[]> findByNoCmAndTglInput(@Param("noCm") String noCm,@Param("tglInput") String tglInput);		
		
}
