package com.jasamedika.medifirst2000.dao;

import com.jasamedika.medifirst2000.entities.PelayananPasienDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Repository class for PelayananPasien
 * 
 * @author Generator
 */
public interface PelayananPasienDetailDao extends JpaRepository<PelayananPasienDetail, String> {
	@Query("select model from PelayananPasienDetail model left join model.pelayananPasien a where a.noRec=:noRec")
	List<PelayananPasienDetail> findByPelayananPasien(@Param("noRec") String noRec);

	@Query("select sum(ppd.hargaDiscount) " + "from PelayananPasienDetail ppd "
			+ "where ppd.pelayananPasienId = :noRec " + "and ppd.komponenHargaId = 35")
	Double totalDiskonJasamedis(@Param("noRec") String noRec);

	@Query("select ppd " + "from PelayananPasienDetail ppd " + "where ppd.pelayananPasienId in (:listIdPelayanan) "
			+ "and ppd.komponenHargaId = :idKomponenHarga")
	List<PelayananPasienDetail> findByPelayananAndKomponenHarga(@Param("listIdPelayanan") List<String> listIdPelayanan,
			@Param("idKomponenHarga") Integer idKomponenHarga);
}
