@extends('layouts.app') @section('title', $patient->name) @section('content') @php $severeAllergies = $patient->allergies->whereIn('severity', ['moderate','severe']); @endphp
{{ $patient->initials }}
Patients · {{ $patient->mrn }}

{{ $patient->name }}

{{ $patient->age !== null ? $patient->age.' years' : 'Age unknown' }} @if($patient->gender) · {{ ucfirst($patient->gender) }} @endif @if($patient->blood_group) · Blood {{ $patient->blood_group }} @endif @if($patient->phone) · {{ $patient->phone }} @endif

Book visit Add labs Prescribe
@if($severeAllergies->isNotEmpty())
Allergy alert: {{ $severeAllergies->pluck('allergen')->implode(', ') }}
@endif
{{-- ============ OVERVIEW ============ --}}

Demographics

Edit →
MRN
{{ $patient->mrn }}
Date of birth
{{ optional($patient->date_of_birth)->format('j M Y') ?? '—' }}
Phone
{{ $patient->phone ?: '—' }}
Email
{{ $patient->email ?: '—' }}
Address
{{ $patient->address ?: '—' }}
Emergency
{{ $patient->emergency_contact_name ? $patient->emergency_contact_name.' · '.$patient->emergency_contact_phone : '—' }}
@if($patient->notes)
Clinical notes

{{ $patient->notes }}

@endif

Active conditions

@php($active = $patient->medicalHistories->whereIn('status',['active','chronic'])) @if($active->isNotEmpty())
@foreach($active as $h) {{ $h->condition }} @endforeach
@else

No active conditions recorded.

@endif

Latest results

All trends →
@php($latestReport = $patient->labReports->first()) @if($latestReport && $latestReport->results->isNotEmpty())
@foreach($latestReport->results->take(6) as $r) @endforeach
TestValueRange
{{ $r->test_name }} {{ $r->display_value }} {{ $r->unit }} {{ $r->ref_low !== null || $r->ref_high !== null ? trim(($r->ref_low!==null?rtrim(rtrim(number_format($r->ref_low,3),'0'),'.'):'').' – '.($r->ref_high!==null?rtrim(rtrim(number_format($r->ref_high,3),'0'),'.'):'')) : '—' }}
From {{ $latestReport->panel ?: 'report' }} · {{ $latestReport->report_date->format('j M Y') }}
@else
No lab results yet.
@endif
{{-- ============ HISTORY & ALLERGIES ============ --}}

Medical history

@forelse($patient->medicalHistories as $h)
{{ $h->condition }} {{ ucfirst($h->status) }}
@if($h->diagnosed_on) Diagnosed {{ $h->diagnosed_on->format('M Y') }} @endif @if($h->notes) · {{ $h->notes }} @endif
@csrf @method('DELETE')
@empty
No past history recorded.
@endforelse
@csrf

Allergies

@forelse($patient->allergies as $a)
{{ $a->allergen }} {{ ucfirst($a->severity) }}
@if($a->reaction)
{{ $a->reaction }}
@endif
@csrf @method('DELETE')
@empty
No known allergies.
@endforelse
@csrf
{{-- ============ LAB TRENDS (signature) ============ --}}

Each marker is one result over time. The shaded band is the reference range — points outside it are flagged.

Add lab report
@if($trends->isNotEmpty())
@foreach($trends as $name => $t) @php $pts = collect($t['points']); $last = $pts->last(); $prev = $pts->count() > 1 ? $pts[$pts->count()-2] : null; $delta = $prev ? $last['value'] - $prev['value'] : null; @endphp
{{ $name }} {{ rtrim(rtrim(number_format($last['value'],3),'0'),'.') }} {{ $t['unit'] }}
{{ $pts->count() }} {{ Str::plural('reading', $pts->count()) }} @if($delta !== null) · {{ $delta > 0 ? '▲' : '▼' }} {{ rtrim(rtrim(number_format(abs($delta),3),'0'),'.') }} since last @endif
@endforeach
@else
No numeric lab results yet. Add a report to start tracking trends.
@endif

Lab reports

@forelse($patient->labReports as $lab)
{{ $lab->panel ?: 'Lab report' }}
{{ $lab->report_date->format('j M Y') }} @if($lab->lab_name) · {{ $lab->lab_name }} @endif · {{ $lab->results->count() }} {{ Str::plural('test', $lab->results->count()) }}
@if($lab->attachment_path)File@endif View
@empty
No reports yet.
@endforelse
{{-- ============ APPOINTMENTS ============ --}}

Visit history

Book appointment
@forelse($patient->appointments as $appt)
{{ $appt->scheduled_at->format('j M Y') }}
{{ $appt->scheduled_at->format('g:i A') }}
{{ $appt->reason ?: 'Consultation' }}
@if($appt->notes)
{{ $appt->notes }}
@endif
{{ ucfirst(str_replace('_',' ',$appt->status)) }}
@empty
No appointments recorded.
@endforelse
{{-- ============ PRESCRIPTIONS ============ --}}

Prescriptions

New prescription
@forelse($patient->prescriptions as $rx)

{{ $rx->diagnosis ?: 'Prescription' }}

{{ $rx->prescribed_on->format('j M Y') }}
Open
@foreach($rx->items as $item)
{{ $item->drug_name }} {{ collect([$item->dosage, $item->frequency, $item->duration])->filter()->implode(' · ') }}
@endforeach
@empty
No prescriptions yet.
@endforelse
@push('scripts') @endpush @endsection