Skip to content

Commit

Permalink
Merge pull request #6650 from hmislk/Issue#6624
Browse files Browse the repository at this point in the history
Issue#6624 Closes #6624
  • Loading branch information
DeshaniPubudu authored Jul 28, 2024
2 parents 302e3b4 + 7e92412 commit 20e0f09
Show file tree
Hide file tree
Showing 11 changed files with 525 additions and 133 deletions.
3 changes: 2 additions & 1 deletion nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ That way multiple projects can share the same settings (useful for formatting ru
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>

<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
<org-netbeans-modules-projectapi.jsf_2e_language>JSP</org-netbeans-modules-projectapi.jsf_2e_language>
Expand All @@ -28,5 +29,5 @@ Any value defined here will override the pom.xml file value but is only applicab
<org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>js/libs</org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.jdkPlatform>JDK_11</netbeans.hint.jdkPlatform>
</properties>

</project-shared-configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2092,6 +2109,127 @@ private ReportTemplateRowBundle handleItemSummaryByBill(
return bundle;
}

private ReportTemplateRowBundle handleSessionInstanceList(
List<BillTypeAtomic> 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<String, Object> 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<ReportTemplateRow> rs = (List<ReportTemplateRow>) 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<BillTypeAtomic> btas,
Date paramDate,
Expand Down
41 changes: 20 additions & 21 deletions src/main/java/com/divudi/bean/report/ReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -312,27 +312,27 @@ 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();
}

public void processOpdServiceCountDoctorWise() {
List<BillTypeAtomic> 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 "
Expand All @@ -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<ItemCount>) billItemFacade.findLightsByJpql(jpql, m);
}



public void processCollectingCentreReportsToPrint() {
String jpql = "select bi "
+ " from BillItem bi "
Expand Down Expand Up @@ -425,9 +423,6 @@ public void processCollectingCentreReportsToPrint() {
billItems = billItemFacade.findByJpql(jpql, m);
}




public void processCollectingCentreStatementReport() {
String jpql = "select bi "
+ " from BillItem bi "
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -1789,4 +1784,8 @@ public void setReportOpdServiceCount(List<ItemCount> reportOpdServiceCount) {
this.reportOpdServiceCount = reportOpdServiceCount;
}

public String navigateToDynamicReportSummary() {
return "/reports/dynamic_reports/dynamic_report_summary?faces-redirect=true";
}

}
14 changes: 14 additions & 0 deletions src/main/java/com/divudi/data/ReportTemplateRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -48,8 +49,13 @@ public class ReportTemplateRow {
private WebUser user;
private Long startId;
private Long endId;
private SessionInstance sessionInstance;

private List<BillTypeAtomic> btas;

public ReportTemplateRow(SessionInstance sessionInstance) {
this.sessionInstance = sessionInstance;
}



Expand Down Expand Up @@ -397,4 +403,12 @@ public void setBtas(List<BillTypeAtomic> btas) {
this.btas = btas;
}

public SessionInstance getSessionInstance() {
return sessionInstance;
}

public void setSessionInstance(SessionInstance sessionInstance) {
this.sessionInstance = sessionInstance;
}

}
11 changes: 10 additions & 1 deletion src/main/java/com/divudi/data/ReportTemplateRowBundle.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -20,7 +21,7 @@ public class ReportTemplateRowBundle {
private Long count;
private String name;
private String description;

private SessionInstance sessionInstance;



Expand Down Expand Up @@ -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;
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hmisPU" transaction-type="JTA">
<jta-data-source>jdbc/arogya</jta-data-source>
<jta-data-source>jdbc/hims</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
Expand All @@ -10,7 +10,7 @@
</properties>
</persistence-unit>
<persistence-unit name="hmisAuditPU" transaction-type="JTA">
<jta-data-source>jdbc/arogyaAudit</jta-data-source>
<jta-data-source>jdbc/himsaudit</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
Expand Down
Loading

0 comments on commit 20e0f09

Please sign in to comment.