package com.jasamedika.medifirst2000.dao;

import java.util.List;

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

/**
 * Repository class for KelompokPasien
 * 
 * @author Askur
 */
@Repository("KelompokPasienDao")
public interface KelompokPasienDao extends PagingAndSortingRepository<KelompokPasien, Integer> {

	@Query("select p from KelompokPasien p where p.id= (Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='KdKelompokPasienUmum')")
	public List<KelompokPasien> getKelompokPasienUmum();

	@Query("select model from KelompokPasien model where model.id=:id")
	public KelompokPasien findById(@Param("id") Integer id);

	@Query("select model from KelompokPasien model where model.id = (Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='KdKelompokPasienUmum' ) ")
	public KelompokPasien defaultKelompokPasien();

	@Query("select p from KelompokPasien p where statusEnabled=true")
	public List<KelompokPasien> findKelompokPasien();

}
