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.KirimProduk;
import com.jasamedika.medifirst2000.entities.SatuanStandar;
import com.jasamedika.medifirst2000.entities.StrukPelayanan;
import com.jasamedika.medifirst2000.entities.StrukPelayananDetail;

@Repository("LaundryDao")
public interface LaundryDao extends CrudRepository<KirimProduk, String> {
	@Query("select new Map(nostruk.noRec as noRecStrukPelayanan," 
			+"nostruk.nostruk as noStruk, "
			+"noplanning.noplanning as noPlanning,"
			+"nostruk.qtyproduk as berat, "
			+"produk.id as produkId,  "
			+"produk.namaProduk as namaProduk, " 			
			+"ruanganasal.id as ruanganAsalId,   "
			+"ruanganasal.namaRuangan as namaRuanganAsal, "  
			+"ruangan.id as ruanganId,   "
			+"ruangan.namaRuangan as namaRuangan, "  
			+"satuanstandar.id as satuanId,   "
			+"satuanstandar.satuanStandar as namaSatuan, "  
			+"nostruk.tglstruk as tglTerima)  "
			+"from StrukPelayananDetail model   "
			+"left join model.nostruk nostruk   "
			+"left join nostruk.kdkelompoktransaksi kelompoktransaksi " 
			+"left join model.kdproduk4used produk   "
			+"left join nostruk.kdruangan ruangan    "
			+"left join nostruk.kdruanganasal ruanganasal    "
			+"left join model.kdsatuanstandar satuanstandar "
			+ "left join nostruk.noplanning noplanning " 
			+"where kelompoktransaksi=6 and noplanning.noplanning is null")
	List<Map<String,Object>> getAllPenerimaanLinen();

	@Query("select new Map (alat.id as mesinId, "
			+"alat.namaAlat as namaMesin, "
			+"coalesce(alat.kapasitasAlat,0) as kapasitas) " 
			+"from MapAlatToProdukToBhp model "
			+"left join model.alat alat "
			+ "where alat.id=:mesinId")
	List<Map<String,Object>> getKapasitasMesin(@Param("mesinId")Integer mesinId);

	@Query("select new Map (alat.id as mesinId, "
			+"alat.namaAlat as namaMesin, "
			+"produkcuci.id as produkProsesCuciId, "
			+"produkcuci.namaProduk as namaProdukProsesCuci, "
			+"produkbahan.id as produkBahanId, "
			+"produkbahan.namaProduk as namaProdukBahan, "
			+"model.qtyProdukB as jumlahBahan, "
			+"satuanstandarbahan.id as satuanBahanId, "
			+"satuanstandarbahan.satuanStandar as namaSatuanBahan) " 
			+"from MapAlatToProdukToBhp model "
			+"left join model.alat alat "
			+"left join model.produk produkcuci "
			+"left join model.produkB produkbahan "
			+"left join model.satuanStandarB satuanstandarbahan "
			+ "where alat.id=:mesinId and produkcuci.id=:prosesCuciId")
	List<Map<String,Object>> getAllBahanFromMesinAndProses(@Param("mesinId")Integer mesinId,@Param("prosesCuciId")Integer prosesCuciId);

	@Query("select new Map("
			+"strukPlaning.noRec as noRecStrukPlaning,"
			+"ruangan.id as ruanganId,"
			+"ruangan.namaRuangan as namaRuangan,"
			+"produk.id as produkId,"
			+"produk.namaProduk as namaProduk,"
			+"pegawai.id as pegawaiId,"
			+"pegawai.namaLengkap as namaLengkap) "
			+"from PlanningPelayananPetugas model "
			+"left join model.pegawai pegawai "
			+"left join model.ruangan ruangan "
			+"left join model.peoduk produk "
			+"left join model.strukPlaning strukPlaning "
			+"where strukPlaning.noRec=:strukPlaning")
	List<Map<String,Object>> getAllPetugasByStrukPlanning(@Param("strukPlaning")String strukPlaning);

	@Query("select new Map( "
			+"strukPlanning.noRec as noRecStrukPlaning,"
			+"ruangan.id as ruanganId,"
			+"ruangan.namaRuangan as namaRuangan,"
			+"produk.id as produkId,"
			+"produk.namaProduk as namaProduk,"
			+"model.qtyProduk as jumlahBahan,"
			+"satuanStandar.id as satuanStandarId,"
			+"satuanStandar.satuanStandar as namaSatuanStandar) " 
			+"from PlanningPelayananDbhp model  "
			+"left join model.produk produk  "
			+"left join model.ruangan ruangan  "
			+"left join model.satuanStandar satuanStandar " 
			+"left join model.strukPlanning strukPlanning "		
			+"where strukPlanning.noRec=:strukPlaning")
	List<Map<String,Object>> getAllBahanByStrukPlanning(@Param("strukPlaning")String strukPlaning);

	@Query("select new Map(model.id as id,model.namaProduk as namaProduk) "
			 +"from Produk model "
			 +"left join model.departemen departemen " 
			+"left join model.detailJenisProduk detailJenisProduk " 
			+"left join detailJenisProduk.jenisProduk jenisProduk "
			+"where departemen.id=15 and "
			+"jenisProduk.id=55")
	List<Map<String,Object>> getProdukPelipatan();

	@Query("select new Map(model.id as id,model.namaProduk as namaProduk, 0 as hargaSatuan) "
			+ "from Produk model "
			+"left join model.departemen departemen "
			+"left join model.detailJenisProduk detailJenisProduk "
			+"where departemen.id=15 and "
			+ "detailJenisProduk.id in (439,440,441,442,443,444)")
	List<Map<String,Object>> getProdukPenerimaanLinenExternal();
	
	// Loundry - Sarpras
	@Query("select ss from SatuanStandar ss where ss.id = 145")
	public List<SatuanStandar> findSatuanStandarPotong();

