*/ public const NURSING_ROLES = [ 'nurse', 'ed_nurse', 'theatre_nurse', 'labour_ward_nurse', 'fertility_nurse', 'dialysis_nurse', 'midwife', ]; /** * @return Collection */ public function nurseRegistry(Organization $organization, string $ownerRef): Collection { return Member::owned($ownerRef) ->where('organization_id', $organization->id) ->whereIn('role', self::NURSING_ROLES) ->with('branch') ->orderBy('role') ->get(); } /** * Active placements for nursing staff today. * * @return Collection */ public function activeAllocations(Organization $organization, string $ownerRef): Collection { return StaffAssignment::owned($ownerRef) ->where('organization_id', $organization->id) ->where('status', 'active') ->unitPlacements() ->effectiveOn(now()) ->whereHas('member', fn ($q) => $q->whereIn('role', self::NURSING_ROLES)) ->with(['member', 'careUnit.department', 'department']) ->orderBy('care_unit_id') ->get(); } /** * Care units useful for nursing ops (inpatient / outpatient / float / service). * * @return Collection */ public function careUnits(Organization $organization, string $ownerRef): Collection { return CareUnit::owned($ownerRef) ->where('organization_id', $organization->id) ->where('is_active', true) ->with('department.branch') ->orderBy('name') ->get(); } /** * @param Collection $members * @return array */ public function memberLabels(Collection $members): array { return app(RosterService::class)->memberLabels($members); } }