Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Laboratory Workload Report #9762 #9772

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 30 additions & 19 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 @@ -312,14 +313,15 @@ public class ReportsController implements Serializable {
private String settlementStatus;
private String dischargedStatus;

private Investigation investigation;

// Map<Week, Map<ItemName, Map<dayOfMonth, Count>>>
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap7to7;
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap7to1;
Map<Integer, Map<String, Map<Integer, Double>>> weeklyDailyBillItemMap1to7;

private boolean showChart;


public String getDischargedStatus() {
return dischargedStatus;
}
Expand Down Expand Up @@ -361,6 +363,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 @@ -3057,6 +3067,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 @@ -3083,20 +3094,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 @@ -3114,8 +3125,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 @@ -3157,13 +3168,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
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