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

Issue#10275 fix interim bill don't get child encounter's items and fees #10276

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2ccd3a6
Merge pull request #10063
DamithDeshan Jan 11, 2025
9604797
Merge pull request #10090 from hmislk/10044-need-sqeuencial-bill-numb…
buddhika75 Jan 12, 2025
38553a7
Merge pull request #10091 from hmislk/10044-need-sqeuencial-bill-numb…
buddhika75 Jan 12, 2025
de1a5ec
Signed-off-by: Dr M H Buddhika Ariyaratne <[email protected]>
buddhika75 Jan 17, 2025
0f0d742
Closes #10125
buddhika75 Jan 17, 2025
b5269c4
Merge pull request #10127 from hmislk/10125-inpatient-pharmacy-issue-…
buddhika75 Jan 17, 2025
398ca26
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 19, 2025
201a59c
Merge branch 'Issue#10046-Pharmacy_Retail_Sale_Bill' into Issue#8678-…
DARKDRAGON-LK Jan 19, 2025
f67e70a
Added New Page to List OPD Cards
DARKDRAGON-LK Jan 19, 2025
1d730c0
Added Menu Item
DARKDRAGON-LK Jan 19, 2025
7c9da54
Added new Methods to New Page
DARKDRAGON-LK Jan 19, 2025
e9cfc9c
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 19, 2025
c7b4848
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 19, 2025
8fd3660
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 20, 2025
b27fef5
Add Navigation Methods to Convert to BHT
DARKDRAGON-LK Jan 20, 2025
4e302c2
Added New Method to Handle new Admission
DARKDRAGON-LK Jan 20, 2025
a2bdaec
Added New Variuble to Find converted or Not
DARKDRAGON-LK Jan 20, 2025
26d44f7
Added New View
DARKDRAGON-LK Jan 20, 2025
76df997
Fixed #8678
DARKDRAGON-LK Jan 20, 2025
44109e9
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 20, 2025
a712b15
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 21, 2025
0664652
Merge pull request #10212 from hmislk/development
buddhika75 Jan 24, 2025
e7945dc
Fixed Issue With OPD Card Can't Add Drugs
DARKDRAGON-LK Jan 24, 2025
ae28369
Removed Duplicated Method
DARKDRAGON-LK Jan 27, 2025
b40c65a
Add Method to Fetch Child Enconters and Modified Methods to get both …
DARKDRAGON-LK Jan 27, 2025
12bdec9
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 27, 2025
7804aec
Merge branch 'Coop_Prod_OPD_Card_Issue-24-01-25' of https://github.co…
DARKDRAGON-LK Jan 27, 2025
31bcbe6
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 27, 2025
2e9e05b
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 27, 2025
a65fd6c
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 27, 2025
6995a5a
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 28, 2025
b783042
Merge branch 'development' of https://github.com/hmislk/hmis.git into…
DARKDRAGON-LK Jan 29, 2025
435447e
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 29, 2025
3ce01b7
Signed-off-by: Lawan Samarasekara <[email protected]>
DARKDRAGON-LK Jan 29, 2025
e8023c7
Fixed #10275
DARKDRAGON-LK Jan 29, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public String navigatePatientAdmit() {
return "/inward/inward_admission?faces-redirect=true;";

}

