package com.jasamedika.medifirst2000.dao;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
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.OrderPelayanan;
import com.jasamedika.medifirst2000.entities.PapPengambilanSpesimen;
import com.jasamedika.medifirst2000.entities.Produk;
import com.jasamedika.medifirst2000.entities.ProdukDetailLaboratorium;
import com.jasamedika.medifirst2000.entities.ResepRacikanOrderDetail;

/**
 * Repository class for PAPPernapasan
 * 
 * @author Askur
 */
@Repository("OrderPelayananDao")
public interface OrderPelayananDao
		extends PagingAndSortingRepository<OrderPelayanan, String>, JpaSpecificationExecutor<OrderPelayanan> {

	OrderPelayanan findFirstByNoRec(String noRec);

	@Query("select p from OrderPelayanan p where p.noRec=:noRec ")
	OrderPelayanan findById(@Param("noRec") String noRec);

	@Query("select p from OrderPelayanan p where p.strukOrder.noOrder =:noOrder or p.strukOrder.noOrderIntern =:noOrder")
	List<OrderPelayanan> findOrderByNoOrder(@Param("noOrder") String noOrder);

	@Query("select distinct p from  PapPengambilanSpesimen p where p.strukOrder.noOrderIntern =:noOrder ")
	List<PapPengambilanSpesimen> findByStrukOrderNoOrderIntern(@Param("noOrder") String noOrder);

	@Query("select distinct p.produk from  OrderPelayanan p where p.strukOrder.noOrderIntern =:noOrder ")
	List<Produk> findDistinctByNoStrukOrderNoOrder(@Param("noOrder") String noOrder);

	@Query("select p.detail from  HasilPemeriksaan p where p.strukHasilPemeriksaan.strukOrder.noOrderIntern =:noOrder ")
	List<ProdukDetailLaboratorium> findHasilByNoStrukOrderNoOrder(@Param("noOrder") String noOrder);

	@Query("select NEW Map(so.noRec as noRecStrukOrder, so.tglOrder as tglOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,coalesce(so.noTelpMobile,'') as noTelp,"
			+ "so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.id as namaProdukId,pdk.namaProduk as namaPelayanan,"
			+ "kmr.id as kamarId,kmr.namaKamar as namaKamar,so.totalHargaSatuan as totalHargaSatuan,so.status as status) from OrderPelayanan op "
			+ "left join op.noOrder so left join op.produk pdk left join op.kamar kmr where date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and so.noOrderIntern like '%RD%' order by so.noOrder")
	List<Map<String, Object>> findDaftarPemakaianRumahDukaByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// sewa asrama - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,so.alamat as alamat,"
			+ "so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,so.tglKeluar as tglCheckout,so.lamaSewa as lamaSewa,"
			+ "so.totalHargaSatuan as harga,so.status as status) from OrderPelayanan op left join op.noOrder so left join op.produk pdk "
			+ "where date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and so.noOrderIntern like '%SA%' order by so.noOrder")
	List<OrderPelayanan> findDaftarSewaAsramaByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// daftar sewa lahan - sarpras Sewa Lahan Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,so.alamat as alamat, "
			+ "so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.namaProduk as namaLahan,so.lamaSewa as lamaSewa,"
			+ "sw.satuanWaktu as satuan,so.totalHargaSatuan as harga,so.status as status) from OrderPelayanan op left join op.noOrder so "
			+ "left join op.produk pdk left join op.satuanWaktu sw where date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) "
			+ "and so.noOrderIntern like '%SL%' order by so.noOrder")
	List<OrderPelayanan> findDaftarSewaLahanByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// daftar ambulance - sarpras Rumah Tangga
	@Query("select o from OrderPelayanan o, StrukOrder s where o.strukOrderId=s.noRec and date(s.tglPelayananAwal) between date(:periodeAwal) and date(:periodeAkhir) and s.noOrderIntern like '%OA%'")
	List<OrderPelayanan> findDaftarPesanAmbulanceByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// daftar kendaraan dinas - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglPelayananAwal as tglKeberangkatan,"
			+ "so.tglPelayananAkhir as tglAkhirPemakaian,so.waktuPengembalian as waktuPengembalian,up.namaRuangan as unitPemesan,"
			+ "so.alamatTempatTujuan as alamatTempatTujuan,so.status as status) from StrukOrder so left join so.unitPemesan up "
			+ "where date(so.tglPelayananAwal) between date(:periodeAwal) and date(:periodeAkhir) and so.noOrderIntern like '%KD%'")
	List<OrderPelayanan> findDaftarKendaraanDinasByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// ruang rapat - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,so.temaRapat as temaRapat,so.tglPelayananAwal as mulaiRapat,so.tglPelayananAkhir as selesaiRapat,"
			+ "so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia,jk.id as jenisKonsumsiId,jk.name as jenisKonsumsi,"
			+ "pks.noRec as noRecPenambahan,coalesce(pks.namaBarang,'') as namaBarang,coalesce(pks.jumlah,0) as jumlah,coalesce(pks.harga,0) as harga,"
			+ "coalesce(pks.satuan,'') as satuan,so.status as status) from JenisKonsumsiSet jks,PenambahanKebutuhanSarana pks,"
			+ "StrukOrder so,JenisKonsumsi jk,Ruangan r,Ruangan rg,OrderPelayanan op where so.noRec=op.noOrderId and rg.id=op.ruanganId and "
			+ "date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and "
			+ "so.noRec=jks.strukOrderId and so.noRec=pks.strukOrderId and jk.id=jks.jenisKonsumsiId "
			+ "and r.id=so.unitPemesanId and so.noOrderIntern like '%ORR%' order by so.noOrder")
	List<Map<String, Object>> findDaftarRuangRapatByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// sewa asrama - sarpras Rumah Tangga
	@Query("select NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,so.alamat as alamat,"
			+ "so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,so.tglKeluar as tglCheckout,so.lamaSewa as lamaSewa,"
			+ "so.totalHargaSatuan as harga,so.status as status) from OrderPelayanan op left join op.noOrder so left join op.produk pdk "
			+ "where so.noOrderIntern like '%SA%' order by so.noOrder")
	List<OrderPelayanan> getAllSewaAsrama();

	// sewa lahan - sarpras Rumah Tangga
	@Query("select NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,so.alamat as alamat,"
			+ "so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.namaProduk as namaLahan,so.lamaSewa as lamaSewa,"
			+ "sw.satuanWaktu as satuan,so.totalHargaSatuan as harga,so.status as status) from OrderPelayanan op left join op.noOrder so "
			+ "left join op.produk pdk left join op.satuanWaktu sw where so.noOrderIntern like '%SL%' order by so.noOrder")
	List<OrderPelayanan> getAllSewaLahan();

	// daftar order ambulance - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk,Ruangan r where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId "
			+ "and date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findDaftarOrderAmbulanceByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// daftar order ambulance - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk,Ruangan r where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId "
			+ "and so.noOrder=:noOrder and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findDaftarOrderAmbulanceByNoOrder(@Param("noOrder") String noOrder);

	// daftar order ambulance - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,PasienDaftar pd,Alamat alm,Ruangan r,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId "
			+ "and r.id=op.ruanganId and p.id=pd.pasienId order by p.id")
	List<OrderPelayanan> getAllDaftarOrderAmbulance();

	// daftar order ambulance - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk,Ruangan r where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId "
			+ "and date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and so.noOrder=:noOrder and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findByPeriodeDanNoOrder(@Param("noOrder") String noOrder,
			@Param("periodeAwal") String periodeAwal, @Param("periodeAkhir") String periodeAkhir);

	// kendaraan dinas & pejabat - sarpras
	@Query("select op from OrderPelayanan op where op.strukOrder.noOrderIntern like '%KD%'")
	List<OrderPelayanan> getAllKendaraanDinasDanPejabat();

	@Query("select p from OrderPelayanan p where p.strukOrder.noRec=:noRec")
	List<OrderPelayanan> findByNoRec(@Param("noRec") String noRec);

	@Query("select p from OrderPelayanan p where p.noRec=:noRec")
	OrderPelayanan finById(@Param("noRec") String noRec);

	@Query("select p from OrderPelayanan p where p.strukOrder.noRec=:noRec")
	OrderPelayanan findByNoRecStrukOrder(@Param("noRec") String noRec);

	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.unitPemesan as unitPemesan,so.temaRapat as temaRapat,"
			+ "so.tglPelayananAwal as tglPelayananAwal,so.tglPelayananAkhir as tglPelayananAkhir,so.jumlahPeserta as jumlahPeserta,"
			+ "so.jumlahPanitia as jumlahPanitia,r.id as idRuangan,r.namaRuangan as namaRuangan,jk.id as idKonsumsi,"
			+ "jk.name as namaKonsumsi,pks.noRec as noRecSarana,pks.namaBarang as namaBarang,pks.jumlah as jumlah,pks.satuan as satuan) "
			+ "from OrderPelayanan p,StrukOrder so,Ruangan r,JenisKonsumsiSet jks,PenambahanKebutuhanSarana pks,JenisKonsumsi jk "
			+ "where so.noRec=p.noOrderId and r.id=p.ruanganId and so.noRec=jks.strukOrderId "
			+ "and so.noRec=pks.strukOrderId and jk.id=jks.jenisKonsumsiId and so.noOrder=:noOrder")
	List<OrderPelayanan> findByNoOrder(@Param("noOrder") String noOrder);

	// ruang rapat - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,so.temaRapat as temaRapat,so.tglPelayananAwal as mulaiRapat,"
			+ "so.tglPelayananAkhir as selesaiRapat,so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia,jk.id as jenisKonsumsiId,"
			+ "jk.name as jenisKonsumsi,pks.noRec as noRecPenambahan,coalesce(pks.namaBarang,'') as namaBarang,coalesce(pks.jumlah,0) as jumlah,"
			+ "coalesce(pks.harga,0) as harga,coalesce(pks.satuan,'') as satuan,so.status as status) from JenisKonsumsiSet jks,"
			+ "PenambahanKebutuhanSarana pks,StrukOrder so,JenisKonsumsi jk,Ruangan r,Ruangan rg,OrderPelayanan op where so.noRec=op.noOrderId and "
			+ "rg.id=op.ruanganId and so.noRec=jks.strukOrderId and so.noRec=pks.strukOrderId and jk.id=jks.jenisKonsumsiId "
			+ "and r.id=so.unitPemesanId and so.noOrderIntern like '%ORR%' order by so.noOrder")
	List<Map<String, Object>> getAllOrderRuangRapat();
	
	// ruang rapat - sarpras Rumah Tangga by date
	// update : by iwankasan
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,"
			+ "r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,so.temaRapat as temaRapat," 
			+ "to_char(so.tglPelayananAwal,'yyyy-mm-dd hh24:mi:ss') as mulaiRapat,"
			+ "to_char(so.tglPelayananAkhir,'yyyy-mm-dd hh24:mi:ss') as selesaiRapat,"
			+ "so.tglPelayananAwal as tglPelayananAwal,"
			+ "so.tglPelayananAkhir as tglPelayananAkhir,"
			+ "so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia,"
			+ "so.status as status, pg.id as idPegawai, pg.namaLengkap as namaLengkap) from StrukOrder so,"
			+ "Ruangan r,Ruangan rg,OrderPelayanan op, Pegawai pg where so.noRec=op.noOrderId and "
			+ "rg.id=op.ruanganId and so.statusEnabled in('true') "
			+ "and so.tglPelayananAkhir>=now() "
			+ "and so.petugasId=pg.id "
			+ "and r.id=so.unitPemesanId and so.noOrderIntern like '%ORR%' " 
			+ "and date(so.tglPelayananAwal) between date(:startDate) and date(:endDate) order by so.noOrder")
	List<Map<String, Object>> getAllOrderRuangRapatByDate(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//showdata ruang rapat-yg digunakan/diorder
	//update by : iwankasan
	@Query("select new map(r.id as id, r.namaRuangan as namaRuangan)" +
			" from Ruangan r where r.namaRuangan like '%Rapat%'")
	public List<Map<String, Object>> getRuanganRapat();
	
	// ruang rapat - sarpras Rumah Tangga by date
	// update : by iwankasan
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder," 
			+ "r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,"
			+ "so.temaRapat as temaRapat,to_char(so.tglPelayananAwal,'yyyy-mm-dd hh24:mi:ss') as mulaiRapat,"
			+ "so.tglPelayananAwal as tglPelayananAwal,so.tglPelayananAkhir as tglPelayananAkhir,"
			+ "to_char(so.tglPelayananAkhir,'yyyy-mm-dd hh24:mi:ss') as selesaiRapat,"
			+ "so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia,"
			+ "so.status as status) from StrukOrder so,"
			+ "Ruangan r,Ruangan rg,OrderPelayanan op where so.noRec=op.noOrderId and "
			+ "rg.id=op.ruanganId and so.statusEnabled in('true') "
			+ "and so.tglPelayananAkhir>=now() "
			+ "and r.id=so.unitPemesanId and so.noOrderIntern like '%ORR%' " 
			+ "and date(so.tglPelayananAwal)=date(:dateNow) and rg.id=:idRuangan order by so.noOrder")
	List<Map<String, Object>> getAllOrderRuangRapatByRuangan(@Param("dateNow")String dateNow, @Param("idRuangan")Integer idRuangan);
	
	// get all daftar pemakaian rumah duka - sarpras Rumah Tangga
	@Query("select NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,coalesce(so.noTelpMobile,'') as noTelp,"
			+ "so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.id as namaProdukId,pdk.namaProduk as namaPelayanan,"
			+ "kmr.id as kamarId,kmr.namaKamar as namaKamar,so.totalHargaSatuan as totalHargaSatuan,so.status as status) from OrderPelayanan op "
			+ "left join op.noOrder so left join op.produk pdk left join op.kamar kmr where so.noOrderIntern like '%RD%' order by so.noOrder")
	List<Map<String, Object>> getAllDaftarPemakaianRumahDuka();

	// daftar pemulasaraan jenazah - sarpras
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,Ruangan r,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId "
			+ "and date(so.tglOrder) between date(:periodeAwal) and date(:periodeAkhir) and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findDaftarPemulasaraanJenazahByPeriode(@Param("periodeAwal") String periodeAwal,
			@Param("periodeAkhir") String periodeAkhir);

	// daftar pemulasaraan jenazah - sarpras
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,cb.id as idCaraBayar,cb.caraBayar as tipePembayaran,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk,CaraBayar cb,Ruangan r where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId and cb.id=so.caraBayarQuoId "
			+ "and so.noRec=:noRec and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findDaftarPemulasaraanJenazahByNoRec(@Param("noRec") String noRec);

	// daftar pemulasaraan jenazah - sarpras
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,cb.id as idCaraBayar,cb.caraBayar as tipePembayaran,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan,r.namaRuangan as namaRuangan,so.status as status) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk,CaraBayar cb,Ruangan r where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and so.noRec=op.strukOrderId and pdk.id=op.produkId and cb.id=so.caraBayarQuoId "
			+ "and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> getAllDaftarPemulasaraanJenazah();
	
	// daftar pemulasaraan jenazah - sarpras
	//author by iwankasan
	//date : 16.07.2018
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,cb.id as idCaraBayar,cb.caraBayar as tipePembayaran,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "so.status as status) "
			+ "from StrukOrder so,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,CaraBayar cb " 
			+ "where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId " 
			+ "and cb.id=so.caraBayarQuoId "
			+ "order by p.id")
	List<Map<String, Object>> getAllDaftarPemulasaraanJenazahRev1();
	
	
	// daftar pemulasaraan jenazah external- sarpras
	//author by iwankasan
	//date : 16.07.2018
	@Query("select new map(sp.noRec as noRec, " +
			" sp.nostruk as nostruk, sp.tglstruk as tglstruk, " +
			" sp.namapasien_klien as namaPemesan, sp.noteleponfaks as noTelp, " +
			" sp.noKontrak as noKtp, sp.alamattempattujuan as alamat, " +
			" sp.totalhargasatuan as totalhargasatuan, sp.tglfaktur as tglfaktur) " +
			" from StrukPelayanan sp where date(sp.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getAllDaftarPemulasaraanJenazahExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	// daftar pemulasaraan jenazah external- sarpras
	//author by iwankasan
	//date : 16.07.2018
	@Query("select new map(sp.noRec as noRec, " +
			" sp.nostruk as nostruk, sp.tglstruk as tglstruk, " +
			" sp.namapasien_klien as namaPemesan, sp.noteleponfaks as noTelp, " +
			" sp.noKontrak as noKtp, sp.alamattempattujuan as alamat, " +
			" sp.totalhargasatuan as totalhargasatuan, sp.tglfaktur as tglfaktur) " +
			" from StrukPelayanan sp where sp.noRec=:noRec")
	List<Map<String, Object>> getPemulasaraanJenazahExternalByNoRec(@Param("noRec")String noRec);
	
	// daftar pemulasaraan jenazah external- sarpras
	//author by iwankasan
	//date : 16.07.2018
	@Query("select new map(spd.noRec as noRecDetail, " +
			" spd.hargasatuan as harga, p.id as produkId, " +
			" p.namaProduk as namaProduk) " +
			" from StrukPelayananDetail spd left join " +
			" spd.nostruk sp left join spd.kdproduk p where sp.noRec=:noRec")
	List<Map<String, Object>> getPemulasaraanJenazahExternalDetailByNoRec(@Param("noRec")String noRec);
		
	
	//daftar pemulasaraan jenazah - sarpras
	//set data yg ditampilkan hanya data pemulasaran jenazah
	//author by iwankasan
	//date : 16.07.2018
	@Query("select distinct NEW Map(r.id as idRuangan,r.namaRuangan as namaRuangan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk) "
			+ "from StrukOrder so,OrderPelayanan op, Ruangan r, "
			+ "Produk pdk where so.noRec=:noRec and r.id=op.ruanganId "
			+ "and so.noRec=op.strukOrderId and pdk.id=op.produkId and r.id in(53)")
	List<Map<String, Object>> getAllDaftarPemulasaraanJenazahDetailRev1(@Param("noRec")String noRec);

	// Daftar pasien yang masih ada di rs - sarpras Gizi
	@Query(" select distinct new Map(\n " + " o.noRec as orderId, \n " + " o.ruanganId as ruanganId, \n "
			+ " p.noRec as pasienDaftarId,\n" + " ps.id as pasienId, \n" + " ps.tglLahir as tglLahir, \n"
			+ " p.kelasId as kelasId, \n" + " s.noRec as strukId ) \n" + " from OrderPelayanan o, \n "
			+ "      StrukOrder s, \n " + "      PasienDaftar p, \n" + "      Pasien ps \n"
			// + " AntrianPasienDiPeriksa a \n"
			+ " where p.tglPulang is null \n" + " and   p.noRec = s.noRegistrasiId \n"
			+ " and   o.strukOrderId = s.noRec \n" + " and   p.pasienId = ps.id \n"
			// + " and p.noRec = a.pasienDaftarId \n"
			// + " and a.strukOrderId = s.noRec \n"
			+ " and  (o.produkId = 2 or s.tglOrder = :now)")
	public List<Map<String, Object>> getPasienOrderSiklus(@Param("now") Date now);

	@Query("select p from OrderPelayanan p where date( p.tglPelayanan)= date(:date) and p.noRegistrasi.noRec =:noAntrian and p.jenisWaktu.id=:jenisWaktu ")
	List<OrderPelayanan> findGiziPermintaan(@Param("date") Date date, @Param("noAntrian") String noAntrian,
			@Param("jenisWaktu") int jenisWaktu);

	// daftar sewa asrama by no order - sarpras sewa asrama Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,"
			+ "so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,k.namaKamar as namaKamar,r.id as idRuangan,"
			+ "r.namaRuangan as namaRuangan,so.tglKeluar as tglCheckout,so.lamaSewa as lamaSewa,hrg.hargaSatuan as hargaSatuan,"
			+ "so.totalHargaSatuan as totalHarga,so.status as status) from MappingKamarAsrama mka,HargaNettoProdukByKelas hrg left join hrg.produk p "
			+ "left join mka.orderPelayanan op left join mka.kamar k left join mka.ruangan r left join op.noOrder so where so.noOrderIntern like '%SA%' and r.namaRuangan like '%Asrama%' "
			+ "and p.id in (Select cast(s.nilaiField as int) from SettingDataFixed s where s.namaField='KdProdukSewaAsrama') "
			+ "and so.noOrder=:noOrder order by r.id,so.noOrder")
	List<OrderPelayanan> findDaftarAsramaByNoOrder(@Param("noOrder") String noOrder);

	// daftar sewa lahan by no order - sarpras sewa lahan Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile as noTelp,"
			+ "so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.namaProduk as namaLahan,"
			+ "so.lamaSewa as lamaSewa,sw.satuanWaktu as satuan,so.totalHargaSatuan as harga,so.status as status) from OrderPelayanan op "
			+ "left join op.noOrder so left join op.produk pdk left join op.satuanWaktu sw where so.noOrderIntern like '%SL%' "
			+ "and so.noOrder=:noOrder order by so.noOrder")
	List<OrderPelayanan> findDaftarSewaLahanByNoOrder(@Param("noOrder") String noOrder);

	// daftar rumah duka - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile "
			+ "as noTelp,so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,pdk.id as namaProdukId,pdk.namaProduk as namaPelayanan,"
			+ "kmr.id as kamarId,kmr.namaKamar as namaKamar,so.totalHargaSatuan as totalHargaSatuan,so.status as status) from OrderPelayanan op "
			+ "left join op.noOrder so left join op.produk pdk left join op.kamar kmr where so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> findDaftarRumahDukaByNoRec(@Param("noRec") String noRec);
	
	// daftar rumah duka - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.namaPenyewa as namaPenyewa,so.noKtp as noKtp,so.noTelpMobile "
			+ "as noTelp,so.alamat as alamat,so.tglPelayananAwal as tglSewaAwal,so.tglPelayananAkhir as tglSewaAkhir,"
			+ "so.totalHargaSatuan as totalHargaSatuan,so.status as status) from OrderPelayanan op "
			+ "left join op.noOrder so where so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> findDaftarRumahDukaByNoRecRev1(@Param("noRec") String noRec);

	// daftar pemakaian ruang rapat = sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,so.temaRapat as temaRapat,so.tglPelayananAwal as mulaiRapat,so.tglPelayananAkhir as selesaiRapat,"
			+ "so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia,jk.id as jenisKonsumsiId,jk.name as jenisKonsumsi,"
			+ "pks.noRec as noRecPenambahan,coalesce(pks.namaBarang,'') as namaBarang,coalesce(pks.jumlah,0) as jumlah,coalesce(pks.harga,0) as harga,"
			+ "coalesce(pks.satuan,'') as satuan,so.status as status) from JenisKonsumsiSet jks,PenambahanKebutuhanSarana pks,"
			+ "StrukOrder so,JenisKonsumsi jk,Ruangan r,Ruangan rg,OrderPelayanan op where so.noRec=op.noOrderId and rg.id=op.ruanganId and "
			+ "so.noRec=jks.strukOrderId and so.noRec=pks.strukOrderId and jk.id=jks.jenisKonsumsiId "
			+ "and r.id=so.unitPemesanId and so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> findDaftarOrderPemakaianRuangRapatNoRec(@Param("noRec") String noRec);
	
	//daftar pemakaian ruang rapat = sarpras Rumah Tangga
	//revisi by iwankasan
	//date : 11.12.2018
	@Query("select new Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,"
			+ "r.id as unitPemesanId,r.namaRuangan as unitPemesan,"
			+ "rg.id as ruangRapatId,rg.namaRuangan as ruangRapat,so.temaRapat as temaRapat,"
			+ "so.tglPelayananAwal as mulaiRapat,so.tglPelayananAkhir as selesaiRapat,"
			+ "so.jumlahPeserta as jumlahPeserta,so.jumlahPanitia as jumlahPanitia) from "
			+ "StrukOrder so,Ruangan r,Ruangan rg,OrderPelayanan op " 
			+ "where so.noRec=op.noOrderId and rg.id=op.ruanganId and "
			+ " r.id=so.unitPemesanId and so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> findDaftarOrderPemakaianRuangRapatNoRecRev1(@Param("noRec") String noRec);
	
	// daftar pemakaian ruang rapat = sarpras Rumah Tangga
	//jeniskonsumsi
	//by iwankasan
	//11.12.2018
	@Query("select new Map(jk.id as jenisKonsumsiId,jk.name as jenisKonsumsi)"
			+ "from JenisKonsumsiSet jks,"
			+ "StrukOrder so,JenisKonsumsi jk where "
			+ "so.noRec=jks.strukOrderId and jk.id=jks.jenisKonsumsiId "
			+ "and so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> getJenisKonsumsiRapatByNoRec(@Param("noRec") String noRec);
	
	// daftar pemakaian ruang rapat = sarpras Rumah Tangga
	//jeniskonsumsi
	//by iwankasan
	//11.12.2018
	@Query("select new Map(pks.noRec as noRecPenambahan,coalesce(pks.namaBarang,'') as namaBarang," 
			+ "coalesce(pks.jumlah,0) as jumlah,coalesce(pks.harga,0) as harga,"
			+ "coalesce(pks.satuan,'') as satuan) from PenambahanKebutuhanSarana pks,StrukOrder so where  "
			+ "so.noRec=pks.strukOrderId and so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> getPenambahanKebutuhanSaranaByNoRec(@Param("noRec") String noRec);

	// daftar order ambulance by no rec- sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan, "
			+ "r.namaRuangan as namaRuangan,so.status as status, "
			+ "so.namaPJawabKeluarga as pJawabKeluarga, so.namaTempatTujuan as namaTempatTujuan, "
			+ "so.alamatTempatTujuan as alamatTempatTujuan, so.keteranganLainnya as keteranganLainnya, "
			+ "op.produkAsetId as produkAsetId, pdkAset.namaProduk as namaAset, supir.id as idSupir, supir.namaLengkap as namaSupir) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk, Produk pdkAset,Ruangan r, Pegawai supir where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and "
			+ "so.noRec=op.strukOrderId and pdk.id=op.produkId and  pdkAset.id=op.produkAsetId and supir.id=so.petugasId "
			+ "and so.noRec=:noRec and r.id=op.ruanganId order by p.id")
	List<OrderPelayanan> findDaftarOrderAmbulanceByNoRec(@Param("noRec") String noRec);
	
	// daftar order ambulance by no rec- sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglOrder as tglOrder,"
			+ "p.id as idPasien,p.noCm as noCm,p.namaPasien as namaPasien,"
			+ "EXTRACT(year FROM AGE(p.tglLahir)) as umur,alm.id as idAlamat,alm.alamatLengkap as alamat,jk.id as idJenisKelamin,"
			+ "jk.jenisKelamin as jenisKelamin,sp.id as idStatusPerkawinan,sp.statusPerkawinan as statusPerkawinan,"
			+ "pdk.id as idProduk,pdk.namaProduk as namaProduk,r.id as idRuangan, "
			+ "r.namaRuangan as namaRuangan,so.status as status, "
			+ "so.namaPJawabKeluarga as pJawabKeluarga, so.namaTempatTujuan as namaTempatTujuan, "
			+ "so.alamatTempatTujuan as alamatTempatTujuan, so.keteranganLainnya as keteranganLainnya, "
			+ "op.produkAsetId as produkAsetId, pdkAset.namaProduk as namaAset, supir.id as idSupir, supir.namaLengkap as namaSupir) "
			+ "from StrukOrder so,OrderPelayanan op,Pasien p,Alamat alm,"
			+ "JenisKelamin jk,StatusPerkawinan sp,Produk pdk, Produk pdkAset,Ruangan r, Pegawai supir where p.id=so.NoCmId and p.id=alm.pasienId "
			+ "and jk.id=p.jenisKelaminId and sp.id=p.statusPerkawinanId and "
			+ "so.noRec=op.strukOrderId and pdk.id=op.produkId and  pdkAset.id=op.produkAsetId and supir.id=so.petugasId "
			+ "and so.noRec=:noRec and r.id=op.ruanganId order by p.id")
	List<Map<String, Object>> getDaftarOrderAmbulanceByNoRec(@Param("noRec") String noRec);
	
	@Query("select new map(a.noRec as noRecPegawaiAmbulance," +
			" perawat.id as idPerawat, " +
			" perawat.namaLengkap as namaPerawat) " +
			" from MappingPegawaiPemakaianAmbulance a " +
			" left join a.perawat perawat left join " +
			" a.strukOrder so where so.noRec=:noRec")
	List<Map<String, Object>> getPerawatAmbulanceByNoRec(@Param("noRec")String noRec);

	// daftar kendaraan dinas - sarpras Rumah Tangga
	@Query("select distinct NEW Map(so.noRec as noRecStrukOrder,so.noOrder as noOrder,so.tglPelayananAwal as tglKeberangkatanAwal,"
			+ "so.tglPelayananAkhir as tglKeberangkatanAkhir,up.id as unitPemesanId,up.namaRuangan as unitPemesan,"
			+ "so.alamatTempatTujuan as tujuan,ptg.id as petugasBerangkatId,ptg.namaLengkap as petugasBerangkat) "
			+ "from MappingPegawaiKendaraanDinas mpkd left join mpkd.strukOrder so left join mpkd.petugas ptg "
			+ "left join so.unitPemesan up where so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> findPemakaianKendaraanDinasByNoRec(@Param("noRec") String noRec);
	
	// daftar kendaraan dinas - sarpras Rumah Tangga
	@Query("select NEW Map(so.noRec as noRec, so.noOrder as noOrder,so.tglPelayananAwal as tglKeberangkatanAwal,"
			+ "so.tglPelayananAkhir as tglKeberangkatanAkhir,up.id as unitPemesanId,up.namaRuangan as unitPemesan,"
			+ "so.alamatTempatTujuan as tujuan) "
			+ "from StrukOrder so "
			+ "left join so.unitPemesan up where so.noRec=:noRec order by so.noOrder")
	List<Map<String, Object>> getPemakaianKendaraanDinasByNoRec(@Param("noRec") String noRec);
	
	// penggunaan kendaraan dinas petugas by norec - sarpras Rumah Tangga
	@Query("select NEW Map(ptg.id as petugasBerangkatId,ptg.namaLengkap as petugasBerangkat) "
			+ "from MappingPegawaiKendaraanDinas mpkd left join mpkd.strukOrder so left join mpkd.petugas ptg "
			+ "where so.noRec=:noRec")
	List<Map<String, Object>> getPemakaianKendaraanDinasByPetugasNoRec(@Param("noRec") String noRec);

	// get jenis konsumsi - sarpras Rumah Tangga
	@Query("select distinct NEW Map(jk.jenisKonsumsi.id as jenisKonsumsiId, jk.jenisKonsumsi.name as jenisKonsumsi) from JenisKonsumsiSet jk where jk.strukOrderId=:noRecStrukOrder")
	List<Map<String, Object>> findJenisKonsumsi(@Param("noRecStrukOrder") String noRec);

	// get penambahan kebutuhan sarana - sarpras Rumah Tangga
	@Query("select distinct NEW Map(coalesce(pks.namaBarang,'') as namaBarang,coalesce(pks.jumlah,0) as jumlah,"
			+ "coalesce(pks.harga,0) as harga,coalesce(pks.satuan,'') as satuan) from PenambahanKebutuhanSarana pks where pks.strukOrderId=:noRecStrukOrder")
	List<Map<String, Object>> findPenambahanKebutuhanSarana(@Param("noRecStrukOrder") String noRec);
	
	// get penambahan kebutuhan sarana - jenis pelayanan
	@Query("select distinct NEW Map(pro.id as idPelayanan, " +
			" pro.namaProduk as namaPelayanan, " +
			" htp.hargaSatuan as hargaSatuan) " +
			" from OrderPelayanan op " +
			" left join op.produk pro, HargaNettoProdukByKelas htp" +
			" where pro.id=htp.produkId and op.strukOrderId=:noRecStrukOrder")
	List<Map<String, Object>> getJenisPelayananbyNoRec(@Param("noRecStrukOrder") String noRec);
	
	// get penambahan kebutuhan sarana - jenis kamar jenazah
	@Query("select distinct NEW Map(kmr.id as kamarId,kmr.namaKamar as namaKamar) " +
			" from OrderPelayanan op left join op.kamar kmr where op.strukOrderId=:noRecStrukOrder")
	List<Map<String, Object>> getJenisKamarbyNoRec(@Param("noRecStrukOrder") String noRec);
	
	@Query("select distinct  p from StrukResep s , OrderPelayanan p where p.strukOrder.noOrder=:noOrder")
	List<OrderPelayanan> findOrderPelayananByNoOrder(@Param("noOrder")String noOrder);

	@Query("select model from ResepRacikanOrder model where model.noResep.strukOrder.noOrder=:noOrder")
	List<ResepRacikanOrderDetail> findOrderPelayananRacikanOrder(@Param("noOrder")String noOrder);

	@Query("select model from ResepRacikanOrderDetail model where model.noResep.strukOrder.noOrder=:noOrder")
	List<ResepRacikanOrderDetail> findOrderPelayananRacikanOrderDetail(@Param("noOrder")String noOrder);

	@Query("select new Map (produk.id as produkId,"
			+ "produk.namaProduk as namaProduk,"
			+ "bentukproduk.id as bentukProdukId,"
			+ "bentukproduk.namaBentukProduk as namaBentukProduk, "
			+"model.jumlah as jumlah,"
			+ "pasien.noCm as noCm,"
			+ "pasien.namaPasien as namaPasien, "
			+"jeniskelamin.jenisKelamin as jenisKelamin,"
			+ "kelas.namaKelas as namaKelas,"
			+ "ruangan.namaRuangan as namaRuangan, "
			+"jenisdiet.jenisDiet as jenisDiet,"
			+ "typemakanan.name as tipeMakanan, "
			+" jeniswaktu.jenisWaktu as jenisWaktu,"
			+"strukorder.noRec as noRecStrukOrder,"
			+ "antrian.noRec as noRecAntrian,"
			+ "case when jenisdiet is null then 'Menu Keluarga' else 'Menu Pasien' end as flag) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"left join produk.bentukProduk bentukproduk "
			+"left join model.strukOrder strukorder "
			+"left join model.ruangan ruangan "
			+"left join model.ruanganTujuan ruangantujuan "
			+"left join strukorder.noCm pasien "
			+"left join pasien.jenisKelamin jeniskelamin "
			+"left join strukorder.noRegistrasi antrian "
			+"left join antrian.kelas kelas "
			+"left join model.jenisDiet jenisdiet "
			+"left join model.typeMakanan typemakanan "
			+"left join model.jenisWaktu jeniswaktu "
			+"where ruangantujuan.id=:ruanganId and produk.detailJenisProduk.id in "
			+"(select model.id from DetailJenisProduk model where model.jenisProduk.id="
			+ "(Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='kdProdukMenuGizi')) "
			+"order by pasien.id desc")
	List<Map<String,Object>> findOrderPelayananGizi(@Param("ruanganId") Integer ruanganId);
	
	@Query("select new Map (model.noRec as noRecOrder,"
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk,"
			+ "bentukproduk.id as bentukProdukId,"
			+ "bentukproduk.namaBentukProduk as namaBentukProduk, "
			+"model.jumlah as jumlah,"
			+ "pasien.noCm as noCm,"
			+ "pasien.namaPasien as namaPasien, "
			+"jeniskelamin.jenisKelamin as jenisKelamin,"
			+ "kelas.id as kelasId,"
			+ "kelas.namaKelas as namaKelas,"
			+ "ruangan.namaRuangan as namaRuangan, "
			+"jenisdiet.jenisDiet as jenisDiet,"
			+ "typemakanan.name as tipeMakanan, "
			+" jeniswaktu.id as jenisWaktuId,"
			+" jeniswaktu.jenisWaktu as jenisWaktu,"
			+"strukorder.noRec as noRecStrukOrder,"
			+ "antrian.noRec as noRecPasienDaftar,"
			+ "antrian.tglRegistrasi as tglRegistrasi,"
			+ "model.statusGizi as status,"
			+ "model.tglPelayanan as tglPelayanan,"
			+ "case when jenisdiet is null then 'Menu Keluarga' else 'Menu Pasien' end as flag) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"left join produk.bentukProduk bentukproduk "
			+"left join model.strukOrder strukorder "
			+"left join model.ruangan ruangan "
			+"left join model.ruanganTujuan ruangantujuan "
			+"left join strukorder.noCm pasien "
			+"left join pasien.jenisKelamin jeniskelamin "
			+"left join strukorder.noRegistrasi antrian "
			+"left join antrian.kelas kelas "
			+"left join model.jenisDiet jenisdiet "
			+"left join model.typeMakanan typemakanan "
			+"left join model.jenisWaktu jeniswaktu "
			+"where ruangantujuan.id=:ruanganId and bentukproduk.id=:bentukProdukId and jeniswaktu.id=:jenisWaktuId and "
			+ "ruangan.id=:ruanganAsalId and date(model.tglPelayanan) between :startDate and :endDate and "
			+ "produk.detailJenisProduk.id in "
			+"(select model.id from DetailJenisProduk model where model.jenisProduk.id="
			+ "(Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='kdProdukMenuGizi')) "
			+"order by model.tglPelayanan desc,pasien.id desc,jeniswaktu.id")
	List<Map<String,Object>> findOrderPelayananGizi(@Param("ruanganId") Integer ruanganId,
			@Param("bentukProdukId") Integer bentukProdukId,
			@Param("ruanganAsalId") Integer ruanganAsalId,
			@Param("jenisWaktuId") Integer jenisWaktuId,
			@Param("startDate") Date startDate,
			@Param("endDate") Date endDate);

	@Query("select new Map (model.noRec as noRecOrder,"
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk,"
			+ "bentukproduk.id as bentukProdukId,"
			+ "bentukproduk.namaBentukProduk as namaBentukProduk, "
			+"model.jumlah as jumlah,"
			+ "pasien.noCm as noCm,"
			+ "pasien.namaPasien as namaPasien, "
			+"jeniskelamin.jenisKelamin as jenisKelamin,"
			+ "kelas.id as kelasId,"
			+ "kelas.namaKelas as namaKelas,"
			+ "ruangan.namaRuangan as namaRuangan, "
			+"jenisdiet.jenisDiet as jenisDiet,"
			+ "typemakanan.name as tipeMakanan, "
			+" jeniswaktu.id as jenisWaktuId,"
			+" jeniswaktu.jenisWaktu as jenisWaktu,"
			+"strukorder.noRec as noRecStrukOrder,"
			+ "antrian.noRec as noRecPasienDaftar,"
			+ "antrian.tglRegistrasi as tglRegistrasi,"
			+ "model.statusGizi as status,"
			+ "model.tglPelayanan as tglPelayanan,"
			+ "case when jenisdiet is null then 'Menu Keluarga' else 'Menu Pasien' end as flag) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"left join produk.bentukProduk bentukproduk "
			+"left join model.strukOrder strukorder "
			+"left join model.ruangan ruangan "
			+"left join model.ruanganTujuan ruangantujuan "
			+"left join strukorder.noCm pasien "
			+"left join pasien.jenisKelamin jeniskelamin "
			+"left join strukorder.noRegistrasi antrian "
			+"left join antrian.kelas kelas "
			+"left join model.jenisDiet jenisdiet "
			+"left join model.typeMakanan typemakanan "
			+"left join model.jenisWaktu jeniswaktu "
			+"where ruangantujuan.id=:ruanganId and bentukproduk.id=:bentukProdukId and "
			+ "ruangan.id is not null and date(model.tglPelayanan) between :startDate and :endDate and "
			+ "produk.detailJenisProduk.id in "
			+"(select model.id from DetailJenisProduk model where model.jenisProduk.id="
			+ "(Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='kdProdukMenuGizi')) "
			+"order by model.tglPelayanan desc,pasien.id desc,jeniswaktu.id")
	List<Map<String,Object>> findOrderPelayananGiziAllRuangan(@Param("ruanganId") Integer ruanganId,
			@Param("bentukProdukId") Integer bentukProdukId,
			@Param("startDate") Date startDate,
			@Param("endDate") Date endDate);
	
	@Query("select new Map (model.menuProduk.id as menuId,model.bahanProduk.id as bahanId,model.menuProduk.namaProduk as menu,"
			+ "model.bahanProduk.namaProduk as bahan,"
			+"model.satuanStandar.id as satuanId,model.satuanStandar.satuanStandar as satuanStandar,"
			+ "model.standarPorsi as jumlahPorsi,"
			+"model.menuProduk.qtyKalori as kalori,model.menuProduk.qtyKarbohidrat as karbohidrat,"
			+ "model.menuProduk.qtyProtein as protein,model.menuProduk.qtyLemak as lemak) " 
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id=:produkId and model.statusEnabled = TRUE" )
	List<Map<String,Object>> findKomposisiMakanan(@Param("produkId") Integer produkId);
	
	@Query("select new Map (model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan,"
			+"model.satuanStandar.id as satuanStandarId, "
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=50),0) as stok,"
			+"sum(model.standarPorsi) as jumlahPorsi) " 
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id in (:produkId) "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.satuanStandar.id,"
			+ "model.bahanProduk.id "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getPemesananBahan(@Param("produkId") List<Integer> produkId);
	
	@Query("select new Map ("
			+ "model.menuProduk.id as menuId, "
			+ "model.menuProduk.namaProduk as menu, "
			+ "model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan, "
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=54),0) as stok,"
			+"sum(model.standarPorsi) as jumlahPorsi) " 
			+"from MapProdukMenuToBahan model "
			+"where model.bahanProduk.id in (:produkId) "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.bahanProduk.id, "
			+ "model.menuProduk.id,"
			+ "model.menuProduk.namaProduk "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getProduksiBahan(@Param("produkId") List<Integer> produkId);
	
	@Query("select new Map ("
			+ "model.menuProduk.id as menuId, "
			+ "model.menuProduk.namaProduk as menu, "
			+ "model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan, "
			+ "model.kelas.id as kelasId,"
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=54),0) as stok,"
			+ "count(model.menuProduk.id) as jumlahMenu) "
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id in (:produkId) and :kelasId=:kelasId) "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.bahanProduk.id, "
			+ "model.menuProduk.id,"
			+ "model.menuProduk.namaProduk, "
			+ "model.kelas.id "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getProduksiMenu2(@Param("produkId") List<Integer> produkId, @Param("kelasId") List<Integer> kelasId);
	
	@Query("select new Map ("
			+ "model.menuProduk.id as menuId, "
			+ "model.menuProduk.namaProduk as menu, "
			+ "model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan, "
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=54),0) as stok,"
			+ "count(model.menuProduk.id) as jumlahMenu) "
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id in (:produkId) "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.bahanProduk.id, "
			+ "model.menuProduk.id,"
			+ "model.menuProduk.namaProduk "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getProduksiMenu(@Param("produkId") List<Integer> produkId);

	@Query("select new Map ("
			+ "model.menuProduk.id as menuId, "
			+ "model.menuProduk.namaProduk as menu, "
			+ "model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan, "
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=54),0) as stok,"
			+ "count(model.menuProduk.id) as jumlahMenu) "
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id in (:produkId) "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.bahanProduk.id, "
			+ "model.menuProduk.id,"
			+ "model.menuProduk.namaProduk "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getKirimMenu(@Param("produkId") List<Integer> produkId);
	
	@Query("select p from OrderPelayanan p where p.strukOrder.noRec =:noRec")
	List<OrderPelayanan> findOrderByStrukOrder(@Param("noRec") String noRec);

	@Query("select p from OrderPelayanan p where p.noRec =:noRec and p.jenisWaktu.id=:jenisWaktuId")
	List<OrderPelayanan> findOrderByNoRecAndJenisWaktu(@Param("noRec") String noRec,@Param("jenisWaktuId") Integer jenisWaktuId);

	@Query("select p from OrderPelayanan p where p.noRec =:noRec")
	List<OrderPelayanan> findOrderByNoRecAndJenisWaktu(@Param("noRec") String noRec);

	@Query("select new Map (model.noRec as noRecOrder,"
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk,"
			+ "bentukproduk.id as bentukProdukId,"
			+ "bentukproduk.namaBentukProduk as namaBentukProduk, "
			+"model.jumlah as jumlah,"
			+ "pasien.noCm as noCm,"
			+ "pasien.namaPasien as namaPasien, "
			+"jeniskelamin.jenisKelamin as jenisKelamin,"
			+ "kelas.id as kelasId,"
			+ "kelas.namaKelas as namaKelas,"
			+ "ruangan.namaRuangan as namaRuangan, "
			+"jenisdiet.jenisDiet as jenisDiet,"
			+ "typemakanan.name as tipeMakanan, "
			+" jeniswaktu.id as jenisWaktuId,"
			+" jeniswaktu.jenisWaktu as jenisWaktu,"
			+"strukorder.noRec as noRecStrukOrder,"
			+ "antrian.noRec as noRecPasienDaftar,"
			+ "antrian.tglRegistrasi as tglRegistrasi,"
			+ "model.statusGizi as status,"
			+ "model.tglPelayanan as tglPelayanan,"
			+ "case when jenisdiet is null then 'Menu Keluarga' else 'Menu Pasien' end as flag) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"left join model.bentukProduk bentukproduk "
			+"left join model.strukOrder strukorder "
			+"left join model.ruangan ruangan "
			+"left join model.ruanganTujuan ruangantujuan "
			+"left join strukorder.noCm pasien "
			+"left join pasien.jenisKelamin jeniskelamin "
			+"left join strukorder.noRegistrasi antrian "
			+"left join antrian.kelas kelas "
			+"left join model.jenisDiet jenisdiet "
			+"left join model.typeMakanan typemakanan "
			+"left join model.jenisWaktu jeniswaktu "
			+"where ruangantujuan.id=:ruanganId and bentukproduk.id=:bentukProdukId and :jenisWaktuId=:jenisWaktuId and "
			+ "ruangan.id=:ruanganAsalId and date(model.tglPelayanan) between :startDate and :endDate and "
			+ ":statusGizi =:statusGizi and "
			+ "produk.detailJenisProduk.id in "
			+"(select model.id from DetailJenisProduk model where model.jenisProduk.id="
			+ "(Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='kdProdukMenuGizi')) "
			+"order by model.tglPelayanan desc,pasien.id desc,jeniswaktu.id")
	List<Map<String,Object>> findOrderPelayananKirimMenuGizi(@Param("ruanganId") Integer ruanganId,
			@Param("bentukProdukId") Integer bentukProdukId,
			@Param("ruanganAsalId") Integer ruanganAsalId,
			@Param("jenisWaktuId") Integer jenisWaktuId,
			@Param("startDate") Date startDate,
			@Param("endDate") Date endDate,
			@Param("statusGizi") String statusGizi);

	@Query("select new Map (model.noRec as noRecOrder,"
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk,"
			+ "bentukproduk.id as bentukProdukId,"
			+ "bentukproduk.namaBentukProduk as namaBentukProduk, "
			+"model.jumlah as jumlah,"
			+ "pasien.noCm as noCm,"
			+ "pasien.namaPasien as namaPasien, "
			+"jeniskelamin.jenisKelamin as jenisKelamin,"
			+ "kelas.id as kelasId,"
			+ "kelas.namaKelas as namaKelas,"
			+ "ruangan.namaRuangan as namaRuangan, "
			+"jenisdiet.jenisDiet as jenisDiet,"
			+ "typemakanan.name as tipeMakanan, "
			+" jeniswaktu.id as jenisWaktuId,"
			+" jeniswaktu.jenisWaktu as jenisWaktu,"
			+"strukorder.noRec as noRecStrukOrder,"
			+ "antrian.noRec as noRecPasienDaftar,"
			+ "antrian.tglRegistrasi as tglRegistrasi,"
			+ "model.statusGizi as status,"
			+ "model.tglPelayanan as tglPelayanan,"
			+ "case when jenisdiet is null then 'Menu Keluarga' else 'Menu Pasien' end as flag) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"left join model.bentukProduk bentukproduk "
			+"left join model.strukOrder strukorder "
			+"left join model.ruangan ruangan "
			+"left join model.ruanganTujuan ruangantujuan "
			+"left join strukorder.noCm pasien "
			+"left join pasien.jenisKelamin jeniskelamin "
			+"left join strukorder.noRegistrasi antrian "
			+"left join antrian.kelas kelas "
			+"left join model.jenisDiet jenisdiet "
			+"left join model.typeMakanan typemakanan "
			+"left join model.jenisWaktu jeniswaktu "
			+"where ruangantujuan.id=:ruanganId and bentukproduk.id=:bentukProdukId and :jenisWaktuId=:jenisWaktuId and "
			+ "ruangan.id is not null and date(model.tglPelayanan) between :startDate and :endDate and "
			+ ":statusGizi =:statusGizi and "
			+ "produk.detailJenisProduk.id in "
			+"(select model.id from DetailJenisProduk model where model.jenisProduk.id="
			+ "(Select cast(s.nilaiField as int) from  SettingDataFixed s where s.namaField='kdProdukMenuGizi')) "
			+"order by model.tglPelayanan desc,pasien.id desc,jeniswaktu.id")
	List<Map<String,Object>> findOrderPelayananKirimMenuGiziAllRuangan(@Param("ruanganId") Integer ruanganId,
			@Param("bentukProdukId") Integer bentukProdukId,
			@Param("jenisWaktuId") Integer jenisWaktuId,
			@Param("startDate") Date startDate,
			@Param("endDate") Date endDate,
			@Param("statusGizi") String statusGizi);
	
	@Query("select new Map (produk.namaProduk as menu,"
			+ "produk.id as menuId,"
			+"sum(model.jumlah) as jumlahMenu,"
			+"coalesce((select model2.qtyProdukAsal " 
			+"from ProdukProduksi model2 "
			+"left join model2.produkAsal produkasal " 
			+"where produk.id=produkasal.id),0) as stok) "
			+"from OrderPelayanan model "
			+"left join model.produk produk "
			+"where model.noRec in (:noRecOrder) "
			+"and produk.id in (:idMenuProduk) "
			+"group by produk.namaProduk,produk.id")
	List<Map<String,Object>> getMenuProduksi(@Param("idMenuProduk") List<Integer> idMenuProduk,
			@Param("noRecOrder") List<String> noRecOrder);

	@Query("select new Map (model.bahanProduk.id as bahanId, "
			+ "model.bahanProduk.namaProduk as bahan,"
			+"model.satuanStandar.id as satuanStandarId, "
			+"model.satuanStandar.satuanStandar as satuanStandar, "
			+"coalesce((select model2.qtyProduk "
			+"from StokProdukGlobal model2 "
			+"where model.bahanProduk.id=model2.produk.id and model2.ruangan.id=50),0) as stok,"
			+"sum(model.standarPorsi) as jumlahPorsi,"
			+ "model.bahanProduk.satuanStandar.id as satuanStokId,"
			+"model.bahanProduk.satuanStandar.satuanStandar as namaSatuanStok) " 
			+"from MapProdukMenuToBahan model "
			+"where model.menuProduk.id=:produkId "
			+"group by model.bahanProduk.namaProduk,"
			+"model.satuanStandar.satuanStandar,"
			+ "model.satuanStandar.id,"
			+ "model.bahanProduk.id, "
			+ "model.bahanProduk.satuanStandar.id,"
			+"model.bahanProduk.satuanStandar.satuanStandar "
			+"order by model.bahanProduk.namaProduk")
	List<Map<String,Object>> getPemesananBahan(@Param("produkId") Integer produkId);

	@Query("select NEW MAP(op.noRec as noRec, op.produk.id as idprod, op.produk.kdProfile  as kdprofile, op.produk.kdProduk as kdprod, op.produk.namaProduk as nama, op.produk.bahanSample.id as idBs, op.produk.bahanSample.namaBahanSample as namaBs, op.isCito as cito) from OrderPelayanan op where op.strukOrder.noOrder =:noOrder")
	List<Map<String, Object>> getOrderPelayananLaborat(@Param("noOrder") String noOrder);
	
	//add iwankasan
	@Query("select new map(p.id as idProduk, p.namaProduk as namaProduk) from Produk p order by p.id asc")
	List<Map<String, Object>> getProdukAll(Pageable pageable);
	
	//add iwankasan
	@Query("select new map(r.id as idRuangan, r.namaRuangan as namaRuangan) from Ruangan r order by r.id asc")
	List<Map<String, Object>> getRuanganAll(Pageable pageable);
	
	//add iwankasan
	@Query("select new map(j.id as idJenisDok, j.jenisDokumen as jenisDokumen) from JenisDokumen j order by j.id asc")
	List<Map<String, Object>> getJenisDok(Pageable pageable);
	

	@Query("select orderPelayanan "+
			"from OrderPelayanan orderPelayanan "+
			"where orderPelayanan.noRec = :noRec")
	OrderPelayanan getOrderPelayananNorec(@Param("noRec") String noRec);
	
	@Query("select NEW Map(a.noRec as noRec) "
			+ "from OrderPelayanan a "
			+ "left join a.strukOrder b "
			+ "where b.noRec=:noRec")
	List<Map<String, Object>> getOrderRadiologiByStrukOrder(
			@Param("noRec") String noRec);

}
