Skip to content

Commit

Permalink
Merge pull request #6636 from hmislk/Issue#6194
Browse files Browse the repository at this point in the history
Issue#6194 Closes #6194
  • Loading branch information
DeshaniPubudu authored Jul 27, 2024
2 parents 1bff55e + d8574a1 commit 5f5e048
Show file tree
Hide file tree
Showing 26 changed files with 515 additions and 89 deletions.
1 change: 1 addition & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ 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>
<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>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
</properties>
</project-shared-configuration>
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<artifactId>vfs</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>ruhunu-demo</name>
<name>sethmademo</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/com/divudi/bean/common/BillBeanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.divudi.bean.inward.InwardBeanController;
import com.divudi.data.BillFeeBundleEntry;
import com.divudi.data.BillType;
import com.divudi.data.BillTypeAtomic;
import com.divudi.data.FeeType;
import com.divudi.data.OpdBillingStrategy;
import com.divudi.data.OpdTokenNumberGenerationStrategy;
Expand Down Expand Up @@ -2483,6 +2484,51 @@ public Double[] fetchBillItemValues(Bill b) {
return dbl;
}

public List<Bill> validBillsOfBatchBill(Bill batchBill) {
String j = "Select b "
+ " from Bill b "
+ " where b.backwardReferenceBill=:bb "
+ " and b.cancelled=false";
Map m = new HashMap();
m.put("bb", batchBill);
List<Bill> tbs = billFacade.findByJpql(j, m);
return tbs;
}

public List<Bill> findValidBillsForSampleCollection(Long bill) {
Bill b = billFacade.find(bill);

if (b == null) {
return null;
}
return findValidBillsForSampleCollection(b);
}

public List<Bill> findValidBillsForSampleCollection(Bill b) {

if (b == null) {
return null;
}
List<Bill> bs = new ArrayList<>();
if (b.getBillTypeAtomic() != null) {
if (b.getBillTypeAtomic() == BillTypeAtomic.OPD_BATCH_BILL_WITH_PAYMENT
|| b.getBillTypeAtomic() == BillTypeAtomic.OPD_BATCH_BILL_TO_COLLECT_PAYMENT_AT_CASHIER) {
bs.addAll(validBillsOfBatchBill(b));
return bs;
} else {
bs.add(b);
return bs;
}
}
if (b.getBillType() == BillType.OpdBathcBill) {
bs.addAll(validBillsOfBatchBill(b));
return bs;
} else {
bs.add(b);
return bs;
}
}