public String navigateToConvertNonBhtToBht(Admission nonBhtAd) {
Admission ad = new Admission();
if (ad.getDateOfAdmission() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ public void saveConvertSelected() {
getCurrentNonBht().setParentEncounter(current);
getCurrentNonBht().setDischarged(true);
getCurrentNonBht().setDateOfDischarge(new Date());
getCurrentNonBht().setConvertedToBht(true);
getCurrentNonBht().setConvertedToAnotherEncounter(true);
getFacade().edit(currentNonBht);
currentNonBht = null;

Expand Down
159 changes: 137 additions & 22 deletions src/main/java/com/divudi/bean/inward/InwardBeanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public class InwardBeanController implements Serializable {
private PriceMatrixFacade priceMatrixFacade;
@EJB
private AdmissionFacade admissionFacade;
@EJB
private PatientEncounterFacade encounterFacade;
@Inject
BillBeanController billBean;
@Inject
Expand Down Expand Up @@ -459,11 +461,20 @@ public List<BillFee> createDoctorAndNurseFee(PatientEncounter patientEncounter)
+ " and type(bt.staff)!=:class "
+ " and bt.fee.feeType=:ftp "
+ " and (bt.bill.billType=:btp)"
+ " and bt.bill.patientEncounter=:pe ";
+ " and bt.bill.patientEncounter IN :pe ";
hm.put("class", Consultant.class);
hm.put("ftp", FeeType.Staff);
hm.put("btp", BillType.InwardProfessional);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);

return getBillFeeFacade().findByJpql(sql, hm, TemporalType.TIME);

Expand All @@ -476,12 +487,21 @@ public List<BillFee> createProfesionallFee(PatientEncounter patientEncounter) {
+ " and type(bt.staff)=:class "
+ " and bt.fee.feeType=:ftp "
+ " and (bt.bill.billType=:btp)"
+ " and bt.bill.patientEncounter=:pe "
+ " and bt.bill.patientEncounter IN :pe "
+ " order by bt.feeAdjusted desc ";
hm.put("class", Consultant.class);
hm.put("ftp", FeeType.Staff);
hm.put("btp", BillType.InwardProfessional);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);

return getBillFeeFacade().findByJpql(sql, hm, TemporalType.TIME);
//////// // System.out.println("Size : " + profesionallFee.size());
Expand Down Expand Up @@ -515,11 +535,20 @@ public void setProfesionallFeeAdjusted(PatientEncounter patientEncounter) {
+ " and type(bt.staff)=:class "
+ " and bt.fee.feeType=:ftp "
+ " and (bt.bill.billType=:btp)"
+ " and bt.bill.patientEncounter=:pe ";
+ " and bt.bill.patientEncounter in :pe ";
hm.put("class", Consultant.class);
hm.put("ftp", FeeType.Staff);
hm.put("btp", BillType.InwardProfessional);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);

List<BillFee> list = getBillFeeFacade().findByJpql(sql, hm);

Expand All @@ -539,12 +568,21 @@ public List<Bill> fetchIssueTable(PatientEncounter patientEncounter, BillType bi
+ " WHERE b.retired=false "
+ " and b.billType=:btp "
+ " and (b.billedBill is null ) "
+ " and b.patientEncounter=:pe"
+ " and b.patientEncounter IN :pe"
+ " and (type(b)=:class) ";
hm = new HashMap();
hm.put("btp", billType);
hm.put("class", PreBill.class);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);

List<Bill> bills = getBillFacade().findByJpql(sql, hm);

Expand All @@ -553,13 +591,22 @@ public List<Bill> fetchIssueTable(PatientEncounter patientEncounter, BillType bi
+ " WHERE b.retired=false "
+ " and b.billType=:btp"
+ " and type(b.billedBill)=:billedClass "
+ " and b.patientEncounter=:pe"
+ " and b.patientEncounter IN :pe"
+ " and (type(b)=:class) ";
hm = new HashMap();
hm.put("btp", billType);
hm.put("class", RefundBill.class);
hm.put("billedClass", PreBill.class);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts1 = new ArrayList<>();
pts1.add(patientEncounter);
List<PatientEncounter> cpts1 = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts1.size() > 0){
for(PatientEncounter pt : cpts1){
pts1.add(pt);
}
}
hm.put("pe", pts1);

List<Bill> bills2 = getBillFacade().findByJpql(sql, hm);

Expand Down Expand Up @@ -941,10 +988,19 @@ private List<Department> getToDepartmentList(PatientEncounter patientEncounter,
}

sql += " and Type(b.item)!=TimedItem "
+ " and b.bill.patientEncounter=:pe ";
+ " and b.bill.patientEncounter in :pe ";

hm.put("btp", BillType.InwardBill);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);

return getDepartmentFacade().findByJpql(sql, hm, TemporalType.TIME);
}
Expand All @@ -961,12 +1017,21 @@ private List<Item> getToDepartmentItems(PatientEncounter patientEncounter, Depar
}

sql += " and Type(b.item)!=TimedItem"
+ " and b.bill.patientEncounter=:pe"
+ " and b.bill.patientEncounter IN :pe"
+ " and b.bill.toDepartment=:dep "
+ " order by b.item.name ";

hm.put("btp", BillType.InwardBill);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);
hm.put("dep", department);

