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

@Repository("KeluhanPelangganDao")
public interface KeluhanPelangganDao extends PagingAndSortingRepository<KeluhanPelanggan, Integer>{
	//add by iwankasan 19062017
	@Query("select new map(a.namaPasien as namaPasien, a.noRm as noRm, a.alamat as alamat, " +
			" a.namaPasien as namaPasien, a.noRm as noRm, a.email as email, " +
			" a.noTlp as noTelp, a.keluhan as keluhan, a.saran as saran, " +
			" a.umur as umur, a.tglKeluhan as tglKeluhan, a.tglOrder as tglOrder) from " +
		    " KeluhanPelanggan a where month(a.tglOrder) = :bulan and year(a.tglOrder) = :tahun")
	List<Map<String, Object>> getKeluhanPelangganByPeriod(@Param("tahun") Integer tahun, @Param("bulan") Integer bulan);
	
	@Query("select new map(a.id as id, a.pekerjaan as pekerjaan) from Pekerjaan a")
	List<Map<String, Object >> getPekerjaan();
	
}
