@extends('layouts.master') @section('title', $title) @php $p = $em->Patient; $active = $em->status === 'Active'; $statusCls = ['Active' => 'bg-danger', 'Discharged' => 'bg-success', 'Transferred' => 'bg-info'][$em->status] ?? 'bg-secondary'; // Per-tab access: view = read only, create = add, update = edit/complete/delete. $can = []; foreach (['vital-signs', 'consultation', 'doctor-order', 'lab', 'prescription', 'service'] as $t) { foreach (['view', 'create', 'update'] as $a) { $can[$t][$a] = auth()->user()->can("emergency-{$t}-{$a}"); } $can[$t]['write'] = $can[$t]['create'] || $can[$t]['update']; } // nurses: give / skip doses and complete orders (with a note) $can['doctor-order']['give'] = auth()->user()->can('emergency-doctor-order-give') || $can['doctor-order']['update']; $can['doctor-order']['complete'] = auth()->user()->can('emergency-doctor-order-complete'); $can['doctor-order']['stop'] = auth()->user()->can('emergency-doctor-order-stop'); $can['doctor-order']['undo'] = auth()->user()->can('emergency-doctor-order-undo'); $can['doctor-order']['taken'] = auth()->user()->can('emergency-doctor-order-taken-view'); // pharmacy-only users, or no "See amounts": no emergency hours money, payments or Payments tab $pharmacyOnly = auth()->user()->can('emergency-pharmacy-only') || !sees_amounts('emergency'); @endphp @section('page_css') @endsection @section('content') {{-- time-locked nurses: vital signs, medication and doses are recorded at the current time --}} @include('partials.nurse_time_lock', ['lockScope' => '#vital_form, #med_form, #med_edit_form', 'lockFields' => ['date', 'time']]) @include('partials.nurse_time_lock', ['lockScope' => '#dose_form', 'lockFields' => ['given_at']])
Emergency list
@if (auth()->user()->can('emergency-payment') && !$pharmacyOnly) @endif @if ($active) @can('emergency-transfer') @endcan @can('emergency-discharge') @endcan @elseif (in_array($em->status, ['Discharged', 'Transferred'])) @can('emergency-undo') @endcan @endif @can('emergency-update') @endcan

{{ $p?->name }} {{ $em->status }}

