Skip to content

Commit

Permalink
External Laboratory Workload Report #9762
Browse files Browse the repository at this point in the history
  • Loading branch information
imexh committed Dec 19, 2024
1 parent 622647b commit 78f0483
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
58 changes: 35 additions & 23 deletions src/main/java/com/divudi/bean/common/ReportsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.divudi.entity.inward.Admission;
import com.divudi.entity.inward.AdmissionType;
import com.divudi.entity.inward.RoomCategory;
import com.divudi.entity.lab.Investigation;
import com.divudi.entity.lab.PatientInvestigation;
import com.divudi.entity.lab.PatientReport;
import com.divudi.facade.*;
Expand Down Expand Up @@ -311,6 +312,8 @@ public class ReportsController implements Serializable {
private String settlementStatus;
private String dischargedStatus;

private Investigation investigation;

public String getDischargedStatus() {
return dischargedStatus;
}
Expand All @@ -324,11 +327,11 @@ public PaymentMethod getPaymentMethod() {
return paymentMethod;
}


public void setPaymentMethod(PaymentMethod paymentMethod) {
this.paymentMethod = paymentMethod;
}


public CommonController getCommonController() {
return commonController;
Expand All @@ -354,6 +357,14 @@ public void setPatientReportFacade(PatientReportFacade patientReportFacade) {
this.patientReportFacade = patientReportFacade;
}

public Investigation getInvestigation() {
return investigation;
}

public void setInvestigation(Investigation investigation) {
this.investigation = investigation;
}

public Institution getCreditCompany() {
return creditCompany;
}
Expand Down Expand Up @@ -2383,7 +2394,7 @@ public void generateDebtorBalanceReport(final boolean onlyDueBills) {
}

public ReportTemplateRowBundle generateDebtorBalanceReportBills(List<BillTypeAtomic> bts, List<PaymentMethod> billPaymentMethods,
boolean onlyDueBills) {
boolean onlyDueBills) {
Map<String, Object> parameters = new HashMap<>();
String jpql = "SELECT new com.divudi.data.ReportTemplateRow(bill) "
+ "FROM Bill bill "
Expand Down Expand Up @@ -2873,6 +2884,7 @@ public void externalLaboratoryWorkloadReport() {
opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_PAYMENT_COLLECTION_AT_CASHIER);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_WITH_PAYMENT);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_PAYMENT_COLLECTION_AT_CASHIER);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BILL_WITH_PAYMENT);
opdBts.add(BillTypeAtomic.OPD_BATCH_BILL_CANCELLATION);
opdBts.add(BillTypeAtomic.OPD_BILL_CANCELLATION);
opdBts.add(BillTypeAtomic.PACKAGE_OPD_BATCH_BILL_CANCELLATION);
Expand All @@ -2899,20 +2911,20 @@ public void externalLaboratoryWorkloadReport() {
private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List<BillTypeAtomic> bts) {
Map<String, Object> parameters = new HashMap<>();

String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) "
+ "FROM BillItem billItem "
+ "JOIN billItem.bill bill "
+ "LEFT JOIN PatientInvestigation pi ON pi.billItem = billItem "
+ "WHERE bill.billTypeAtomic IN :bts "
+ "AND bill.createdAt BETWEEN :fd AND :td ";

// String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) "
// + "FROM PatientInvestigation pi "
// + "JOIN pi.billItem billItem "
// + "FROM BillItem billItem "
// + "JOIN billItem.bill bill "
// + "WHERE pi.retired=false "
// + " and billItem.retired=false "
// + " and bill.retired=false ";
// + "LEFT JOIN PatientInvestigation pi ON pi.billItem = billItem "
// + "WHERE bill.billTypeAtomic IN :bts "
// + "AND bill.createdAt BETWEEN :fd AND :td ";

String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) "
+ "FROM PatientInvestigation pi "
+ "JOIN pi.billItem billItem "
+ "JOIN billItem.bill bill "
+ "WHERE pi.retired=false "
+ " and billItem.retired=false "
+ " and bill.retired=false ";

jpql += "AND bill.billTypeAtomic in :bts ";
parameters.put("bts", bts);
Expand All @@ -2930,8 +2942,8 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List
}

if (item != null) {
jpql += "AND billItem.patientInvestigation.investigation.name = :item ";
parameters.put("item", item.getName());
jpql += "AND billItem.item = :item ";
parameters.put("item", item);
}

if (institution != null) {
Expand Down Expand Up @@ -2973,13 +2985,13 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List
}

