@php $isEdit = $summary !== null; $action = $action ?? ($isEdit ? route('discharge-summaries.update', $summary) : route('discharge-summaries.store')); $method = $method ?? ($isEdit ? 'PUT' : 'POST'); $backRoute = $backRoute ?? ($isEdit ? route('discharge-summaries.show', $summary) : route('admissions.show', $admission)); $deathLocked = (bool) ($summary?->is_death_summary ?? false); $deathOpen = (bool) old('is_death_summary', $deathLocked); $canDeath = auth()->user()->can('discharge-summaries.death'); $typeOptions = \App\Support\Lookup::options('discharge_type'); $conditionOptions = \App\Support\Lookup::options('condition_at_discharge'); $icdOptions = $icdCodes->mapWithKeys(fn ($c) => [$c->id => $c->code.' — '.$c->description])->all(); $medDefaults = [ 'drug_name' => '', 'dose' => '', 'route' => 'oral', 'frequency' => '', 'duration' => '', 'instructions' => '', ]; $seedMeds = is_array(old('medications')) ? array_values(old('medications')) : ($summary?->medications->map(fn ($m) => [ 'drug_name' => $m->drug_name, 'dose' => $m->dose ?? '', 'route' => $m->route ?? 'oral', 'frequency' => $m->frequency ?? '', 'duration' => $m->duration ?? '', 'instructions' => $m->instructions ?? '', ])->all() ?? []); $seedMeds = collect($seedMeds) ->map(fn ($row) => array_merge($medDefaults, is_array($row) ? $row : [])) ->values() ->all(); @endphp
{{ $admission->patient->full_name }}
{{ $admission->patient->medical_record_number }}
An issued summary is a legal record — corrections go through amendment, not editing.