update smpk dan wtrjtrb

This commit is contained in:
ridwan 2025-11-06 08:54:55 +07:00
parent f2cbf093e8
commit 5573473894
3 changed files with 66 additions and 1 deletions

View File

@ -708,6 +708,49 @@ public class ReportingController {
}
}
@RequestMapping(value = {"/waktu-rawat-jalan"}, method = {RequestMethod.GET})
public void handleWaktuRawatJalanTRB(
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter,
@RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan,
@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,
HttpServletResponse response) throws Exception {
// Generate report (common for both PDF/Excel)
JasperPrint jasperPrint = this.reportingService.exportWaktuRawatJalanTRB(tglAwal, tglAkhir, idDokter, idRuangan, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Ketepatan_Waktu_Rawat_Jalan_TRB.xlsx");
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
SimpleXlsxReportConfiguration config = new SimpleXlsxReportConfiguration();
config.setOnePagePerSheet(false);
config.setDetectCellType(true);
config.setCollapseRowSpan(false);
config.setRemoveEmptySpaceBetweenRows(true);
config.setWhitePageBackground(false);
exporter.setConfiguration(config);
exporter.exportReport();
} else {
// Handle PDF preview
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=Laporan_Ketepatan_Waktu_Rawat_Jalan_TRB.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
exporter.exportReport();
}
}
@RequestMapping(value = {"/laporan-kunjungan-pasien"}, method = {RequestMethod.GET})
public void handleLaporanKunjunganPasienn(

View File

@ -1143,6 +1143,24 @@ public class ReportingDao {
return null;
}
public JasperPrint exportWaktuRawatJalanTRB(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "waktu_rawat_jalan_trb.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idDokter", idDokter);
parameters.put("idRuangan", idRuangan);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportWaktuRawatJalanTRB");
LOG.error(ReportingDao.class, var15);
}
return null;
}
public JasperPrint exportKunjunganPasien(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "kunjungan_pasien.jrxml";
@ -1281,7 +1299,7 @@ public class ReportingDao {
}
public JasperPrint exportPdfSMPK(Integer smpk, String printBy) {
try (Connection conn = this.jdbcTemplate4.getDataSource().getConnection()) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "SMPK_testing.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();

View File

@ -378,6 +378,10 @@ public class ReportingService {
return this.reportingDao.exportWaktuRawatJalan(tglAwal, tglAkhir, idDokter, idRuangan, printBy);
}
public JasperPrint exportWaktuRawatJalanTRB(String tglAwal, String tglAkhir, Integer idDokter, Integer idRuangan, String printBy) {
return this.reportingDao.exportWaktuRawatJalanTRB(tglAwal, tglAkhir, idDokter, idRuangan, printBy);
}
public JasperPrint exportKunjunganPasien(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, String printBy) {
return this.reportingDao.exportKunjunganPasien(tglAwal, tglAkhir,idInstalasi, idUnit, idRuangan, printBy);
}