Clean code

This commit is contained in:
Salman Manoe 2023-07-13 09:46:59 +07:00
parent ed22248b75
commit 439eb26c34
19 changed files with 571 additions and 1365 deletions

24
pom.xml
View File

@ -6,7 +6,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<!-- <version>2.0.3.RELEASE</version> -->
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.rsabhk</groupId>
@ -19,7 +18,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- <mainClass>com.rsabhk.ReportingServiceApplication</mainClass> -->
<java.version>1.8</java.version>
</properties>
@ -37,27 +35,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<!-- dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency> -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
@ -72,11 +59,6 @@
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency> -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
@ -134,26 +116,21 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.barbecue/barbecue -->
<dependency>
<groupId>net.sourceforge.barbecue</groupId>
<artifactId>barbecue</artifactId>
<version>1.5-beta1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
@ -164,5 +141,4 @@
</plugin>
</plugins>
</build>
</project>

View File

@ -6,9 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReportingApp {
public ReportingApp() {
}
public static void main(String[] args) {
SpringApplication.run(ReportingApp.class, args);
}

View File

@ -1,9 +1,9 @@
package com.reporting.Utility;
public class Age {
private int days;
private int months;
private int years;
private final int days;
private final int months;
private final int years;
public Age(int days, int months, int years) {
this.days = days;

View File

@ -3,7 +3,6 @@ package com.reporting.Utility;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;
public final class AgeCalculator {
@ -11,56 +10,10 @@ public final class AgeCalculator {
}
public static Age calculateAge(Date birthDate) {
Age age = null;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
LocalDate today = LocalDate.now();
LocalDate birthday = LocalDate.parse(format.format(birthDate));
Period period = Period.between(birthday, today);
age = new Age(period.getDays(), period.getMonths(), period.getYears());
return age;
}
public static Age calculateAge2(Date tglRegistrasi, Date birthDate) {
int years = 0;
int months = 0;
int days = 0;
try {
Calendar birthDay = Calendar.getInstance();
birthDay.setTimeInMillis(birthDate.getTime());
Calendar regDay = Calendar.getInstance();
regDay.setTimeInMillis(tglRegistrasi.getTime());
years = regDay.get(1) - birthDay.get(1);
int currMonth = regDay.get(2) + 1;
int birthMonth = birthDay.get(2) + 1;
months = currMonth - birthMonth;
if (months < 0) {
--years;
months = 12 - birthMonth + currMonth;
if (regDay.get(5) < birthDay.get(5)) {
--months;
}
} else if (months == 0 && regDay.get(5) < birthDay.get(5)) {
--years;
months = 11;
}
if (regDay.get(5) > birthDay.get(5)) {
days = regDay.get(5) - birthDay.get(5);
} else if (regDay.get(5) < birthDay.get(5)) {
int today = regDay.get(5);
regDay.add(2, -1);
days = regDay.getActualMaximum(5) - birthDay.get(5) + today;
} else {
days = 0;
if (months == 12) {
++years;
months = 0;
}
}
} catch (Exception var10) {
}
return new Age(days, months, years);
return new Age(period.getDays(), period.getMonths(), period.getYears());
}
}

View File

@ -1,42 +1,10 @@
package com.reporting.Utility;
public class Constants {
public static final long ACCESS_TOKEN_VALIDITY_SECONDS = 18000L;
public static final String SIGNING_KEY = "x1y2z399";
public static final String TOKEN_PREFIX = "";
public static final String HEADER_STRING = "Authorization";
public static final boolean _TRUE = true;
public static final boolean _FALSE = false;
public Constants() {
}
public static final class ConnDb1 {
public static final String poolName = "PoolReporting1";
public static final String typeDriver = "com.zaxxer.hikari.HikariDataSource";
public static final String driverClassName = "org.postgresql.Driver";
public static final String urlDriver = "jdbc:postgresql://172.16.88.8:5432/rsab_hk_production";
public static final String userName = "postgres";
public static final String password = "root";
public static final String testQuery = "SELECT 1";
public static final int maxTimeOut = 100000;
public static final int maxLifetime = 60000;
public static final int minIdle = 5;
public static final int idleTimeout = 300000;
public static final int maximumPoolSize = 20;
public static final Boolean autoCommit = true;
public ConnDb1() {
}
}
public static final class MessageInfo {
public static final String INFO_MESSAGE = "INFO_MESSAGE";
public static final String WARNING_MESSAGE = "WARNING_MESSAGE";
public static final String ERROR_MESSAGE = "ERROR_MESSAGE";
public static final String EXCEPTION_MESSAGE = "EXCEPTION_MESSAGE";
public MessageInfo() {
}
}
}

View File

@ -1,91 +0,0 @@
package com.reporting.Utility;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class DatabaseUtility {
static final Log LOG = LogFactory.getLog(DatabaseUtility.class);
public DatabaseUtility() {
}
public static void clear(Connection conn, PreparedStatement pstmt, ResultSet rs) throws Exception {
try {
if (pstmt != null) {
if (rs != null) {
rs.close();
rs = null;
}
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (Exception var4) {
LOG.error("Exception at clear(conn, pstmt, rs)");
LOG.error(DatabaseUtility.class, var4);
throw var4;
}
}
public static void clear(Connection conn, PreparedStatement pstmt) throws Exception {
try {
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (Exception var3) {
LOG.error("Exception at clear(conn, pstmt)");
LOG.error(DatabaseUtility.class, var3);
throw var3;
}
}
public static void clear(PreparedStatement pstmt, ResultSet rs) throws Exception {
try {
if (pstmt != null) {
if (rs != null) {
rs.close();
rs = null;
}
pstmt.close();
pstmt = null;
}
} catch (Exception var3) {
LOG.error("Exception at clear(pstmt, rs)");
LOG.error(DatabaseUtility.class, var3);
throw var3;
}
}
public static void clear(PreparedStatement pstmt) throws Exception {
try {
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
} catch (Exception var2) {
LOG.error("Exception at clear(pstmt)");
LOG.error(DatabaseUtility.class, var2);
throw var2;
}
}
}

View File

@ -3,33 +3,24 @@ package com.reporting.config;
import com.reporting.Utility.Constants.ConnDb1;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
@Configuration
public class DbConfig {
static final Log LOG = LogFactory.getLog(DbConfig.class);
public DbConfig() {
}
@Primary
@Bean(
name = {"db"}
)
@Bean(name = {"db"})
public DataSource dataSource1() {
HikariConfig config = null;
try {
config = new HikariConfig();
HikariConfig config = new HikariConfig();
config.setPoolName("PoolReporting1");
config.setDriverClassName("org.postgresql.Driver");
config.setConnectionTestQuery("SELECT 1");
@ -41,16 +32,14 @@ public class DbConfig {
config.setMaximumPoolSize(20);
config.setConnectionTimeout(100000L);
config.setAutoCommit(ConnDb1.autoCommit);
return new HikariDataSource(config);
} catch (Exception var3) {
System.out.println(var3.getMessage());
}
return new HikariDataSource(config);
return null;
}
@Bean(
name = {"jdbcTemplate"}
)
@Bean(name = {"jdbcTemplate"})
public JdbcTemplate jdbcTemplate1(@Qualifier("db") DataSource ds) {
return new JdbcTemplate(ds);
}

View File

@ -4,330 +4,259 @@ import com.reporting.model.Pasien;
import com.reporting.service.ReportingService;
import com.reporting.service.ResepService;
import com.reporting.service.VerifikasiTagihanSupplierServices;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping({"/service-reporting"})
public class ReportingController {
static final Log LOG = LogFactory.getLog(ReportingController.class);
@Autowired
private ReportingService reportingService;
@Autowired
private ResepService resepService;
@Autowired
private VerifikasiTagihanSupplierServices verifikasiTagihanSupplierServices;
public ReportingController() {
}
@RequestMapping(
value = {"/label-gizi/{noregistrasi}"},
method = {RequestMethod.GET}
)
public void exportLabelGiziTest(ModelAndView mv, @PathVariable("noregistrasi") String noregistrasi, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.exportPdfLabelGizi(noregistrasi);
@RequestMapping(value = {"/label-gizi/{noregistrasi}"}, method = {RequestMethod.GET})
public void exportLabelGiziTest(@PathVariable("noregistrasi") String noregistrasi,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfLabelGizi(noregistrasi);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/permintaan-makanan"},
method = {RequestMethod.GET}
)
public void exportPermintaanMakanan(@RequestParam("idRu") Integer idRu, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
@RequestMapping(value = {"/permintaan-makanan"}, method = {RequestMethod.GET})
public void exportPermintaanMakanan(@RequestParam("idRu") Integer idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/rekap-makanan"},
method = {RequestMethod.GET}
)
public void exportRekapMakanan(@RequestParam("idRu") Integer idRu, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir);
@RequestMapping(value = {"/rekap-makanan"}, method = {RequestMethod.GET})
public void exportRekapMakanan(@RequestParam("idRu") Integer idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/kartu-pasien/{nocm}"},
method = {RequestMethod.GET}
)
public void exportKartuPasien(ModelAndView mv, @PathVariable("nocm") String nocm, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printReportKartuPasien(nocm);
@RequestMapping(value = {"/kartu-pasien/{nocm}"}, method = {RequestMethod.GET})
public void exportKartuPasien(@PathVariable("nocm") String nocm,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printReportKartuPasien(nocm);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/resep-dokter"},
method = {RequestMethod.GET}
)
@RequestMapping(value = {"/resep-dokter"}, method = {RequestMethod.GET})
public Map<String, Object> getResepDokter(@RequestParam("strukOrder") String strukOrder) {
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<>();
try {
Pasien pasien = this.resepService.getPasien(strukOrder);
map.put("data", pasien);
} catch (Exception var4) {
var4.printStackTrace();
}
return map;
}
@RequestMapping(
value = {"/resep-pasien/{strukOrder}"},
method = {RequestMethod.GET}
)
public void exportResepPasien(ModelAndView mv, @PathVariable("strukOrder") String strukOrder, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.resepService.exportPdfResepPasien(strukOrder);
@RequestMapping(value = {"/resep-pasien/{strukOrder}"}, method = {RequestMethod.GET})
public void exportResepPasien(@PathVariable("strukOrder") String strukOrder,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.resepService.exportPdfResepPasien(strukOrder);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-bedah/{noregis}"},
method = {RequestMethod.GET}
)
public void exportLapBedahPasien(ModelAndView mv, @PathVariable("noregis") String noregis, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printReportLapBedah(noregis);
@RequestMapping(value = {"/lap-bedah/{noregis}"}, method = {RequestMethod.GET})
public void exportLapBedahPasien(@PathVariable("noregis") String noregis,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printReportLapBedah(noregis);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-konsul/{noorder}"},
method = {RequestMethod.GET}
)
public void exportKonsulPasien(ModelAndView mv, @PathVariable("noorder") String noorder, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printReportKonsul(noorder);
@RequestMapping(value = {"/lap-konsul/{noorder}"}, method = {RequestMethod.GET})
public void exportKonsulPasien(@PathVariable("noorder") String noorder,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printReportKonsul(noorder);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-lab/{noorder}"},
method = {RequestMethod.GET}
)
@RequestMapping(value = {"/lap-lab/{noorder}"}, method = {RequestMethod.GET})
public void showPDF(@PathVariable("noorder") String noorder, HttpServletResponse response) {
InputStream inputStream = null;
try {
String path = "/mnt/lis/" + noorder + ".pdf";
File file = new File(path);
inputStream = new FileInputStream(file);
try (InputStream inputStream = Files.newInputStream(
new File("/mnt/lis/" + noorder + ".pdf").toPath())) {
int nRead;
while ((nRead = inputStream.read()) != -1) {
response.getWriter().write(nRead);
}
} catch (Exception var15) {
System.out.println(var15.getMessage());
} finally {
try {
inputStream.close();
} catch (Exception var14) {
}
}
}
@RequestMapping(
value = {"/cetak-sep/{norec_pd}"},
method = {RequestMethod.GET}
)
@RequestMapping(value = {"/cetak-sep/{norec_pd}"}, method = {RequestMethod.GET})
public void showPDFSEP(@PathVariable("norec_pd") String norec_pd, HttpServletResponse response) {
InputStream inputStream = null;
try {
String path = "/home/admindev/reporting/" + norec_pd + ".pdf";
File file = new File(path);
inputStream = new FileInputStream(file);
try (InputStream inputStream = Files.newInputStream(
new File("/home/admindev/reporting/" + norec_pd + ".pdf").toPath())) {
int nRead;
while ((nRead = inputStream.read()) != -1) {
response.getWriter().write(nRead);
}
} catch (Exception var15) {
System.out.println(var15.getMessage());
} finally {
try {
inputStream.close();
} catch (Exception var14) {
}
}
}
@RequestMapping(
value = {"/lap-upk/{nores}"},
method = {RequestMethod.GET}
)
public void exportUpk(ModelAndView mv, @PathVariable("nores") String nores, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printReportUpk(nores);
@RequestMapping(value = {"/lap-upk/{nores}"}, method = {RequestMethod.GET})
public void exportUpk(@PathVariable("nores") String nores,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printReportUpk(nores);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-verifikasi-tagihan-supplier/{noverifikasifk}"},
method = {RequestMethod.GET}
)
public void exportVerifikasiTagihanSupplier(ModelAndView mv, @PathVariable("noverifikasifk") String noverifikasifk, HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.verifikasiTagihanSupplierServices.generateVerifikasiTagihanPdf(noverifikasifk);
@RequestMapping(value = {"/lap-verifikasi-tagihan-supplier/{noverifikasifk}"}, method = {RequestMethod.GET})
public void exportVerifikasiTagihanSupplier(
@PathVariable("noverifikasifk") String noverifikasifk, ModelAndView mv,
HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = this.verifikasiTagihanSupplierServices.generateVerifikasiTagihanPdf(noverifikasifk);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-verifikasi-pembayaran-umum/{noverifikasifk}"},
method = {RequestMethod.GET}
)
public void exportVerifikasiPembayaranUmum(ModelAndView mv, @PathVariable("noverifikasifk") String noverifikasifk, HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.verifikasiTagihanSupplierServices.generateVerifikasiPembayaranUmumPdf(noverifikasifk);
@RequestMapping(value = {"/lap-verifikasi-pembayaran-umum/{noverifikasifk}"}, method = {RequestMethod.GET})
public void exportVerifikasiPembayaranUmum(
@PathVariable("noverifikasifk") String noverifikasifk, ModelAndView mv,
HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = this.verifikasiTagihanSupplierServices
.generateVerifikasiPembayaranUmumPdf(noverifikasifk);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-harian-by-dept/{deptId}/{tglAwal}/{tglAkhir}"},
method = {RequestMethod.GET}
)
public void exportRekapPHarian(ModelAndView mv, @PathVariable("deptId") int deptId, @PathVariable("tglAwal") String tglAwal, @PathVariable("tglAkhir") String tglAkhir, HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfLapRekapHarianByDept(deptId, tglAwal, tglAkhir);
@RequestMapping(value = {"/lap-rekap-harian-by-dept/{deptId}/{tglAwal}/{tglAkhir}"}, method = {RequestMethod.GET})
public void exportRekapPHarian(@PathVariable("deptId") int deptId,
@PathVariable("tglAwal") String tglAwal,
@PathVariable("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfLapRekapHarianByDept(deptId, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-harian-by-ruangan/{deptId}/{ruangId}/{tglAwal}/{tglAkhir}"},
method = {RequestMethod.GET}
)
public void exportRekapPHarian(ModelAndView mv, @PathVariable("deptId") int deptId, @PathVariable("ruangId") int ruangId, @PathVariable("tglAwal") String tglAwal, @PathVariable("tglAkhir") String tglAkhir, HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfLapRekapHarianByRuanganId(deptId, ruangId, tglAwal, tglAkhir);
@RequestMapping(value = {"/lap-rekap-harian-by-ruangan/{deptId}/{ruangId}/{tglAwal}/{tglAkhir}"},
method = {RequestMethod.GET})
public void exportRekapPHarian(@PathVariable("deptId") int deptId,
@PathVariable("ruangId") int ruangId,
@PathVariable("tglAwal") String tglAwal,
@PathVariable("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletResponse response, HttpServletRequest req) throws Exception {
JasperPrint jasperPrint = this.reportingService
.printPdfLapRekapHarianByRuanganId(deptId, ruangId, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-pengkajian-awal-by-nores/{nores}"},
method = {RequestMethod.GET}
)
public void exportPengkajianAwalbyNoRes(ModelAndView mv, @PathVariable("nores") String nores, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfPengkajianAwalByNoRes(nores);
@RequestMapping(value = {"/lap-pengkajian-awal-by-nores/{nores}"}, method = {RequestMethod.GET})
public void exportPengkajianAwalbyNoRes(@PathVariable("nores") String nores, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfPengkajianAwalByNoRes(nores);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-penjamin"},
method = {RequestMethod.GET}
)
public void exportRekapPenjamin(ModelAndView mv, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, @RequestParam("idDept") int idDept, @RequestParam("kelompokPasien") int kelompokPasien, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfRekapPenjamin(tglAwal, tglAkhir, idDept, kelompokPasien);
@RequestMapping(value = {"/lap-rekap-penjamin"}, method = {RequestMethod.GET})
public void exportRekapPenjamin(@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam("idDept") int idDept,
@RequestParam("kelompokPasien") int kelompokPasien, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService
.printPdfRekapPenjamin(tglAwal, tglAkhir, idDept, kelompokPasien);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-penjamin-by-institusi"},
method = {RequestMethod.GET}
)
public void exportRekapPenjaminByInstitusiPasien(ModelAndView mv, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, @RequestParam("idDept") int idDept, @RequestParam("kelompokPasien") int kelompokPasien, @RequestParam("institusiPasien") int institusiPasien, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien);
@RequestMapping(value = {"/lap-rekap-penjamin-by-institusi"}, method = {RequestMethod.GET})
public void exportRekapPenjaminByInstitusiPasien(
@RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir,
@RequestParam("idDept") int idDept, @RequestParam("kelompokPasien") int kelompokPasien,
@RequestParam("institusiPasien") int institusiPasien, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService
.printPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-penjamin-by-ranap"},
method = {RequestMethod.GET}
)
public void exportRekapPenjaminByRanap(ModelAndView mv, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, @RequestParam("idDept") int idDept, @RequestParam("kelompokPasien") int kelompokPasien, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien);
@RequestMapping(value = {"/lap-rekap-penjamin-by-ranap"}, method = {RequestMethod.GET})
public void exportRekapPenjaminByRanap(@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir,
@RequestParam("idDept") int idDept,
@RequestParam("kelompokPasien") int kelompokPasien, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService
.printPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-permintaan-makanan"},
method = {RequestMethod.GET}
)
public void exportPermintaanMakanan(ModelAndView mv, @RequestParam("idRu") int idRu, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
@RequestMapping(value = {"/lap-permintaan-makanan"}, method = {RequestMethod.GET})
public void exportPermintaanMakanan(@RequestParam("idRu") int idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-rekap-makanan"},
method = {RequestMethod.GET}
)
public void exportRekapMakanan(ModelAndView mv, @RequestParam("idRu") int idRu, @RequestParam("tglAwal") String tglAwal, @RequestParam("tglAkhir") String tglAkhir, HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.printPdfRekapMakanan(idRu, tglAwal, tglAkhir);
@RequestMapping(value = {"/lap-rekap-makanan"}, method = {RequestMethod.GET})
public void exportRekapMakanan(@RequestParam("idRu") int idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfRekapMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/gelang-pasien/{noregistrasi}"},
method = {RequestMethod.GET}
)
public void exportLabelGelangPasien(ModelAndView mv, @PathVariable("noregistrasi") String noregistrasi, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.exportPdfGelangPasien(noregistrasi);
@RequestMapping(value = {"/gelang-pasien/{noregistrasi}"}, method = {RequestMethod.GET})
public void exportLabelGelangPasien(@PathVariable("noregistrasi") String noregistrasi,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfGelangPasien(noregistrasi);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(
value = {"/lap-resume-medis/{norec}"},
method = {RequestMethod.GET}
)
public void printLapResumeMedis(ModelAndView mv, @PathVariable("norec") String norec, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = null;
jasperPrint = this.reportingService.exportPdfResumeMedis(norec);
@RequestMapping(value = {"/lap-resume-medis/{norec}"}, method = {RequestMethod.GET})
public void printLapResumeMedis(@PathVariable("norec") String norec,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfResumeMedis(norec);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}

View File

@ -1,26 +1,8 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.reporting.controller;
import com.reporting.model.InfoResponse;
import com.reporting.model.Printer;
import com.reporting.model.PrinterForm;
import com.reporting.service.UserService;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.AttributeSet;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
@ -31,6 +13,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping({"/"})
public class UserController {
@ -40,65 +31,46 @@ public class UserController {
public UserController() {
}
@RequestMapping(
value = {"/", ""},
method = {RequestMethod.GET}
)
@RequestMapping(value = {"/", ""}, method = {RequestMethod.GET})
public ModelAndView home() {
ModelAndView model = new ModelAndView();
PrinterForm printerForm = new PrinterForm();
PrintService[] services = PrintServiceLookup.lookupPrintServices((DocFlavor) null, (AttributeSet) null);
List<Printer> printers = new ArrayList();
PrintService[] var5 = services;
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
List<Printer> printers = new ArrayList<>();
int var6 = services.length;
for (int var7 = 0; var7 < var6; ++var7) {
PrintService service = var5[var7];
for (PrintService service : services) {
Printer printer = new Printer();
printer.setPrinterName(service.getName());
printers.add(printer);
}
model.addObject("listPrinters", printers);
model.addObject("printerForm", printerForm);
model.setViewName("home");
return model;
}
@RequestMapping(
value = {"/export"},
method = {RequestMethod.POST}
)
public void export(ModelAndView model, HttpServletResponse response) throws IOException, JRException, SQLException {
JasperPrint jasperPrint = null;
@RequestMapping(value = {"/export"}, method = {RequestMethod.POST})
public void export(ModelAndView model,
HttpServletResponse response) throws IOException, JRException, SQLException {
response.setContentType("application/x-download");
response.setHeader("Content-Disposition", String.format("attachment; filename=\"users.pdf\""));
response.setHeader("Content-Disposition", "attachment; filename=\"users.pdf\"");
OutputStream out = response.getOutputStream();
jasperPrint = this.userService.exportPdfFile();
JasperPrint jasperPrint = this.userService.exportPdfFile();
JasperExportManager.exportReportToPdfStream(jasperPrint, out);
}
@RequestMapping(
value = {"/printDirect"},
method = {RequestMethod.POST}
)
public void printDirect(@ModelAttribute("printerForm") PrinterForm printerForm, ModelAndView model) throws IOException, JRException, SQLException {
JasperPrint jasperPrint = null;
jasperPrint = this.userService.exportPdfFile();
@RequestMapping(value = {"/printDirect"}, method = {RequestMethod.POST})
public void printDirect(@ModelAttribute("printerForm") PrinterForm printerForm,
ModelAndView model) throws IOException, JRException, SQLException {
JasperPrint jasperPrint = this.userService.exportPdfFile();
this.userService.printReport(jasperPrint, printerForm.getPrinterName());
}
@RequestMapping(
value = {"/printDirectDefault"},
method = {RequestMethod.POST}
)
@RequestMapping(value = {"/printDirectDefault"}, method = {RequestMethod.POST})
public void printDirectDefaultPrinter() throws SQLException, JRException, IOException {
JasperPrint jasperPrint = null;
InfoResponse infoResponse = new InfoResponse();
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
String printServiceName = service.getName();
jasperPrint = this.userService.exportPdfFile();
JasperPrint jasperPrint = this.userService.exportPdfFile();
this.userService.printReport(jasperPrint, printServiceName);
infoResponse.setInfo("Cetak Data Berhasil");
}
}

View File

@ -1,43 +0,0 @@
package com.reporting.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.ResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Repository
public class LabelGizi {
@Autowired
@Qualifier("jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Autowired
private ResourceLoader resourceLoader;
public LabelGizi() {
}
public JasperPrint exportPdfFile() throws SQLException, JRException, IOException {
Connection conn = this.jdbcTemplate.getDataSource().getConnection();
String path = this.resourceLoader.getResource("classpath:rpt_labelgizi.jrxml").getURI().getPath();
JasperReport jasperReport = JasperCompileManager.compileReport(path);
String noregistrasi = "22fa0dd0-43c1-11e9-961f-8d877e74";
Map<String, Object> parameters = new HashMap();
parameters.put("noregistrasi", noregistrasi);
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return print;
}
}

View File

@ -1,27 +1,6 @@
package com.reporting.dao;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.AttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.HashPrintServiceAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.PrintServiceAttributeSet;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PrinterName;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.type.OrientationEnum;
import net.sf.jasperreports.export.SimpleExporterInput;
@ -34,13 +13,21 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.*;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PrinterName;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
@Transactional
@Repository
public class ReportingDao {
private static final Log LOG = LogFactory.getLog(ReportingDao.class);
@Autowired
@Qualifier("db")
private DataSource ds1;
@Qualifier("jdbcTemplate")
@Autowired
private JdbcTemplate jdbcTemplate1;
@ -51,14 +38,11 @@ public class ReportingDao {
public void printReport(JasperPrint jasperPrint, String selectedPrinter) throws JRException {
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
if (jasperPrint.getOrientationValue() == OrientationEnum.LANDSCAPE) {
printRequestAttributeSet.add(OrientationRequested.PORTRAIT);
if (jasperPrint.getOrientationValue() == OrientationEnum.LANDSCAPE)
printRequestAttributeSet.add(OrientationRequested.LANDSCAPE);
} else {
printRequestAttributeSet.add(OrientationRequested.PORTRAIT);
}
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
printServiceAttributeSet.add(new PrinterName(selectedPrinter, (Locale) null));
printServiceAttributeSet.add(new PrinterName(selectedPrinter, null));
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
configuration.setPrintRequestAttributeSet(printRequestAttributeSet);
@ -67,500 +51,296 @@ public class ReportingDao {
configuration.setDisplayPrintDialog(false);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setConfiguration(configuration);
PrintService[] services = PrintServiceLookup.lookupPrintServices((DocFlavor) null, (AttributeSet) null);
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
PrintService selectedService = null;
if (services.length != 0 || services != null) {
PrintService[] var9 = services;
int var10 = services.length;
for (int var11 = 0; var11 < var10; ++var11) {
PrintService service = var9[var11];
String existingPrinter = service.getName();
if (existingPrinter.equals(selectedPrinter)) {
selectedService = service;
break;
}
int var10 = services.length;
for (PrintService service : services) {
String existingPrinter = service.getName();
if (existingPrinter.equals(selectedPrinter)) {
selectedService = service;
break;
}
}
if (selectedService != null) {
exporter.exportReport();
} else {
System.out.println("You did not set the printer!");
}
}
public JasperPrint exportPdfLabelGizi(String noregistrasi) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfLabelGizi(String noregistrasi) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_labelgizi.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregistrasi", noregistrasi);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfLabelGizi");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfPermintaanMakanan(Integer idRu, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfPermintaanMakanan(Integer idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_permintaan_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfPermintaanMakanan");
LOG.error(ReportingDao.class, var17);
} finally {
try {
conn.close();
} catch (Exception var16) {
}
}
return print;
return null;
}
public JasperPrint exportPdfRekapMakanan(Integer idRu, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfRekapMakanan(Integer idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_rekap_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfRekapMakanan");
LOG.error(ReportingDao.class, var17);
} finally {
try {
conn.close();
} catch (Exception var16) {
}
}
return print;
return null;
}
public JasperPrint exportPdfKartuPasien(String nocm) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfKartuPasien(String nocm) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_kartupasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("nocm", nocm);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfLabelGizi");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfLapBedah(String noregis) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfLapBedah(String noregis) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_lapbedah.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregis", noregis);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfResepPasien");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfKonsul(String noorder) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfKonsul(String noorder) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_konsul.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("noorder", noorder);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfResepPasien");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfUpk(String nores) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfUpk(String nores) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_upk.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("nores", nores);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfUpk");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfVerifikasiTagihan(String noverifikasifk) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfVerifikasiTagihan(String noverifikasifk) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/BuktiKas.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfVerifikasiTagihan");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfLapRekapHarianByDept(int deptId, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfLapRekapHarianByDept(int deptId, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_LapRekapPHarian.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("deptId", deptId);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfLapRekapHarianByDept");
LOG.error(ReportingDao.class, var17);
} finally {
try {
conn.close();
} catch (Exception var16) {
}
}
return print;
return null;
}
public JasperPrint exportPdfLapRekapHarianByRuanganId(int deptId, int ruangId, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfLapRekapHarianByRuanganId(int deptId, int ruangId, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_LapRekapPHarianV2.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("deptId", deptId);
parameters.put("ruangId", ruangId);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var18) {
LOG.error("Exception at exportPdfLapRekapHarianByRuanganId");
LOG.error(ReportingDao.class, var18);
} finally {
try {
conn.close();
} catch (Exception var17) {
}
}
return print;
return null;
}
public JasperPrint exportPdfPengkajianAwalByNoRes(String nores) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfPengkajianAwalByNoRes(String nores) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_PengkajianAwal.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("nores", nores);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfPengkajianAwalByNoRes");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfRekapPenjamin(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfRekapPenjamin(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjamin.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idDept", idDept);
parameters.put("kelompokPasien", kelompokPasien);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var18) {
LOG.error("Exception at exportPdfPengkajianAwalRekapPenjamin");
LOG.error(ReportingDao.class, var18);
} finally {
try {
conn.close();
} catch (Exception var17) {
}
}
return print;
return null;
}
public JasperPrint exportPdfRekapPenjaminByInstitusiPasien(String tglAwal, String tglAkhir, int idDept, int kelompokPasien, int institusiPasien) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfRekapPenjaminByInstitusiPasien(
String tglAwal, String tglAkhir, int idDept, int kelompokPasien, int institusiPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjamin.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idDept", idDept);
parameters.put("kelompokPasien", kelompokPasien);
parameters.put("institusiPasien", institusiPasien);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var19) {
LOG.error("Exception at exportPdfPengkajianAwalRekapPenjaminByInstitusiPasien");
LOG.error(ReportingDao.class, var19);
} finally {
try {
conn.close();
} catch (Exception var18) {
}
}
return print;
return null;
}
public JasperPrint exportPdfRekapPenjaminByRanap(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfRekapPenjaminByRanap(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjaminRanap.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
parameters.put("idDept", idDept);
parameters.put("kelompokPasien", kelompokPasien);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var18) {
LOG.error("Exception at exportPdfRekapPenjaminByRanap");
LOG.error(ReportingDao.class, var18);
} finally {
try {
conn.close();
} catch (Exception var17) {
}
}
return print;
return null;
}
public JasperPrint exportPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_permintaan_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfPermintaanMakanan");
LOG.error(ReportingDao.class, var17);
} finally {
try {
conn.close();
} catch (Exception var16) {
}
}
return print;
return null;
}
public JasperPrint exportPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_rekap_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
parameters.put("tglAwal", tglAwal);
parameters.put("tglAkhir", tglAkhir);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var17) {
LOG.error("Exception at exportPdfRekapMakanan");
LOG.error(ReportingDao.class, var17);
} finally {
try {
conn.close();
} catch (Exception var16) {
}
}
return print;
return null;
}
public JasperPrint exportPdfGelangPasien(String noregistrasi) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfGelangPasien(String noregistrasi) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/gelang_pasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregistrasi", noregistrasi);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfGelangPasien");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
public JasperPrint exportPdfResumeMedis(String norec) throws Exception {
JasperPrint print = null;
Connection conn = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfResumeMedis(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/ResumeMedis.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("norec", norec);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var15) {
LOG.error("Exception at exportPdfResumeMedis");
LOG.error(ReportingDao.class, var15);
} finally {
try {
conn.close();
} catch (Exception var14) {
}
}
return print;
return null;
}
}

View File

@ -1,28 +1,6 @@
package com.reporting.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.AttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.HashPrintServiceAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.PrintServiceAttributeSet;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PrinterName;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.type.OrientationEnum;
import net.sf.jasperreports.export.SimpleExporterInput;
@ -34,12 +12,25 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.*;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PrinterName;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
@Transactional
@Repository
public class UserDaoImpl {
@Autowired
@Qualifier("jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Autowired
private ResourceLoader resourceLoader;
@ -50,22 +41,18 @@ public class UserDaoImpl {
Connection conn = this.jdbcTemplate.getDataSource().getConnection();
String path = this.resourceLoader.getResource("classpath:rpt_users.jrxml").getURI().getPath();
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap();
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return print;
Map<String, Object> parameters = new HashMap<>();
return JasperFillManager.fillReport(jasperReport, parameters, conn);
}
public void printReport(JasperPrint jasperPrint, String selectedPrinter) throws JRException {
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
if (jasperPrint.getOrientationValue() == OrientationEnum.LANDSCAPE) {
printRequestAttributeSet.add(OrientationRequested.PORTRAIT);
if (jasperPrint.getOrientationValue() == OrientationEnum.LANDSCAPE)
printRequestAttributeSet.add(OrientationRequested.LANDSCAPE);
} else {
printRequestAttributeSet.add(OrientationRequested.PORTRAIT);
}
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
printServiceAttributeSet.add(new PrinterName(selectedPrinter, (Locale) null));
printServiceAttributeSet.add(new PrinterName(selectedPrinter, null));
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
configuration.setPrintRequestAttributeSet(printRequestAttributeSet);
@ -74,27 +61,20 @@ public class UserDaoImpl {
configuration.setDisplayPrintDialog(false);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setConfiguration(configuration);
PrintService[] services = PrintServiceLookup.lookupPrintServices((DocFlavor) null, (AttributeSet) null);
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
PrintService selectedService = null;
if (services.length != 0 || services != null) {
PrintService[] var9 = services;
int var10 = services.length;
for (int var11 = 0; var11 < var10; ++var11) {
PrintService service = var9[var11];
String existingPrinter = service.getName();
if (existingPrinter.equals(selectedPrinter)) {
selectedService = service;
break;
}
int var10 = services.length;
for (PrintService service : services) {
String existingPrinter = service.getName();
if (existingPrinter.equals(selectedPrinter)) {
selectedService = service;
break;
}
}
if (selectedService != null) {
exporter.exportReport();
} else {
System.out.println("You did not set the printer!");
}
}
}

View File

@ -1,37 +0,0 @@
package com.reporting.model;
public class ApiResponse<T> {
private int status;
private String message;
private Object result;
public ApiResponse(int status, String message, Object result) {
this.status = status;
this.message = message;
this.result = result;
}
public int getStatus() {
return this.status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getResult() {
return this.result;
}
public void setResult(Object result) {
this.result = result;
}
}

View File

@ -1,16 +0,0 @@
package com.reporting.model;
public class InfoResponse {
private String info;
public InfoResponse() {
}
public String getInfo() {
return this.info;
}
public void setInfo(String info) {
this.info = info;
}
}

View File

@ -1,52 +0,0 @@
package com.reporting.service;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;
import com.reporting.dao.ReportingDao;
import java.io.File;
import java.io.FileInputStream;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@Service("lapLabService")
public class LapLabService {
static final Log LOG = LogFactory.getLog(LapLabService.class);
@Autowired
@Qualifier("db")
private DataSource ds1;
@Qualifier("jdbcTemplate")
@Autowired
private JdbcTemplate jdbcTemplate1;
public LapLabService() {
}
public void getLapLab() {
new File("/home/iwankasan/Documents/lap_lab/19057181.pdf");
FileInputStream fis = null;
try {
String path = "/home/iwankasan/Documents/lap_lab/19057181.pdf";
PdfReader pdfReader = new PdfReader(path);
int pages = pdfReader.getNumberOfPages();
for (int i = 1; i <= pages; ++i) {
String pageContent = PdfTextExtractor.getTextFromPage(pdfReader, i);
System.out.println("Content on page " + i + ": " + pageContent);
}
pdfReader.close();
} catch (Exception var8) {
LOG.error("Exception at LapLabService");
LOG.error(ReportingDao.class, var8);
}
}
}

View File

@ -14,15 +14,15 @@ public class ReportingService {
public ReportingService() {
}
public JasperPrint exportPdfLabelGizi(String noregistrasi) throws Exception {
public JasperPrint exportPdfLabelGizi(String noregistrasi) {
return this.reportingDao.exportPdfLabelGizi(noregistrasi);
}
public JasperPrint exportPdfPermintaanMakanan(Integer idRu, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint exportPdfPermintaanMakanan(Integer idRu, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
}
public JasperPrint exportPdfRekapMakanan(Integer idRu, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint exportPdfRekapMakanan(Integer idRu, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir);
}
@ -30,63 +30,65 @@ public class ReportingService {
this.reportingDao.printReport(jasperPrint, selectedPrinter);
}
public JasperPrint printReportKartuPasien(String nocm) throws Exception {
public JasperPrint printReportKartuPasien(String nocm) {
return this.reportingDao.exportPdfKartuPasien(nocm);
}
public JasperPrint printReportLapBedah(String noregis) throws Exception {
public JasperPrint printReportLapBedah(String noregis) {
return this.reportingDao.exportPdfLapBedah(noregis);
}
public JasperPrint printReportKonsul(String noregis) throws Exception {
public JasperPrint printReportKonsul(String noregis) {
return this.reportingDao.exportPdfKonsul(noregis);
}
public JasperPrint printReportUpk(String nores) throws Exception {
public JasperPrint printReportUpk(String nores) {
return this.reportingDao.exportPdfUpk(nores);
}
public JasperPrint printReportVerifikasiTagihan(String noverifikasifk) throws Exception {
public JasperPrint printReportVerifikasiTagihan(String noverifikasifk) {
return this.reportingDao.exportPdfVerifikasiTagihan(noverifikasifk);
}
public JasperPrint printPdfLapRekapHarianByDept(int deptId, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint printPdfLapRekapHarianByDept(int deptId, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfLapRekapHarianByDept(deptId, tglAwal, tglAkhir);
}
public JasperPrint printPdfLapRekapHarianByRuanganId(int deptId, int ruangId, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint printPdfLapRekapHarianByRuanganId(int deptId, int ruangId, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfLapRekapHarianByRuanganId(deptId, ruangId, tglAwal, tglAkhir);
}
public JasperPrint printPdfPengkajianAwalByNoRes(String nores) throws Exception {
public JasperPrint printPdfPengkajianAwalByNoRes(String nores) {
return this.reportingDao.exportPdfPengkajianAwalByNoRes(nores);
}
public JasperPrint printPdfRekapPenjamin(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) throws Exception {
public JasperPrint printPdfRekapPenjamin(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
return this.reportingDao.exportPdfRekapPenjamin(tglAwal, tglAkhir, idDept, kelompokPasien);
}
public JasperPrint printPdfRekapPenjaminByInstitusiPasien(String tglAwal, String tglAkhir, int idDept, int kelompokPasien, int institusiPasien) throws Exception {
return this.reportingDao.exportPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien);
public JasperPrint printPdfRekapPenjaminByInstitusiPasien(
String tglAwal, String tglAkhir, int idDept, int kelompokPasien, int institusiPasien) {
return this.reportingDao
.exportPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien);
}
public JasperPrint printPdfRekapPenjaminByRanap(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) throws Exception {
public JasperPrint printPdfRekapPenjaminByRanap(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
return this.reportingDao.exportPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien);
}
public JasperPrint printPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint printPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
}
public JasperPrint printPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) throws Exception {
public JasperPrint printPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) {
return this.reportingDao.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir);
}
public JasperPrint exportPdfGelangPasien(String noregistrasi) throws Exception {
public JasperPrint exportPdfGelangPasien(String noregistrasi) {
return this.reportingDao.exportPdfGelangPasien(noregistrasi);
}
public JasperPrint exportPdfResumeMedis(String norec) throws Exception {
public JasperPrint exportPdfResumeMedis(String norec) {
return this.reportingDao.exportPdfResumeMedis(norec);
}
}

View File

@ -2,21 +2,10 @@ package com.reporting.service;
import com.reporting.Utility.Age;
import com.reporting.Utility.AgeCalculator;
import com.reporting.Utility.DatabaseUtility;
import com.reporting.dao.ReportingDao;
import com.reporting.model.Pasien;
import com.reporting.model.Resep;
import com.reporting.model.ResepDetail;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
@ -28,12 +17,23 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("resepService")
public class ResepService {
static final Log LOG = LogFactory.getLog(ResepService.class);
@Autowired
@Qualifier("db")
private DataSource ds1;
@Qualifier("jdbcTemplate")
@Autowired
private JdbcTemplate jdbcTemplate1;
@ -42,20 +42,25 @@ public class ResepService {
}
public Pasien getPasien(String strukOrder) throws Exception {
Pasien pasien = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL = "select st.norec,st.objectpegawaiorderfk as dokter,to_char(st.tglorder,'dd-MM-yyyy') as tglorder,st.noregistrasifk, \tpg.namalengkap,ru.namaruangan,pd.noregistrasi,pd.tglregistrasi,ps.nocm,ps.namapasien, to_char(ps.tgllahir,'dd-MM-yyyy') as tgllahir,st.noorder,date(ps.tgllahir) as umurPasien, \tst.masalah as riwayatAlergi, st.diagnosis as beratBadan\tfrom strukorder_t st \tleft join pasien_m ps on st.nocmfk=ps.id \tleft join pasiendaftar_t pd on pd.norec=st.noregistrasifk \tleft join pegawai_m pg on pg.id=st.objectpegawaiorderfk \tleft join ruangan_m ru on ru.id=st.objectruanganfk \twhere st.statusenabled=true and st.keteranganorder='Order Farmasi' and st.norec='" + strukOrder + "'";
try {
this.ds1 = this.jdbcTemplate1.getDataSource();
conn = this.ds1.getConnection();
pstmt = conn.prepareStatement(SQL);
rs = pstmt.executeQuery();
String SQL = "select st.norec,st.objectpegawaiorderfk as dokter," +
"to_char(st.tglorder,'dd-MM-yyyy') as tglorder,st.noregistrasifk,pg.namalengkap,ru.namaruangan," +
"pd.noregistrasi,pd.tglregistrasi,ps.nocm,ps.namapasien," +
"to_char(ps.tgllahir,'dd-MM-yyyy') as tgllahir,st.noorder,date(ps.tgllahir) as umurPasien," +
"st.masalah as riwayatAlergi, st.diagnosis as beratBadan " +
"from strukorder_t st " +
"left join pasien_m ps on st.nocmfk=ps.id " +
"left join pasiendaftar_t pd on pd.norec=st.noregistrasifk " +
"left join pegawai_m pg on pg.id=st.objectpegawaiorderfk " +
"left join ruangan_m ru on ru.id=st.objectruanganfk " +
"where st.statusenabled=true " +
"and st.keteranganorder='Order Farmasi' " +
"and st.norec='" + strukOrder + "'";
this.ds1 = this.jdbcTemplate1.getDataSource();
try (Connection conn = this.ds1.getConnection();
PreparedStatement pstmt = conn.prepareStatement(SQL);
ResultSet rs = pstmt.executeQuery()) {
Pasien pasien = new Pasien();
while (rs.next()) {
pasien = new Pasien();
pasien.setNoRegistrasi(rs.getString("noregistrasi"));
pasien.setNamaDokter(rs.getString("namalengkap"));
pasien.setTglOrder(rs.getString("tglorder"));
@ -64,7 +69,7 @@ public class ResepService {
pasien.setNamaRuangan(rs.getString("namaruangan"));
pasien.setNoCm(rs.getString("nocm"));
Age age = AgeCalculator.calculateAge(rs.getDate("umurPasien"));
String umurPasien = Integer.toString(age.getYears()) + " tahun " + Integer.toString(age.getMonths()) + " bulan " + Integer.toString(age.getDays()) + " hari";
String umurPasien = age.getYears() + " tahun " + age.getMonths() + " bulan " + age.getDays() + " hari";
pasien.setUmurPasien(umurPasien);
if (rs.getString("riwayatAlergi") != null) {
pasien.setRiwayatAlergi(rs.getString("riwayatAlergi"));
@ -76,107 +81,66 @@ public class ResepService {
pasien.setUmurPasien(umurPasien);
pasien.setListResep(this.getResepHeader(strukOrder));
}
return pasien;
} catch (Exception var16) {
LOG.error("Exception at getPasien()", var16);
throw var16;
} finally {
try {
DatabaseUtility.clear(conn, pstmt, rs);
} catch (Exception var15) {
}
}
return pasien;
}
public List<Resep> getResepHeader(String strukOrder) throws Exception {
List<Resep> list = null;
Resep resep = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL_HEADER = "select rd.racikanke as resep,rd.strukorderfk as strukorder from \t t_resep_dokter rd where rd.strukorderfk='" + strukOrder + "' \t and rd.statusenabled='true' group by rd.racikanke,rd.strukorderfk order by rd.racikanke asc";
try {
list = new ArrayList();
this.ds1 = this.jdbcTemplate1.getDataSource();
conn = this.ds1.getConnection();
pstmt = conn.prepareStatement(SQL_HEADER);
rs = pstmt.executeQuery();
String SQL_HEADER = "select rd.racikanke as resep,rd.strukorderfk as strukorder " +
"from t_resep_dokter rd " +
"where rd.strukorderfk='" + strukOrder + "' " +
"and rd.statusenabled='true' " +
"group by rd.racikanke,rd.strukorderfk " +
"order by rd.racikanke asc";
this.ds1 = this.jdbcTemplate1.getDataSource();
try (Connection conn = this.ds1.getConnection();
PreparedStatement pstmt = conn.prepareStatement(SQL_HEADER);
ResultSet rs = pstmt.executeQuery()) {
List<Resep> list = new ArrayList<>();
while (rs.next()) {
resep = new Resep();
Resep resep = new Resep();
resep.setResep(rs.getString("resep"));
resep.setResepDetail(this.getResepDetail(strukOrder, rs.getString("resep")));
if (resep != null) {
list.add(resep);
}
list.add(resep);
}
return list;
} catch (Exception var16) {
LOG.error("Exception at getResepDetail()", var16);
throw var16;
} finally {
resep = null;
try {
DatabaseUtility.clear(conn, pstmt, rs);
} catch (Exception var15) {
}
}
return list;
}
private List<ResepDetail> getResepDetail(String strukOrder, String resepke) throws Exception {
List<ResepDetail> list = null;
ResepDetail detail = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL_ITEM = "select rd.objectprodukfk,rd.qtyproduk,rd.satuanview, rd.keteranganpakai,rd.keteranganlainnya,rd.namaobat from t_resep_dokter rd where rd.strukorderfk='" + strukOrder + "' and rd.racikanke='" + resepke + "'";
try {
list = new ArrayList();
this.ds1 = this.jdbcTemplate1.getDataSource();
conn = this.ds1.getConnection();
pstmt = conn.prepareStatement(SQL_ITEM);
rs = pstmt.executeQuery();
String SQL_ITEM = "select rd.objectprodukfk,rd.qtyproduk,rd.satuanview,rd.keteranganpakai," +
"rd.keteranganlainnya,rd.namaobat " +
"from t_resep_dokter rd " +
"where rd.strukorderfk='" + strukOrder + "' " +
"and rd.racikanke='" + resepke + "'";
this.ds1 = this.jdbcTemplate1.getDataSource();
try (Connection conn = this.ds1.getConnection();
PreparedStatement pstmt = conn.prepareStatement(SQL_ITEM);
ResultSet rs = pstmt.executeQuery()) {
List<ResepDetail> list = new ArrayList<>();
while (rs.next()) {
detail = new ResepDetail();
ResepDetail detail = new ResepDetail();
detail.setNamaObat(rs.getString("namaobat"));
detail.setKeteranganLainnya(rs.getString("keteranganlainnya"));
detail.setKeteranganPakai(rs.getString("keteranganpakai"));
detail.setQtyProduk(rs.getString("qtyproduk"));
if (detail != null) {
list.add(detail);
}
list.add(detail);
}
return list;
} catch (Exception var17) {
LOG.error("Exception at getResepDetail()", var17);
throw var17;
} finally {
detail = null;
try {
DatabaseUtility.clear(conn, pstmt, rs);
} catch (Exception var16) {
}
}
return list;
}
public JasperPrint exportPdfResepPasien(String strukOrder) throws Exception {
JasperPrint print = null;
Connection conn = null;
Map<String, Object> parameters = null;
try {
conn = this.jdbcTemplate1.getDataSource().getConnection();
public JasperPrint exportPdfResepPasien(String strukOrder) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_eresep1.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
String namaPasien = this.getPasien(strukOrder).getNamaPasien();
@ -189,7 +153,7 @@ public class ResepService {
String noCM = this.getPasien(strukOrder).getNoCm();
String alergi = this.getPasien(strukOrder).getRiwayatAlergi();
String beratBadan = this.getPasien(strukOrder).getBeratBadan();
parameters = new HashMap();
Map<String, Object> parameters = new HashMap<>();
parameters.put("strukOrder", strukOrder);
parameters.put("noRegistrasi", noRegistrasi);
parameters.put("namaPasien", namaPasien);
@ -201,18 +165,11 @@ public class ResepService {
parameters.put("noCM", noCM);
parameters.put("alergi", alergi);
parameters.put("beratBadan", beratBadan);
print = JasperFillManager.fillReport(jasperReport, parameters, conn);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception var25) {
LOG.error("Exception at exportPdfResepPasien");
LOG.error(ReportingDao.class, var25);
} finally {
try {
conn.close();
} catch (Exception var24) {
}
}
return print;
return null;
}
}

View File

@ -1,18 +1,7 @@
package com.reporting.service;
import com.reporting.Utility.DatabaseUtility;
import com.reporting.model.VerifikasiTagihanSupplier;
import com.reporting.model.VerifikasiTagihanSupplier2;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
@ -25,12 +14,24 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.sql.DataSource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
@Service("verifikasiTagihanSupplierServices")
public class VerifikasiTagihanSupplierServices {
static final Log LOG = LogFactory.getLog(VerifikasiTagihanSupplierServices.class);
@Autowired
@Qualifier("db")
private DataSource ds1;
@Qualifier("jdbcTemplate")
@Autowired
private JdbcTemplate jdbcTemplate1;
@ -39,20 +40,19 @@ public class VerifikasiTagihanSupplierServices {
}
public static String terbilang(BigDecimal value) {
value = value.setScale(0, 6);
value = value.setScale(0, RoundingMode.HALF_EVEN);
String strValue = value.toString();
int lenValue = strValue.length();
int x = 0;
int y = 0;
String bil1 = "";
String bil2 = "";
String urai = "";
String bil2;
StringBuilder urai = new StringBuilder();
while (x < lenValue) {
int z;
int strTot;
++x;
strTot = Integer.valueOf(strValue.substring(x - 1, x));
strTot = Integer.parseInt(strValue.substring(x - 1, x));
y += strTot;
z = lenValue - x + 1;
label94:
@ -67,16 +67,13 @@ public class VerifikasiTagihanSupplierServices {
}
break;
}
if (z != 2 && z != 5 && z != 8 && z != 11 && z != 14) {
bil1 = "Se";
break;
}
++x;
int newStrTot = Integer.valueOf(strValue.substring(x - 1, x));
int newStrTot = Integer.parseInt(strValue.substring(x - 1, x));
z = lenValue - x + 1;
bil2 = "";
switch (newStrTot) {
case 0:
bil1 = "Sepuluh ";
@ -111,7 +108,6 @@ public class VerifikasiTagihanSupplierServices {
break label94;
}
}
bil1 = "Satu ";
break;
case 2:
@ -141,7 +137,6 @@ public class VerifikasiTagihanSupplierServices {
default:
bil1 = "";
}
if (strTot > 0) {
if (z != 2 && z != 5 && z != 8 && z != 11 && z != 14) {
if (z != 3 && z != 6 && z != 9 && z != 12 && z != 15) {
@ -155,7 +150,6 @@ public class VerifikasiTagihanSupplierServices {
} else {
bil2 = "";
}
if (y > 0) {
switch (z) {
case 4:
@ -182,20 +176,19 @@ public class VerifikasiTagihanSupplierServices {
y = 0;
}
}
if (bil1.equals("Se")) {
String pre = bil2.substring(0, 1);
urai = urai + bil1 + bil2.replace(pre, pre.toLowerCase());
urai.append(bil1).append(bil2.replace(pre, pre.toLowerCase()));
} else {
urai = urai + bil1 + bil2;
urai.append(bil1).append(bil2);
}
}
return urai;
return urai.toString();
}
public String bilangx(double angka) {
String[] nomina = new String[]{"", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"};
String[] nomina = new String[]{"", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan",
"sembilan", "sepuluh", "sebelas"};
if (angka < 12.0) {
return nomina[(int) angka];
} else if (angka >= 12.0 && angka <= 19.0) {
@ -209,27 +202,70 @@ public class VerifikasiTagihanSupplierServices {
} else if (angka >= 1000.0 && angka <= 1999.0) {
return "seribu " + this.bilangx(angka % 1000.0);
} else if (angka >= 2000.0 && angka <= 999999.0) {
return this.bilangx((double) ((int) angka / 1000)) + " ribu " + this.bilangx(angka % 1000.0);
return this.bilangx((double) (int) angka / 1000) + " ribu " + this.bilangx(angka % 1000.0);
} else {
return angka >= 1000000.0 && angka <= 9.99999999E8 ? this.bilangx((double) ((int) angka / 1000000)) + " juta " + this.bilangx(angka % 1000000.0) : "";
return angka >= 1000000.0 && angka <= 9.99999999E8 ? this.bilangx((double) (int) angka / 1000000) +
" juta " + this.bilangx(angka % 1000000.0) : "";
}
}
public VerifikasiTagihanSupplier getVerifikasiTagihanSupplier(String noverifikasifk) throws Exception {
VerifikasiTagihanSupplier verif = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL = "select * from(select xx.norec,xx.noverifikasifk,xx.tglstruk,xx.tgldokumen,xx.tgljatuhtempo,xx.rknid,xx.namarekanan,xx.asalproduk,xx.nostruk,xx.nodokumen,xx.nopo,xx.keperluan,xx.nosbk, \t\t\t\t(CASE WHEN xx.noverifikasi is null THEN '-' ELSE xx.noverifikasi END) as noverifikasi,xx.total,xx.totalppn,xx.totaldiskon,xx.subtotal,xx.sisautang, (CASE WHEN xx.noverifikasi is null THEN '-' ELSE xx.noverifikasi END) as noverifikasi, (case when xx.noorder is null then '-' else xx.noorder end) as nospk, (CASE WHEN xx.totalbayar = 0 THEN 'BELUM LUNAS' WHEN xx.totalbayar <> 0 and xx.totalbayar > 0 and xx.sisautang <> 0 THEN 'KREDIT' WHEN xx.totalbayar = xx.subtotal OR xx.sisautang = 0 THEN 'LUNAS' ELSE '' END) as statusbayar, (Case when xx.noverifikasi is null THEN 'BLM VERIFIKASI' WHEN xx.noverifikasi is not null THEN 'VERIFIKASI' ELSE '' END) as status, (Case when xx.confirmfk is null THEN 'BLM CONFIRM' ELSE 'CONFIRM' END) as statusconfirmkabag, (Case when xx.confirm1fk is null THEN 'BLM CONFIRM' ELSE 'CONFIRM' END) as statusconfirmanggaran, xx.noorderintern,xx.tglorder,xx.confirmfk,xx.confirm1fk,xx.keteranganlainnya as kodeanggaran,xx.kode_dana,xx.kode_dana,xx.ba,xx.sppb,xx.faktur,xx.pph FROM(SELECT x.norec,x.tglstruk,x.asalproduk,x.tgldokumen,x.tgljatuhtempo,x.rknid,x.namarekanan,x.nostruk,x.nodokumen,x.nopo, x.totalppn as totalppn, x.totaldiskon as totaldiskon, x.total as total, (x.total+x.totalppn-x.totaldiskon) as subtotal, x.totaldibayar as totalbayar, (case when x.totalsisahutang is null then (x.total+x.totalppn-x.totaldiskon) ELSE \t\t\t\t x.totalsisahutang end) as sisautang, x.nosbk,x.noverifikasi,x.noverifikasifk,x.confirmfk,x.confirm1fk,x.noorderintern,x.noorder,x.tglorder,x.keteranganlainnya,x.keperluan,x.kode_dana,x.ba,x.sppb,x.faktur,x.pph FROM (SELECT sp.norec,sp.tglstruk,sp.tglfaktur as tgldokumen,sp.nostruk,sp.nosppb as nopo,sp.nofaktur as nodokumen, SUM(spd.qtyproduk*spd.hargasatuan) as total, asp.asalproduk as asalproduk, SUM(spd.qtyproduk*spd.hargappn) as totalppn,SUM(spd.qtyproduk*spd.hargadiscount) as totaldiskon, CASE WHEN sbk.totaldibayar is null then 0 else sbk.totaldibayar end as totaldibayar, CASE WHEN sbk.totalsudahdibayar is null then 0 else sbk.totalsudahdibayar end as totalsudahdibayar,\t sbk.nosbk,sv.noverifikasi,sv.norec as noverifikasifk,sp.tgljatuhtempo,rkn.id as rknid,rkn.namarekanan,sbk.totalsisahutang, sv.confirmfk,sv.confirm1fk,so.noorderintern,so.noorder,so.tglorder,sv.keteranganlainnya,sv.keperluan,pg.kode_dana,sv.ba,sv.sppb,sv.faktur,sv.pph from strukpelayanan_t as sp left join strukorder_t as so on so.norec = sp.noorderfk inner join strukpelayanandetail_t as spd on spd.nostrukfk = sp.norec \t\t\t\t LEFT JOIN asalproduk_m as asp ON asp.id = spd.objectasalprodukfk left join rekanan_m as rkn on rkn.id = sp.objectrekananfk left join strukbuktipengeluaran_t as sbk on sbk.norec = sp.nosbklastfk left join strukverifikasi_t as sv on sv.norec = spd.noverifikasifk left join ruangan_m as ru on ru.id = sv.objectruanganfk \t\t\t\t left join penggunaan_anggaran_t as pg on pg.kode_anggaran=sv.keteranganlainnya\t where sp.objectkelompoktransaksifk=35 and sv.norec='" + noverifikasifk + "' GROUP BY sp.norec,sp.tglstruk,sp.tglfaktur,sp.nostruk,sp.nosppb,sp.nofaktur,sp.nosbklastfk,sbk.totaldibayar,pg.kode_dana, sbk.totalsudahdibayar,sp.tgljatuhtempo,rkn.id,rkn.namarekanan,sbk.nosbk,sv.noverifikasi,sv.norec,sbk.totalsisahutang,so.noorderintern,so.noorder,so.tglorder,asp.asalproduk) as x) as xx) as su";
try {
this.ds1 = this.jdbcTemplate1.getDataSource();
conn = this.ds1.getConnection();
pstmt = conn.prepareStatement(SQL);
rs = pstmt.executeQuery();
String SQL = "select * from(" +
"select xx.norec,xx.noverifikasifk,xx.tglstruk,xx.tgldokumen,xx.tgljatuhtempo,xx.rknid," +
"xx.namarekanan,xx.asalproduk,xx.nostruk,xx.nodokumen,xx.nopo,xx.keperluan,xx.nosbk," +
"(CASE WHEN xx.noverifikasi is null THEN '-' ELSE xx.noverifikasi END) as noverifikasi," +
"xx.total,xx.totalppn,xx.totaldiskon,xx.subtotal,xx.sisautang," +
"(CASE WHEN xx.noverifikasi is null THEN '-' ELSE xx.noverifikasi END) as noverifikasi," +
"(case when xx.noorder is null then '-' else xx.noorder end) as nospk," +
"(CASE WHEN xx.totalbayar = 0 THEN 'BELUM LUNAS' WHEN xx.totalbayar <> 0 and xx.totalbayar > 0 " +
"and xx.sisautang <> 0 THEN 'KREDIT' " +
"WHEN xx.totalbayar = xx.subtotal OR xx.sisautang = 0 THEN 'LUNAS' " +
"ELSE '' END) as statusbayar," +
"(Case when xx.noverifikasi is null THEN 'BLM VERIFIKASI' " +
"WHEN xx.noverifikasi is not null THEN 'VERIFIKASI' ELSE '' END) as status," +
"(Case when xx.confirmfk is null THEN 'BLM CONFIRM' ELSE 'CONFIRM' END) as statusconfirmkabag," +
"(Case when xx.confirm1fk is null THEN 'BLM CONFIRM' ELSE 'CONFIRM' END) as statusconfirmanggaran," +
"xx.noorderintern,xx.tglorder,xx.confirmfk,xx.confirm1fk,xx.keteranganlainnya as kodeanggaran," +
"xx.kode_dana,xx.kode_dana,xx.ba,xx.sppb,xx.faktur,xx.pph " +
"FROM(" +
"SELECT x.norec,x.tglstruk,x.asalproduk,x.tgldokumen,x.tgljatuhtempo,x.rknid,x.namarekanan,x.nostruk," +
"x.nodokumen,x.nopo,x.totalppn as totalppn,x.totaldiskon as totaldiskon,x.total as total," +
"(x.total+x.totalppn-x.totaldiskon) as subtotal,x.totaldibayar as totalbayar," +
"(case when x.totalsisahutang is null then (x.total+x.totalppn-x.totaldiskon) " +
"ELSE x.totalsisahutang end) as sisautang,x.nosbk,x.noverifikasi,x.noverifikasifk,x.confirmfk," +
"x.confirm1fk,x.noorderintern,x.noorder,x.tglorder,x.keteranganlainnya,x.keperluan,x.kode_dana," +
"x.ba,x.sppb,x.faktur,x.pph " +
"FROM (SELECT sp.norec,sp.tglstruk,sp.tglfaktur as tgldokumen,sp.nostruk,sp.nosppb as nopo," +
"sp.nofaktur as nodokumen,SUM(spd.qtyproduk*spd.hargasatuan) as total, asp.asalproduk as asalproduk," +
"SUM(spd.qtyproduk*spd.hargappn) as totalppn,SUM(spd.qtyproduk*spd.hargadiscount) as totaldiskon," +
"CASE WHEN sbk.totaldibayar is null then 0 else sbk.totaldibayar end as totaldibayar," +
"CASE WHEN sbk.totalsudahdibayar is null then 0 else sbk.totalsudahdibayar end as totalsudahdibayar," +
"sbk.nosbk,sv.noverifikasi,sv.norec as noverifikasifk,sp.tgljatuhtempo," +
"rkn.id as rknid,rkn.namarekanan,sbk.totalsisahutang,sv.confirmfk,sv.confirm1fk,so.noorderintern," +
"so.noorder,so.tglorder,sv.keteranganlainnya,sv.keperluan,pg.kode_dana,sv.ba,sv.sppb,sv.faktur,sv.pph" +
"from strukpelayanan_t as sp " +
"left join strukorder_t as so on so.norec = sp.noorderfk " +
"inner join strukpelayanandetail_t as spd on spd.nostrukfk = sp.norec " +
"LEFT JOIN asalproduk_m as asp ON asp.id = spd.objectasalprodukfk " +
"left join rekanan_m as rkn on rkn.id = sp.objectrekananfk " +
"left join strukbuktipengeluaran_t as sbk on sbk.norec = sp.nosbklastfk " +
"left join strukverifikasi_t as sv on sv.norec = spd.noverifikasifk " +
"left join ruangan_m as ru on ru.id = sv.objectruanganfk " +
"left join penggunaan_anggaran_t as pg on pg.kode_anggaran=sv.keteranganlainnya " +
"where sp.objectkelompoktransaksifk=35 and sv.norec='" + noverifikasifk + "' " +
"GROUP BY sp.norec,sp.tglstruk,sp.tglfaktur,sp.nostruk,sp.nosppb,sp.nofaktur,sp.nosbklastfk," +
"sbk.totaldibayar,pg.kode_dana,sbk.totalsudahdibayar,sp.tgljatuhtempo,rkn.id,rkn.namarekanan," +
"sbk.nosbk,sv.noverifikasi,sv.norec,sbk.totalsisahutang," +
"so.noorderintern,so.noorder,so.tglorder,asp.asalproduk) " +
"as x) " +
"as xx) " +
"as su";
this.ds1 = this.jdbcTemplate1.getDataSource();
try (Connection conn = this.ds1.getConnection();
PreparedStatement pstmt = conn.prepareStatement(SQL);
ResultSet rs = pstmt.executeQuery()) {
VerifikasiTagihanSupplier verif = new VerifikasiTagihanSupplier();
if (rs.next()) {
verif = null;
verif = new VerifikasiTagihanSupplier();
verif.setNoverifikasifk(rs.getString("noverifikasifk"));
verif.setNoSpk(rs.getString("nospk"));
verif.setKodeAnggaran(rs.getString("kodeanggaran"));
@ -243,38 +279,32 @@ public class VerifikasiTagihanSupplierServices {
verif.setSppb(rs.getString("sppb"));
verif.setFaktur(rs.getString("faktur"));
verif.setPph(rs.getDouble("pph"));
verif.setTerbilang(terbilang(new BigDecimal(rs.getDouble("subtotal"))).toUpperCase() + "RUPIAH");
verif.setTerbilang(terbilang(BigDecimal.valueOf(rs.getDouble("subtotal")))
.toUpperCase() + "RUPIAH");
}
return verif;
} catch (Exception var15) {
LOG.error("Exception at getVerifikasiTagihanSupplier()");
LOG.error("VerifikasiTagihanSupplierServices.class", var15);
throw var15;
} finally {
try {
DatabaseUtility.clear(conn, pstmt, rs);
} catch (Exception var14) {
}
}
return verif;
}
public VerifikasiTagihanSupplier getVerifikasiPembayaranUmum(String noverifikasifk) throws Exception {
VerifikasiTagihanSupplier verif = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String SQL = "select spu.norec,to_char(spu.tgltransaksi,'dd-MM-yyyy') as tglSPK,spu.keperluan,spu.totaltagihan,spu.totalbayar,\t sv.norec as noverifikasifk,sv.tglverifikasi,sv.noverifikasi,sv.confirmfk,sv.confirm1fk,sv.keteranganlainnya as kodeanggaran,\t pg.kode_dana,spu.nospk,spu.keperluan,spu.namarekanan,spu.dana as asalproduk,sv.ba,sv.sppb,sv.faktur,sv.pph\t from strukpembayaranumum_t as spu \t left join strukverifikasi_t as sv on sv.norec=spu.noverifikasifk left join penggunaan_anggaran_t as pg on pg.kode_anggaran=sv.keteranganlainnya where sv.norec='" + noverifikasifk + "'";
try {
this.ds1 = this.jdbcTemplate1.getDataSource();
conn = this.ds1.getConnection();
pstmt = conn.prepareStatement(SQL);
rs = pstmt.executeQuery();
String SQL = "select spu.norec,to_char(spu.tgltransaksi,'dd-MM-yyyy') as tglSPK,spu.keperluan," +
"spu.totaltagihan,spu.totalbayar,sv.norec as noverifikasifk,sv.tglverifikasi,sv.noverifikasi," +
"sv.confirmfk,sv.confirm1fk,sv.keteranganlainnya as kodeanggaran,pg.kode_dana,spu.nospk," +
"spu.keperluan,spu.namarekanan,spu.dana as asalproduk,sv.ba,sv.sppb,sv.faktur,sv.pph " +
"from strukpembayaranumum_t as spu " +
"left join strukverifikasi_t as sv on sv.norec=spu.noverifikasifk " +
"left join penggunaan_anggaran_t as pg on pg.kode_anggaran=sv.keteranganlainnya " +
"where sv.norec='" + noverifikasifk + "'";
this.ds1 = this.jdbcTemplate1.getDataSource();
try (Connection conn = this.ds1.getConnection();
PreparedStatement pstmt = conn.prepareStatement(SQL);
ResultSet rs = pstmt.executeQuery()) {
VerifikasiTagihanSupplier verif = new VerifikasiTagihanSupplier();
if (rs.next()) {
verif = null;
verif = new VerifikasiTagihanSupplier();
verif.setNoverifikasifk(rs.getString("noverifikasifk"));
verif.setNoSpk(rs.getString("nospk"));
verif.setKodeAnggaran(rs.getString("kodeanggaran"));
@ -289,182 +319,106 @@ public class VerifikasiTagihanSupplierServices {
verif.setSppb(rs.getString("sppb"));
verif.setFaktur(rs.getString("faktur"));
verif.setPph(rs.getDouble("pph"));
verif.setTerbilang(terbilang(new BigDecimal(rs.getDouble("totaltagihan"))).toUpperCase() + "RUPIAH");
verif.setTerbilang(terbilang(BigDecimal.valueOf(rs.getDouble("totaltagihan")))
.toUpperCase() + "RUPIAH");
}
return verif;
} catch (Exception var15) {
LOG.error("Exception at getVerifikasiPembayaranUmum()");
LOG.error("VerifikasiTagihanSupplierServices.class", var15);
throw var15;
} finally {
try {
DatabaseUtility.clear(conn, pstmt, rs);
} catch (Exception var14) {
}
}
return verif;
}
public JasperPrint generateVerifikasiTagihanPdf(String noverifikasifk) throws Exception {
JasperPrint print = null;
Map<String, Object> parameters = null;
JRBeanCollectionDataSource jrbcds = null;
Vector<VerifikasiTagihanSupplier2> collection = null;
VerifikasiTagihanSupplier verif = null;
VerifikasiTagihanSupplier2 verif2 = null;
public JasperPrint generateVerifikasiTagihanPdf(String noverifikasifk) {
try {
try {
if (noverifikasifk == null) {
throw new Exception("Cannot find verifikasi = " + noverifikasifk + ".");
}
if (noverifikasifk == null)
throw new Exception("Cannot find verifikasi");
Vector<VerifikasiTagihanSupplier2> collection = new Vector<>();
VerifikasiTagihanSupplier verif = this.getVerifikasiTagihanSupplier(noverifikasifk);
VerifikasiTagihanSupplier2 verif2 = new VerifikasiTagihanSupplier2();
verif2.setNoSpk(verif.getNoSpk());
verif2.setKodeAnggaran(verif.getKodeAnggaran());
verif2.setKodeDana(verif.getKodeDana());
verif2.setNamaRekanan(verif.getNamaRekanan());
verif2.setTotalBayar(verif.getTotalBayar());
verif2.setKeperluan(verif.getKeperluan());
verif2.setAsalproduk("-");
if (verif.getAsalproduk() != null)
verif2.setAsalproduk(verif.getAsalproduk());
verif2.setNoVerifikasi(verif.getNoVerifikasi());
verif2.setTerbilang("#" + verif.getTerbilang() + "#");
verif2.setBa("-");
if (verif.getBa() != null)
verif2.setBa(verif.getBa());
verif2.setSppb("-");
if (verif.getSppb() != null)
verif2.setSppb(verif.getSppb());
verif2.setFaktur("-");
if (verif.getFaktur() != null)
verif2.setFaktur(verif.getFaktur());
verif2.setPph(0.0);
if (verif.getPph() != null)
verif2.setPph(verif.getPph());
collection.add(verif2);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasitagihansupplier.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
return JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {
LOG.error("Exception at generateVerifikasiTagihanPdf()");
LOG.error(VerifikasiTagihanSupplierServices.class, var13);
}
return null;
}
collection = null;
collection = new Vector();
verif = null;
verif = this.getVerifikasiTagihanSupplier(noverifikasifk);
verif2 = null;
verif2 = new VerifikasiTagihanSupplier2();
public JasperPrint generateVerifikasiPembayaranUmumPdf(String noverifikasifk) {
try {
if (noverifikasifk == null)
throw new Exception("Cannot find verifikasi");
Vector<VerifikasiTagihanSupplier2> collection = new Vector<>();
VerifikasiTagihanSupplier verif = this.getVerifikasiPembayaranUmum(noverifikasifk);
VerifikasiTagihanSupplier2 verif2 = new VerifikasiTagihanSupplier2();
verif2.setNoSpk("-");
if (verif.getNoSpk() != null)
verif2.setNoSpk(verif.getNoSpk());
verif2.setKodeAnggaran(verif.getKodeAnggaran());
verif2.setKodeDana(verif.getKodeDana());
verif2.setKodeAnggaran(verif.getKodeAnggaran());
verif2.setKodeDana(verif.getKodeDana());
verif2.setNamaRekanan("-");
if (verif.getNamaRekanan() != null)
verif2.setNamaRekanan(verif.getNamaRekanan());
verif2.setTotalBayar(verif.getTotalBayar());
verif2.setKeperluan(verif.getKeperluan());
if (verif.getAsalproduk() != null) {
verif2.setAsalproduk(verif.getAsalproduk());
} else {
verif2.setAsalproduk("-");
}
verif2.setNoVerifikasi(verif.getNoVerifikasi());
verif2.setTerbilang("#" + verif.getTerbilang() + "#");
if (verif.getBa() != null) {
verif2.setBa(verif.getBa());
} else {
verif2.setBa("-");
}
if (verif.getSppb() != null) {
verif2.setSppb(verif.getSppb());
} else {
verif2.setSppb("-");
}
if (verif.getFaktur() != null) {
verif2.setFaktur(verif.getFaktur());
} else {
verif2.setFaktur("-");
}
if (verif.getPph() != null) {
verif2.setPph(verif.getPph());
} else {
verif2.setPph(0.0);
}
collection.add(verif2);
parameters = new HashMap();
parameters.put("noverifikasifk", noverifikasifk);
jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasitagihansupplier.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
print = JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {
LOG.error("Exception at generateVerifikasiTagihanPdf()");
LOG.error(VerifikasiTagihanSupplierServices.class, var13);
}
return print;
} finally {
;
}
}
public JasperPrint generateVerifikasiPembayaranUmumPdf(String noverifikasifk) throws Exception {
JasperPrint print = null;
Map<String, Object> parameters = null;
JRBeanCollectionDataSource jrbcds = null;
Vector<VerifikasiTagihanSupplier2> collection = null;
VerifikasiTagihanSupplier verif = null;
VerifikasiTagihanSupplier2 verif2 = null;
try {
try {
if (noverifikasifk == null) {
throw new Exception("Cannot find verifikasi = " + noverifikasifk + ".");
}
collection = null;
collection = new Vector();
verif = null;
verif = this.getVerifikasiPembayaranUmum(noverifikasifk);
verif2 = null;
verif2 = new VerifikasiTagihanSupplier2();
if (verif.getNoSpk() != null) {
verif2.setNoSpk(verif.getNoSpk());
} else {
verif2.setNoSpk("-");
}
verif2.setKodeAnggaran(verif.getKodeAnggaran());
verif2.setKodeDana(verif.getKodeDana());
if (verif.getNamaRekanan() != null) {
verif2.setNamaRekanan(verif.getNamaRekanan());
} else {
verif2.setNamaRekanan("-");
}
verif2.setTotalBayar(verif.getTotalBayar());
verif2.setKeperluan(verif.getKeperluan());
if (verif.getAsalproduk() != null) {
verif2.setAsalproduk(verif.getAsalproduk());
} else {
verif2.setAsalproduk("-");
}
verif2.setNoVerifikasi(verif.getNoVerifikasi());
verif2.setTerbilang("#" + verif.getTerbilang() + "#");
if (verif.getBa() != null) {
verif2.setBa(verif.getBa());
} else {
verif2.setBa("-");
}
if (verif.getSppb() != null) {
verif2.setSppb(verif.getSppb());
} else {
verif2.setSppb("-");
}
if (verif.getFaktur() != null) {
verif2.setFaktur(verif.getFaktur());
} else {
verif2.setFaktur("-");
}
if (verif.getPph() != null) {
verif2.setPph(verif.getPph());
} else {
verif2.setPph(0.0);
}
collection.add(verif2);
parameters = new HashMap();
parameters.put("noverifikasifk", noverifikasifk);
jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasipembayaranumum.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
print = JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {
LOG.error("Exception at generateVerifikasiPembayaranUmumPdf()");
LOG.error(VerifikasiTagihanSupplierServices.class, var13);
}
return print;
} finally {
;
verif2.setTotalBayar(verif.getTotalBayar());
verif2.setKeperluan(verif.getKeperluan());
verif2.setAsalproduk("-");
if (verif.getAsalproduk() != null)
verif2.setAsalproduk(verif.getAsalproduk());
verif2.setNoVerifikasi(verif.getNoVerifikasi());
verif2.setTerbilang("#" + verif.getTerbilang() + "#");
verif2.setBa("-");
if (verif.getBa() != null)
verif2.setBa(verif.getBa());
verif2.setSppb("-");
if (verif.getSppb() != null)
verif2.setSppb(verif.getSppb());
verif2.setFaktur("-");
if (verif.getFaktur() != null)
verif2.setFaktur(verif.getFaktur());
verif2.setPph(0.0);
if (verif.getPph() != null)
verif2.setPph(verif.getPph());
collection.add(verif2);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasipembayaranumum.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
return JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {
LOG.error("Exception at generateVerifikasiPembayaranUmumPdf()");
LOG.error(VerifikasiTagihanSupplierServices.class, var13);
}
return null;
}
}

View File

@ -1,20 +1,8 @@
server.port=7777
#Datasource
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/simrs_db_new
spring.datasource.url=jdbc:postgresql://172.16.88.8:5432/rsab_hk_production
#spring.datasource.url=jdbc:postgresql://192.168.12.1:5432/rsab_hk_production
#spring.datasource.url=jdbc:postgresql://192.168.12.3:5432/rsabhk_db_17022020
spring.datasource.username=postgres
spring.datasource.password=root
#spring.datasource.hikari.pool-name=SpringBootHikariCP
#spring.datasource.hikari.connection-test-query=SELECT 1
#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=50
#spring.datasource.hikari.connection-timeout=30000
#spring.datasource.hikari.idle-timeout=600000
#spring.datasource.hikari.max-lifetime=1800000
#spring.datasource.hikari.auto-commit=true
spring.mvc.dispatch-trace-request=true
spring.main.banner-mode=off