ID: {{ $p?->patient_id }} · {{ ucfirst($p?->gender) }} @if ($p?->dob) · {{ \Carbon\Carbon::parse($p->dob)->age }} years @endif @if ($p?->phone) · {{ $p->phone }} @endif @if ($p?->address) · {{ $p->address }} @endif
@if ($em->status === 'Transferred' && $em->admission_id) @endif @include('patient_mangement.appointment.profile.stay_follow_ups', [ 'fuKind' => 'emergency', 'fuStay' => $em, 'fuNo' => $em->emergency_no ?: $em->id, 'fuPatient' => $p?->name, ])
Arrived
{{ $em->date_in->format('d M, h:i A') }}
{{ $active ? 'Still here' : 'Left' }}
{{ $active ? '—' : $em->date_out?->format('d M, h:i A') }}
Hours {{ $em->hours !== null ? '(set)' : '' }}
-
@unless ($pharmacyOnly)
Rate / hour
$ {{ number_format($em->rate, 2) }}
Cost
-
Paid
-
Balance
-
@endunless
{{-- every detail of this emergency visit --}} @php $emPayCls = ['Paid' => 'bg-success', 'Partially paid' => 'bg-warning', 'Unpaid' => 'bg-label-danger'][$em->payment_status] ?? 'bg-secondary'; @endphp
Emergency #
{{ $em->emergency_no }}
Department
{{ $em->Department?->name ?? '-' }}
Doctor
{{ $em->Doctor?->name ?? '-' }}
Status
{{ $em->status }}
Arrival time
{{ $em->date_in->format('d M, Y h:i A') }}
Leaving time
{{ $em->date_out ? $em->date_out->format('d M, Y h:i A') : 'Still in emergency' }}
Hours billed
{{ $em->hours !== null ? ($em->hours + 0) . ' h (set by hand)' : 'Counted from the clock' }}
@unless ($pharmacyOnly)
Payment status
{{ $em->payment_status }}
@endunless
Registered by
{{ $em->createdBy?->name ?? '-' }}
Registered at
{{ $em->created_at?->format('d M, Y h:i A') }}
@if ($em->admission_id) @endif
Complaint
{{ $em->complaint ?: '-' }}
Notes
{{ $em->notes ?: '-' }}
{{-- Vital signs --}} @if ($can['vital-signs']['view'])
@if ($can['vital-signs']['write'])
@foreach (['pulse', 'temperature', 'respiratory_rate', 'spo2', 'weight', 'height'] as $vf) @endforeach
DateTimeBP (sys / dia)PulseTemp °CRRSpO₂ %Weight kgHeight cm
/
@endif
DateBPPulseTempRRSpO₂WeightHeightBMIBy
@endif {{-- Consultation --}} @if ($can['consultation']['view'])
@if ($can['consultation']['write'])
{{-- Same pick-list as the appointment consultation (Settings → Diagnosis). --}}
@endif
Loading...
@endif {{-- Doctor order: what the doctor asks for (the Prescription tab is what was given) --}} @if ($can['doctor-order']['view'])
@if ($can['doctor-order']['write'])
@foreach ($drugs as $d) @endforeach
@foreach (['pain', 'fever above 38.5 °C', 'nausea / vomiting', 'agitation', 'sleep', 'breathlessness', 'constipation'] as $r) @endforeach
@endif
DateDoctorTypeDrugDoseRouteScheduleInstructionStatusDone by
{{-- PRN ("as needed") orders: give a dose when the patient needs it, within the doctor's limits --}}
As needed (PRN)
{{-- Medication schedule: every dose of the "give medication" orders, day by day --}}
Medication schedule
due overdue given skipped order stopped — tick a dose when it is given
@if ($can['doctor-order']['taken']) {{-- Medication taken: every dose given / skipped, like a prescription list --}}
Medication taken
Given atDueMedicationDoseRouteStatusByNote
@endif
@endif {{-- Laboratory: same table as the admission Lab request tab; requests go to the Lab module (payment + results). --}} @if ($can['lab']['view'])
Laboratory request
@if ($can['lab']['create']) @endif
#DateLab typeCommentRoutineResultPaymentTotal amountAction
@endif {{-- Prescription (medication given, auto-invoiced) --}} @if ($can['prescription']['view'])
@if ($can['prescription']['write'])
Drug *Quantity *DoseRouteNote
@endif @if (sees_pharmacy_prices())
Billing (pharmacy invoice)
Total: $ 0.00
@endif
Medication given
DateDrugQtyDoseRouteNoteByInvoice
@endif {{-- Service --}} @if ($can['service']['view'])
@if ($can['service']['write'])
Select a category
@endif
DateServicesAmountPaymentNotes
Service requests are paid in the Services module.
@endif {{-- Payments: whole-visit billing + hourly payments --}} @unless ($pharmacyOnly)
Billing summary
BillingChargePaidDiscountBalancePaid in
Hour payments
DatePaidDiscountStatus
The Pay button pays the emergency hours; laboratory, medication and services are paid where they're billed (shown above).
@endunless
{{-- Pay --}} {{-- Complete a doctor order: note required, the user is recorded --}} {{-- One dose of the medication schedule: given / skipped with a note --}} {{-- Discharge: pick the leaving time, see the hours and cost before confirming --}} {{-- Transfer to admission --}} {{-- Edit visit --}} {{-- New / edit lab request — wide so the test categories have room. --}} @if ($can['lab']['write']) @endif {{-- Full lab result (the Lab module's result page) --}} {{-- Edit one medication --}} @endsection @section('page_js') @include('partials.dose_times_js') @include('partials.dose_checklist_js') @include('partials.service_timer_js') @endsection