@extends("layouts.app", ["title" => "Family Health Profile"]) @section("content_body") @include("shared.partials.page-title", ["subtitle" => "Healthcare", "title" => "Digital Family Health Profile"])
CuraLink Family Health Score
@php $score = $family->family_health_score ?? 0; $riskLevel = $family->family_health_risk_level ?? 'Low Risk'; $gaugeColors = [ 'Low Risk' => ['text-success', 'bg-success-subtle', 'border-success'], 'Moderate Risk' => ['text-info', 'bg-info-subtle', 'border-info'], 'High Risk' => ['text-warning', 'bg-warning-subtle', 'border-warning'], 'Very High Risk' => ['text-danger', 'bg-danger-subtle', 'border-danger'], ]; $colors = $gaugeColors[$riskLevel] ?? ['text-secondary', 'bg-secondary-subtle', 'border-secondary']; @endphp
{{ $score }}
{{ $riskLevel }}

Evaluated automatically based on household disease burden, age distribution, lifestyle risks, and environmental factors.

@php $contactUser = $family->users()->whereHas('roles', fn($q) => $q->where('slug', 'family-contact'))->first(); $contactPatient = null; if ($contactUser) { $contactPatient = $family->patients()->where('name', $contactUser->name)->first(); } if (!$contactPatient && $family->head_name) { $contactPatient = $family->patients()->where('name', $family->head_name)->first(); } @endphp
@if($contactPatient && $contactPatient->avatar_path) {{ $contactPatient->name }} @else @endif

{{ $family->name }}

Household Code: {{ $family->family_code }}

Family Number: {{ $family->family_number ?? 'N/A' }}

@if ($healthProfile['subscription_active']) Subscription: Active @else Subscription: Inactive @endif

Household Head
@if($family->head_name)
  • Name: {{ $family->head_name }}
  • NRC Number: {{ $family->head_national_id ?? 'N/A' }}
  • Phone Number: {{ $family->head_phone ?? 'N/A' }}
  • Gender: {{ ucfirst($family->head_gender ?? 'N/A') }}
  • DOB/Age: {{ $family->head_date_of_birth?->format('Y-m-d') ?? 'N/A' }} @if($family->head_date_of_birth) ({{ $family->head_date_of_birth->age }} yrs) @endif
  • Occupation: {{ $family->head_occupation ?? 'N/A' }}
  • Education: {{ $family->head_educational_level ?? 'N/A' }}
@else

No head of household profile details registered.

@endif
Household Address
  • Village/Compound: {{ $family->village->name }}
  • Ward: {{ $family->village->ward->name ?? 'N/A' }}
  • Constituency: {{ $family->village->ward->constituency->name ?? 'N/A' }}
  • District: {{ $family->village->ward->constituency->district->name ?? 'N/A' }}
  • Province: {{ $family->village->ward->constituency->district->province->name ?? 'N/A' }}
  • Registered By: {{ $family->registeredBy->name ?? 'N/A' }}
  • Date Registered: {{ $family->registration_date?->format('Y-m-d') ?? 'N/A' }}
  • GPS Location: {{ $family->gps_location ?? 'N/A' }}
  • Allocated Doctor: @if ($family->doctor) {{ $family->doctor->user->name }} @else None Allocated @endif

Health Index Codes
  • Circunscripción No: {{ $family->circunscripcion_number ?? 'N/A' }}
  • CDR Number: {{ $family->cdr_number ?? 'N/A' }}
  • EBS Team Number: {{ $family->ebs_number ?? 'N/A' }}

Family Portal Account
@php $contactUser = $family->users()->whereHas('roles', fn($q) => $q->where('slug', 'family-contact'))->first(); @endphp @if($contactUser)
Account Active
Name: {{ $contactUser->name }}
Email: {{ $contactUser->email }}
@else
No Login Account Created
@csrf
@endif

Family Health Assessment Records

Household Size

{{ $healthProfile['household_size'] }}

Chronic Cases

