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

@Repository("ProdukKeslingNilaiNormalDao")
public interface ProdukKeslingNilaiNormalDao extends PagingAndSortingRepository<ProdukKeslingNilaiNormal, Integer> {

	@Query("select new Map(p.namaExternal as nama,"
			+ "coalesce(s.satuanStandar,'-') as satuan,"
			+ "p.id as id,"
			+ "j.name as jenisPemeriksaan,"
			+ "p.refrange as refrange )"
			+ "from ProdukKeslingNilaiNormal "
			+ "p left join p.satuanStandar "
			+ "s left join p.jenisPemeriksaan j where p.jenisPemeriksaanId=:jenisPemeriksaanId ")
	List<Map<String,Object>> getProdukKeslingNilaiNormal(@Param("jenisPemeriksaanId") Integer jenisPemeriksaanId);
}