public Double[] fetchBillFeeValues(Bill b) {
String sql = "Select sum(bf.feeGrossValue),sum(bf.feeDiscount),sum(bf.feeValue),sum(bf.feeVat) "
+ " from BillFee bf where "
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/com/divudi/bean/common/EnumController.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class EnumController implements Serializable {
List<PaymentMethod> paymentMethodsForOpdBilling;
List<PaymentMethod> paymentMethodsForChanneling;
List<PaymentMethod> paymentMethodsForPharmacyBilling;
List<PaymentMethod> paymentMethodsForPatientDeposit;
private List<PaymentMethod> paymentMethodsForPatientDeposit;
SessionNumberType[] sessionNumberTypes;

@PostConstruct
Expand All @@ -91,12 +91,6 @@ public List<PaymentMethod> getPaymentMethodsForOpdBilling() {
return paymentMethodsForOpdBilling;
}

public List<PaymentMethod> getPaymentMethodsForPatientDeposit() {
if (paymentMethodsForPatientDeposit == null) {
fillPaymentMethodsForPatientDeposit();
}
return paymentMethodsForPatientDeposit;
}

public List<PaymentMethod> getPaymentMethodsForPackageBilling() {
if (paymentMethodsForOpdBilling == null) {
Expand Down Expand Up @@ -808,4 +802,19 @@ public void setPaymentScheme(PaymentScheme paymentScheme) {
this.paymentScheme = paymentScheme;
}

public List<PaymentMethod> getPaymentMethodsForPatientDeposit() {
paymentMethodsForPatientDeposit = new ArrayList<>();
for (PaymentMethod pm : PaymentMethod.values()) {
boolean include = configOptionApplicationController.getBooleanValueByKey(pm.getLabel() + " is available for Patient Deposit", true);
if (include) {
paymentMethodsForPatientDeposit.add(pm);
}
}
return paymentMethodsForPatientDeposit;
}

public void setPaymentMethodsForPatientDeposit(List<PaymentMethod> paymentMethodsForPatientDeposit) {
this.paymentMethodsForPatientDeposit = paymentMethodsForPatientDeposit;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private TreeNode<PrivilegeHolder> createPrivilegeHolderTreeNodes() {
TreeNode OpdLabReportSearchNode = new DefaultTreeNode(new PrivilegeHolder(Privileges.OpdLabReportSearch, "Lab Report Search"), opdNode);
TreeNode opdBillSearchEditNode = new DefaultTreeNode(new PrivilegeHolder(Privileges.OpdBillSearchEdit, "OPD Bill Search Edit (Patient Details)"), opdNode);
TreeNode OpdReprintOriginalBillNode = new DefaultTreeNode(new PrivilegeHolder(Privileges.OpdReprintOriginalBill, "Reprint the Original Bill"), opdNode);
TreeNode addCreditLimit = new DefaultTreeNode(new PrivilegeHolder(Privileges.AddCreditLimitInRegistration, "Add Credit Limit During Patient Registration"), opdNode);

TreeNode inwardNode = new DefaultTreeNode(new PrivilegeHolder(null, "Inward"), allNode);
TreeNode inwardMenuNode = new DefaultTreeNode(new PrivilegeHolder(Privileges.Inward, "Inward Menu"), inwardNode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.divudi.bean.lab;

import com.divudi.bean.common.BillBeanController;
import com.divudi.bean.common.BillController;
import com.divudi.bean.common.CommonController;
import com.divudi.bean.common.ConfigOptionApplicationController;
Expand Down Expand Up @@ -126,6 +127,8 @@ public class PatientInvestigationController implements Serializable {
@Inject
CommonController commonController;
@Inject
BillBeanController billBeanController;
@Inject
private InvestigationItemController investigationItemController;
@Inject
private BillController billController;
Expand Down Expand Up @@ -1176,6 +1179,8 @@ public void prepareToSample() {
}

public void generateBarcodesForSelectedBills() {
System.out.println("generateBarcodesForSelectedBills");
System.out.println("selectedBillBarcodes = " + selectedBillBarcodes);
if (selectedBillBarcodes == null) {
JsfUtil.addErrorMessage("No Bills Seelcted");
return;
Expand All @@ -1185,16 +1190,26 @@ public void generateBarcodesForSelectedBills() {
return;
}
for (BillBarcode bb : selectedBillBarcodes) {
List<Bill> bs = new ArrayList<>();
bs.add(bb.getBill());
System.out.println("bb = " + bb);
List<Bill> bs = billBeanController.findValidBillsForSampleCollection(bb.getBill());
System.out.println("bs = " + bs);
List<PatientSampleWrapper> psws = new ArrayList<>();
List<PatientSample> pss = prepareSampleCollectionByBillsForRequestss(bs, sessionController.getLoggedUser());
if(pss!=null){
for(PatientSample ps:pss){
System.out.println("pss = " + pss);
if (pss != null) {
for (PatientSample ps : pss) {
System.out.println("ps = " + ps);
PatientSampleWrapper ptsw = new PatientSampleWrapper(ps);
psws.add(ptsw);
}
}
for (PatientInvestigationWrapper piw : bb.getPatientInvestigationWrappers()) {
piw.getPatientInvestigation().setBarcodeGenerated(true);
piw.getPatientInvestigation().setBarcodeGeneratedAt(new Date());
piw.getPatientInvestigation().setBarcodeGeneratedBy(sessionController.getLoggedUser());
ejbFacade.edit(piw.getPatientInvestigation());
}
System.out.println("psws = " + psws);
bb.setPatientSampleWrappers(psws);
}

Expand Down Expand Up @@ -1227,6 +1242,24 @@ public void listBillsToGenerateBarcodes() {
billBarcodes = createBilBarcodeObjects(pis);
}

public void listBillsWithGeneratedBarcodes() {
String temSql;
Map temMap = new HashMap();
temSql = "SELECT i "
+ " FROM PatientInvestigation i "
+ " where i.retired=:ret "
+ " and i.barcodeGenerated=:bg "
+ " and i.billItem.bill.billDate between :fromDate and :toDate "
+ " order by i.id desc";
temMap.put("fromDate", getFromDate());
temMap.put("toDate", getToDate());
temMap.put("ret", false);
temMap.put("bg", true);
billBarcodes = new ArrayList<>();
List<PatientInvestigation> pis = getFacade().findByJpql(temSql, temMap, TemporalType.TIMESTAMP);
billBarcodes = createBilBarcodeObjects(pis);
}

private List<BillBarcode> createBilBarcodeObjects(List<PatientInvestigation> ptis) {
Map<Bill, BillBarcode> billBarcodeMap = new HashMap<>();
for (PatientInvestigation pi : ptis) {
Expand Down Expand Up @@ -2147,6 +2180,9 @@ public void setCommonController(CommonController commonController) {
}

public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill> bills, WebUser wu) {
System.out.println("wu = " + wu);
System.out.println("bills = " + bills);
System.out.println("wu = " + wu);
String j = "";
Map m;
Map<Long, PatientSample> rPatientSamplesMap = new HashMap<>();
Expand All @@ -2156,19 +2192,21 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>
}

for (Bill b : bills) {
System.out.println("b = " + b);
m = new HashMap();
m.put("can", false);
m.put("bill", b);
j = "Select pi from PatientInvestigation pi "
+ " where pi.cancelled=:can "
+ " and pi.billItem.bill=:bill";
List<PatientInvestigation> pis = ejbFacade.findByJpql(j, m);

System.out.println("pis = " + pis);
if (pis == null) {
return null;
}

for (PatientInvestigation ptix : pis) {
System.out.println("ptix = " + ptix);

Investigation ix = ptix.getInvestigation();

Expand All @@ -2190,12 +2228,14 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>
}

for (InvestigationItem ixi : ixis) {
System.out.println("ixi = " + ixi);

if (ixi.getIxItemType() == InvestigationItemType.Value) {

System.out.println("ixi.getTube() = " + ixi.getTube());
if (ixi.getTube() == null) {
continue;
}
System.out.println("ixi.getSample() = " + ixi.getSample());
if (ixi.getSample() == null) {
continue;
}
Expand All @@ -2222,8 +2262,10 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>
j += " and ps.investigationComponant=:sc ";
m.put("sc", ixi.getSampleComponent());
}

System.out.println("j = " + j);
System.out.println("m = " + m);
PatientSample pts = patientSampleFacade.findFirstByJpql(j, m);
System.out.println("pts = " + pts);
if (pts == null) {
pts = new PatientSample();

Expand All @@ -2246,6 +2288,7 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>
pts.setReadyTosentToAnalyzer(false);
pts.setSentToAnalyzer(false);
patientSampleFacade.create(pts);
System.out.println("new pts = " + pts);
}
rPatientSamplesMap.put(pts.getId(), pts);

Expand All @@ -2272,8 +2315,11 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>

m.put("ixc", ixi.getSampleComponent());

ptsc = patientSampleComponantFacade.findFirstByJpql(j, m);
System.out.println("j = " + j);
System.out.println("m = " + m);

ptsc = patientSampleComponantFacade.findFirstByJpql(j, m);
System.out.println("ptsc = " + ptsc);
if (ptsc == null) {
ptsc = new PatientSampleComponant();
ptsc.setPatientSample(pts);
Expand All @@ -2295,6 +2341,22 @@ public List<PatientSample> prepareSampleCollectionByBillsForRequestss(List<Bill>
return rPatientSamples;
}

public List<PatientSampleComponant> getPatientSampleComponentsByPatientSample(PatientSample patientSample) {
List<PatientSampleComponant> ptsc;
String j;
Map m = new HashMap();
j = "select ps from PatientSampleComponant ps "
+ " where ps.patientSample=:pts "
+ " and ps.retired=false ";
m = new HashMap();
m.put("pts", patientSample);
System.out.println("j = " + j);
System.out.println("m = " + m);
ptsc = patientSampleComponantFacade.findByJpql(j, m);
System.out.println("ptsc = " + ptsc);
return ptsc;
}

public List<InvestigationItem> getItems(Investigation ix) {
List<InvestigationItem> iis;
if (ix == null) {
Expand Down
Loading

0 comments on commit 5f5e048

Please sign in to comment.