{{-- Pregnancy banner partial Expects: $patient, $pregnancy (nullable), $consult, $riskResult --}} @php $level = $riskResult['level'] ?? 'low'; $factors = $riskResult['factors'] ?? []; $banners = $riskResult['banners'] ?? []; $autoUpgraded = $riskResult['auto_upgraded'] ?? false; $levelColors = [ 'low' => ['bg' => 'bg-emerald-50', 'border' => 'border-emerald-500', 'text' => 'text-emerald-800', 'dot' => 'bg-emerald-500', 'label' => 'LOW RISK'], 'moderate' => ['bg' => 'bg-amber-50', 'border' => 'border-amber-500', 'text' => 'text-amber-800', 'dot' => 'bg-amber-500', 'label' => 'MODERATE RISK'], 'high' => ['bg' => 'bg-rose-50', 'border' => 'border-rose-600', 'text' => 'text-rose-800', 'dot' => 'bg-rose-600', 'label' => 'HIGH RISK'], ]; $c = $levelColors[$level]; // Compute GA display $gaDisplay = null; if ($consult->gestation_weeks !== null) { $gaDisplay = $consult->gestation_weeks . 'w'; if ($consult->gestation_days) { $gaDisplay .= ' ' . $consult->gestation_days . 'd'; } } elseif ($consult->lmp) { $days = \Carbon\Carbon::parse($consult->lmp)->diffInDays(now()); $w = intdiv($days, 7); $d = $days % 7; $gaDisplay = $w . 'w ' . $d . 'd'; } $bannerSeverityClasses = [ 'danger' => 'bg-rose-100 border-rose-400 text-rose-900', 'warning' => 'bg-amber-100 border-amber-400 text-amber-900', 'info' => 'bg-sky-100 border-sky-400 text-sky-900', ]; @endphp
{{-- Main pregnancy banner --}}
{{ $c['label'] }} @if($autoUpgraded) AUTO-UPGRADED @endif
{{ $patient->full_name ?? $patient->name ?? 'Patient' }} @if($patient->date_of_birth) · {{ \Carbon\Carbon::parse($patient->date_of_birth)->age }} yrs @endif @if($patient->patient_number ?? null) · {{ $patient->patient_number }} @endif
@if($consult->visit_number)
ANC #{{ $consult->visit_number }}
@endif @if($gaDisplay)
GA {{ $gaDisplay }}
@endif @if($consult->edd)
EDD {{ \Carbon\Carbon::parse($consult->edd)->format('d M Y') }}
@endif @if($consult->gravida !== null || $consult->para !== null)
G/P {{ $consult->gravida ?? '?' }}/{{ $consult->para ?? '?' }}
@endif
{{-- Risk factors chip list --}} @if(count($factors))
Flagged risk factors ({{ count($factors) }})
@foreach($factors as $factor) {{ $factor }} @endforeach
@endif
{{-- Clinical banners (treatment reminders) --}} @if(count($banners))
@foreach($banners as $banner) @php $severityClass = $bannerSeverityClasses[$banner['severity']] ?? $bannerSeverityClasses['info']; @endphp
{{ $banner['title'] }}
{{ $banner['message'] }}
@endforeach
@endif {{-- Triage soft warning --}} @if(! ($triageOk ?? false))
Triage incomplete. Please record BP, pulse, temperature and weight before finalising this consult. You can still save, but this consult will be flagged in the incomplete-triage report.
@endif