@extends('hms.layout') @section('title','Patient profile') @section('content')

{{ $patient->first_name }} {{ $patient->last_name }}

{{ $patient->patient_number }}

@if($canManagePortal)Edit profile@endif All patients
@php($currentAdmission=\App\Models\Hms\Admission::where('organization_id',$patient->organization_id)->where('patient_id',$patient->id)->whereIn('status',['recommended','admitted'])->latest()->first()) @if($currentAdmission) @php($currentBed=$currentAdmission->bed_id?\App\Models\Hms\Bed::where('organization_id',$patient->organization_id)->find($currentAdmission->bed_id):null) @php($currentRoom=$currentBed?\App\Models\Hms\Room::where('organization_id',$patient->organization_id)->find($currentBed->room_id):null)

Current inpatient status · {{ ucfirst($currentAdmission->status) }}

{{ $currentRoom ? (($currentRoom->ward?:'Unassigned ward').' / Room '.$currentRoom->name.' / Bed '.$currentBed->label) : 'Awaiting bed assignment' }} · Admissions directory

@endif

Patient details

@if(\Illuminate\Support\Facades\Schema::hasTable('hms_chat_rooms') && ($discussionMember=\App\Services\Hms\ChatAccess::member($patient->organization_id,(int)auth()->id())) && \App\Services\Hms\ChatAccess::patient($discussionMember,$patient->id)) Private discussion @endif
Date of birth
{{ $patient->date_of_birth?->format('d M Y') ?? 'Not provided' }}
Sex
{{ $patient->sex ? ucfirst($patient->sex) : 'Not provided' }}
Phone
{{ $patient->phone ?? 'Not provided' }}
Email
{{ $patient->email ?? 'Not provided' }}
Postal / physical address
{{ \App\Services\Hms\Address::format($patient,true) ?: 'Not provided' }}
Residence area
{{ collect([$patient->residence_town,$patient->residence_district,$patient->residence_region,$patient->residence_country])->filter()->implode(', ') ?: 'Not provided' }}
Emergency contact
{{ $patient->emergency_contact ?? 'Not provided' }}

Appointment and visit history

{{ $visits->count() }} visits
@include('hms.patients.visit-rows',['profileVisits'=>$visits->take(6)]) @if($visits->count()>6)
Older visits {{ $visits->count()-6 }} @include('hms.patients.visit-rows',['profileVisits'=>$visits->slice(6)])
@endif
@if($canManagePortal)
any()) open @endif>Patient portal access {{ ucfirst($portalAccount?->status ?? 'Not invited') }}

Patient sign-in page

Verify identity and the patient's personal email before inviting them. Shared emails cannot identify multiple patients. Changing the email revokes access until a new invitation is issued.

@if(!$portalAccount || $portalAccount->status!=='active')
@csrf
@else

The patient can use Forgot password to reset their password.

@endif @if($portalAccount && $portalAccount->status!=='revoked')
@csrf
@endif
@endif
@if($summary) @php($profilePhysician=\App\Models\Hms\Membership::where('organization_id',$patient->organization_id)->where('user_id',auth()->id())->value('role')==='physician')

Clinical summary and trends

Historical observations only. Missing records do not imply absence of a condition or allergy.

@foreach(['Visits'=>$summary['visits'],'Consultations'=>$summary['consultations'],'Lab requests'=>$summary['lab_requests']] as $label=>$value)
{{ $value }}{{ $label }}
@endforeach

Conditions, allergies and medical history

@foreach(['allergy'=>'Allergies','chronic_condition'=>'Chronic conditions','medical_history'=>'Other medical history'] as $category=>$label)

{{ $label }}

@forelse($summary['flags']->where('category',$category) as $flag)
{{ $flag->name }} @if($flag->details)
{{ $flag->details }}
@endif {{ ucfirst($flag->status) }} @if($flag->status==='active' && $profilePhysician)
@csrf @method('PATCH')
@endif
@empty
Not documented
@endforelse @endforeach

Recent vital-sign trends

@forelse($summary['recent_vitals'] as $v) @empty@endforelse
RecordedBPPulseTempSpO₂
{{ $v->created_at->format('d M Y') }}{{ $v->systolic_bp??'—' }}/{{ $v->diastolic_bp??'—' }}{{ $v->pulse_bpm??'—' }}{{ $v->temperature_c??'—' }}{{ $v->oxygen_saturation??'—' }}
No observations recorded.
Visit trends and recurring complaints

Repeated complaints are grouped by exact text, not diagnoses.

Visit trend by month

@if($summary['monthly']->isEmpty())

No visit history.

@else @php($peak=max(1,$summary['monthly']->max())) @foreach($summary['monthly']->take(-12) as $month=>$count)
{{ $month }}
{{ $count }}
@endforeach @endif

Most frequently recorded chief complaints

@forelse($summary['issues'] as $issue)
{{ $issue['label'] }}{{ $issue['count'] }}
@empty

No documented chief complaints.

@endforelse
@if($profilePhysician)
any()) open @endif>Add clinical history entry
@csrf
@endif
@endif
@endsection