@extends('hms.layout') @section('title','Visit details') @section('content')

{{ $patient->first_name }} {{ $patient->last_name }}

Appointment: {{ $visit->scheduled_at->format('d M Y, H:i') }} · {{ ucfirst(str_replace('_',' ',$visit->status)) }}
@if($encounter)Print prescriptions & advice@endif

Reception

Patient registered by
{{ ($staff[$patient->registered_by]??null)?->name ?? 'Not recorded' }}
Appointment booked by
{{ ($staff[$visit->registered_by]??null)?->name ?? 'Not recorded' }}
Checked in by
{{ ($staff[$visit->checked_in_by]??null)?->name ?? 'Not recorded' }}
Check-in time
{{ $visit->checked_in_at?->format('d M Y H:i')??'Pending' }}

Practitioner

{{ ($staff[$visit->physician_user_id]??null)?->name ?? 'Unassigned' }}

Visit: {{ str_replace('_',' ',$visit->status) }}

@if($showClinical) @if(auth()->check() && $showClinical && $triage->isEmpty() && $visit->status==='checked_in')
Awaiting visit-specific vital signs. @if(\App\Models\Hms\Membership::where('user_id',auth()->id())->where('organization_id',$visit->organization_id)->value('role')==='nurse')Record vitals for this visit@else Nursing staff must complete triage before consultation. @endif
@endif

Triage and vital signs

@forelse($triage as $v)
{{ $v->created_at->format('d M Y H:i') }} · Nurse: {{ ($staff[$v->recorded_by]??null)?->name ?? 'Unknown' }} · Temperature {{ $v->temperature_c??'—' }}°C · BP {{ $v->systolic_bp??'—' }}/{{ $v->diastolic_bp??'—' }} · Pulse {{ $v->pulse_bpm??'—' }} · SpO₂ {{ $v->oxygen_saturation??'—' }}% · {{ ucfirst($v->priority) }}
{{ $v->notes }}
@empty

No vitals linked to this appointment.

@endforelse

Consultation

@if($encounter)
Consulted by
{{ ($staff[$encounter->clinician_user_id]??null)?->name ?? 'Unknown' }}
Chief complaint
{{ $encounter->chief_complaint }}
Findings
{{ $encounter->clinical_notes }}
Assessment
{{ $encounter->assessment }}
Treatment plan
{{ $encounter->plan }}
Lifestyle advice
{{ $encounter->lifestyle_advice }}
@else

Awaiting consultation.

@endif

Laboratory requests and findings

@forelse($labs as $lab)
{{ $lab->test_name }} · {{ str_replace('_',' ',$lab->status) }}
Requested {{ $lab->created_at->format('d M Y H:i') }}
{{ $lab->result_text ?? 'Awaiting result' }}
Technician: {{ ($staff[$lab->result_recorded_by]??null)?->name ?? 'Pending' }}
@empty

No lab requests.

@endforelse

Prescriptions

@forelse($prescriptions as $rx)
{{ $rx->medication_name }} — {{ $rx->dose }} · {{ $rx->frequency }} · {{ $rx->duration }}
{{ $rx->instructions }}
{{ $rx->fulfillment==='internal'?'Facility pharmacy':'External pharmacy' }} · {{ $rx->status }}
@empty

No medications prescribed.

@endforelse
@if($referrals->isNotEmpty())

Specialist referrals

@foreach($referrals as $ref)

{{ $ref->reason }} · {{ $ref->status }}

@endforeach
@endif
@else
Clinical observations, results and prescriptions are available only to authorized clinical staff.
@endif @endsection