@extends("layouts.app", ["title" => "Patient EHR Profile"]) @section("content_body") @include("shared.partials.page-title", ["subtitle" => "Healthcare", "title" => "Electronic Health Record (EHR) Profile"])
@if($patient->avatar_path) {{ $patient->name }} @else @endif
@csrf

{{ $patient->first_name ?? $patient->name }} {{ $patient->first_surname ?? '' }} {{ $patient->second_surname ?? '' }}

Display Name: {{ $patient->name }}

CuraLink ID: {{ $patient->curalink_patient_number ?? 'N/A' }}

NRC ID: {{ $patient->national_id ?? 'N/A' }}

@if ($patient->is_pregnant) Pregnant @endif @if ($patient->date_of_birth->age >= 60) Elderly @endif @if ($patient->dispensary_group) @php $groupColors = [ 'Group I' => 'bg-success', 'Group II' => 'bg-info', 'Group III' => 'bg-danger', 'Group IV' => 'bg-purple', ]; $color = $groupColors[$patient->dispensary_group] ?? 'bg-secondary'; @endphp {{ $patient->dispensary_group }} @endif @if ($patient->removal_reason) Inactive ({{ $patient->removal_reason }}) @endif

General Info
  • Gender: {{ ucfirst($patient->gender) }}
  • Age: {{ $patient->date_of_birth->age }} years
  • Date of Birth: {{ $patient->date_of_birth->format('Y-m-d') }}
  • Nationality: {{ $patient->nationality ?? 'N/A' }}
  • Phone: {{ $patient->phone ?? 'N/A' }}
  • Marital Status: {{ ucfirst($patient->marital_status ?? 'N/A') }}
  • Educational Level: {{ $patient->educational_level ?? 'N/A' }}
  • Occupation: {{ $patient->occupation ?? 'N/A' }}
  • Household Family: {{ $patient->family->name }}
  • Relationship to Head: {{ ucfirst($patient->relationship_to_head ?? 'N/A') }}
  • Registration Date: {{ $patient->registration_date?->format('Y-m-d') ?? 'N/A' }}
  • Health Worker: {{ $patient->registrationHealthWorker->name ?? 'N/A' }}
@if ($patient->father_name || $patient->mother_name)
Parents
    @if ($patient->father_name)
  • Father: {{ $patient->father_name }} {{ $patient->father_alive ? 'Alive' : 'Deceased' }} @if ($patient->father_alive === false && $patient->father_cause_of_death) (Cause of death: {{ $patient->father_cause_of_death }}) @endif
  • @endif @if ($patient->mother_name)
  • Mother: {{ $patient->mother_name }} {{ $patient->mother_alive ? 'Alive' : 'Deceased' }} @if ($patient->mother_alive === false && $patient->mother_cause_of_death) (Cause of death: {{ $patient->mother_cause_of_death }}) @endif
  • @endif
@endif @if ($patient->emergency_contact_name)
Emergency Contact
  • Name: {{ $patient->emergency_contact_name }}
  • Phone: {{ $patient->emergency_contact_phone ?? 'N/A' }}
  • Relation: {{ $patient->emergency_contact_relationship ?? 'N/A' }}
  • Address: {{ $patient->emergency_contact_address ?? 'N/A' }}
@endif
SECTION 3: PERSONAL MEDICAL HISTORY
Pre-existing Diseases:
@forelse($patient->medical_history_diseases ?? [] as $dis) {{ $dis }} @empty None recorded @endforelse
Diagnosis Date:

{{ $patient->medical_history_diagnosis_date?->format('Y-m-d') ?? 'N/A' }}

Details:

{{ $patient->medical_history_details ?? 'N/A' }}

Current Treatment:

{{ $patient->medical_history_treatment ?? 'N/A' }}

SECTION 4: SURGICAL HISTORY
@forelse($patient->surgical_history ?? [] as $surg) @empty @endforelse
Procedure Year Hospital Complications
{{ $surg['procedure'] ?? 'N/A' }} {{ $surg['year'] ?? 'N/A' }} {{ $surg['hospital'] ?? 'N/A' }} {{ $surg['complications'] ?? 'N/A' }}
No surgeries logged
SECTION 5: ALLERGIES
Drug Allergies:

{{ $patient->drug_allergies ?? 'None' }}

Food Allergies:

{{ $patient->food_allergies ?? 'None' }}

Other Allergies:

{{ $patient->other_allergies ?? 'None' }}

Reaction / Severity:

{{ $patient->allergy_reaction ?? 'N/A' }}

SECTION 6: MEDICATION HISTORY
@forelse($patient->current_medications ?? [] as $med) @empty @endforelse
Medication Dose Frequency Reason
{{ $med['medication'] ?? 'N/A' }} {{ $med['dose'] ?? 'N/A' }} {{ $med['frequency'] ?? 'N/A' }} {{ $med['reason'] ?? 'N/A' }}
No current medications logged
Medication Adherence: {{ $patient->medication_adherence ?? 'N/A' }}
Reason for poor adherence: {{ $patient->medication_adherence_reason ?? 'N/A' }}
SECTION 7: IMMUNIZATION HISTORY (Esquema de Vacunación)
Childhood Vaccinations:
@php $childhoodVaccs = ['BCG', 'Polio', 'Pentavalent', 'PCV', 'Rotavirus', 'Measles']; $loggedVaccs = $patient->immunization_history ?? []; @endphp @foreach($childhoodVaccs as $v) {{ $v }} @endforeach
Adult Vaccinations:
@php $adultVaccs = ['COVID-19', 'Tetanus', 'Hepatitis B']; @endphp @foreach($adultVaccs as $v) {{ $v }} @endforeach
SECTION 11: FAMILY HISTORY
@forelse($patient->family_history ?? [] as $hist) @empty @endforelse
Disease Relationship Age of Onset
{{ $hist['disease'] ?? 'N/A' }} {{ $hist['relationship'] ?? 'N/A' }} {{ $hist['age_of_onset'] ?? 'N/A' }} years
No family history illnesses recorded
SECTION 8: FEMALE REPRODUCTIVE HEALTH
Age at Menarche: {{ $patient->menarche_age ?? 'N/A' }} years
Cycle: {{ $patient->menstrual_cycle ?? 'N/A' }}
LMP: {{ $patient->lmp?->format('Y-m-d') ?? 'N/A' }}
Pregnancy & Birth History
Pregnancies (Gravida) {{ $patient->gravida ?? 0 }}
Births (Para) {{ $patient->para ?? 0 }}
Abortions {{ $patient->abortions ?? 0 }}
Living Children {{ $patient->living_children ?? 0 }}
Current Contraception Method: {{ $patient->contraceptive_method ?? 'None' }}
ANC Visits (if pregnant): {{ $patient->anc_visits ?? 'N/A' }}
Gestational Age (weeks): {{ $patient->anc_gestational_age ?? 'N/A' }}
ANC Risk Factors: {{ $patient->anc_risk_factors ?? 'None' }}
SECTION 8: MALE REPRODUCTIVE HEALTH
Fertility Concerns:

{{ $patient->fertility_concerns ?? 'None logged' }}

Sexual Health Concerns:

{{ $patient->sexual_health_concerns ?? 'None logged' }}