return getItemFacade().findByJpql(sql, hm, TemporalType.TIME);
Expand Down Expand Up @@ -1062,12 +1127,21 @@ private double calBillItemCount(Bill bill, Item item, PatientEncounter patientEn
hm.put("fB", forwardBill);
}

sql += " and b.bill.patientEncounter=:pe "
sql += " and b.bill.patientEncounter IN :pe "
+ " and b.item=:itm "
+ " and type(b.bill)=:cls";

hm.put("btp", BillType.InwardBill);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);
hm.put("itm", item);
hm.put("cls", bill.getClass());
double dbl = getBillItemFacade().countByJpql(sql, hm, TemporalType.TIME);
Expand Down Expand Up @@ -1101,11 +1175,20 @@ public List<Bill> fetchOutSideBill(PatientEncounter patientEncounter) {
String sql = "Select i From BilledBill i "
+ " where i.retired=false"
+ " and i.billType=:btp "
+ " and i.patientEncounter=:pe ";
+ " and i.patientEncounter in :pe ";

HashMap m = new HashMap();
m.put("btp", BillType.InwardOutSideBill);
m.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
m.put("pe", pts);
return getBillFacade().findByJpql(sql, m, TemporalType.DATE);

//return additionalChargeBill;
Expand Down Expand Up @@ -1142,14 +1225,37 @@ public double caltValueFromAdditionalCharge(InwardChargeType inwardChargeType, P

return val;
}

public List<PatientEncounter> fetchChildPatientEncounter(PatientEncounter patientEncounter){
List<PatientEncounter> cpt = new ArrayList<>();

HashMap hm = new HashMap();
String sql = "SELECT pe FROM PatientEncounter pe "
+ " where pe.parentEncounter = :pe "
+ " and pe.retired=false ";
hm.put("pe", patientEncounter);

cpt = encounterFacade.findByJpql(sql, hm);

return cpt;
}

public List<PatientItem> fetchPatientItem(PatientEncounter patientEncounter) {
HashMap hm = new HashMap();
String sql = "SELECT i FROM PatientItem i "
+ " where Type(i.item)=TimedItem "
+ " and i.retired=false "
+ " and i.patientEncounter=:pe";
hm.put("pe", patientEncounter);
+ " and i.patientEncounter in :pe";
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);
return getPatientItemFacade().findByJpql(sql, hm);
}