	@Query("select new Map(model.id as id,"
			+ "model.hargaNetto1 as hargaNetto1,"
			+ "model.hargaNetto2 as hargaNetto2,"
			+ "model.hargaSatuan as hargaSatuan,"
			+"kelas.id as kelasId, "
			+ "kelas.namaKelas as namaKelas, "
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk) " 
			+"from HargaNettoProdukByKelas model "
			+"left join model.produk produk "
			+"left join model.kelas kelas "
			+"left join produk.departemen departemen "
			+"left join produk.detailJenisProduk detailJenisProduk "
			+"where departemen.id=15 and detailJenisProduk in (439,440,441,442,443,444)")
	List<Map<String, Object>> getHargaLaundry();
	
	@Query("select new Map(model.id as id,"
			+ "model.hargaNetto1 as hargaNetto1,"
			+ "model.hargaNetto2 as hargaNetto2,"
			+ "model.hargaSatuan as hargaSatuan,"
			+"kelas.id as kelasId, "
			+ "kelas.namaKelas as namaKelas, "
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk) " 
			+"from HargaNettoProdukByKelas model "
			+"left join model.produk produk "
			+"left join model.kelas kelas "
			+"left join produk.departemen departemen "
			+"left join produk.detailJenisProduk detailJenisProduk "
			+"where departemen.id=15 and detailJenisProduk in (439,440,441,442,443,444) "
			+ "and kelas.id=:kelasId")
	List<Map<String, Object>> getHargaLaundryByKelas(@Param("kelasId") Integer kelasId);

	@Query("select new Map(model.id as id,"
			+ "model.hargaNetto1 as hargaNetto1,"
			+ "model.hargaNetto2 as hargaNetto2,"
			+ "model.hargaSatuan as hargaSatuan,"
			+"kelas.id as kelasId, "
			+ "kelas.namaKelas as namaKelas, "
			+ "produk.id as produkId,"
			+ "produk.namaProduk as namaProduk) " 
			+"from HargaNettoProdukByKelas model "
			+"left join model.produk produk "
			+"left join model.kelas kelas "
			+"left join produk.departemen departemen "
			+"left join produk.detailJenisProduk detailJenisProduk "
			+"where departemen.id=15 and detailJenisProduk in (439,440,441,442,443,444) "
			+ "and kelas.id=:kelasId and produk.id=:produkId")
	List<Map<String, Object>> getHargaLaundryByProdukKelas(@Param("produkId") Integer produkId,
			@Param("kelasId") Integer kelasId);
	
	@Query("select new Map("
					+"strukPelayanan.noRec as noRecStrukPelayanan,"
					+"strukPlanning.noRec as noRecStrukPlanning,"
					+"strukPlanning.noplanning as noPlanning,"
					+"to_char(planningPelayanan.tglPelayanan,'yyyy-mm-dd hh:mm:ss') as tglPelayanan,"
					+"alat.id as alatId,"
					+"alat.namaAlat as namaAlat,"
					+"coalesce(alat.kapasitasAlat,0) as kapasitasAlat,"
					+"planningPelayanan.qtyProdukExec as beratLinen,"
					+"ruanganAsal.id as ruanganAsalId, "
					+"ruanganAsal.namaRuangan as namaRuanganAsal, "
					+"produk.id as produkId,"
					+"produk.namaProduk as namaProduk) "
					+"from PlanningPelayananDetail model "
					+"left join model.strukPelayanan strukPelayanan "
					+"left join model.planningPelayanan planningPelayanan "
					+"left join planningPelayanan.strukPlaning strukPlanning "
					+"left join strukPlanning.kdruanganasal ruanganAsal "
					+"left join strukPlanning.kdkelompoktransaksi kelompoktransaksi "					
					+"left join model.produk produk "
					+"left join model.alat alat "
					+ "where strukPelayanan.noRec=:noRecStrukPelayanan and kelompoktransaksi.id=73")
	List<Map<String,Object>> getAllDataPembilasanToPengeringan(@Param("noRecStrukPelayanan") String noRecStrukPelayanan);
	
	@Query("select new Map("
			+"strukPelayanan.noRec as noRecStrukPelayanan,"
			+"strukPlanning.noRec as noRecStrukPlanning,"
			+"strukPlanning.noplanning as noPlanning,"
			+"to_char(planningPelayanan.tglPelayanan,'yyyy-mm-dd hh:mm:ss') as tglPelayanan,"
			+"alat.id as alatId,"
			+"alat.namaAlat as namaAlat,"
			+"coalesce(alat.kapasitasAlat,0) as kapasitasAlat,"
			+"planningPelayanan.qtyProdukExec as beratLinen,"
			+"ruanganAsal.id as ruanganAsalId, "
			+"ruanganAsal.namaRuangan as namaRuanganAsal, "
			+"produk.id as produkId,"
			+"produk.namaProduk as namaProduk) "
			+"from PlanningPelayananDetail model "
			+"left join model.strukPelayanan strukPelayanan "
			+"left join model.planningPelayanan planningPelayanan "
			+"left join planningPelayanan.strukPlaning strukPlanning "
			+"left join strukPlanning.kdruanganasal ruanganAsal "
			+"left join strukPlanning.kdkelompoktransaksi kelompoktransaksi "					
			+"left join model.produk produk "
			+"left join model.alat alat "
			+ "where strukPelayanan.noRec=:noRecStrukPelayanan and kelompoktransaksi.id=74")
	List<Map<String,Object>> getAllDataPengeringanToPelipatan(@Param("noRecStrukPelayanan") String noRecStrukPelayanan);

	@Query("select new Map(nostruk.noRec as noRecStrukPelayanan, "
				+ "nostruk.nostruk as noStruk,"
				+ "nocm.id as pelangganId,"
				+ "nocm.namaPasien as namaPelanggan,"
				+ "nocm.noHp as telepon,"
				+"nostruk.nostruk as noStruk, "
				+"noplanning.noplanning as noPlanning, "
				+"nostruk.qtyproduk as berat, "
				+"produk.id as produkId, "
				+"produk.namaProduk as namaProduk, "  
				+"ruanganasal.id as ruanganAsalId, " 
				+"ruanganasal.namaRuangan as namaRuanganAsal, " 
				+"noclosing.noClosing as noClosing, "   
				+"ruangan.id as ruanganId, "   
				+"ruangan.namaRuangan as namaRuangan, "   
				+"pegawai.id as petugasId,"
				+"pegawai.namaLengkap as namaPetugas,"
				+"satuanstandar.id as satuanId, "   
				+"satuanstandar.satuanStandar as namaSatuan, "   
				+"to_char(nostruk.tglstruk,'dd-mm-yyyy') as tglTerima, "
				+"nocm.id as pelangganId, "
				+"nocm.namaPasien as namaPelanggan) "  
				+"from StrukPelayananDetail model "
				+"left join model.nostruk nostruk "   
				+"left join nostruk.nocm nocm "
				+"left join nostruk.kdkelompoktransaksi kelompoktransaksi "  
				+"left join model.kdproduk4used produk "   
				+"left join nostruk.kdruangan ruangan "    
				+"left join nostruk.kdruanganasal ruanganasal "  
				+"left join nostruk.noplanning noplanning "  
				+"left join nostruk.kdpegawaipenerima pegawai "
				+"left join nostruk.noclosing noclosing " 
				+"left join model.kdsatuanstandar satuanstandar "
				+"left join nostruk.nocm nocm "
				+ "where kelompoktransaksi.id = 6 and nostruk.noRec=:noRecStrukPelayanan")
	List<Map<String, Object>> getStrukOrderLaundryEksternal(@Param("noRecStrukPelayanan") String noRecStrukPelayanan);
	
	@Query("select new Map("
					+ "model.noRec as noRecPlanningPelayananDetail,"
					+ "planningPelayanan.noRec as noRecPlanningPelayanan,"
					+"strukPelayanan.noRec as noRecStrukPelayanan,"
					+ "strukPelayanan.nostruk as noStrukPelayanan,"
					+"strukPlanning.noRec as noRecStrukPlanning,"
					+"strukPlanning.noplanning as noPlanning,"
					+ "pelanggan.id as pelangganId,"
					+ "pelanggan.namaPasien as namaPelanggan,"
					+ "pelanggan.noHp as noTelepon,"
					+"to_char(planningPelayanan.tglPelayanan,'yyyy-mm-dd hh:mm:ss') as tglPelayanan,"
					+"planningPelayanan.qtyProdukExec as beratLinen,"
					+"ruanganAsal.id as ruanganAsalId, "
					+"ruanganAsal.namaRuangan as namaRuanganAsal,  "
					+"produk.id as produkId,"
					+"produk.namaProduk as namaProduk,"
					+ "model.jumlahCycle as jumlahCycle) "
					+"from PlanningPelayananDetail model "
					+ "left join model.strukPelayanan strukPelayanan "
					+"left join model.planningPelayanan planningPelayanan "
					+"left join planningPelayanan.strukPlaning strukPlanning "
					+"left join strukPlanning.kdruanganasal ruanganAsal "
					+"left join strukPlanning.kdkelompoktransaksi kelompoktransaksi "					
					+"left join model.produk produk "
					+ "left join strukPelayanan.nocm pelanggan "
					+ "where strukPelayanan.noRec=:noRecStrukPelayanan and kelompoktransaksi.id=75 "
					+ "and strukPelayanan.tglAmbil is not null and ruanganAsal.id=93")
	List<Map<String,Object>> getAllDataPengambilanToRetur(@Param("noRecStrukPelayanan") String noRecStrukPelayanan);

	@Query("select model "
			+"from StrukPelayananDetail model "
			+"left join model.nostruk strukPelayanan " 
			+"left join model.kdproduk produk "
			+ "where model.noRec=:noRecStrukPelayananDetail "
			+ "and strukPelayanan.noRec=:noRecStrukPelayanan "
			+ "and produk.id=:produkId")
	StrukPelayananDetail findByStrukPelStrukPelDetailProduk(@Param("noRecStrukPelayanan")String noRecStrukPelayanan,
			@Param("noRecStrukPelayananDetail")String noRecStrukPelayananDetail,@Param("produkId")Integer produkId);
	
	//digunakan untuk getData Pengambilan Linen Kotor dari Ruangan
	//diubah menjadi permintaan linen bersih dari ruangan
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaLengkap as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, " +
			" pegawaiPenerima.namaLengkap as namaPenerima, " +
			" ruangan.id as idRuangan, " +
			" ruangan.namaRuangan as namaRuangan, " +
			" kdruanganasal.id as idRuanganAsal, " +
			" kdruanganasal.namaRuangan as namaRuanganAsal) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.kdruanganasal kdruanganasal " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and strukPelayanan.noTerima is null " +
			" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getOrderLaundrySebelumDiTerima(@Param("startDate")String startDate, 
			@Param("endDate")String endDate);
	
	//digunakan untuk getData Pengambilan Linen Kotor dari Ruangan
		//diubah menjadi permintaan linen bersih dari ruangan
		@Query("select new map(strukPelayanan.noRec as noRec, " +
				" strukPelayanan.keteranganlainnya as ket, " +
				" strukPelayanan.nostruk as nostruk, " +
				" strukPelayanan.qtyproduk as qtyproduk, " +
				" strukPelayanan.tglstruk as tglstruk, " +
				" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
				" menyerahkan.id as idMenyerahkan, " +
				" menyerahkan.namaLengkap as namaMenyerahkan, " +
				" pegawaiPenerima.id as idPenerima, " +
				" pegawaiPenerima.namaLengkap as namaPenerima, " +
				" ruangan.id as idRuangan, " +
				" ruangan.namaRuangan as namaRuangan, " +
				" kdruanganasal.id as idRuanganAsal, " +
				" kdruanganasal.namaRuangan as namaRuanganAsal) " +
				" from StrukPelayanan strukPelayanan " +
				" left join strukPelayanan.kdruanganasal ruangAsal " +
				" left join strukPelayanan.kdruangan ruangan " +
				" left join strukPelayanan.kdruanganasal kdruanganasal " +
				" left join strukPelayanan.menyerahkan menyerahkan " +
				" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
				" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
				" and strukPelayanan.noTerima is null " +
				" and kdruanganasal.id=:idRuanganAsal " +
				" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
		List<Map<String, Object>> getOrderLaundrySebelumDiTerimaByRuangan(@Param("startDate")String startDate, 
				@Param("endDate")String endDate, @Param("idRuanganAsal")Integer idRuanganAsal);
	
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" strukPelayanan.tglAmbil as tglAmbil, " +
			" strukPelayanan.noTerima as noTerima, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaLengkap as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, " +
			" pegawaiPenerima.namaLengkap as namaPenerima, " +
			" ruangan.id as idRuangan, " +
			" ruangan.namaRuangan as namaRuangan, " +
			" kdruanganasal.id as idRuanganAsal, " +
			" kdruanganasal.namaRuangan as namaRuanganAsal) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.kdruanganasal kdruanganasal " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getMonitoringPermintaanLaundryDariRuangan(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//digunakan untuk getData Pengambilan linen Kotor dari Ruangan by NoRec
	@Query("select new map(strukPelayananDetail.noRec as noRec, " +
			" strukPelayananDetail.qtyproduk as qtyProduk, " +
			" strukPelayanan.noRec as noRecStrukPelayanan, " +
			" produk.id as idProduk, satuanStandar.id as idSatuan, " +
			" satuanStandar.namaExternal as satuan, " +
			" produk.namaExternal as namaExternal) " +
			" from StrukPelayananDetail strukPelayananDetail " +
			" left join strukPelayananDetail.nostruk strukPelayanan " +
			" left join strukPelayananDetail.kdproduk produk " +
			" left join strukPelayananDetail.kdsatuanstandar satuanStandar " +
			" where strukPelayanan.noRec=:noRec")
	List<Map<String, Object>> getDetailOrderLaundryByOrder(@Param("noRec")String noRec);
	
	//cek stock berdasarkan linen bersih diruangan
	@Query("select new map(stokProdukGlobal.id as idStokProdukGlobal, "+
			" stokProdukGlobal.qtyProduk as qtyStokProduk, produk.id as idProduk) " +
			" from StokProdukDetail stokProdukGlobal " +
			" left join stokProdukGlobal.produk produk " +
			" left join stokProdukGlobal.ruangan ruangan " +
			" where produk.id=:idProduk and ruangan.id in(93)")
	List<Map<String, Object>> getCekStockLinenBersih(@Param("idProduk")Integer idProduk);
	
	/*
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayananDetail.qtyproduk as qtyproduk, " +
			" kdproduk.id as idProduk, " +
			" kdproduk.namaProduk as namaProduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.strukPelayananDetail strukPelayananDetail " +
			" left join strukPelayananDetail.kdproduk kdproduk " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and strukPelayanan.noRec=:noRec" )*/
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" to_char(strukPelayanan.tglstruk,'yyyy-mm-dd') as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and strukPelayanan.noRec=:noRec" )
	List<Map<String, Object>> getOrderLaundrySebelumDiTerimaByNoOrder(@Param("noRec")String noRec);
	
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and pegawaiPenerima.id is not null" )
	List<Map<String, Object>> getOrderLaundryDiTerima();
	
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and pegawaiPenerima.id is not null and strukPelayanan.noRec=:noRec" )
	List<Map<String, Object>> getOrderLaundryDiTerimaByNoOrder(@Param("noRec")String noRec);
	
	//show data proses pencuci internal
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" alat.kapasitasAlat as kapasitasAlat, " +
			" alat.satuanStandar.satuanStandar as satuanStandar, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where strukPelayanan.keteranganlainnya in('Proses Pencucian Internal') " +
			" and produk.id=produkAlat.id " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesCuciInternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses pencuci external
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" alat.kapasitasAlat as kapasitasAlat, " +
			" alat.satuanStandar.satuanStandar as satuanStandar, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where strukPlaning.keteranganlainnya in('Proses Pencucian External') " +
			" and produk.id=produkAlat.id " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesCuciExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data pegawai berdasarkan prosescuciinternal
	@Query("select new map(pegawai.id as idPegawai, pegawai.namaLengkap as namapegawai) " +
			" from PlanningPelayananPetugas planningPelayananPetugas " +
			" left join planningPelayananPetugas.strukPlaning strukPlaning " +
			" left join planningPelayananPetugas.pegawai pegawai where strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getPegawaiProsesCuci(@Param("noRec")String noRec);
	
	//show data proses cuci internal dan external by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where produk.id=produkAlat.id and strukPelayanan.noRec=:noRec")
	List<Map<String, Object>> getProsesCuciInternalbyNoRec(@Param("noRec")String noRec);
	
	//group bilas by norec
	@Query("select new map(planningPelayananDbhp.keterangan as bilas) " +
			" from PlanningPelayananDbhp planningPelayananDbhp " +
			" left join planningPelayananDbhp.strukPlanning strukPlanning " +
			" where strukPlanning.noRec=:noRec and " +
			" planningPelayananDbhp.keterangan<>'' " +
			" group by planningPelayananDbhp.keterangan")
	List<Map<String, Object>> getProsesCuciInternalBilasByNoRec(@Param("noRec")String noRec);
	
	//show data bahan2 group by bilas and norec
	@Query("select new map(produk.id as idProduk, " +
			" produk.namaProduk as namaProduk, " +
			" planningPelayananDbhp.qtyProduk as jumlahBahan, " +
			" planningPelayananDbhp.satuanStandar.id as idSatuan, " +
			" planningPelayananDbhp.satuanStandar.namaExternal as satuan) " +
			" from PlanningPelayananDbhp planningPelayananDbhp " +
			" left join planningPelayananDbhp.strukPlanning strukPlanning " +
			" left join planningPelayananDbhp.produk produk" +
			" where strukPlanning.noRec=:noRec and planningPelayananDbhp.keterangan=:bilas")
	List<Map<String, Object>> getProsesCuciInternalBahanByNoRecBilas(
			@Param("noRec")String noRec, @Param("bilas")String bilas);
	
	//show data proses pengeringan internal
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" alat.kapasitasAlat as kapasitasAlat, " +
			" alat.satuanStandar.satuanStandar as satuanStandar, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where strukPlaning.keteranganlainnya in('Proses Pengeringan Internal') " +
			" and produk.id=produkAlat.id and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesPengeringanInternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses pengeringan external
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" alat.kapasitasAlat as kapasitasAlat, " +
			" alat.satuanStandar.satuanStandar as satuanStandar, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where strukPlaning.keteranganlainnya in('Proses Pengeringan External') " +
			" and produk.id=produkAlat.id and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesPengeringanExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses pengeringan by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" planningPelayanan.qtyProdukExec as beratLinen, " +
			" alat.id as idMesin, alat.namaAlat as namaAlat, " +
			" strukPelayanan.noRec as noRecstrukPelayanan, " +
			" planningPelayananDetail.jumlahCycle as jumlahCycle) " +
			" from PlanningPelayananDetail planningPelayananDetail " +
			" left join planningPelayananDetail.planningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk, " +
			" Alat alat left join alat.produkAset produkAlat " +
			" where produk.id=produkAlat.id and strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesPengeringanInternalbyNoRec(@Param("noRec")String noRec);
	
	//show data proses pelipatan
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningExecAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Pelipatan') " +
			" and strukPelayanan.keteranganAmbil is null " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesPelipatan(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses pelipatan External
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningExecAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Pelipatan External') " +
			" and strukPelayanan.keteranganAmbil is null " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesPelipatanExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses pelipatan by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Pelipatan') " +
			" and strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesPelipatanbyNoRec(@Param("noRec")String noRec);
	
	//show data proses pelipatan external by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Pelipatan External') " +
			" and strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesPelipatanExternalbyNoRec(@Param("noRec")String noRec);
	
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPelayanan.noRec as noRecstrukPelayanan, " +
			" planningPelayananDetail.jumlahCycle as jmlLipatan, " +
			" planningPelayananDetail.qtyProdukDetail as beratLinen, " +
			" planningPelayananDetail.totalVolumeProdukDetail as totalProdukLinen, " +
			" produk.id as idLinen, produk.namaExternal as namaLinen) " +
			" from PlanningPelayananDetail planningPelayananDetail " +
			" left join planningPelayananDetail.planningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayananDetail.produkDetail produk " +
			" where strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesPelipatanDetailbyNoRec(@Param("noRec")String noRec);
	
	//show data proses Roll Press
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningExecAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Roll Press') " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesRollPress(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses Roll Press External
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" strukPlaning.keteranganlainnya as keteranganlainnya, " +
			" planningPelayanan.tglPlanningExecAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.keteranganlainnya in('Proses Roll Press External') " +
			" and date(strukPlaning.tglplanning) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getProsesRollPressExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//show data proses Roll Press by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPlaning.tglplanning as tglplanning, " +
			" planningPelayanan.tglPlanningAkhir as tglPlanningAkhir, " +
			" strukPelayanan.noRec as noRecstrukPelayanan) " +
			" from PlanningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayanan.produk produk " +
			" where strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesRollPressbyNoRec(@Param("noRec")String noRec);
	
	//show data proses Roll Press Detail by norec
	@Query("select new map(strukPlaning.noRec as noRec, " +
			" strukPelayanan.noRec as noRecstrukPelayanan, " +
			" planningPelayananDetail.jumlahCycle as jmlLipatan, " +
			" planningPelayananDetail.qtyProdukDetail as beratLinen, " +
			" planningPelayananDetail.totalVolumeProdukDetail as totalProdukLinen, " +
			" produk.id as idLinen, produk.namaExternal as namaLinen) " +
			" from PlanningPelayananDetail planningPelayananDetail " +
			" left join planningPelayananDetail.planningPelayanan planningPelayanan " +
			" left join planningPelayanan.strukPlaning strukPlaning " +
			" left join planningPelayanan.strukPelayanan strukPelayanan " +
			" left join planningPelayananDetail.produkDetail produk " +
			" where strukPlaning.noRec=:noRec")
	List<Map<String, Object>> getProsesRollPressDetailbyNoRec(@Param("noRec")String noRec);
	
	//show data bahan laundry
	@Query("select new map(a.id as id, a.namaProduk as namaProduk) " +
			" from Produk a left join a.detailJenisProduk " +
			" b where b.id in(178) ") //khusus untuk bahan laundry
	List<Map<String, Object>> getBahanLaundry();
	
	//cek stock linen bersih
	//khusu linen
	//diganti dengan StokProdukDetail
	//request by bro nanda
	@Query("select new map(a.id as id, b.namaExternal as namaExternal, " +
			" a.qtyProduk as qtyProduk, d.id as idSatuan, " +
			" d.satuanStandar as satuanStandar, " +
			" b.id as idProduk, b.qtySatuKemasan as beratLinen) " +
			" from StokProdukDetail a " +
			" left join a.produk b " +
			" left join b.detailJenisProduk j " +
			" left join a.ruangan c " +
			" left join b.satuanStandar d " +
			" where j.id in(177) and c.id=:idRuangan")
	List<Map<String, Object>> getStockLaundryLinenBersih(@Param("idRuangan")Integer idRuangan);
	
	//cek stock bahan
	//khusu linen
	//diganti dengan StokProdukDetail
	//request by bro nanda
	@Query("select new map(a.id as id, b.namaExternal as namaExternal, " +
			" a.qtyProduk as qtyProduk, d.id as idSatuan, " +
			" d.satuanStandar as satuanStandar, b.id as idProduk) " +
			" from StokProdukDetail a " +
			" left join a.produk b " +
			" left join b.detailJenisProduk j " +
			" left join a.ruangan c " +
			" left join b.satuanStandar d " +
			" where j.id in(178) and c.id=:idRuangan")
	List<Map<String, Object>> getStockBahanLaundry(@Param("idRuangan")Integer idRuangan);

	//show data distribusi linen bersih
	@Query("select new map(strukPelayanan.nostruk as nostruk, " +
		" strukPelayanan.noRec as noRec, " +
		" strukPelayanan.tglstruk as tglPengiriman, " +
		" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
		" menyerahkan.id as idPetugas, " +
		" menyerahkan.namaExternal as Petugas, " +
		" kdruangan.id as idRuanganPenerima, " +
		" kdruangan.namaExternal as ruanganPenerima, " +
		" kdpegawaipenerima.id as idPegawaiPenerima, " +
		" kdpegawaipenerima.namaExternal as namaPegawaiPenerima) " +
		" from StrukPelayanan strukPelayanan " +
		" left join strukPelayanan.kdruangan kdruangan " +
		" left join strukPelayanan.kdpegawaipenerima kdpegawaipenerima " +
		" left join strukPelayanan.menyerahkan menyerahkan " +
		" where strukPelayanan.keteranganlainnya in('Distribusi Linen') " +
		" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getDistribusiLinen(@Param("startDate")String startDate, @Param("endDate")String endDate);	
	
	//show data distribusi linen bersih by ruangan
	@Query("select new map(strukPelayanan.nostruk as nostruk, " +
		" strukPelayanan.noRec as noRec, " +
		" strukPelayanan.tglstruk as tglPengiriman, " +
		" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
		" menyerahkan.id as idPetugas, " +
		" menyerahkan.namaExternal as Petugas, " +
		" kdruangan.id as idRuanganPenerima, " +
		" kdruangan.namaExternal as ruanganPenerima, " +
		" kdpegawaipenerima.id as idPegawaiPenerima, " +
		" kdpegawaipenerima.namaExternal as namaPegawaiPenerima) " +
		" from StrukPelayanan strukPelayanan " +
		" left join strukPelayanan.kdruangan kdruangan " +
		" left join strukPelayanan.kdpegawaipenerima kdpegawaipenerima " +
		" left join strukPelayanan.menyerahkan menyerahkan " +
		" where strukPelayanan.keteranganlainnya in('Distribusi Linen') and " +
		" kdruangan.id=:idRuangan and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getDistribusiLinenByRuangan(@Param("idRuangan") Integer idRuangan, @Param("startDate")String startDate, @Param("endDate")String endDate);	
	
	@Query("select strukPelayanan from " +
			" StrukPelayanan strukPelayanan where strukPelayanan.noRec=:noRec")
	StrukPelayanan getDistribusiLinenByNoRec(@Param("noRec")String noRec);
	
	//update tglterima di flag Order Order Laundry Internal
	@Query("select strukPelayanan from StrukPelayanan strukPelayanan " +
			" where strukPelayanan.nostruk=:noStruk and " +
			" strukPelayanan.keteranganlainnya in('Order Laundry Internal')") 
	StrukPelayanan getUpdateTglTerimaByNoStruk(@Param("noStruk")String noStruk);
	
	//show data distribusi linen bersih by norec
	@Query("select new map(strukPelayanan.nostruk as nostruk, " +
		" strukPelayanan.noRec as noRec, " +
		" strukPelayanan.tglstruk as tglPengiriman, " +
		" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
		" menyerahkan.id as idPetugas, " +
		" menyerahkan.namaExternal as Petugas, " +
		" kdruangan.id as idRuanganPenerima, " +
		" kdruangan.namaExternal as ruanganPenerima, " +
		" kdpegawaipenerima.id as idPegawaiPenerima, " +
		" kdpegawaipenerima.namaExternal as namaPegawaiPenerima) " +
		" from StrukPelayanan strukPelayanan " +
		" left join strukPelayanan.kdruangan kdruangan " +
		" left join strukPelayanan.kdpegawaipenerima kdpegawaipenerima " +
		" left join strukPelayanan.menyerahkan menyerahkan " +
		" where strukPelayanan.keteranganlainnya in('Distribusi Linen') and strukPelayanan.noRec=:noRec")
	List<Map<String, Object>> getDistribusiLinenBersihByNoRec(@Param("noRec")String noRec);	
	
	//show data distribusi linen bersih detail by norec 
	@Query("select new map(strukPelayanan.nostruk as nostruk, " +
		" strukPelayananDetail.noRec as noRec, " +
		" strukPelayananDetail.qtyproduk as qtyproduk, " +
		" produk.id as idProduk, produk.namaExternal as namaProduk, " +
		" satuanStandar.id as idSatuan, " +
		" satuanStandar.namaExternal as namaExternal) " +
		" from StrukPelayananDetail strukPelayananDetail " +
		" left join  strukPelayananDetail.nostruk strukPelayanan " +
		" left join strukPelayananDetail.kdproduk produk " +
		" left join produk.satuanStandar satuanStandar" +
		" where strukPelayanan.noRec=:noRec")
	List<Map<String, Object>> getDistribusiLinenDetailByNoRec(@Param("noRec")String noRec);	
	
	//get penerimaan linen External
	@Query("select new map(strukPelayanan.noRec as noRec, strukPelayanan.tglstruk as tglStruk,  "+
			" menyerahkan.id as idMenyerahkan, menyerahkan.namaExternal as namaMenyerahkan, " +
			" penerima.id as idPetugas, penerima.namaExternal as petugas, " +
			" strukPelayanan.tglterimakiriman as tglTerima, " +
			" ruanganAsal.id as ruanganAsal, ruanganAsal.namaExternal as ruanganAsal, " +
			" strukPelayanan.keteranganlainnya as keterangan, strukPelayanan.qtyproduk as berat) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdpegawaipenerima penerima " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdruanganasal ruanganAsal" +
			" where strukPelayanan.keteranganlainnya in('Order Laundry Internal') " +
			" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getPenerimaanLinenInternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	//get penerimaan linen External
	@Query("select new map(strukPelayanan.noRec as noRec, strukPelayanan.tglstruk as tglStruk,  "+
			" menyerahkan.id as idMenyerahkan, menyerahkan.namaExternal as namaMenyerahkan, " +
			" penerima.id as idPetugas, penerima.namaExternal as petugas, " +
			" strukPelayanan.tglterimakiriman as tglTerima, " +
			" ruanganAsal.id as ruanganAsal, ruanganAsal.namaExternal as ruanganAsal, " +
			" strukPelayanan.keteranganlainnya as keterangan, strukPelayanan.qtyproduk as berat) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdpegawaipenerima penerima " +
			" left join strukPelayanan.nocm menyerahkan " +
			" left join strukPelayanan.kdruanganasal ruanganAsal" +
			" where strukPelayanan.keteranganlainnya in('Order Laundry External') " +
			" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")
	List<Map<String, Object>> getPenerimaanLinenExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(strukPelayanan.noRec as noRecStrukPelayanan, "
			+ " strukPelayanan.nostruk as nostruk,"
			+ " strukPelayanan.totalhargasatuan as totalhargasatuan, "
			+ " strukPelayanan.namaLengkapAmbil as namaLengkapAmbil,"
			+ " to_char(strukPelayanan.tglstruk, 'yyyy-mm-dd') as tglOrder, "
			+ " to_char(strukPelayanan.tglAmbil,'yyyy-mm-dd') as tglAmbil, "
			+ " strukPelayanan.keteranganAmbil as keteranganAmbil, "
			+ " pasien.id as pelangganId, "
			+ " pasien.namaPasien as namaPelanggan, "
			+ " strukPelayanan.qtyproduk as beratLinen, "   
			+ " noclosing.noRec as noClosing) "
			+ " from StrukPelayanan strukPelayanan " 
			+ " left join strukPelayanan.nocm pasien " 
			+ " left join strukPelayanan.noclosing noclosing "
			+ " where strukPelayanan.keteranganlainnya in('Order Laundry External') " 
			+ " and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)")				
	public List<Map<String, Object>> getDistribusiLinenExternal(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(model.noRec as noRecStrukPelayananDetail, "
			+ " model.hargasatuan as hargasatuan, "
			+ " nostruk.noRec as noRecStrukPelayanan, "
			+ " nostruk.namaLengkapAmbil as namaLengkapAmbil,"
			+ " to_char(nostruk.tglAmbil,'yyyy-mm-dd') as tglAmbil,"
			+ " nostruk.keteranganAmbil as keteranganAmbil, "
			+ " nostruk.totalhargasatuan as totalhargasatuan, "
			+ " pasien.id as pelangganId, "
			+ " pasien.namaPasien as namaPelanggan, "
			+ " produk.id as produkId, "
			+ " produk.namaProduk as namaProduk, "
			+ " kdsatuanstandar.id as idSatuan, "
			+ " kdsatuanstandar.satuanStandar as satuanStandar, "
			+ " ruanganAsal.id as ruanganAsalId, "
			+ " ruanganAsal.namaRuangan as namaRuanganAsal,"
			+ " model.qtyproduk as qtyProduk, "
			+ " noclosing.noRec as noClosing) "
			+ " from StrukPelayananDetail model "
			+ " left join model.kdproduk produk "
			+ " left join model.kdsatuanstandar kdsatuanstandar "
			+ " left join model.noplanning noplanning "
			+ " left join model.nostruk nostruk "
			+ " left join nostruk.nocm pasien "
			+ " left join nostruk.noclosing noclosing "
			+ " left join nostruk.kdruanganasal ruanganAsal "
			+ " where nostruk.noRec=:noRecStrukPelayanan ")
	public List<Map<String, Object>> findStrukPelayananByNoRec(@Param("noRecStrukPelayanan") String noRecStrukPelayanan);
	
	//pengambilan linen kotor
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" to_char(strukPelayanan.tglstruk,'yyyy-mm-dd') as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Pengambilan Linen Kotor Internal') " +
			" and date(strukPelayanan.tglstruk) between date(:startDate) and date(:endDate)" )
	List<Map<String, Object>> getPengambilanLinenDariRuangan(@Param("startDate")String startDate, @Param("endDate")String endDate);
		
	//pengambilan linen kotor by norec
	@Query("select new map(strukPelayanan.noRec as noRec, " +
			" strukPelayanan.keteranganlainnya as ket, " +
			" strukPelayanan.nostruk as nostruk, " +
			" strukPelayanan.qtyproduk as qtyproduk, " +
			" strukPelayanan.tglstruk as tglstruk, " +
			" strukPelayanan.tglterimakiriman as tglterimakiriman, " +
			" menyerahkan.id as idMenyerahkan, " +
			" menyerahkan.namaExternal as namaMenyerahkan, " +
			" pegawaiPenerima.id as idPenerima, pegawaiPenerima.namaExternal as namaPenerima) " +
			" from StrukPelayanan strukPelayanan " +
			" left join strukPelayanan.kdruanganasal ruangAsal " +
			" left join strukPelayanan.kdruangan ruangan " +
			" left join strukPelayanan.menyerahkan menyerahkan " +
			" left join strukPelayanan.kdpegawaipenerima pegawaiPenerima " +
			" where strukPelayanan.keteranganlainnya in('Pengambilan Linen Kotor Internal') " +
			" and strukPelayanan.noRec=:noRec" )
	List<Map<String, Object>> getPengambilanLinenDariRuanganByNoRec(@Param("noRec")String noRec);
	
	@Query("select new map(jenisLinen.id as id, " +
			" jenisLinen.jenisLinen as jenisLinen) " +
			" from JenisLinen jenisLinen where jenisLinen.statusEnabled in('true')")
	List<Map<String, Object>> getJenisLinen();
	
	//get Mesin Linen berdasarkan Jenis Linennya
	@Query("select new map(alat.id as id,  " +
			" alat.namaAlat as namaAlat, " +
			" alat.kapasitasAlat as kapasitasAlat, " +
			" satuanStandar.id as idSatuan, " +
			" satuanStandar.satuanStandar as satuanStandar) " +
			" from MappingJenisLinenToProduk a " +
			" left join a.alat alat " +
			" left join alat.produkAset produkAset " +
			" left join produkAset.satuanStandar satuanStandar " +
			" left join a.jenisLinen jenisLinen " +
			" where jenisLinen.id=:idJenis " +
			" group by alat.id, alat.namaAlat, " +
			" alat.kapasitasAlat, satuanStandar.id")	
	List<Map<String, Object>> getMesinLinenByJenisLinen(@Param("idJenis")Integer idJenis);
	
	//get produk/detergen/bahan yg telah diset untuk jenislinen & mesinlinen(alat)
	@Query("select new map(a.id as idMapping, " +
			" produk.id as idProduk, " +
			" produk.namaProduk as namaProduk, " +
			" satuanStandar.id as idSatuan, " +
			" satuanStandar.satuanStandar as satuanStandar, a.qty as qty) " +
			" from MappingJenisLinenToProduk a " +
			" left join a.alat alat " +
			" left join a.jenisLinen jenisLinen " +
			" left join a.produk produk " +
			" left join a.satuanStandar satuanStandar " +
			" where jenisLinen.id=:idJenis and alat.id=:idMesin")
	List<Map<String, Object>> getBahanByJenisLinenMesin(@Param("idJenis")Integer idJenis, @Param("idMesin")Integer idMesin);
	
	@Query("select new Map(produk.id as idProduk, "+
			"produk.namaProduk as namaProduk, "+
			"satuan.satuanStandar as satuan, "+
			"cast(sum(coalesce(strukPelayananDetail.qtyproduk, 0)) as long) as qty) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and produk.id = :idProduk "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"group by produk.id, produk.namaProduk, satuan.satuanStandar "+
			"order by produk.namaProduk")
	List<Map<String, Object>> getRawLapLinenPerLayanan(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idProduk")Integer idProduk);
	
	@Query("select new Map (ruangan.id as idRuangan, "+
			"ruangan.namaRuangan as namaRuangan, "+
			"produk.id as idProduk, "+
			"produk.namaProduk as namaProduk, "+
			"satuan.satuanStandar as satuan, "+
			"to_char(strukPelayanan.tglstruk, 'dd/MM/yyyy') as tglStruk, "+
			"coalesce(strukPelayananDetail.qtyproduk, 0) as qty, "+
			"strukPelayanan.nostruk as noTrans) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by ruangan.namaRuangan, produk.namaProduk, strukPelayanan.tglstruk")
	List<Map<String, Object>> getRawDetailRekapLaundry(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map (ruangan.id as idRuangan, "+
			"ruangan.namaRuangan as namaRuangan, "+
			"produk.id as idProduk, "+
			"produk.namaProduk as namaProduk, "+
			"satuan.satuanStandar as satuan, "+
			"to_char(strukPelayanan.tglstruk, 'dd/MM/yyyy') as tglStruk, "+
			"coalesce(strukPelayananDetail.qtyproduk, 0) as qty, "+
			"strukPelayanan.nostruk as noTrans) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and ruangan.id = :idRuangan "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by ruangan.namaRuangan, produk.namaProduk, strukPelayanan.tglstruk")
	List<Map<String, Object>> getRawDetailRekapLaundryByRuangan(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idRuangan")Integer idRuangan);
	
	@Query("select new Map (ruangan.id as idRuangan, "+
			"ruangan.namaRuangan as namaRuangan, "+
			"produk.id as idProduk, "+
			"produk.namaProduk as namaProduk, "+
			"satuan.satuanStandar as satuan, "+
			"to_char(strukPelayanan.tglstruk, 'dd/MM/yyyy') as tglStruk, "+
			"cast(sum(coalesce(strukPelayananDetail.qtyproduk, 0)) as long) as qty, "+
			"strukPelayanan.nostruk as noTrans) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and ruangan.id = :idRuangan "+
			"and produk.id = :idProduk "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"group by ruangan.id, ruangan.namaRuangan, produk.id, produk.namaProduk, satuan.satuanStandar, strukPelayanan.tglstruk, strukPelayanan.nostruk "+
			"order by ruangan.namaRuangan, produk.namaProduk, strukPelayanan.tglstruk")
	List<Map<String, Object>> getRawDetailRekapLaundryByProduk(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idRuangan")Integer idRuangan, @Param("idProduk")Integer idProduk);
	
	@Query("select coalesce(stokProdukDetail.hargaNetto1, 0)-(coalesce(stokProdukDetail.hargaDiscount, 0)/100*coalesce(stokProdukDetail.hargaNetto1, 0)) "+
			"from StokProdukDetail stokProdukDetail "+
			"where stokProdukDetail.produkId = :idProduk "+
			"and stokProdukDetail.statusEnabled is true "+
			"and stokProdukDetail.tglpelayanan = "+
			"(select max(spd.tglpelayanan) "+
			"from StokProdukDetail spd "+
			"where spd.produkId = stokProdukDetail.produkId "+
			"and spd.statusEnabled is true)")
	Double getHargaStokProdukDetailLaundry(@Param("idProduk")Integer idProduk);
	
	@Query("select distinct new Map(ruangan.id as idRuangan, "+
			"ruangan.namaRuangan as namaRuangan) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by ruangan.namaRuangan")
	List<Map<String, Object>> getListRuanganRekapLaundry(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(ruangan.id as idRuangan, "+
			"ruangan.namaRuangan as namaRuangan, "+
			"produk.id as idProduk, "+
			"produk.namaProduk as namaProduk, "+
			"to_char(strukPelayanan.tglstruk, 'dd/MM/yyyy') as tglStruk) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and ruangan.id = :idRuangan "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by ruangan.namaRuangan, produk.namaProduk, strukPelayanan.tglstruk")
	List<Map<String, Object>> getListProdukRekapLaundry(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idRuangan")Integer idRuangan);
	
	@Query("select distinct new Map(produk.id as idProduk, "+
			"produk.namaProduk as namaProduk) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail strukPelayananDetail "+
			"left join strukPelayanan.kdruangan ruangan "+
			"inner join strukPelayananDetail.kdproduk produk "+
			"left join produk.satuanStandar satuan "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by produk.namaProduk")
	List<Map<String, Object>> getListProdukRekapLaundry(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(departemen.id as idDepartemen,"+
			"departemen.namaDepartemen as namaDepartemen,"+
			"ruangan.id as idRuangan,"+
			"ruangan.namaRuangan as namaRuangan,"+
			"produk.id as idProduk,"+
			"produk.namaProduk as namaProduk,"+
			"coalesce(detailStrukPelayanan.qtyproduk, 0) as qty,"+
			"(coalesce(produk.qtySatuKemasan, 0)*coalesce(detailStrukPelayanan.qtyproduk, 0)) as berat) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail detailStrukPelayanan "+
			"left join detailStrukPelayanan.kdruangan ruangan "+
			"inner join ruangan.departemen departemen "+
			"inner join detailStrukPelayanan.kdproduk produk "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by departemen.namaDepartemen, ruangan.namaRuangan")
	List<Map<String, Object>> getGrandRekapCuciLinen(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(departemen.id as idDepartemen,"+
			"departemen.namaDepartemen as namaDepartemen,"+
			"ruangan.id as idRuangan,"+
			"ruangan.namaRuangan as namaRuangan,"+
			"produk.id as idProduk,"+
			"produk.namaProduk as namaProduk,"+
			"coalesce(detailStrukPelayanan.qtyproduk, 0) as qty,"+
			"(coalesce(produk.qtySatuKemasan, 0)*coalesce(detailStrukPelayanan.qtyproduk, 0)) as berat) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail detailStrukPelayanan "+
			"left join detailStrukPelayanan.kdruangan ruangan "+
			"inner join ruangan.departemen departemen "+
			"inner join detailStrukPelayanan.kdproduk produk "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"and departemen.id = :idDepartemen "+
			"order by departemen.namaDepartemen, ruangan.namaRuangan")
	List<Map<String, Object>> getListRekapCuciLinenByDepartemen(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idDepartemen")Integer idDepartemen);
	
	@Query("select new Map(departemen.id as idDepartemen,"+
			"departemen.namaDepartemen as namaDepartemen,"+
			"ruangan.id as idRuangan,"+
			"ruangan.namaRuangan as namaRuangan,"+
			"produk.id as idProduk,"+
			"produk.namaProduk as namaProduk,"+
			"coalesce(detailStrukPelayanan.qtyproduk, 0) as qty,"+
			"(coalesce(produk.qtySatuKemasan, 0)*coalesce(detailStrukPelayanan.qtyproduk, 0)) as berat) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail detailStrukPelayanan "+
			"left join detailStrukPelayanan.kdruangan ruangan "+
			"inner join ruangan.departemen departemen "+
			"inner join detailStrukPelayanan.kdproduk produk "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"and departemen.id = :idDepartemen "+
			"and ruangan.id = :idRuangan "+
			"order by departemen.namaDepartemen, ruangan.namaRuangan")
	List<Map<String, Object>> getListRekapCuciLinenByRuangan(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idDepartemen")Integer idDepartemen, @Param("idRuangan")Integer idRuangan);
	
	@Query("select new Map(departemen.id as idDepartemen,"+
			"departemen.namaDepartemen as namaDepartemen) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail detailStrukPelayanan "+
			"left join detailStrukPelayanan.kdruangan ruangan "+
			"inner join ruangan.departemen departemen "+
			"inner join detailStrukPelayanan.kdproduk produk "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"order by departemen.namaDepartemen")
	List<Map<String, Object>> getListDepartemenRekapCuciLinen(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	@Query("select new Map(ruangan.id as idRuangan,"+
			"ruangan.namaRuangan as namaRuangan) "+
			"from StrukPelayanan strukPelayanan "+
			"inner join strukPelayanan.strukPelayananDetail detailStrukPelayanan "+
			"left join detailStrukPelayanan.kdruangan ruangan "+
			"inner join ruangan.departemen departemen "+
			"inner join detailStrukPelayanan.kdproduk produk "+
			"where strukPelayanan.keteranganlainnya = 'Distribusi Linen' "+
			"and strukPelayanan.tglterimakiriman is not null "+
			"and to_char(strukPelayanan.tglstruk, 'yyyy-MM-dd') between :startDate and :endDate "+
			"and departemen.id = :idDepartemen "+
			"order by ruangan.namaRuangan")
	List<Map<String, Object>> getListRuanganRekapCuciLinen(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("idDepartemen")Integer idDepartemen);
	
}