SECTION 9: LIFESTYLE & BEHAVIOUR
Tobacco Use: {{ $patient->tobacco_use ?? 'Never' }} @if(($patient->tobacco_use ?? '') != 'Never' && $patient->tobacco_use)
Type: {{ $patient->tobacco_type }}, Duration: {{ $patient->tobacco_duration }}, Qty: {{ $patient->tobacco_quantity }} @endif
Alcohol Use Frequency: {{ $patient->alcohol_use ?? 'None' }}
Nutrition & Physical Activity
Height {{ $patient->height ?? 'N/A' }} cm
Weight {{ $patient->weight ?? 'N/A' }} kg
BMI {{ $patient->bmi ?? 'N/A' }}
Waist Circumference {{ $patient->waist_circumference ?? 'N/A' }} cm
Diet Pattern: {{ $patient->diet_pattern ?? 'N/A' }}
Physical Activity Level: {{ $patient->physical_activity_level ?? 'N/A' }}
Fruit Intake: {{ $patient->fruit_intake ?? 'N/A' }}
Vegetable Intake: {{ $patient->vegetable_intake ?? 'N/A' }}
Sugar/Salt Intake: {{ $patient->sugar_intake ?? 'N/A' }} / {{ $patient->salt_intake ?? 'N/A' }}
Staple Foods:
@forelse($patient->staple_foods ?? [] as $food) {{ $food }} @empty None specified @endforelse
SECTION 10: OCCUPATIONAL & ENVIRONMENTAL RISKS
Occupational Exposures/Risks:
@forelse($patient->occupational_risks ?? [] as $risk) {{ $risk }} @empty No occupational exposures @endforelse
Environmental Hazards/Risks:
@forelse($patient->environmental_risks ?? [] as $risk) {{ $risk }} @empty No environmental hazards @endforelse
SECTION 12: PHYSICAL EXAMINATION (Baseline)
@php $pe = $patient->physical_examination ?? []; @endphp @if(!empty($pe))
Exam Date: {{ $pe['date'] ?? 'N/A' }}
Healthcare Worker: {{ $pe['worker'] ?? 'N/A' }}
Vital Signs Findings
Blood Pressure {{ data_get($pe, 'vitals.blood_pressure', 'N/A') }}
Heart Rate {{ data_get($pe, 'vitals.heart_rate', 'N/A') }} bpm
Resp. Rate {{ data_get($pe, 'vitals.respiratory_rate', 'N/A') }} /min
Temperature {{ data_get($pe, 'vitals.temperature', 'N/A') }} °C
SpO2 {{ data_get($pe, 'vitals.oxygen_saturation', 'N/A') }} %
General Examination Findings
Appearance: {{ data_get($pe, 'general.appearance', 'N/A') }}
Nutrition status: {{ data_get($pe, 'general.nutrition', 'N/A') }}
Hydration: {{ data_get($pe, 'general.hydration', 'N/A') }}
Systemic Examination Findings
@foreach(['cardiovascular', 'respiratory', 'neurological', 'musculoskeletal', 'abdominal', 'skin'] as $system)
{{ ucfirst($system) }}: {{ data_get($pe, "systems.{$system}", 'Not Examined') }}
@endforeach
@else

No baseline physical exam recorded

@endif
SECTION 13: SCREENING RECORD
@php $scr = $patient->screening_record ?? []; @endphp @if(!empty($scr))
Non-Communicable Disease Screening
BP Check: {{ data_get($scr, 'ncd.blood_pressure', 'N/A') }}
Glucose: {{ data_get($scr, 'ncd.blood_glucose', 'N/A') }}
Cholesterol: {{ data_get($scr, 'ncd.cholesterol', 'N/A') }}
Cancer Screening: {{ data_get($scr, 'ncd.cancer', 'N/A') }}
Infectious Disease Screening
HIV: {{ data_get($scr, 'infectious.hiv', 'N/A') }}
TB Screening: {{ data_get($scr, 'infectious.tb', 'N/A') }}
Malaria: {{ data_get($scr, 'infectious.malaria', 'N/A') }}
STI/Hepatitis: {{ data_get($scr, 'infectious.sti_hep', 'N/A') }}
@else

No screening records on file

@endif
SECTION 14: DISPENSARY CLASSIFICATION
Patient Category: @if($patient->dispensary_group) {{ $patient->dispensary_group }} @else Unclassified @endif
Active Risk Factors (Group 2):
@forelse($patient->dispensary_risk_factors ?? [] as $rf) {{ $rf }} @empty None @endforelse
Chronic Conditions (Group 3):

{{ $patient->dispensary_chronic_conditions ?? 'N/A' }}

Disability & Support Required (Group 4):

Condition: {{ $patient->dispensary_disability_condition ?? 'N/A' }}
Support: {{ $patient->dispensary_disability_support ?? 'N/A' }}