{{ $healthProfile['chronic_diseases_count'] }}

Pregnancies

{{ $healthProfile['pregnancy_status_count'] }}

Seniors (60+)

{{ $healthProfile['elderly_residents_count'] }}

SECTION 2: FAMILY COMPOSITION
Add Member
@forelse ($family->patients as $patient) @empty @endforelse
Name Sex Age Relationship Occupation Dispensarización Action
{{ $patient->name }}
NRC: {{ $patient->national_id ?? 'N/A' }}
{{ ucfirst($patient->gender) }} {{ $patient->date_of_birth->age }} yrs
{{ $patient->date_of_birth->format('Y-m-d') }}
{{ ucfirst($patient->relationship_to_head ?? 'Member') }} {{ $patient->occupation ?? 'N/A' }} @if ($patient->is_pregnant) Pregnant @endif @if($patient->dispensary_group) @php $dispColors = ['Group I' => 'bg-success', 'Group II' => 'bg-info', 'Group III' => 'bg-danger', 'Group IV' => 'bg-purple']; $dColor = $dispColors[$patient->dispensary_group] ?? 'bg-secondary'; @endphp {{ $patient->dispensary_group }} @endif @if($patient->dispensary_chronic_conditions)
{{ $patient->dispensary_chronic_conditions }} @endif
EHR
No family members registered yet.
SECTION 3: FAMILY STRUCTURE
Family Type: {{ $family->family_type ?? 'N/A' }}
Family Life Cycle Stage: {{ $family->family_lifecycle_stage ?? 'N/A' }}
SECTION 4: SOCIOECONOMIC CONDITIONS
House Type: {{ $family->house_type ?? 'N/A' }}
Ownership: {{ $family->house_ownership ?? 'N/A' }}
Water Source: {{ $family->water_source ?? 'N/A' }} ({{ $family->water_distance ?? 'N/A' }})
Sanitation: {{ $family->toilet_facility ?? 'N/A' }} ({{ $family->waste_disposal ?? 'N/A' }})
Electricity Access: {{ $family->electricity_access ?? 'N/A' }}
FAMILY LIVING CONDITIONS EVALUATIONS (Model 54-50)
@forelse ($family->evaluations as $eval) @empty @endforelse
Date Housing Crowding Equipment Income Functioning Health Status Interventions
{{ $eval->evaluation_date->format('Y-m-d') }} {{ ucfirst($eval->housing_condition) }} {{ ucfirst($eval->crowding_index) }} @if($eval->bedroom_count)
{{ $eval->bedroom_count }} beds@endif
{{ ucfirst($eval->basic_equipment) }} {{ ucfirst(str_replace('_', ' ', $eval->income_satisfaction)) }} {{ ucfirst(str_replace('_', ' ', $eval->family_functioning)) }} @if($eval->health_evaluation_status === 'healthy') Healthy @else Problems @endif @forelse($eval->intervention_type ?? [] as $intv) {{ ucfirst($intv) }} @empty None @endforelse
No evaluations logged yet.
SECTION 6: FAMILY HEREDITARY DISEASES
Conditions present in family:
@forelse($family->family_diseases ?? [] as $fd) {{ $fd }} @empty None recorded @endforelse
Diseases Details:

{{ $family->family_diseases_details ?? 'N/A' }}

SECTION 8: BEHAVIOURAL ASSESSMENT
Alcohol Consumption: {{ $family->family_alcohol_use ?? 'N/A' }}
Physical Activity: {{ $family->family_physical_activity ?? 'N/A' }}
Common Family Foods:
@forelse($family->family_common_foods ?? [] as $food) {{ $food }} @empty None specified @endforelse
@if(!empty($family->family_diet_frequency))
Intake Frequencies:
@foreach($family->family_diet_frequency as $k => $v)
{{ ucfirst(str_replace('_', ' ', $k)) }}: {{ $v }}
@endforeach
@endif
SECTION 9: MENTAL HEALTH & SOCIAL WELLBEING
Stressors / Mental Risks:
@forelse($family->mental_social_risks ?? [] as $ms) {{ $ms }} @empty None logged @endforelse
Social Support Systems:
@forelse($family->social_support_systems ?? [] as $ss) {{ $ss }} @empty None logged @endforelse
SECTION 10: HEALTH SITUATION ANALYSIS (ASIS)
Determinants Affecting Family Health:
@forelse($family->asis_determinants ?? [] as $det) {{ $det }} @empty No determinants flagged @endforelse
Identified Health Problems:
    @forelse($family->asis_health_problems ?? [] as $p) @if($p)
  • {{ $p }}
  • @endif @empty No health problems specified @endforelse
