diff --git a/src/app/group-manager/group-detail/group-detail.component.ts b/src/app/group-manager/group-detail/group-detail.component.ts index 101dabc5b..075f58658 100644 --- a/src/app/group-manager/group-detail/group-detail.component.ts +++ b/src/app/group-manager/group-detail/group-detail.component.ts @@ -379,12 +379,33 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit { } } + checkIfDrugPickupFilled(cohortVisit, patient) { + let xx = false; + const drugPickupUuid = '987009c6-6f24-43f7-9640-c285d6553c63'; + + cohortVisit.cohortMemberVisits.filter((cmv) => { + if (cmv.visit.patient.uuid === patient.person.uuid) { + cmv.visit.encounters.forEach((en) => { + if ( + en.encounterType.uuid === drugPickupUuid && + Moment(cmv.visit.startDatetime).format('DD MMMM YYYY') === + Moment(en.encounterDatetime).format('DD MMMM YYYY') + ) { + xx = true; + } + }); + } + }); + + return xx; + } + private patientPresent(patient, cohortVisit) { let present = false; const patientVisit = cohortVisit.cohortMemberVisits.find((v) => { return v.visit.patient.uuid === patient.person.uuid; }); - if (patientVisit) { + if (patientVisit && this.checkIfDrugPickupFilled(patient, cohortVisit)) { present = true; } return present;