SECTION 15: HEALTH PROBLEM LIST
@forelse($patient->health_problem_list ?? [] as $prob) @empty @endforelse
Problem Date Identified Status
{{ $prob['problem'] ?? 'N/A' }} {{ $prob['date_identified'] ?? 'N/A' }} @php $stColors = ['Active' => 'bg-danger', 'Resolved' => 'bg-success', 'Chronic' => 'bg-warning']; $stColor = $stColors[$prob['status'] ?? ''] ?? 'bg-secondary'; @endphp {{ $prob['status'] ?? 'N/A' }}
No health problems listed
SECTION 16: INDIVIDUAL CARE PLAN
@php $plan = $patient->individual_care_plan ?? []; @endphp @if(!empty($plan))
Preventive Care Actions:
@forelse(data_get($plan, 'preventive_care', []) as $pc) {{ $pc }} @empty None specified @endforelse
Treatment Plan:
Diagnosis: {{ data_get($plan, 'treatment.diagnosis', 'N/A') }} Medication: {{ data_get($plan, 'treatment.medication', 'N/A') }} Follow-up: {{ data_get($plan, 'treatment.follow_up', 'N/A') }}
Referral History:
Referred To: {{ data_get($plan, 'referral.referred_to', 'None') }}
Reason: {{ data_get($plan, 'referral.reason', 'N/A') }}
Outcome: {{ data_get($plan, 'referral.outcome', 'N/A') }}
@else

No individual care plan established

@endif

Consultation Logs (SOAP format & Home visits)

@forelse ($patient->consultations as $index => $consult)

SOAP Notes
Subjective:

{{ $consult->reason_for_admission ?? 'N/A' }}
Illness history: {{ $consult->history_of_current_illness ?? 'N/A' }}

Objective (Physical Exam):

{{ $consult->clinical_notes ?? 'N/A' }}

Assessment (Diagnosis):
@forelse ($consult->chronic_diseases ?? [] as $illness) {{ ucfirst($illness) }} @empty No diagnoses flagged @endforelse
Plan (Treatment & Follow-up):

{{ $consult->evolution_treatment ?? 'N/A' }}
Follow-up type: {{ str_replace('_', ' ', ucfirst($consult->follow_up_plan ?? 'N/A')) }}

@if (!empty($consult->vitals))
Blood Pressure {{ data_get($consult->vitals, 'blood_pressure', 'N/A') }}
Pulse Rate {{ data_get($consult->vitals, 'pulse', 'N/A') }} bpm
Temperature {{ data_get($consult->vitals, 'temperature', 'N/A') }} °C
Weight {{ data_get($consult->vitals, 'weight', 'N/A') }} kg
@endif
SECTION 18: HOME VISIT RECORD DETAILS
Visit Date: {{ $consult->homeVisit->scheduled_at->format('Y-m-d') }}
Reason: {{ $consult->homeVisit->notes ?? 'Regular checkup' }}
Status: {{ ucfirst($consult->homeVisit->status) }}
@empty
No clinical consultations found in record history.
@endforelse
ATTACHMENTS & SUPPORTING DOCUMENTS
@forelse ($patient->attachments as $attachment) @empty @endforelse
Document Description Size Uploaded By Uploaded At Action
@php $ext = pathinfo($attachment->file_name, PATHINFO_EXTENSION); $icon = match(strtolower($ext)) { 'pdf' => 'bi-file-pdf-fill text-danger', 'jpg', 'jpeg', 'png', 'gif', 'webp' => 'bi-file-image-fill text-success', 'doc', 'docx' => 'bi-file-word-fill text-primary', 'xls', 'xlsx' => 'bi-file-excel-fill text-success', default => 'bi-file-earmark-fill text-secondary' }; @endphp {{ $attachment->file_name }} {{ $attachment->description ?? 'N/A' }} {{ number_format($attachment->file_size / 1024, 1) }} KB {{ $attachment->uploader->name }} {{ $attachment->created_at->format('Y-m-d H:i') }}
@csrf @method('DELETE')
No documents uploaded yet.
@endsection