From ff136965f009dd86673e1d95e512e6838d1a4b6f Mon Sep 17 00:00:00 2001 From: ridwan Date: Thu, 4 Jun 2026 14:02:39 +0700 Subject: [PATCH] update reporting kualitas medis ke 1 --- .../controller/ReportingController.java | 12 ++-- .../java/com/reporting/dao/ReportingDao.java | 12 ++-- .../reporting/service/ReportingService.java | 56 +++++++++++++++---- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/reporting/controller/ReportingController.java b/src/main/java/com/reporting/controller/ReportingController.java index 448913d..93a9b66 100644 --- a/src/main/java/com/reporting/controller/ReportingController.java +++ b/src/main/java/com/reporting/controller/ReportingController.java @@ -1019,6 +1019,7 @@ public class ReportingController { @RequestParam("tglAkhir") String tglAkhir, @RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter, @RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan, + @RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit, @RequestParam(value = "format", required = false, defaultValue = "pdf") String format, @RequestParam(value = "mode", required = false, defaultValue = "download") String mode, @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, @@ -1026,7 +1027,7 @@ public class ReportingController { JasperPrint jasperPrint = null; try { // Generate report (common for both PDF/Excel) - jasperPrint = this.reportingService.exportVisit(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + jasperPrint = this.reportingService.exportVisit(tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); if ("excel".equalsIgnoreCase(format)) { // Handle Excel export @@ -1067,6 +1068,7 @@ public class ReportingController { @RequestParam("tglAkhir") String tglAkhir, @RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter, @RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan, + @RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit, @RequestParam(value = "format", required = false, defaultValue = "pdf") String format, @RequestParam(value = "mode", required = false, defaultValue = "download") String mode, @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, @@ -1075,7 +1077,7 @@ public class ReportingController { try { // Generate report (common for both PDF/Excel) - jasperPrint = this.reportingService.exportWaktuRawatJalan(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + jasperPrint = this.reportingService.exportWaktuRawatJalan(tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); if ("excel".equalsIgnoreCase(format)) { // Handle Excel export @@ -1115,6 +1117,7 @@ public class ReportingController { @RequestParam("tglAkhir") String tglAkhir, @RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter, @RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan, + @RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit, @RequestParam(value = "format", required = false, defaultValue = "pdf") String format, @RequestParam(value = "mode", required = false, defaultValue = "download") String mode, @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, @@ -1124,7 +1127,7 @@ public class ReportingController { try { // Generate report (common for both PDF/Excel) - jasperPrint = this.reportingService.exportWaktuRawatJalanTRB(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + jasperPrint = this.reportingService.exportWaktuRawatJalanTRB(tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); if ("excel".equalsIgnoreCase(format)) { // Handle Excel export @@ -1607,6 +1610,7 @@ public class ReportingController { @RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit, @RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan, @RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter, + @RequestParam(value = "idUnitSDM", required = false, defaultValue = "") Integer idUnitSDM, @RequestParam(value = "format", required = false, defaultValue = "pdf") String format, @RequestParam(value = "mode", required = false, defaultValue = "download") String mode, @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, @@ -1615,7 +1619,7 @@ public class ReportingController { JasperPrint jasperPrint = null; try { // Generate report (common for both PDF/Excel) - jasperPrint = this.reportingService.exportLpResumeMedis(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idDokter, printBy); + jasperPrint = this.reportingService.exportLpResumeMedis(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idDokter, idUnitSDM, printBy); if ("excel".equalsIgnoreCase(format)) { // Handle Excel export diff --git a/src/main/java/com/reporting/dao/ReportingDao.java b/src/main/java/com/reporting/dao/ReportingDao.java index b1d5e80..e21f1cc 100644 --- a/src/main/java/com/reporting/dao/ReportingDao.java +++ b/src/main/java/com/reporting/dao/ReportingDao.java @@ -1130,7 +1130,7 @@ public class ReportingDao { //Export Excel - public JasperPrint exportVisit(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { + public JasperPrint exportVisit(Timestamp tglAwal, Timestamp tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { String path = jaspersim2DirPath + "visit.jrxml"; JasperReport jasperReport = JasperCompileManager.compileReport(path); @@ -1139,6 +1139,7 @@ public class ReportingDao { parameters.put("tglAkhir", tglAkhir); parameters.put("idDokter", idDokter); parameters.put("idRuangan", idRuangan); + parameters.put("idUnit", idUnit); parameters.put("printBy", printBy); return JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (Exception var15) { @@ -1148,7 +1149,7 @@ public class ReportingDao { return null; } - public JasperPrint exportWaktuRawatJalan(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { + public JasperPrint exportWaktuRawatJalan(Timestamp tglAwal, Timestamp tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { String path = jaspersim2DirPath + "waktu_rawat_jalan.jrxml"; JasperReport jasperReport = JasperCompileManager.compileReport(path); @@ -1157,6 +1158,7 @@ public class ReportingDao { parameters.put("tglAkhir", tglAkhir); parameters.put("idDokter", idDokter); parameters.put("idRuangan", idRuangan); + parameters.put("idUnit", idUnit); parameters.put("printBy", printBy); return JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (Exception var15) { @@ -1166,7 +1168,7 @@ public class ReportingDao { return null; } - public JasperPrint exportWaktuRawatJalanTRB(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { + public JasperPrint exportWaktuRawatJalanTRB(Timestamp tglAwal, Timestamp tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { String path = jaspersim2DirPath + "waktu_rawat_jalan_trb.jrxml"; JasperReport jasperReport = JasperCompileManager.compileReport(path); @@ -1175,6 +1177,7 @@ public class ReportingDao { parameters.put("tglAkhir", tglAkhir); parameters.put("idDokter", idDokter); parameters.put("idRuangan", idRuangan); + parameters.put("idUnit", idUnit); parameters.put("printBy", printBy); return JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (Exception var15) { @@ -1355,7 +1358,7 @@ public class ReportingDao { return null; } - public JasperPrint exportLpResumeMedis(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, String printBy) { + public JasperPrint exportLpResumeMedis(Timestamp tglAwal, Timestamp tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, Integer idUnitSDM, String printBy) { try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { String path = jaspersim2DirPath + "LaporanResumeMedis.jrxml"; JasperReport jasperReport = JasperCompileManager.compileReport(path); @@ -1366,6 +1369,7 @@ public class ReportingDao { parameters.put("idUnit", idUnit); parameters.put("idRuangan", idRuangan); parameters.put("idPegawai", idPegawai); + parameters.put("idUnitSDM", idUnitSDM); parameters.put("printBy", printBy); return JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (Exception var15) { diff --git a/src/main/java/com/reporting/service/ReportingService.java b/src/main/java/com/reporting/service/ReportingService.java index c9d96b8..a6e6016 100644 --- a/src/main/java/com/reporting/service/ReportingService.java +++ b/src/main/java/com/reporting/service/ReportingService.java @@ -370,19 +370,43 @@ public class ReportingService { // Export Excel - public JasperPrint exportVisit(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { - log.info("Starting exportVisit with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, printBy); - return this.reportingDao.exportVisit(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + public JasperPrint exportVisit(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { + log.info("Starting exportVisit with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, iduNIT: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime()); + Timestamp parse2 = new Timestamp(formatter.parse(tglAkhir).getTime()); + return this.reportingDao.exportVisit(parse, parse2, idDokter, idRuangan, idUnit, printBy); + } catch (ParseException e) { + log.error(e.getMessage()); + return null; + } } - public JasperPrint exportWaktuRawatJalan(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { - log.info("Starting exportWaktuRawatJalan with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, printBy); - return this.reportingDao.exportWaktuRawatJalan(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + public JasperPrint exportWaktuRawatJalan(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { + log.info("Starting exportWaktuRawatJalan with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, idUnit: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime()); + Timestamp parse2 = new Timestamp(formatter.parse(tglAkhir).getTime()); + return this.reportingDao.exportWaktuRawatJalan(parse, parse2, idDokter, idRuangan, idUnit, printBy); + } catch (ParseException e) { + log.error(e.getMessage()); + return null; + } } - public JasperPrint exportWaktuRawatJalanTRB(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) { - log.info("Starting exportWaktuRawatJalanTRB with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, printBy); - return this.reportingDao.exportWaktuRawatJalanTRB(tglAwal, tglAkhir, idDokter, idRuangan, printBy); + public JasperPrint exportWaktuRawatJalanTRB(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, Integer idUnit, String printBy) { + log.info("Starting exportWaktuRawatJalanTRB with tglAwal: {}, tglAkhir: {}, idDokter: {}, idRuangan: {}, idUnit: {}, printBy: {}", tglAwal, tglAkhir, idDokter, idRuangan, idUnit, printBy); + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime()); + Timestamp parse2 = new Timestamp(formatter.parse(tglAkhir).getTime()); + return this.reportingDao.exportWaktuRawatJalanTRB(parse, parse2, idDokter, idRuangan, idUnit, printBy); + } catch (ParseException e) { + log.error(e.getMessage()); + return null; + } } public JasperPrint exportKunjunganPasien(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, String printBy) { @@ -439,9 +463,17 @@ public class ReportingService { return this.reportingDao.exportLpVolumeTindakan(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idProduk, idPegawai, idKp, printBy); } - public JasperPrint exportLpResumeMedis(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, String printBy) { - log.info("Starting exportLpResumeMedis with tglAwal: {}, tglAkhir: {}, idInstalasi: {}, idUnit: {}, idRuangan: {}, idPegawai: {}, printBy: {}", tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idPegawai, printBy); - return this.reportingDao.exportLpResumeMedis(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idPegawai, printBy); + public JasperPrint exportLpResumeMedis(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, Integer idUnitSDM, String printBy) { + log.info("Starting exportLpResumeMedis with tglAwal: {}, tglAkhir: {}, idInstalasi: {}, idUnit: {}, idRuangan: {}, idPegawai: {}, idUnitSDM: {}, printBy: {}", tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idPegawai, idUnitSDM, printBy); + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Timestamp parse = new Timestamp(formatter.parse(tglAwal).getTime()); + Timestamp parse2 = new Timestamp(formatter.parse(tglAkhir).getTime()); + return this.reportingDao.exportLpResumeMedis(parse, parse2, idInstalasi, idUnit, idRuangan, idPegawai, idUnitSDM, printBy); + } catch (ParseException e) { + log.error(e.getMessage()); + return null; + } } public JasperPrint exportLpSatuSehat(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, String printBy) {