From c0884302183fa88302609e84da379b03451ab5df Mon Sep 17 00:00:00 2001 From: buddhika75 Date: Sat, 27 Jul 2024 17:31:33 +0530 Subject: [PATCH 1/3] Signed-off-by: buddhika75 --- .../analytics/ReportTemplateController.java | 138 ++++++++++++++ .../com/divudi/data/ReportTemplateRow.java | 14 ++ .../divudi/data/ReportTemplateRowBundle.java | 11 +- .../data/analytics/ReportTemplateType.java | 1 + src/main/webapp/dataAdmin/report.xhtml | 177 +++++++----------- 5 files changed, 233 insertions(+), 108 deletions(-) diff --git a/src/main/java/com/divudi/bean/channel/analytics/ReportTemplateController.java b/src/main/java/com/divudi/bean/channel/analytics/ReportTemplateController.java index 4e2ba50f74..4babc16c0b 100644 --- a/src/main/java/com/divudi/bean/channel/analytics/ReportTemplateController.java +++ b/src/main/java/com/divudi/bean/channel/analytics/ReportTemplateController.java @@ -548,6 +548,23 @@ public ReportTemplateRowBundle generateReport( paramStartId, paramEndId); break; + case SESSION_INSTANCE_LIST: + bundle = handleSessionInstanceList( + btas, + paramDate, + paramFromDate, + paramToDate, + paramInstitution, + paramDepartment, + paramFromInstitution, + paramFromDepartment, + paramToInstitution, + paramToDepartment, + paramUser, + paramCreditCompany, + paramStartId, + paramEndId); + break; default: JsfUtil.addErrorMessage("Unknown Report Type"); return null; @@ -2092,6 +2109,127 @@ private ReportTemplateRowBundle handleItemSummaryByBill( return bundle; } + private ReportTemplateRowBundle handleSessionInstanceList( + List btas, + Date paramDate, + Date paramFromDate, + Date paramToDate, + Institution paramInstitution, + Department paramDepartment, + Institution paramFromInstitution, + Department paramFromDepartment, + Institution paramToInstitution, + Department paramToDepartment, + WebUser paramUser, + Institution paramCreditCompany, + Long paramStartId, + Long paramEndId) { + + String jpql; + Map parameters = new HashMap<>(); + ReportTemplateRowBundle bundle = new ReportTemplateRowBundle(); + + jpql = "select new com.divudi.data.ReportTemplateRow(" + + " ss " + + " from SessionInstance ss " + + " where ss.retired<>:br "; + parameters.put("br", true); + + if (paramDate != null) { + jpql += " and ss.startedAt=:bd"; + parameters.put("bd", paramDate); + } + + if (paramToDate != null) { + jpql += " and ss.startedAt < :td"; + parameters.put("td", paramToDate); + } + + if (paramFromDate != null) { + jpql += " and ss.startedAt > :fd"; + parameters.put("fd", paramFromDate); + } + + if (paramInstitution != null) { + jpql += " and ss.institution=:ins"; + parameters.put("ins", paramInstitution); + } + + if (paramDepartment != null) { + jpql += " and ss.department=:dep"; + parameters.put("dep", paramDepartment); + } + + if (paramUser != null) { + jpql += " and ss.creater=:wu"; + parameters.put("wu", paramUser); + } + + System.out.println("jpql = " + jpql); + System.out.println("parameters = " + parameters); + + List rs = (List) ejbFacade.findLightsByJpql(jpql, parameters, TemporalType.DATE); + + if (rs == null || rs.isEmpty()) { + System.out.println("No results found."); + return null; + } else { + System.out.println("Results found: " + rs.size()); + } + + + long idCounter = 1; + + for (ReportTemplateRow row : rs) { + row.setId(idCounter++); + if (row.getBtas() == null) { + row.setBtas(btas); + } + if (row.getDate() == null) { + row.setDate(paramDate); + } + if (row.getFromDate() == null) { + row.setFromDate(paramFromDate); + } + if (row.getToDate() == null) { + row.setToDate(paramToDate); + } + if (row.getInstitution() == null) { + row.setInstitution(paramInstitution); + } + if (row.getDepartment() == null) { + row.setDepartment(paramDepartment); + } + if (row.getFromInstitution() == null) { + row.setFromInstitution(paramFromInstitution); + } + if (row.getFromDepartment() == null) { + row.setFromDepartment(paramFromDepartment); + } + if (row.getToInstitution() == null) { + row.setToInstitution(paramToInstitution); + } + if (row.getToDepartment() == null) { + row.setToDepartment(paramToDepartment); + } + if (row.getUser() == null) { + row.setUser(paramUser); + } + if (row.getCreditCompany() == null) { + row.setCreditCompany(paramCreditCompany); + } + if (row.getStartId() == null) { + row.setStartId(paramStartId); + } + if (row.getEndId() == null) { + row.setEndId(paramEndId); + } + } + + bundle.setReportTemplateRows(rs); + return bundle; + } + private ReportTemplateRowBundle handleToDepartmentSummaryByBillFee( List btas, Date paramDate, diff --git a/src/main/java/com/divudi/data/ReportTemplateRow.java b/src/main/java/com/divudi/data/ReportTemplateRow.java index fef99715fb..95eb52d33f 100644 --- a/src/main/java/com/divudi/data/ReportTemplateRow.java +++ b/src/main/java/com/divudi/data/ReportTemplateRow.java @@ -5,6 +5,7 @@ import com.divudi.entity.Institution; import com.divudi.entity.Item; import com.divudi.entity.WebUser; +import com.divudi.entity.channel.SessionInstance; import java.util.Date; import java.util.List; @@ -48,8 +49,13 @@ public class ReportTemplateRow { private WebUser user; private Long startId; private Long endId; + private SessionInstance sessionInstance; private List btas; + + public ReportTemplateRow(SessionInstance sessionInstance) { + this.sessionInstance = sessionInstance; + } @@ -397,4 +403,12 @@ public void setBtas(List btas) { this.btas = btas; } + public SessionInstance getSessionInstance() { + return sessionInstance; + } + + public void setSessionInstance(SessionInstance sessionInstance) { + this.sessionInstance = sessionInstance; + } + } diff --git a/src/main/java/com/divudi/data/ReportTemplateRowBundle.java b/src/main/java/com/divudi/data/ReportTemplateRowBundle.java index 109fb84e78..68c50855ef 100644 --- a/src/main/java/com/divudi/data/ReportTemplateRowBundle.java +++ b/src/main/java/com/divudi/data/ReportTemplateRowBundle.java @@ -1,6 +1,7 @@ package com.divudi.data; import com.divudi.entity.ReportTemplate; +import com.divudi.entity.channel.SessionInstance; import java.util.ArrayList; import java.util.List; @@ -20,7 +21,7 @@ public class ReportTemplateRowBundle { private Long count; private String name; private String description; - + private SessionInstance sessionInstance; @@ -108,6 +109,14 @@ public void setDescription(String description) { this.description = description; } + public SessionInstance getSessionInstance() { + return sessionInstance; + } + + public void setSessionInstance(SessionInstance sessionInstance) { + this.sessionInstance = sessionInstance; + } + diff --git a/src/main/java/com/divudi/data/analytics/ReportTemplateType.java b/src/main/java/com/divudi/data/analytics/ReportTemplateType.java index f430f28f64..2c41b0ec59 100644 --- a/src/main/java/com/divudi/data/analytics/ReportTemplateType.java +++ b/src/main/java/com/divudi/data/analytics/ReportTemplateType.java @@ -10,6 +10,7 @@ public enum ReportTemplateType { BILL_ITEM_LIST("Bill Item List"), BILL_FEE_LIST("Bill Fee List"), PATIENT_LIST("Patient List"), + SESSION_INSTANCE_LIST("Channelling Session Instance List"), ENCOUNTER_LIST("Encounter List"), BILL_FEE_GROUPED_BY_TO_DEPARTMENT_AND_CATEGORY("Bill fees grouped by to departmetnt and category"), BILL_TYPE_ATOMIC_SUMMARY_USING_BILLS("Bill Type Summary by using Bills"), diff --git a/src/main/webapp/dataAdmin/report.xhtml b/src/main/webapp/dataAdmin/report.xhtml index d4fb765bdd..610cd83787 100644 --- a/src/main/webapp/dataAdmin/report.xhtml +++ b/src/main/webapp/dataAdmin/report.xhtml @@ -13,154 +13,117 @@ + + + + + + + + + - - - - - - - - + + - - - - - - - - - - - - - -

- - -

-
- - -

- - -

-
- - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + - - - - - - - - - - - - + + + + + + + + + - - - - + + + -
+ + + - - - - - - - - - + + + + + + + + + - - - + + + - - - + + + + - + + + + From 2ab8b59becfb218725e685e6b0b1f3e019082427 Mon Sep 17 00:00:00 2001 From: Lahiru Rasanjaya Date: Sat, 27 Jul 2024 18:57:26 +0530 Subject: [PATCH 2/3] closes Issue#6624 Signed-off-by: Lahiru Rasanjaya --- nb-configuration.xml | 2 + .../divudi/bean/report/ReportController.java | 41 ++-- src/main/resources/META-INF/persistence.xml | 4 +- .../dynamic_report_summary.xhtml | 218 ++++++++++++++++++ .../dynamic_reports/dynamic_reports.xhtml | 47 ++++ src/main/webapp/resources/ezcomp/menu.xhtml | 4 +- 6 files changed, 292 insertions(+), 24 deletions(-) create mode 100644 src/main/webapp/reports/dynamic_reports/dynamic_report_summary.xhtml create mode 100644 src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml diff --git a/nb-configuration.xml b/nb-configuration.xml index 535eada8f3..5315dde908 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -16,5 +16,7 @@ Any value defined here will override the pom.xml file value but is only applicab --> ide pfv5ee8 + none + false diff --git a/src/main/java/com/divudi/bean/report/ReportController.java b/src/main/java/com/divudi/bean/report/ReportController.java index bd653f69e2..ca35470090 100644 --- a/src/main/java/com/divudi/bean/report/ReportController.java +++ b/src/main/java/com/divudi/bean/report/ReportController.java @@ -159,10 +159,10 @@ public void processCollectionCenterBalance() { collectionCenters = institutionFacade.findByJpql(jpql, m); } - public String navigatetoOPDLabReportByMenu(){ + public String navigatetoOPDLabReportByMenu() { return "/lab/report_for_opd_print?faces-redirect=true"; } - + public String navigateToPrescriptionSummaryReport() { return "/pharmacy/prescription_summary_report?faces-redirect=true"; } @@ -312,19 +312,19 @@ public void processLabTestCount() { // Convert the map values to a list to be used in the JSF page reportList = new ArrayList<>(categoryReports.values()); } - - public void filterOpdServiceCountBySelectedService(Long selectedItemId){ + + public void filterOpdServiceCountBySelectedService(Long selectedItemId) { if (selectedItemId != null) { - item=itemController.findItem(selectedItemId); - doctor=null; + item = itemController.findItem(selectedItemId); + doctor = null; } processOpdServiceCountDoctorWise(); } - - public void filterOpdServiceCountBySelectedDoctor(Long selectedDoctorId){ + + public void filterOpdServiceCountBySelectedDoctor(Long selectedDoctorId) { if (selectedDoctorId != null) { - doctor=doctorController.findDoctor(selectedDoctorId); - item=null; + doctor = doctorController.findDoctor(selectedDoctorId); + item = null; } processOpdServiceCountDoctorWise(); } @@ -332,7 +332,7 @@ public void filterOpdServiceCountBySelectedDoctor(Long selectedDoctorId){ public void processOpdServiceCountDoctorWise() { List billtypes = new ArrayList<>(); billtypes.add(BillTypeAtomic.OPD_BILL_TO_COLLECT_PAYMENT_AT_CASHIER); - + String jpql = "select new com.divudi.data.ItemCount(bi.bill.fromStaff.person.name, bi.bill.fromStaff.id, bi.item.name, bi.item.id, count(bi)) " + " from BillItem bi " + " where bi.bill.cancelled=:can " @@ -352,18 +352,16 @@ public void processOpdServiceCountDoctorWise() { jpql += " and bi.bill.fromStaff =:fs"; m.put("fs", doctor); } - if(item != null){ + if (item != null) { jpql += " and bi.item =:it"; m.put("it", item); } - + jpql += " group by bi.item, bi.bill.fromStaff "; jpql += " order by bi.bill.fromStaff.person.name, bi.item.name"; reportOpdServiceCount = (List) billItemFacade.findLightsByJpql(jpql, m); } - - public void processCollectingCentreReportsToPrint() { String jpql = "select bi " + " from BillItem bi " @@ -425,9 +423,6 @@ public void processCollectingCentreReportsToPrint() { billItems = billItemFacade.findByJpql(jpql, m); } - - - public void processCollectingCentreStatementReport() { String jpql = "select bi " + " from BillItem bi " @@ -817,7 +812,7 @@ public void downloadLabTestCount() { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=test_counts.xlsx"); - try ( ServletOutputStream outputStream = response.getOutputStream()) { + try (ServletOutputStream outputStream = response.getOutputStream()) { workbook.write(outputStream); fc.responseComplete(); } catch (IOException e) { @@ -833,7 +828,7 @@ public void downloadPharmacySaleItemCount() { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=Sale_Item_Count.xlsx"); - try ( ServletOutputStream outputStream = response.getOutputStream()) { + try (ServletOutputStream outputStream = response.getOutputStream()) { workbook.write(outputStream); fc.responseComplete(); } catch (IOException e) { @@ -849,7 +844,7 @@ public void downloadOpdServiceCount() { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=service_count.xlsx"); - try ( ServletOutputStream outputStream = response.getOutputStream()) { + try (ServletOutputStream outputStream = response.getOutputStream()) { workbook.write(outputStream); fc.responseComplete(); } catch (IOException e) { @@ -1789,4 +1784,8 @@ public void setReportOpdServiceCount(List reportOpdServiceCount) { this.reportOpdServiceCount = reportOpdServiceCount; } + public String navigateToDynamicReportSummary() { + return "/reports/dynamic_reports/dynamic_report_summary?faces-redirect=true"; + } + } diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 19c35b09ad..3d587e1744 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -1,7 +1,7 @@ - jdbc/arogya + jdbc/hims false @@ -10,7 +10,7 @@ - jdbc/arogyaAudit + jdbc/himsaudit false diff --git a/src/main/webapp/reports/dynamic_reports/dynamic_report_summary.xhtml b/src/main/webapp/reports/dynamic_reports/dynamic_report_summary.xhtml new file mode 100644 index 0000000000..44886962ef --- /dev/null +++ b/src/main/webapp/reports/dynamic_reports/dynamic_report_summary.xhtml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
+
+ +
+ +
+
+
+ + + + + + + +
+
+ + + + + Total + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ +
+ +
+ + + diff --git a/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml b/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml new file mode 100644 index 0000000000..baaad083ea --- /dev/null +++ b/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml @@ -0,0 +1,47 @@ + + + + + + + + + + +
+
+ + + + + +
+ + +
+
+
+
+
+
+ + +
+
+ +
+ +
+ +
+ + + diff --git a/src/main/webapp/resources/ezcomp/menu.xhtml b/src/main/webapp/resources/ezcomp/menu.xhtml index af0538dbf1..1e403cadc7 100644 --- a/src/main/webapp/resources/ezcomp/menu.xhtml +++ b/src/main/webapp/resources/ezcomp/menu.xhtml @@ -1159,7 +1159,9 @@ - + + From ff23895c1c7b9198dfd412cb911b701c68a7a727 Mon Sep 17 00:00:00 2001 From: Lahiru Rasanjaya Date: Sat, 27 Jul 2024 19:05:07 +0530 Subject: [PATCH 3/3] close Issue#6624 Signed-off-by: Lahiru Rasanjaya --- src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml b/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml index baaad083ea..8c76690b27 100644 --- a/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml +++ b/src/main/webapp/reports/dynamic_reports/dynamic_reports.xhtml @@ -31,7 +31,7 @@ -
+