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

@Repository("swabAlatPermukaanDao")
public interface SwabAlatPermukaanDao extends PagingAndSortingRepository<SwabAlatPermukaan, Integer>{
	
	@Query("select NEW Map ("
			+ "a.id as ruanganId, "
			+ "a.namaRuangan as namaRuangan) "
			+ "from Ruangan a")
	List<Map<String, Object>> getUnitRuangan();
	
	@Query("select NEW Map ("
			+ "a.id as id, "
			+ "a.tanggal as tanggal, "
			+ "a.jenisAlat as jenisAlat, "
			+ "a.hasilPemeriksaan as hasilPemeriksaan, "
			+ "a.reportDisplay as reportDisplay, "
			+ "a.fileName as fileName) "
			+ "from SwabAlatPermukaan a")
	List<Map<String, Object>> getSwabAlatPermukaan();
	
	@Query("select NEW Map ("
			+ "a.file as file) "
			+ "from SwabAlatPermukaan a "
			+ "where a.id=:id")
	Map<String, Object> downloadFileHasilPemantauan(
			@Param("id") Integer id);
}
