@php $patient = $order->patient; $items = $order->items; $resulted = $items->filter(fn ($item) => $item->result_value !== null || filled($item->result_text) || $item->radiologyReport); $verified = $items->filter(fn ($item) => $item->status === 'verified'); $critical = $items->filter(fn ($item) => in_array($item->flag, ['critical_high', 'critical_low'], true)); $abnormal = $items->filter(fn ($item) => $item->flag && ! in_array($item->flag, ['normal', 'negative', 'critical_high', 'critical_low'], true)); $isFinal = $items->isNotEmpty() && $verified->count() === $items->count(); $flagText = [ 'normal' => 'Normal', 'high' => 'High', 'low' => 'Low', 'critical_high' => 'CRITICAL HIGH', 'critical_low' => 'CRITICAL LOW', 'abnormal' => 'Abnormal', 'positive' => 'Positive', 'negative' => 'Negative', ]; $flagColors = [ 'normal' => '#166534', 'high' => '#b45309', 'low' => '#1d4ed8', 'critical_high' => '#b91c1c', 'critical_low' => '#b91c1c', 'abnormal' => '#b45309', 'positive' => '#b45309', 'negative' => '#166534', ]; $trim = fn ($value) => rtrim(rtrim(number_format((float) $value, 4), '0'), '.'); @endphp
| Patient | {{ $patient?->full_name ?? '—' }} | MRN | {{ $patient?->medical_record_number ?? '—' }} |
| Age / sex | {{ $patient?->age_display ?? '—' }} · {{ $patient?->gender_label ?? '—' }} | Phone | {{ $patient?->phone ?? '—' }} |
| Visit | {{ $order->visit?->visit_no ?? '—' }} @if ($order->visit?->token_number) · token {{ $order->visit->token_number }} @endif | Encounter | {{ $order->encounter?->encounter_no ?? '—' }} |
{{ $order->clinical_notes }}
@endifNo results on this request yet.
@else| # | Test | Result | Reference | Verified by |
|---|---|---|---|---|
| {{ $index + 1 }} |
{{ $item->test_name }}
@if ($item->labTest?->code){{ $item->labTest->code }}@endif
@if ($item->panel)
Panel: {{ $item->panel->name }}
@endif
@if ($item->result_value !== null)
@if ($item->previous_result !== null)
Previous {{ $trim($item->previous_result) }}
@if ($item->delta_pct !== null)
· {{ $item->delta_pct > 0 ? '+' : '' }}{{ $trim(abs((float) $item->delta_pct)) }}% delta
@endif
@endif
@if ($item->delta_check && $item->previous_result !== null)
· {{ $item->delta_check_label }}
@endif
@endif
@if ($item->comments)
Note: {{ $item->comments }}
@endif
|
@if ($item->result_value !== null) {{ $trim($item->result_value) }} {{ $item->result_unit }} @elseif (filled($item->result_text)) {{ $item->result_text }} @else — @endif @if ($item->flag) {{ $flagLabel }} @endif | @if ($item->result_value !== null) {{ $refRange ?? '—' }} @else — @endif |
@if ($item->verifiedBy)
{{ $item->verifiedBy->name }} @if ($item->verified_at) {{ $item->verified_at->format('d M Y H:i') }} @endif digitally signed @elseif ($item->performedBy) {{ $item->performedBy->name }} entered, awaiting verification @else pending @endif |
{{ $item->radiologyReport->study_name ?: $item->test_name }}@if ($item->radiologyReport->technique)Technique Findings Impression Recommendation |
||||
{{ $abnormal->count() }} line(s) sit outside the reference range @if ($abnormal->count() <= 4) ({{ $abnormal->map(fn ($item) => $item->test_name)->implode(', ') }}) @endif — interpret alongside the clinical picture.
@endif|
Verified by
@if ($verified->first()?->verifiedBy)
— {{ $verified->first()->verifiedBy->name }}
@endif
|
Pathologist / radiologist
@if ($items->first()?->radiologyReport?->radiologist)
— {{ $items->first()->radiologyReport->radiologist->name }}
@endif
|
Received by (clinician or patient)
|