@extends('layouts.app') @section('title', 'Maternity Case Summary | ' . ($maternityAdmission->patient->full_name ?? '')) @section('styles') {{-- ── Round 16: Maternity-specific case summary. Visually mirrors the outpatient case-summary (same letterhead partial, same demographic strip, same .cs-* class names) so the document family feels consistent. Key differences from OPD case summary: • Reads from MaternityAdmission, not Visit->consultation • Diagnosis comes from $ma->diagnosis (settable from Overview tab) • Adds Delivery + Newborn + Complications sections when present • Drops the "follow-up" block that's OPD-specific ── --}} @endsection @section('content') @php $ma = $maternityAdmission; $patient = $ma->patient; $visit = $ma->visit; $invoice = $visit?->invoice; $delivery = $ma->resolvedDelivery; $newborns = $delivery?->newborns ?? collect(); $labs = $visit?->labOrders ?? collect(); $imaging = $visit?->imagingRequests ?? collect(); $rxs = $visit?->prescriptions ?? collect(); $los = $ma->length_of_stay ?? '-'; // Payer label for the claim-reconciliation footer (matches OPD case summary) $payerLabel = match($invoice?->payment_mode) { 'insurance' => $invoice?->insuranceCompany?->name ?? 'Insurance', 'corporate' => 'Corporate', 'cash' => 'Cash', 'mpesa' => 'M-Pesa', 'bank_transfer'=> 'Bank Transfer', 'waiver' => 'Waiver', default => ucfirst($invoice?->payment_mode ?? '—'), }; @endphp
Back

Maternity Case Summary | {{ $patient->full_name ?? '' }}

@include('partials._document-header') {{-- Title --}}

Maternity Case Summary

{{-- DEMOGRAPHICS ROW 1 --}}
Name:{{ $patient->full_name ?? '' }} MRN:{{ $patient->mrn ?? '' }} Age:{{ $patient->age ?? '—' }} Phone:{{ $patient->phone ?? '—' }}
{{-- DEMOGRAPHICS ROW 2 --}}
@if($ma->discharge_date) @else @endif
G/A on Adm:{{ $ma->gestational_age_weeks ? $ma->gestational_age_weeks.' wk' : '—' }} Admitted:{{ $ma->admission_date?->format('d M Y H:i') ?? '-' }}Discharged:{{ $ma->discharge_date->format('d M Y H:i') }}Status:{{ ucfirst(str_replace('_',' ', $ma->status)) }}LOS:{{ $los }} day{{ $los == 1 ? '' : 's' }}
{{-- DEMOGRAPHICS ROW 3 --}}
@if($ma->ancRegistration) @endif
Attending Provider:{{ $ma->attendingProvider->name ?? '-' }}ANC No:{{ $ma->ancRegistration->anc_number ?? $ma->ancRegistration->id }} G/P:G{{ $ma->ancRegistration->gravida ?? '-' }}P{{ $ma->ancRegistration->parity ?? '-' }}
{{-- REASON FOR ADMISSION --}}

{{ $ma->reason_for_admission ?: '—' }}

{{-- DIAGNOSIS — the heart of the case summary; required to print this page --}}

{{ $ma->discharge_diagnosis ?: $ma->diagnosis }}

{{-- OBSTETRIC HISTORY --}} @if($ma->obstetric_history)

{{ $ma->obstetric_history }}

@endif {{-- DELIVERY DETAILS --}} @if($delivery)
Date / Time {{ $delivery->delivery_date?->format('d M Y') ?? '-' }} {{ $delivery->delivery_time ?? '' }} Mode {{ ucfirst(str_replace('_',' ', $delivery->mode_of_delivery ?? '-')) }}
G/A at Delivery {{ $delivery->gestational_age_at_delivery ? $delivery->gestational_age_at_delivery.' wk' : '-' }} Blood Loss {{ $delivery->blood_loss ? $delivery->blood_loss.' ml' : '-' }}
Perineum {{ $delivery->perineum ?? '-' }} Delivered By {{ $delivery->deliveredBy->name ?? '-' }}
Mother Outcome {{ ucfirst(str_replace('_',' ', $delivery->mother_outcome ?? '-')) }} Baby Outcome {{ ucfirst(str_replace('_',' ', $delivery->baby_outcome ?? '-')) }}
@endif {{-- NEWBORN(S) --}} @if($newborns->count())
@foreach($newborns as $i => $nb) @endforeach
Baby Gender Weight APGAR (1/5/10) Notes
Baby {{ $i + 1 }} {{ ucfirst($nb->gender ?? 'unknown') }} {{ $nb->birth_weight ? $nb->birth_weight.' kg' : '—' }} {{ $nb->apgar_1min ?? '-' }} / {{ $nb->apgar_5min ?? '-' }} / {{ $nb->apgar_10min ?? '-' }} {{ $nb->resuscitation ? 'Resus. given' : '' }} {{ $nb->vitamin_k ? '· Vit K' : '' }} {{ $nb->bcg ? '· BCG' : '' }} {{ $nb->opv ? '· OPV' : '' }} @if($nb->abnormalities)
{{ $nb->abnormalities }}@endif
@endif {{-- MATERNAL COMPLICATIONS --}} @if($ma->complications->count())
@foreach($ma->complications as $c) @endforeach
Type Severity Management Outcome
{{ ucwords(str_replace('_',' ', $c->complication_type)) }} {{ ucfirst($c->severity ?? '-') }} {{ $c->management ?: '-' }} {{ ucfirst($c->outcome ?: '-') }}{{ $c->referred_out ? ' (Referred)' : '' }}
@endif {{-- INVESTIGATIONS --}} @if($labs->count() || $imaging->count())
@foreach($labs as $lab) @endforeach @foreach($imaging as $img) @endforeach
Type Test / Study Result / Findings
Lab {{ $lab->test_name }} {{ $lab->status === 'validated' ? 'Result attached' : ucfirst($lab->status) }}
Imaging {{ $img->imaging_type }} @if($img->body_part)
{{ $img->body_part }}
@endif
{{ $img->report?->impression ?? 'Report attached' }}
@endif {{-- TREATMENT GIVEN --}} @if($rxs->count())
@foreach($rxs as $rx) @endforeach
Medication Dose Route Frequency Duration
{{ $rx->drug_name }} {{ $rx->dosage ?? '—' }} {{ $rx->route ?? '—' }} {{ $rx->frequency ?? '—' }} {{ $rx->duration ?? '—' }}
@endif {{-- DISCHARGE SUMMARY (if already discharged) --}} @if($ma->discharge_summary)

{{ $ma->discharge_summary }}

@endif {{-- CLAIM RECONCILIATION STRIP --}} @if($invoice)
Bill Total: KES {{ number_format($invoice->total_amount ?? 0) }} Payer: {{ $payerLabel }} Status: {{ $invoice->balance > 0 ? 'Outstanding (KES ' . number_format($invoice->balance) . ')' : 'Cleared' }}
@endif {{-- SIGNATURE + STAMP --}}
Clinician Signature
{{ $ma->attendingProvider->name ?? '—' }}
{{ ($ma->discharge_date ?? $ma->admission_date)?->format('d M Y H:i') ?? '' }}
Official Stamp
Hospital Stamp
@include('partials._document-footer')
@endsection