package com.jasamedika.medifirst2000.service.impl;

import com.jasamedika.medifirst2000.dao.*;
import com.jasamedika.medifirst2000.entities.DetailLogbookDokter;
import com.jasamedika.medifirst2000.entities.LogbookDokter;
import com.jasamedika.medifirst2000.entities.LogbookRemun;
import com.jasamedika.medifirst2000.entities.constant.KelompokPasienM;
import com.jasamedika.medifirst2000.service.LogbookRemunService;
import com.jasamedika.medifirst2000.service.PelayananPasienService;
import com.jasamedika.medifirst2000.service.RemunerasiService;
import com.jasamedika.medifirst2000.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static com.jasamedika.medifirst2000.constants.Master.Profesi.TERAPI;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 25/04/2024
 */
@Service
@Transactional
public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements LogbookRemunService {

	private static final Logger LOGGER = LoggerFactory.getLogger(LogbookRemunServiceImpl.class);

	@Autowired
	private LogbookRemunDao logbookRemunDao;

	@Autowired
	private LogbookDokterDao logbookDokterDao;

	@Autowired
	private DetailLogbookDokterDao detailLogbookDokterDao;

	@Autowired
	private PelayananPasienService pelayananPasienService;

	@Autowired
	private RemunerasiService remunerasiService;

	@Autowired
	private MapPegawaiJabatanToUnitKerjaDao mapPegawaiJabatanToUnitKerjaDao;

	@Autowired
	private MapJabatanProfesiDao mapJabatanProfesiDao;

	@Override
	public void generateRecap() {
		LOGGER.info("Start simpan rekapitulasi detail logbook dokter");

		LocalDate localDate = LocalDate.now().minusMonths(1);
		Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
		Date tglAwal = DateUtil.startMonth(date);
		Date tglAkhir = DateUtil.endMonth(date);
		Set<Integer> listIdDokter = mapPegawaiJabatanToUnitKerjaDao
				.findDokterByUnitKerja(splitDataSettingDatafixed("listIdUnitKerjaKsm"));
		List<Integer> listTerapis = mapJabatanProfesiDao.findIdPegawaiByProfesiIn(Arrays.asList(TERAPI));
		listIdDokter.addAll(listTerapis);
		if (!listIdDokter.isEmpty()) {
			// Delete untuk pembaharuan data
			deleteByPeriod(listIdDokter, tglAwal, tglAkhir);
		}
		saveRekapDetailLogbookDokter(listIdDokter, date);
	}

	public void deleteByPeriod(Set<Integer> idPegawai, Date tglAwal, Date tglAkhir) {
		LOGGER.info("Start deleting previous data");

		List<Integer> listIdPegawai = new ArrayList<>(idPegawai);
		java.sql.Date sqlTglAwal = new java.sql.Date(tglAwal.getTime());
		java.sql.Date sqlTglAkhir = new java.sql.Date(tglAkhir.getTime());
		detailLogbookDokterDao.deleteByKelompokKerjaAndPeriod(listIdPegawai, sqlTglAwal, sqlTglAkhir);
		logbookDokterDao.deleteByKelompokKerjaAndPeriod(listIdPegawai, sqlTglAwal, sqlTglAkhir);
		logbookRemunDao.deleteByKelompokKerjaAndPeriod(listIdPegawai, sqlTglAwal, sqlTglAkhir);

		LOGGER.info("Deleting previous data successfully...!");
	}

	private void saveRekapDetailLogbookDokter(Set<Integer> idPegawaiKelompokKerja, Date date) {
		DateFormat df = new SimpleDateFormat("yyyy-MM");
		String bulan = df.format(date);
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
		YearMonth oct24 = YearMonth.parse("2024-09", formatter);
		YearMonth month = YearMonth.parse(bulan, formatter);
		ExecutorService executorService = Executors.newFixedThreadPool(50);
		CountDownLatch latch = new CountDownLatch(50);
		try {
			for (Integer idPegawai : idPegawaiKelompokKerja) {
				executorService.execute(() -> {
					LOGGER.info("Simpan rekapitulasi detail logbook dokter id {}", idPegawai);

					LogbookRemun logbookRemun = new LogbookRemun();
					logbookRemun.setKdProfile((short) 0);
					logbookRemun.setStatusEnabled(true);
					logbookRemun.setPegawaiId(idPegawai);
					logbookRemun.setBulan(date);
					logbookRemun.setTanggalTarikData(new Date());
					LogbookRemun savedRemun = logbookRemunDao.save(logbookRemun);
					{
						Map<String, Object> kinerjaDokter;
						if (month.isBefore(oct24)) {
							kinerjaDokter = pelayananPasienService.logbookRemunTarifDokter(idPegawai, bulan, null);
						} else {
							kinerjaDokter = remunerasiService.logbookRemunTarifDokter(idPegawai, bulan, null);
						}
						List<Map<String, Object>> remun = (List<Map<String, Object>>) kinerjaDokter.get("data");
						for (Map<String, Object> map : remun) {
							List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
							{
								List<Map<String, Object>> detail = (List<Map<String, Object>>) map.get("detail");
								for (Map<String, Object> d : detail)
									listNorecPelayananPasienPetugas.addAll((List<String>) d.get("norecs"));
							}
							LogbookDokter logbookDokter = new LogbookDokter();
							logbookDokter.setKdProfile((short) 0);
							logbookDokter.setStatusEnabled(true);
							logbookDokter.setJenisLogbook("JKN");
							logbookDokter.setKelompokPasien(
									getKelompokPasien(Integer.parseInt(map.get("idKelompokPasien").toString())));
							logbookDokter.setKeterangan(map.get("keterangan").toString());
							logbookDokter.setPersenJasa(
									Double.parseDouble(map.get("persenJasa").toString().replace("%", "")));
							logbookDokter.setProduk(map.get("namaProduk").toString());
							logbookDokter.setProdukId(Integer.parseInt(map.get("idProduk").toString()));
							double hargaJasa = Double.parseDouble(map.get("hargaJasa").toString());
							logbookDokter.setRemunTindakan(BigDecimal.valueOf(hargaJasa));
							logbookDokter
									.setTarif(BigDecimal.valueOf(Double.parseDouble(map.get("hargaJual").toString())));
							int jumlah = Double.valueOf(map.get("jumlah").toString()).intValue();
							logbookDokter.setTotalRemunTindakan(BigDecimal.valueOf(hargaJasa * jumlah));
							logbookDokter.setTotalTindakan(jumlah);
							logbookDokter.setLogbookRemun(savedRemun);
							LogbookDokter savedLogbookDokter = logbookDokterDao.save(logbookDokter);
							{
								List<Map<String, Object>> detailLogbook = pelayananPasienService
										.detailLogbookTarifDokter(idPegawai, listNorecPelayananPasienPetugas);
								List<DetailLogbookDokter> listDetailLogbookDokter = new ArrayList<>();
								for (Map<String, Object> detail : detailLogbook) {
									DetailLogbookDokter detailLogbookDokter = new DetailLogbookDokter();
									detailLogbookDokter.setKdProfile((short) 0);
									detailLogbookDokter.setStatusEnabled(true);
									detailLogbookDokter.setDiskon(
											BigDecimal.valueOf(Double.parseDouble(detail.get("diskon").toString())));
									detailLogbookDokter.setJumlahTindakan(
											Double.valueOf(detail.get("jumlah").toString()).intValue());
									detailLogbookDokter.setJenisPelaksana(detail.get("jenisPelaksana").toString());
									detailLogbookDokter.setKelas(detail.get("namaKelas").toString());
									detailLogbookDokter.setNamaPasien(detail.get("namaPasien").toString());
									detailLogbookDokter.setNoRegistrasi(detail.get("noRegistrasi").toString());
									detailLogbookDokter.setNoRekamMedis(detail.get("noCm").toString());
									detailLogbookDokter.setRuangan(detail.get("namaRuangan").toString());
									detailLogbookDokter
											.setTanggalPelayanan(DateUtil.toDate(detail.get("tanggal").toString()));
									detailLogbookDokter.setTarif(
											BigDecimal.valueOf(Double.parseDouble(detail.get("hargaJual").toString())));
									detailLogbookDokter.setLogbookDokter(savedLogbookDokter);
									listDetailLogbookDokter.add(detailLogbookDokter);
								}
								detailLogbookDokterDao.save(listDetailLogbookDokter);
							}
						}
					}
					{
						List<Map<String, Object>> ffs;
						if (month.isBefore(oct24)) {
							ffs = pelayananPasienService.logbookFfsTarifDokter(idPegawai, bulan, null);
						} else {
							ffs = remunerasiService.logbookFfsTarifDokter(idPegawai, bulan, null);
						}
						for (Map<String, Object> fee : ffs) {
							List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
							{
								List<Map<String, Object>> detail = (List<Map<String, Object>>) fee.get("detail");
								for (Map<String, Object> d : detail)
									listNorecPelayananPasienPetugas.addAll((List<String>) d.get("norecs"));
							}
							LogbookDokter logbookDokter = new LogbookDokter();
							logbookDokter.setKdProfile((short) 0);
							logbookDokter.setStatusEnabled(true);
							logbookDokter.setJenisLogbook("DALAM_JAM_KERJA");
							logbookDokter.setJenisRuangan(fee.get("jenisRuangan").toString().toUpperCase());
							logbookDokter.setKelompokPasien(
									getKelompokPasien(Integer.parseInt(fee.get("idKelompokPasien").toString())));
							logbookDokter.setKeterangan(fee.get("keterangan").toString());
							logbookDokter.setPersenJasa(
									Double.parseDouble(fee.get("persenJasa").toString().replace("%", "")));
							logbookDokter.setProduk(fee.get("namaProduk").toString());
							logbookDokter.setProdukId(Integer.parseInt(fee.get("idProduk").toString()));
							double hargaJasa = Double.parseDouble(fee.get("hargaJasa").toString());
							logbookDokter.setRemunTindakan(BigDecimal.valueOf(hargaJasa));
							logbookDokter
									.setTarif(BigDecimal.valueOf(Double.parseDouble(fee.get("hargaJual").toString())));
							int jumlah = Double.valueOf(fee.get("jumlah").toString()).intValue();
							logbookDokter.setTotalRemunTindakan(BigDecimal.valueOf(hargaJasa * jumlah));
							logbookDokter.setTotalTindakan(jumlah);
							logbookDokter.setLogbookRemun(savedRemun);
							LogbookDokter savedLogbookDokter = logbookDokterDao.save(logbookDokter);
							{
								List<Map<String, Object>> detailLogbook = pelayananPasienService
										.detailLogbookTarifDokter(idPegawai, listNorecPelayananPasienPetugas);
								List<DetailLogbookDokter> listDetailLogbookDokter = new ArrayList<>();
								for (Map<String, Object> detail : detailLogbook) {
									DetailLogbookDokter detailLogbookDokter = new DetailLogbookDokter();
									detailLogbookDokter.setKdProfile((short) 0);
									detailLogbookDokter.setStatusEnabled(true);
									detailLogbookDokter.setDiskon(
											BigDecimal.valueOf(Double.parseDouble(detail.get("diskon").toString())));
									detailLogbookDokter.setJumlahTindakan(
											Double.valueOf(detail.get("jumlah").toString()).intValue());
									detailLogbookDokter.setJenisPelaksana(detail.get("jenisPelaksana").toString());
									detailLogbookDokter.setKelas(detail.get("namaKelas").toString());
									detailLogbookDokter.setNamaPasien(detail.get("namaPasien").toString());
									detailLogbookDokter.setNoRegistrasi(detail.get("noRegistrasi").toString());
									detailLogbookDokter.setNoRekamMedis(detail.get("noCm").toString());
									detailLogbookDokter.setRuangan(detail.get("namaRuangan").toString());
									detailLogbookDokter
											.setTanggalPelayanan(DateUtil.toDate(detail.get("tanggal").toString()));
									detailLogbookDokter.setTarif(
											BigDecimal.valueOf(Double.parseDouble(detail.get("hargaJual").toString())));
									detailLogbookDokter.setLogbookDokter(savedLogbookDokter);
									listDetailLogbookDokter.add(detailLogbookDokter);
								}
								detailLogbookDokterDao.save(listDetailLogbookDokter);
							}
						}
					}
					{
						List<Map<String, Object>> ffs;
						if (month.isBefore(oct24)) {
							ffs = pelayananPasienService.logbookFfsLuarTarifDokter(idPegawai, bulan, null);
						} else {
							ffs = remunerasiService.logbookFfsLuarTarifDokter(idPegawai, bulan, null);
						}
						for (Map<String, Object> fee : ffs) {
							List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
							{
								List<Map<String, Object>> detail = (List<Map<String, Object>>) fee.get("detail");
								for (Map<String, Object> d : detail)
									listNorecPelayananPasienPetugas.addAll((List<String>) d.get("norecs"));
							}
							LogbookDokter logbookDokter = new LogbookDokter();
							logbookDokter.setKdProfile((short) 0);
							logbookDokter.setStatusEnabled(true);
							logbookDokter.setJenisLogbook("LUAR_JAM_KERJA");
							logbookDokter.setJenisRuangan(fee.get("jenisRuangan").toString().toUpperCase());
							logbookDokter.setKelompokPasien(
									getKelompokPasien(Integer.parseInt(fee.get("idKelompokPasien").toString())));
							logbookDokter.setKeterangan(fee.get("keterangan").toString());
							logbookDokter.setPersenJasa(
									Double.parseDouble(fee.get("persenJasa").toString().replace("%", "")));
							logbookDokter.setProduk(fee.get("namaProduk").toString());
							logbookDokter.setProdukId(Integer.parseInt(fee.get("idProduk").toString()));
							double hargaJasa = Double.parseDouble(fee.get("hargaJasa").toString());
							logbookDokter.setRemunTindakan(BigDecimal.valueOf(hargaJasa));
							logbookDokter
									.setTarif(BigDecimal.valueOf(Double.parseDouble(fee.get("hargaJual").toString())));
							int jumlah = Double.valueOf(fee.get("jumlah").toString()).intValue();
							logbookDokter.setTotalRemunTindakan(BigDecimal.valueOf(hargaJasa * jumlah));
							logbookDokter.setTotalTindakan(jumlah);
							logbookDokter.setLogbookRemun(savedRemun);
							LogbookDokter savedLogbookDokter = logbookDokterDao.save(logbookDokter);
							{
								List<Map<String, Object>> detailLogbook = pelayananPasienService
										.detailLogbookTarifDokter(idPegawai, listNorecPelayananPasienPetugas);
								List<DetailLogbookDokter> listDetailLogbookDokter = new ArrayList<>();
								for (Map<String, Object> detail : detailLogbook) {
									DetailLogbookDokter detailLogbookDokter = new DetailLogbookDokter();
									detailLogbookDokter.setKdProfile((short) 0);
									detailLogbookDokter.setStatusEnabled(true);
									detailLogbookDokter.setDiskon(
											BigDecimal.valueOf(Double.parseDouble(detail.get("diskon").toString())));
									detailLogbookDokter.setJumlahTindakan(
											Double.valueOf(detail.get("jumlah").toString()).intValue());
									detailLogbookDokter.setJenisPelaksana(detail.get("jenisPelaksana").toString());
									detailLogbookDokter.setKelas(detail.get("namaKelas").toString());
									detailLogbookDokter.setNamaPasien(detail.get("namaPasien").toString());
									detailLogbookDokter.setNoRegistrasi(detail.get("noRegistrasi").toString());
									detailLogbookDokter.setNoRekamMedis(detail.get("noCm").toString());
									detailLogbookDokter.setRuangan(detail.get("namaRuangan").toString());
									detailLogbookDokter
											.setTanggalPelayanan(DateUtil.toDate(detail.get("tanggal").toString()));
									detailLogbookDokter.setTarif(
											BigDecimal.valueOf(Double.parseDouble(detail.get("hargaJual").toString())));
									detailLogbookDokter.setLogbookDokter(savedLogbookDokter);
									listDetailLogbookDokter.add(detailLogbookDokter);
								}
								detailLogbookDokterDao.save(listDetailLogbookDokter);
							}
						}
					}
					{
						List<Map<String, Object>> fixedPay;
						if (month.isBefore(oct24)) {
							fixedPay = pelayananPasienService.logbookFixedPayDokter(idPegawai, bulan, null);
						} else {
							fixedPay = remunerasiService.logbookFixedPayDokter(idPegawai, bulan, null);
						}
						for (Map<String, Object> pay : fixedPay) {
							List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
							{
								List<Map<String, Object>> detail = (List<Map<String, Object>>) pay.get("detail");
								for (Map<String, Object> d : detail)
									listNorecPelayananPasienPetugas.addAll((List<String>) d.get("norecs"));
							}
							LogbookDokter logbookDokter = new LogbookDokter();
							logbookDokter.setKdProfile((short) 0);
							logbookDokter.setStatusEnabled(true);
							logbookDokter.setJenisLogbook("FIXED_PAY");
							logbookDokter.setJenisRuangan(pay.get("jenisRuangan").toString().toUpperCase());
							logbookDokter.setKelompokPasien(
									getKelompokPasien(Integer.parseInt(pay.get("idKelompokPasien").toString())));
							logbookDokter.setKeterangan(pay.get("keterangan").toString());
							logbookDokter.setProduk(pay.get("namaProduk").toString());
							logbookDokter.setProdukId(Integer.parseInt(pay.get("idProduk").toString()));
							double hargaJasa = Double.parseDouble(pay.get("hargaJasa").toString());
							logbookDokter.setRemunTindakan(BigDecimal.valueOf(hargaJasa));
							logbookDokter
									.setTarif(BigDecimal.valueOf(Double.parseDouble(pay.get("hargaJual").toString())));
							int jumlah = Double.valueOf(pay.get("jumlah").toString()).intValue();
							logbookDokter.setTotalRemunTindakan(BigDecimal.valueOf(hargaJasa * jumlah));
							logbookDokter.setTotalTindakan(jumlah);
							logbookDokter.setLogbookRemun(savedRemun);
							LogbookDokter savedLogbookDokter = logbookDokterDao.save(logbookDokter);
							{
								List<Map<String, Object>> detailLogbook = pelayananPasienService
										.detailLogbookTarifDokter(idPegawai, listNorecPelayananPasienPetugas);
								List<DetailLogbookDokter> listDetailLogbookDokter = new ArrayList<>();
								for (Map<String, Object> detail : detailLogbook) {
									DetailLogbookDokter detailLogbookDokter = new DetailLogbookDokter();
									detailLogbookDokter.setKdProfile((short) 0);
									detailLogbookDokter.setStatusEnabled(true);
									detailLogbookDokter.setDiskon(
											BigDecimal.valueOf(Double.parseDouble(detail.get("diskon").toString())));
									detailLogbookDokter.setJumlahTindakan(
											Double.valueOf(detail.get("jumlah").toString()).intValue());
									detailLogbookDokter.setJenisPelaksana(detail.get("jenisPelaksana").toString());
									detailLogbookDokter.setKelas(detail.get("namaKelas").toString());
									detailLogbookDokter.setNamaPasien(detail.get("namaPasien").toString());
									detailLogbookDokter.setNoRegistrasi(detail.get("noRegistrasi").toString());
									detailLogbookDokter.setNoRekamMedis(detail.get("noCm").toString());
									detailLogbookDokter.setRuangan(detail.get("namaRuangan").toString());
									detailLogbookDokter
											.setTanggalPelayanan(DateUtil.toDate(detail.get("tanggal").toString()));
									detailLogbookDokter.setTarif(
											BigDecimal.valueOf(Double.parseDouble(detail.get("hargaJual").toString())));
									detailLogbookDokter.setLogbookDokter(savedLogbookDokter);
									listDetailLogbookDokter.add(detailLogbookDokter);
								}
								detailLogbookDokterDao.save(listDetailLogbookDokter);
							}
						}
					}
					{
						List<Map<String, Object>> klaimMpp;
						if (month.isBefore(oct24)) {
							klaimMpp = pelayananPasienService.logbookKlaimMppDokter(idPegawai, bulan);
						} else {
							klaimMpp = remunerasiService.logbookKlaimMppDokter(idPegawai, bulan);
						}
						for (Map<String, Object> mpp : klaimMpp) {
							List<String> listNorecPelayananPasienPetugas = new ArrayList<>();
							{
								List<Map<String, Object>> detail = (List<Map<String, Object>>) mpp.get("detail");
								for (Map<String, Object> d : detail)
									listNorecPelayananPasienPetugas.addAll((List<String>) d.get("norecs"));
							}
							LogbookDokter logbookDokter = new LogbookDokter();
							logbookDokter.setKdProfile((short) 0);
							logbookDokter.setStatusEnabled(true);
							logbookDokter.setJenisLogbook("KLAIM_MPP");
							logbookDokter.setJenisRuangan(mpp.get("jenisRuangan").toString().toUpperCase());
							logbookDokter.setKelompokPasien(
									getKelompokPasien(Integer.parseInt(mpp.get("idKelompokPasien").toString())));
							logbookDokter.setKeterangan(mpp.get("keterangan").toString());
							logbookDokter.setProduk(mpp.get("namaProduk").toString());
							logbookDokter.setProdukId(Integer.parseInt(mpp.get("idProduk").toString()));
							double hargaJasa = Double.parseDouble(mpp.get("hargaJasa").toString());
							logbookDokter.setRemunTindakan(BigDecimal.valueOf(hargaJasa));
							logbookDokter
									.setTarif(BigDecimal.valueOf(Double.parseDouble(mpp.get("hargaJual").toString())));
							int jumlah = Double.valueOf(mpp.get("jumlah").toString()).intValue();
							logbookDokter.setTotalRemunTindakan(BigDecimal.valueOf(hargaJasa * jumlah));
							logbookDokter.setTotalTindakan(jumlah);
							logbookDokter.setLogbookRemun(savedRemun);
							LogbookDokter savedLogbookDokter = logbookDokterDao.save(logbookDokter);
							{
								List<Map<String, Object>> detailLogbook = pelayananPasienService
										.detailLogbookTarifDokter(idPegawai, listNorecPelayananPasienPetugas);
								List<DetailLogbookDokter> listDetailLogbookDokter = new ArrayList<>();
								for (Map<String, Object> detail : detailLogbook) {
									DetailLogbookDokter detailLogbookDokter = new DetailLogbookDokter();
									detailLogbookDokter.setKdProfile((short) 0);
									detailLogbookDokter.setStatusEnabled(true);
									detailLogbookDokter.setDiskon(
											BigDecimal.valueOf(Double.parseDouble(detail.get("diskon").toString())));
									detailLogbookDokter.setJumlahTindakan(
											Double.valueOf(detail.get("jumlah").toString()).intValue());
									detailLogbookDokter.setJenisPelaksana(detail.get("jenisPelaksana").toString());
									detailLogbookDokter.setKelas(detail.get("namaKelas").toString());
									detailLogbookDokter.setNamaPasien(detail.get("namaPasien").toString());
									detailLogbookDokter.setNoRegistrasi(detail.get("noRegistrasi").toString());
									detailLogbookDokter.setNoRekamMedis(detail.get("noCm").toString());
									detailLogbookDokter.setRuangan(detail.get("namaRuangan").toString());
									detailLogbookDokter
											.setTanggalPelayanan(DateUtil.toDate(detail.get("tanggal").toString()));
									detailLogbookDokter.setTarif(
											BigDecimal.valueOf(Double.parseDouble(detail.get("hargaJual").toString())));
									detailLogbookDokter.setLogbookDokter(savedLogbookDokter);
									listDetailLogbookDokter.add(detailLogbookDokter);
								}
								detailLogbookDokterDao.save(listDetailLogbookDokter);
							}
						}
					}
					latch.countDown();
				});
			}
			latch.await();
		} catch (InterruptedException e) {
			Thread.currentThread().interrupt();
		}
	}

	private String getKelompokPasien(Integer idKelompokPasien) {
		KelompokPasienM kelompokPasien = KelompokPasienM.valueOf(idKelompokPasien);
		return kelompokPasien.name();
	}
}
