@extends('hms.layout') @section('title','Inpatient beds and admissions') @section('content')

Recommended admissions await bed assignment. Admitted patients are listed with their exact ward, room and bed.

@php($role=\App\Models\Hms\Membership::where('organization_id',session('hms_organization_id'))->where('user_id',auth()->id())->value('role')) @if(in_array($role,['nurse','organization_manager','admin'],true) && $admissions->where('status','recommended')->count()>0)
Bed allocation requests: {{ $admissions->where('status','recommended')->count() }} patient(s) awaiting assignment. Oldest recommendations appear first.
@endif

Current inpatients and recommendations

@forelse($admissions as $a) @php($bed=$beds->firstWhere('id',$a->bed_id)) @php($room=$bed?$rooms->firstWhere('id',$bed->room_id):null) @empty@endforelse
PatientStatusWard / room / bedReasonAction
{{ ($patients[$a->patient_id]??null)?->first_name }} {{ ($patients[$a->patient_id]??null)?->last_name }} {{ ucfirst($a->status) }} {{ $room ? (($room->ward?:'Unassigned ward').' / '.$room->name.' / '.$bed->label) : 'Not assigned' }} {{ $a->reason }} @if($a->status==='recommended' && in_array($role,['nurse','organization_manager','admin'],true))
@csrf
@elseif($a->status==='admitted' && in_array($role,['physician','organization_manager','admin'],true))
@csrf
@endif
No active admissions or recommendations.

Room and bed directory

@foreach($beds as $bed) @php($room=$rooms->firstWhere('id',$bed->room_id)) @endforeach
WardRoomBedStatus
{{ $room?->ward?:'—' }}{{ $room?->name }}{{ $bed->label }}{{ !$bed->in_service?'Out of service':(in_array($bed->id,$occupied)?'Occupied':'Available') }}
@if(in_array($role,['organization_manager','admin'],true))

Add room

@csrf

Add bed

@csrf
@endif @endsection