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.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.MonitoringTestEthylenOxide;

@Repository("MonitoringTestEntylenOxideDao")
public interface MonitoringTestEntylenOxideDao extends CrudRepository<MonitoringTestEthylenOxide, String>{
	@Query("select new map(a.noRec as noRec, " +
			" a.tanggalMulai as tanggalMulai, " +
			" a.tanggalSelesai as tanggalSelesai, " +
			" a.jamMulai as jamMulai, a.jamSelesai as jamSelesai, " +
			" a.pemeriksaan as pemeriksaan, b.id as idPetugas, " +
			" b.namaExternal as namaPegawai) " +
			" from MonitoringTestEthylenOxide a " +
			" left join a.petugas b where a.statusEnabled in('true') " +
			" and date(a.tanggalMulai) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getMonitoringTestEntylenOxide(@Param("startDate")String startDate, @Param("endDate")String endDate);
}
