update pasien lama
This commit is contained in:
parent
4729935cbb
commit
c4adb3db32
@ -2590,4 +2590,50 @@ public class ReportingController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = {"/laporan-rekap-pasien-lama-pertahun"}, method = {RequestMethod.GET})
|
||||||
|
public void handleLpRekapPasienLama(
|
||||||
|
@RequestParam("tglAwal") Timestamp tglAwal,
|
||||||
|
@RequestParam("tglAkhir") Timestamp tglAkhir,
|
||||||
|
@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 {
|
||||||
|
|
||||||
|
JasperPrint jasperPrint = null;
|
||||||
|
try {
|
||||||
|
// Generate report (common for both PDF/Excel)
|
||||||
|
jasperPrint = this.reportingService.exportLpRekapPasienLama(tglAwal, tglAkhir, printBy);
|
||||||
|
|
||||||
|
if ("excel".equalsIgnoreCase(format)) {
|
||||||
|
// Handle Excel export
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=Laporan_Rekap_Pasien_Lama.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_Pasien_Lama.pdf");
|
||||||
|
|
||||||
|
JRPdfExporter exporter = new JRPdfExporter();
|
||||||
|
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
|
||||||
|
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
|
||||||
|
exporter.exportReport();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
jasperPrint = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1746,4 +1746,20 @@ public class ReportingDao {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JasperPrint exportLpRekapPasienLama(Timestamp tglAwal, Timestamp tglAkhir, String printBy) {
|
||||||
|
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
|
||||||
|
String path = jaspersim2DirPath + "pasien_lama.jrxml";
|
||||||
|
JasperReport jasperReport = JasperCompileManager.compileReport(path);
|
||||||
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
|
parameters.put("tglAwal", tglAwal);
|
||||||
|
parameters.put("tglAkhir", tglAkhir);
|
||||||
|
parameters.put("printBy", printBy);
|
||||||
|
return JasperFillManager.fillReport(jasperReport, parameters, conn);
|
||||||
|
} catch (Exception var15) {
|
||||||
|
LOG.error("Exception at exportLpRekapPasienLama");
|
||||||
|
LOG.error(ReportingDao.class, var15);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -662,4 +662,9 @@ public class ReportingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JasperPrint exportLpRekapPasienLama(Timestamp tglAwal, Timestamp tglAkhir, String printBy) {
|
||||||
|
log.info("Starting exportKunjunganPasienPerRuangan with tglAwal: {}, tglAkhir: {}, printBy: {}", tglAwal, tglAkhir, printBy);
|
||||||
|
return this.reportingDao.exportLpRekapPasienLama(tglAwal, tglAkhir, printBy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user