Expand All @@ -1159,9 +1265,18 @@ public List<Bill> fetchPaymentBill(PatientEncounter patientEncounter) {
String sql = "SELECT b FROM Bill b "
+ " WHERE b.retired=false "
+ " and b.billType=:btp "
+ " and b.patientEncounter=:pe ";
+ " and b.patientEncounter IN :pe ";
hm.put("btp", BillType.InwardPaymentBill);
hm.put("pe", patientEncounter);
List<PatientEncounter> pts = new ArrayList<>();
pts.add(patientEncounter);
List<PatientEncounter> cpts = fetchChildPatientEncounter(patientEncounter);
System.out.println("cpts = " + cpts);
if(cpts.size() > 0){
for(PatientEncounter pt : cpts){
pts.add(pt);
}
}
hm.put("pe", pts);
return getBillFacade().findByJpql(sql, hm, TemporalType.TIMESTAMP);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,10 @@ public void settlePharmacyBhtIssue() {
if (getPatientEncounter().getCurrentPatientRoom() == null) {
matrixDept = getSessionController().getDepartment();
}
if (getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge() != null) {
matrixDept = getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge().getDepartment();
if (getPatientEncounter().getCurrentPatientRoom() != null) {
if (getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge() != null) {
matrixDept = getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge().getDepartment();
}
}

} else if (matrixByIssuingDepartment) {
Expand Down Expand Up @@ -1404,7 +1406,7 @@ public void calculateRates(BillItem bi) {
double grossValue;
double netValue;

Department matrixDept=null;
Department matrixDept = null;
boolean matrixByAdmissionDepartment;
boolean matrixByIssuingDepartment;
matrixByAdmissionDepartment = configOptionApplicationController.getBooleanValueByKey("Price Matrix is calculated from Inpatient Department for " + sessionController.getDepartment().getName(), true);
Expand All @@ -1416,8 +1418,10 @@ public void calculateRates(BillItem bi) {
if (getPatientEncounter().getCurrentPatientRoom() == null) {
matrixDept = getSessionController().getDepartment();
}
if (getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge() != null) {
matrixDept = getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge().getDepartment();
if (getPatientEncounter().getCurrentPatientRoom() != null) {
if (getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge() != null) {
matrixDept = getPatientEncounter().getCurrentPatientRoom().getRoomFacilityCharge().getDepartment();
}
}

} else if (matrixByIssuingDepartment) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/divudi/entity/PatientEncounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class PatientEncounter implements Serializable, RetirableEntity {
private Staff referringConsultant;
@ManyToOne
private Staff referringStaff;
private boolean convertedToBht;
private boolean convertedToAnotherEncounter;

// Transient method for BP
public String getBp() {
Expand Down Expand Up @@ -1031,12 +1031,12 @@ public void setGuardianRelationshipToPatient(Item guardianRelationshipToPatient)
this.guardianRelationshipToPatient = guardianRelationshipToPatient;
}

public boolean isConvertedToBht() {
return convertedToBht;
public boolean isConvertedToAnotherEncounter() {
return convertedToAnotherEncounter;
}

public void setConvertedToBht(boolean convertedToBht) {
this.convertedToBht = convertedToBht;
public void setConvertedToAnotherEncounter(boolean convertedToAnotherEncounter) {
this.convertedToAnotherEncounter = convertedToAnotherEncounter;
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/inward/inpatient_search_without_room.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
icon="fa fa-repeat"
title="Convert to BHT"
action="#{patientController.navigateToConvertNonBhtToBht(a)}"
disabled="#{a.convertedToBht}">
disabled="#{a.convertedToAnotherEncounter}">
<f:setPropertyActionListener value="#{a}" target="#{admissionController.current}" />
</p:commandButton>

Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/inward/inward_bill_final.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<div>
<p:commandButton update="dList tot" value="Process"
actionListener="#{bhtSummeryController.updateTotal()}"
ajax="false"
class="ui-button-warning" icon="fas fa-cog"
style="width: 150px; padding: 1px; margin: auto;" />
<p:commandButton value="Settle" action="#{bhtSummeryController.settle}"
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/inward/inward_bill_service.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
ajax="false"
value="Inpatient Dashboard"
icon="fa fa-id-card"
class="ui-button-warning m-1"
class="ui-button-secondary m-1"
action="#{bhtSummeryController.navigateToInpatientProfile()}"
>
<f:setPropertyActionListener
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/inward/inward_room_change.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<p:commandButton
ajax="false"
icon="fa-solid fa-address-card"
class="ui-button-info mx-1"
class="ui-button-secondary mx-1"
value="Inpatient Dashboard"
action="#{admissionController.navigateToAdmissionProfilePage}"
>
Expand Down