Update lanjutan laporan

This commit is contained in:
ridwan 2025-08-27 16:42:53 +07:00
parent 741a0e783b
commit 7f97dad611
3 changed files with 239 additions and 58 deletions

View File

@ -622,7 +622,7 @@ public class ReportingController {
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Visit.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Ketepatan_Waktu_Visit.xlsx");
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -639,7 +639,7 @@ public class ReportingController {
} else {
// Handle PDF preview
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=Visit.pdf");
response.setHeader("Content-Disposition", "inline; filename=Laporan_Ketepatan_Waktu_Visit.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -647,31 +647,6 @@ public class ReportingController {
exporter.exportReport();
}
}
/*
@RequestMapping(value = {"/waktu-rawat-jalan"}, method = {RequestMethod.GET})
public void exportExcelWaktuRawatJalan(@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
ModelAndView mv, HttpServletResponse response) throws Exception {
// 1. Set content type untuk Excel
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=waktu_rawat_jalan.xlsx");
// 2. Dapatkan JasperPrint dari service
JasperPrint jasperPrint = this.reportingService.exportExcelWaktuRawatJalan(tglAwal, tglAkhir);
// 3. Ekspor langsung ke output stream (tanpa menyimpan file sementara)
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setOnePagePerSheet(false);
configuration.setDetectCellType(true);
configuration.setCollapseRowSpan(false);
configuration.setRemoveEmptySpaceBetweenRows(true);
configuration.setWhitePageBackground(false);
exporter.setConfiguration(configuration);
exporter.exportReport();
}
*/
@RequestMapping(value = {"/waktu-rawat-jalan"}, method = {RequestMethod.GET})
public void handleWaktuRawatJalan(
@ -690,7 +665,7 @@ public class ReportingController {
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=waktu_rawat_jalan.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Ketepatan_Waktu_Rawat_Jalan.xlsx");
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -707,7 +682,7 @@ public class ReportingController {
} else {
// Handle PDF preview
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=waktu_rawat_jalan.pdf");
response.setHeader("Content-Disposition", "inline; filename=Laporan_Ketepatan_Waktu_Rawat_Jalan.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -721,6 +696,8 @@ public class ReportingController {
public void handleLaporanKunjunganPasienn(
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam(value = "idInstalasi", required = false, defaultValue = "") Integer idInstalasi,
@RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit,
@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,
@ -728,12 +705,12 @@ public class ReportingController {
HttpServletResponse response) throws Exception {
// Generate report (common for both PDF/Excel)
JasperPrint jasperPrint = this.reportingService.exportKunjunganPasien(tglAwal, tglAkhir, idRuangan, printBy);
JasperPrint jasperPrint = this.reportingService.exportKunjunganPasien(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=waktu_rawat_jalan.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Kunjungan_Pasien.xlsx");
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -750,7 +727,7 @@ public class ReportingController {
} else {
// Handle PDF preview
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=waktu_rawat_jalan.pdf");
response.setHeader("Content-Disposition", "inline; filename=Laporan_Kunjungan_Pasien.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
@ -810,7 +787,7 @@ public class ReportingController {
@RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit,
@RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan,
@RequestParam(value = "idProduk", required = false, defaultValue = "") Integer idProduk,
@RequestParam(value = "idPegawai", required = false, defaultValue = "") Integer idPegawai,
@RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter,
@RequestParam(value = "idKp", required = false, defaultValue = "") Integer idKp,
@RequestParam(value = "format", required = false, defaultValue = "pdf") String format,
@RequestParam(value = "mode", required = false, defaultValue = "download") String mode,
@ -818,7 +795,7 @@ public class ReportingController {
HttpServletResponse response) throws Exception {
// Generate report (common for both PDF/Excel)
JasperPrint jasperPrint = this.reportingService.exportLpVolumeTindakan(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idProduk, idPegawai, idKp, printBy);
JasperPrint jasperPrint = this.reportingService.exportLpVolumeTindakan(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idProduk, idDokter, idKp, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
@ -850,20 +827,20 @@ public class ReportingController {
}
@RequestMapping(value = {"/laporan-resume-medis"}, method = {RequestMethod.GET})
public void exportLpResumeMedis(
public void handleLpResumeMedis(
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam(value = "idInstalasi", required = false, defaultValue = "") Integer idInstalasi,
@RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit,
@RequestParam(value = "idRuangan", required = false, defaultValue = "") Integer idRuangan,
@RequestParam(value = "idPegawai", required = false, defaultValue = "") Integer idPegawai,
@RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter,
@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.exportLpResumeMedis(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idPegawai, printBy);
JasperPrint jasperPrint = this.reportingService.exportLpResumeMedis(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idDokter, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
@ -894,4 +871,136 @@ public class ReportingController {
}
}
@RequestMapping(value = {"/laporan-pasien-satusehat"}, method = {RequestMethod.GET})
public void handleLpSatuSehat(
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam(value = "idInstalasi", required = false, defaultValue = "") Integer idInstalasi,
@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 = "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.exportLpSatuSehat(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idDokter, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Pasien_SatuSehat.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_Pasien_SatuSehat.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
exporter.exportReport();
}
}
@RequestMapping(value = {"/daftar-tarif-ruangan"}, method = {RequestMethod.GET})
public void handleLpTarif(
@RequestParam(value = "idInstalasi", required = false, defaultValue = "") Integer idInstalasi,
@RequestParam(value = "idProduk", required = false, defaultValue = "") Integer idProduk,
@RequestParam(value = "idTarif", required = false, defaultValue = "") Integer idTarif,
@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.exportLpTarif(idInstalasi, idProduk, idTarif, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Daftar_Tarif_Ruangan.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=Daftar_Tarif_Ruangan.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
exporter.exportReport();
}
}
@RequestMapping(value = {"/laporan-rekap-tindakan"}, method = {RequestMethod.GET})
public void handleLpRekapTidakan(
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam(value = "idUnit", required = false, defaultValue = "") Integer idUnit,
@RequestParam(value = "idDokter", required = false, defaultValue = "") Integer idDokter,
@RequestParam(value = "idKp", required = false, defaultValue = "") Integer idKp,
@RequestParam(value = "idProduk", required = false, defaultValue = "") Integer idProduk,
@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.exportLpRekapTidakan(tglAwal, tglAkhir, idUnit, idDokter, idKp, idProduk, printBy);
if ("excel".equalsIgnoreCase(format)) {
// Handle Excel export
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Rekap_Tindakan.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_Rekap_Tindakan.pdf");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
exporter.exportReport();
}
}
}

View File

@ -1110,13 +1110,15 @@ public class ReportingDao {
return null;
}
public JasperPrint exportKunjunganPasien(Date tglAwal, Date tglAkhir, Integer idRuangan, String printBy) {
public JasperPrint exportKunjunganPasien(Date tglAwal, Date tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "kunjungan_pasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idInstalasi", idInstalasi);
parameters.put("idUnit", idUnit);
parameters.put("idRuangan", idRuangan);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
@ -1127,24 +1129,6 @@ public class ReportingDao {
return null;
}
/*
public JasperPrint exportKunjunganPasien(Date tglAwal, Date tglAkhir, Integer idRuangan, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "kunjungan_pasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idRuangan", idRuangan);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportKunjunganPasien");
LOG.error(ReportingDao.class, var15);
}
return null;
}
*/
public JasperPrint exportLpPendaftaranOnline(Date tglAwal, Date tglAkhir, Integer idUnit, Integer idRuangan, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
@ -1205,4 +1189,62 @@ public class ReportingDao {
}
return null;
}
public JasperPrint exportLpSatuSehat(Date tglAwal, Date tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "laporan_satusehat.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idInstalasi", idInstalasi);
parameters.put("idUnit", idUnit);
parameters.put("idRuangan", idRuangan);
parameters.put("idPegawai", idPegawai);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportLpSatuSehat");
LOG.error(ReportingDao.class, var15);
}
return null;
}
public JasperPrint exportLpTarif(Integer idInstalasi, Integer idProduk, Integer idTarif, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "tindakan_mba_ayu_putri.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idInstalasi", idInstalasi);
parameters.put("idProduk", idProduk);
parameters.put("idTarif", idTarif);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportLpTarif");
LOG.error(ReportingDao.class, var15);
}
return null;
}
public JasperPrint exportLpRekapTidakan(Date tglAwal, Date tglAkhir, Integer idUnit, Integer idDokter, Integer idKp, Integer idProduk, String printBy) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jaspersim2DirPath + "laporan_rekap_tindakan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idUnit", idUnit);
parameters.put("idDokter", idDokter);
parameters.put("idKp", idKp);
parameters.put("idProduk", idProduk);
parameters.put("printBy", printBy);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportLpRekapTidakan");
LOG.error(ReportingDao.class, var15);
}
return null;
}
}

View File

@ -338,12 +338,12 @@ public class ReportingService {
}
}
public JasperPrint exportKunjunganPasien(String tglAwal, String tglAkhir, Integer idRuangan, String printBy) {
public JasperPrint exportKunjunganPasien(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, String printBy) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date parse = formatter.parse(tglAwal);
Date parse2 = formatter.parse(tglAkhir);
return this.reportingDao.exportKunjunganPasien(parse, parse2, idRuangan, printBy);
return this.reportingDao.exportKunjunganPasien(parse, parse2, idInstalasi, idUnit, idRuangan, printBy);
} catch (ParseException e) {
log.error(e.getMessage());
@ -390,4 +390,34 @@ public class ReportingService {
}
}
public JasperPrint exportLpSatuSehat(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idPegawai, String printBy) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date parse = formatter.parse(tglAwal);
Date parse2 = formatter.parse(tglAkhir);
return this.reportingDao.exportLpSatuSehat(parse, parse2, idInstalasi, idUnit, idRuangan, idPegawai, printBy);
} catch (ParseException e) {
log.error(e.getMessage());
return null;
}
}
public JasperPrint exportLpTarif(Integer idInstalasi, Integer idProduk, Integer idTarif, String printBy) {
return this.reportingDao.exportLpTarif(idInstalasi, idProduk, idTarif, printBy);
}
public JasperPrint exportLpRekapTidakan(String tglAwal, String tglAkhir, Integer idUnit, Integer idDokter, Integer idKp, Integer idProduk, String printBy) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date parse = formatter.parse(tglAwal);
Date parse2 = formatter.parse(tglAkhir);
return this.reportingDao.exportLpRekapTidakan(parse, parse2, idUnit, idDokter, idKp, idProduk, printBy);
} catch (ParseException e) {
log.error(e.getMessage());
return null;
}
}
}