up daftar order radiologi
This commit is contained in:
parent
39b029b0d2
commit
617b80113d
@ -1130,4 +1130,45 @@ public class ReportingController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/daftar-order-radiologi"}, method = {RequestMethod.GET})
|
||||
public void handleDOrderRadiologi(
|
||||
@RequestParam("tglAwal") String tglAwal,
|
||||
@RequestParam("tglAkhir") String 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 {
|
||||
|
||||
// Generate report (common for both PDF/Excel)
|
||||
JasperPrint jasperPrint = this.reportingService.exportDOrderRadiologi(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_Daftar_Order_Radiologi.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_Daftar_Order_Radiologi.pdf");
|
||||
|
||||
JRPdfExporter exporter = new JRPdfExporter();
|
||||
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
|
||||
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(response.getOutputStream()));
|
||||
exporter.exportReport();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1353,4 +1353,20 @@ public class ReportingDao {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JasperPrint exportDOrderRadiologi(String tglAwal, String tglAkhir, String printBy) {
|
||||
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
|
||||
String path = jasperDirPath + "rpt_order_radiologi.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 exportDOrderRadiologi");
|
||||
LOG.error(ReportingDao.class, var15);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -404,32 +404,6 @@ public class ReportingService {
|
||||
}
|
||||
}
|
||||
|
||||
/* public JasperPrint exportLpVolumeTindakan(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idProduk, Integer idPegawai, Integer idKp, String printBy) {
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date parse = formatter.parse(tglAwal);
|
||||
Date parse2 = formatter.parse(tglAkhir);
|
||||
return this.reportingDao.exportLpVolumeTindakan(parse, parse2, idInstalasi, idUnit, idRuangan, idProduk, idPegawai, idKp, printBy);
|
||||
} catch (ParseException e) {
|
||||
log.error(e.getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public JasperPrint exportLpResumeMedis(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.exportLpResumeMedis(parse, parse2, idInstalasi, idUnit, idRuangan, idPegawai, printBy);
|
||||
} catch (ParseException e) {
|
||||
log.error(e.getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public JasperPrint exportLpVolumeTindakan(String tglAwal, String tglAkhir, Integer idInstalasi, Integer idUnit, Integer idRuangan, Integer idProduk, Integer idPegawai, Integer idKp, String printBy) {
|
||||
return this.reportingDao.exportLpVolumeTindakan(tglAwal, tglAkhir, idInstalasi, idUnit, idRuangan, idProduk, idPegawai, idKp, printBy);
|
||||
}
|
||||
@ -466,4 +440,8 @@ public class ReportingService {
|
||||
return this.reportingDao.exportPdfRekapLogbook(tahun, bulan, ksm_id, pegawai_id, printBy);
|
||||
}
|
||||
|
||||
public JasperPrint exportDOrderRadiologi(String tglAwal, String tglAkhir, String printBy) {
|
||||
return this.reportingDao.exportDOrderRadiologi(tglAwal, tglAkhir, printBy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user