package com.jasamedika.medifirst2000.dao;

import java.util.List;
import java.util.Map;

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


@Repository("PemeriksaanLimbahDetailDao")
public interface PemeriksaanLimbahDetailDao extends PagingAndSortingRepository<PemeriksaanLimbah, String> {
	
	@Query("select new map ( "
			+"pemeriksaanLimbahDetail.keterangan as keterangan,"
			+"pemeriksaanLimbahDetail.nilai as nilai,"
			+"jenisPemeriksaan.name as jenisPemeriksaan,"
			+"nilaiNormal.refrange as bakuMutu,"
			+"satuanStandar.satuanStandar as satuan ) "
			+"from PemeriksaanLimbahDetail pemeriksaanLimbahDetail "
			+"join pemeriksaanLimbahDetail.produkKeslingNilaiNormal nilaiNormal "
			+"left join nilaiNormal.jenisPemeriksaan jenisPemeriksaan "
			+"left join nilaiNormal.satuanStandar satuanStandar where pemeriksaanLimbahDetail.pemeriksaanLimbahId=:noRec ")
	public List<Map<String,Object>> findByParent(@Param("noRec") String noRec);
	
}
