{{-- Where this admission came from: a link back to the appointment or the emergency visit (its labs, medication, orders, vitals and bill stay there). --}} @php $originEm = \App\Models\Emergency::where('admission_id', $admission->id)->latest('id')->first(); $originApp = $admission->type == 'appointment' ? $admission->Appointment : null; @endphp @if ($originEm || $originApp)
@if ($originEm) From emergency @can('emergency-view') EM #{{ $originEm->emergency_no ?: $originEm->id }} @else EM #{{ $originEm->emergency_no ?: $originEm->id }} @endcan · arrived {{ \Carbon\Carbon::parse($originEm->date_in)->format('d M, Y h:i A') }} — its labs, medication, orders and vitals are on the emergency page @endif @if ($originApp) From appointment App_{{ $originApp->appointment_no }} @endif
@endif {{-- after discharge: follow-up visits booked from this admission --}} @include('patient_mangement.appointment.profile.stay_follow_ups', [ 'fuKind' => 'admission', 'fuStay' => $admission, 'fuNo' => $admission->admission_no ?: $admission->id, 'fuPatient' => (($appointment ?? null)?->Patient ?? $admission->Patient)?->name, ])