Ranked Priority Problems & Interventions
@forelse($family->asis_priority_problems ?? [] as $pr) @empty @endforelse
Priority Problem Risk Level Intervention Required
{{ $pr['problem'] ?? 'N/A' }} @php $rColors = ['High' => 'bg-danger', 'Medium' => 'bg-warning', 'Low' => 'bg-success']; $rColor = $rColors[$pr['risk_level'] ?? ''] ?? 'bg-secondary'; @endphp {{ $pr['risk_level'] ?? 'N/A' }} {{ $pr['intervention'] ?? 'N/A' }}
No priority problems logged
SECTION 11: FAMILY CARE PLAN
Preventive Care Actions:
@forelse($family->care_plan_preventive_actions ?? [] as $pa) {{ $pa }} @empty None specified @endforelse
Community Interventions:
@forelse($family->care_plan_community_interventions ?? [] as $ci) {{ $ci }} @empty None specified @endforelse
Clinical Follow-up Actions Plan
@forelse($family->care_plan_clinical_followups ?? [] as $fl) @if(is_array($fl)) @else @endif @empty @endforelse
Family Member Condition / Objective Follow-up Date Responsible Healthcare Worker
{{ is_array($fl['member'] ?? null) ? implode(', ', $fl['member']) : ($fl['member'] ?? 'N/A') }} {{ is_array($fl['condition'] ?? null) ? implode(', ', $fl['condition']) : ($fl['condition'] ?? 'N/A') }} {{ is_array($fl['date'] ?? null) ? implode(', ', $fl['date']) : ($fl['date'] ?? 'N/A') }} {{ is_array($fl['worker'] ?? null) ? implode(', ', $fl['worker']) : ($fl['worker'] ?? 'N/A') }}{{ is_array($fl) ? implode(', ', $fl) : $fl }}
No clinical follow-ups logged
SECTION 13: HOME VISIT HISTORY
Schedule Visit
@forelse ($family->homeVisits as $visit) @empty @endforelse
Scheduled Date Practitioner Status Completed At Purpose / Notes Action
{{ $visit->scheduled_at->format('Y-m-d H:i') }} {{ $visit->doctor->user->name }} @if($visit->status === 'completed') Completed @elseif($visit->status === 'missed') Missed @else Scheduled @endif {{ $visit->completed_at ? $visit->completed_at->format('Y-m-d H:i') : 'N/A' }} {{ Str::limit($visit->notes, 40) ?? 'N/A' }} Details
No visits scheduled or completed yet.
ATTACHMENTS & SUPPORTING DOCUMENTS
@forelse ($family->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.
FAMILY TREE VISUALIZATION
@php $head = $family->patients->first(function($p) use ($family) { $rel = strtolower($p->relationship_to_head ?? ''); return $rel === 'self' || $rel === 'head' || strtolower($p->name) === strtolower($family->head_name ?? ''); }); if (!$head) { $head = $family->patients->first(); } $spouse = null; if ($head) { $spouse = $family->patients->first(function($p) use ($head) { $rel = strtolower($p->relationship_to_head ?? ''); return ($rel === 'spouse' || $rel === 'wife' || $rel === 'husband') && $p->id !== $head->id; }); } $children = $family->patients->filter(function($p) use ($head, $spouse) { $rel = strtolower($p->relationship_to_head ?? ''); $isChildRel = ($rel === 'child' || $rel === 'son' || $rel === 'daughter' || $rel === 'stepchild'); $notHeadOrSpouse = (!$head || $p->id !== $head->id) && (!$spouse || $p->id !== $spouse->id); return $isChildRel && $notHeadOrSpouse; }); $others = $family->patients->filter(function($p) use ($head, $spouse, $children) { if ($head && $p->id === $head->id) return false; if ($spouse && $p->id === $spouse->id) return false; if ($children->contains('id', $p->id)) return false; return true; }); @endphp
@if ($head) @php $isDeceased = ($head->removal_reason === 'deceased'); $avatarBg = $head->gender === 'female' ? 'bg-danger-subtle text-danger' : 'bg-info-subtle text-info'; $initials = strtoupper(substr($head->first_name ?? $head->name, 0, 1) . substr($head->first_surname ?? '', 0, 1)); @endphp
@if ($head->avatar_path) @else {{ $initials ?: '?' }} @endif
Age: {{ $head->date_of_birth->age }} yrs ({{ ucfirst($head->gender) }})
@if ($head->dispensary_group) {{ $head->dispensary_group }} @endif @if ($isDeceased) Deceased @endif
@else
No Head Registered
@endif @if ($spouse)
@php $isDeceased = ($spouse->removal_reason === 'deceased'); $avatarBg = $spouse->gender === 'female' ? 'bg-danger-subtle text-danger' : 'bg-info-subtle text-info'; $initials = strtoupper(substr($spouse->first_name ?? $spouse->name, 0, 1) . substr($spouse->first_surname ?? '', 0, 1)); @endphp
@if ($spouse->avatar_path) @else {{ $initials ?: '?' }} @endif
Age: {{ $spouse->date_of_birth->age }} yrs ({{ ucfirst($spouse->gender) }})
@if ($spouse->dispensary_group) {{ $spouse->dispensary_group }} @endif @if ($isDeceased) Deceased @endif
@endif
@if ($children->isNotEmpty())
@foreach ($children as $child) @php $isDeceased = ($child->removal_reason === 'deceased'); $avatarBg = $child->gender === 'female' ? 'bg-danger-subtle text-danger' : 'bg-info-subtle text-info'; $initials = strtoupper(substr($child->first_name ?? $child->name, 0, 1) . substr($child->first_surname ?? '', 0, 1)); @endphp
@if ($child->avatar_path) @else {{ $initials ?: '?' }} @endif
{{ $child->name }} {{ ucfirst($child->relationship_to_head ?? 'Child') }}
Age: {{ $child->date_of_birth->age }} yrs ({{ ucfirst($child->gender) }})
@if ($child->dispensary_group) {{ $child->dispensary_group }} @endif @if ($isDeceased) Deceased @endif @if ($child->father_name || $child->mother_name)
@if ($child->father_name)
F: {{ $child->father_name }} @if ($child->father_alive === false) @else @endif
@endif @if ($child->mother_name)
M: {{ $child->mother_name }} @if ($child->mother_alive === false) @else @endif
@endif
@endif
@endforeach
@endif
@if ($others->isNotEmpty())
OTHER HOUSEHOLD MEMBERS
@foreach ($others as $other) @php $isDeceased = ($other->removal_reason === 'deceased'); $avatarBg = $other->gender === 'female' ? 'bg-danger-subtle text-danger' : 'bg-info-subtle text-info'; $initials = strtoupper(substr($other->first_name ?? $other->name, 0, 1) . substr($other->first_surname ?? '', 0, 1)); @endphp
@if ($other->avatar_path) @else {{ $initials ?: '?' }} @endif
{{ $other->name }} {{ ucfirst($other->relationship_to_head ?? 'Member') }}
Age: {{ $other->date_of_birth->age }} yrs ({{ ucfirst($other->gender) }})
@if ($other->dispensary_group) {{ $other->dispensary_group }} @endif @if ($isDeceased) Deceased @endif
@endforeach
@endif
@endsection