Skip to content

Bed 17-Queries for BedPatientAssignment should account for the voided field #80

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ public Location getWardForBed(Bed bed) {
@Override
public BedPatientAssignment getBedPatientAssignmentByUuid(String uuid) {
Session session = sessionFactory.getCurrentSession();
return (BedPatientAssignment) session.createQuery("from BedPatientAssignment bpa " + "where bpa.uuid = :uuid")
.setParameter("uuid", uuid).uniqueResult();
return (BedPatientAssignment) session.createQuery("from BedPatientAssignment bpa " +
"where bpa.uuid = :uuid AND bpa.voided =false")
.setParameter("uuid", uuid)
.uniqueResult();
}

@Override
Expand Down Expand Up @@ -119,7 +121,11 @@ public List<BedPatientAssignment> getBedPatientAssignmentByVisit(String visitUui
public List<BedPatientAssignment> getCurrentAssignmentsByBed(Bed bed) {
Session session = sessionFactory.getCurrentSession();
List<BedPatientAssignment> assignments = session
.createQuery("from BedPatientAssignment where bed=:bed and endDatetime is null").setParameter("bed", bed)
.createQuery("from BedPatientAssignment bpa " +
"where bpa.bed=:bed " +
"AND bpa.voided =false " +
"AND bpa.endDatetime is NULL")
.setParameter("bed", bed)
.list();
return assignments;
}
Expand Down