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

@Repository("HasilPemeriksaanSwaDetailDao")
public interface HasilPemeriksaanSwaDetailDao extends PagingAndSortingRepository<HasilPemeriksaanSwaPantauLimbahCair, String> {


	@Query("select new map("
			+ "coalesce(detail.nilai,0.0) as nilai,"
			+ "coalesce(detail.noRec,'-') as noRec,"
			+ "coalesce(parameter.nama,'-') as parameter,"
			+ "coalesce(satuanStandar.satuanStandar,'-') as satuanStandar"
			+ ") "
			+ "from HasilPemeriksaanSwaDetail detail  "
			+ "left join detail.parameter parameter  "
			+ "left join detail.satuanStandar satuanStandar where detail.hasilPemeriksaanSwaPantauLimbahCair.noRec=:noRec ")
	public List<Map<String,Object>> findByParent(@Param("noRec") String noRec);
	
}