if (category != null) {
jpql += "AND billItem.patientInvestigation.investigation.category.id = :cat ";
jpql += "AND billItem.item.department.id = :cat ";
parameters.put("cat", category.getId());
}

if (investigationCode != null) {
jpql += "AND billItem.patientInvestigation.investigation.code = :code ";
parameters.put("code", investigationCode.getCode());
if (investigation != null) {
jpql += "AND billItem.item = :code ";
parameters.put("code", investigation);
}

jpql += "AND bill.createdAt BETWEEN :fd AND :td ";
Expand Down Expand Up @@ -3270,7 +3282,7 @@ private void groupBills() {

bundle.setGroupedBillItemsByInstitution(billMap);
}

public Double calculateNetTotalByBills(List<Bill> bills) {
Double netTotal = 0.0;

Expand All @@ -3291,7 +3303,7 @@ public Double calculateDiscountByBills(List<Bill> bills) {
return discount;
}


public Double calculateSubTotal() {
double subTotal = 0.0;
Map<Institution, List<Bill>> billMap = bundle.getGroupedBillItemsByInstitution();
Expand Down
22 changes: 11 additions & 11 deletions src/main/webapp/reports/lab/external_laboratory_workload.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -252,32 +252,31 @@
</h:panelGroup>
<p:autoComplete
id="acIx"
value="#{reportsController.investigationCode}"
completeMethod="#{opdBillController.completeOpdItemsByWord}"
value="#{reportsController.investigation}"
completeMethod="#{investigationController.completeInvest}"
var="ix"
onfocus="this.select();"
inputStyleClass="w-100"
itemLabel="#{ix.name}"
itemValue="#{ix}"
converter="itemLightConverter"
forceSelection="true"
scrollHeight="250"
multiple="false"
class="w-100">
<p:column headerText="Name" style="padding: 8px;">
<f:facet name="header">Name</f:facet>
<h:outputText value="#{ix.name}" />
<h:outputText value="#{ix.name}"/>
<h:panelGroup rendered="#{ix.name ne ix.fullName}">
<h:outputText value=" (#{ix.fullName})" />
<h:outputText value=" (#{ix.fullName})"/>
</h:panelGroup>
</p:column>
<p:column headerText="Dept" style="padding: 8px;">
<f:facet name="header">Dept</f:facet>
<h:outputText value="#{ix.departmentName}" />
<h:outputText value="#{ix.department.name}"/>
</p:column>
<p:column headerText="Code" style="padding: 8px;">
<f:facet name="header">Code</f:facet>
<h:outputText value="#{ix.code}" />
<h:outputText value="#{ix.code}"/>
</p:column>
</p:autoComplete>

Expand Down Expand Up @@ -352,7 +351,8 @@
</f:facet>

<p:column headerText="Sample ID" width="8rem">
<h:outputText value="#{row.billItem.item.code}"/>
<h:outputText
value="#{patientInvestigationController.getPatientSamplesByInvestigationAsString(row.billItem.patientInvestigation)}"/>
</p:column>
<p:column headerText="Invoice No" width="14rem">
<h:outputText value="#{row.billItem.patientEncounter != null ?
Expand All @@ -372,10 +372,10 @@
<h:outputText value="#{row.billItem.bill.patient.person.sex}"/>
</p:column>
<p:column headerText="Investigation" width="6rem">
<h:outputText value="#{row.billItem.patientInvestigation.investigation.name}"/>
<h:outputText value="#{row.billItem.item.name}"/>
</p:column>
<p:column headerText="Lab Department" width="5rem">
<h:outputText value="#{row.billItem.patientInvestigation.investigation.category.name}"/>
<h:outputText value="#{row.billItem.item.department.name}"/>
</p:column>
<p:column headerText="CC" width="5rem" rendered="#{reportsController.visitType eq 'CC'}">
<h:outputText value="#{row.billItem.bill.collectingCentre.name}"/>
Expand Down Expand Up @@ -406,7 +406,7 @@
<h:outputText value="#{row.billItem.patientInvestigation.creater.webUserPerson.name}"/>
</p:column>
<p:column headerText="Remarks" width="5rem">
<h:outputText value="#{row.billItem.patientInvestigation.investigation.comments}"/>
<h:outputText value="#{row.billItem.bill.comments}"/>
</p:column>
<p:column headerText="Patient Source" width="5rem">
<h:outputText value="#{row.billItem.bill.ipOpOrCc}"/>
Expand Down

0 comments on commit 78f0483

Please sign in to comment.