package com.jasamedika.medifirst2000.dao;

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

/**
 * Repository class for PapRiwayatKelahiran
 * 
 * @author Askur
 */
@Repository("PapRiwayatKelahiranDao")
public interface PapRiwayatKelahiranDao extends PagingAndSortingRepository<PapRiwayatKelahiran, Integer> {
	@Query("select model from PapRiwayatKelahiran model where model.id=:id")
	public PapRiwayatKelahiran findById(@Param("id") Integer id);
	
	@Query("select model.beratBadanLahir, model.dataPersalinan.name, model.menangis.name, model.usiaKehamilan, model.panjangBadanLahir,riwayatKuning.name from PapRiwayatKelahiran model left join model.riwayatKuning riwayatKuning where model.pasienDaftar.pasienDaftar.pasien.noCm=:noCm and to_char(model.tglInput,'yyyy-MM-dd')=:tglInput")
	public List<Object[]> findByNocmAndTglInput(@Param("noCm") String noCm,@Param("tglInput") String tglInput);	
		
}
