{{ $patient?->name }} Visits

@if($visits && count($visits) > 0)
@foreach($visits as $visit) @php // check if parent exists in the visits collection $parentExists = $visit->parent_visit_id && $visits->where('id', $visit->parent_visit_id)->count() > 0; @endphp @if(!$visit->parent_visit_id || !$parentExists)
{{-- Date & Time --}}
{{ $visit->date }} {{ \Carbon\Carbon::parse($visit->time)->format('H:i') }}
{{-- Diagnosis --}}
Diagnosis: @if($visit->diagnosis) @foreach(optional(json_decode($visit->diagnosis, true) ?? []) as $diag) {{ $diag }} @endforeach @else N/A @endif
{{-- Complain --}}
Complain: {{ $visit->complain ?? '-' }}
{{-- Prescription --}}
Prescription: @if($visit->prescriptionItems && count($visit->prescriptionItems) > 0)
    @foreach($visit->prescriptionItems as $item)
  • {{ $item->drug_name }} - {{ $item->qty }} {{ $item->qty_unit }}, for {{ $item->days }} {{ $item->duration_type }} @if($item->notes)
    Note: {{ $item->notes }} @endif
  • @endforeach
@else No prescription added. @endif
{{-- Expand children --}} @if($visit->children && count($visit->children) > 0)
@endif
{{-- Children visits with timeline --}} @if($visit->children && count($visit->children) > 0)
{{-- Vertical line (timeline) --}}
@foreach($visit->children as $child)
{{-- Timeline dot --}}
{{-- Date & Time --}}
{{ $child->date }} {{ \Carbon\Carbon::parse($child->time)->format('H:i') }}
{{-- Diagnosis --}}
Diagnosis: @if($child->diagnosis) @foreach(optional(json_decode($child->diagnosis, true) ?? []) as $diag) {{ $diag }} @endforeach @else N/A @endif
{{-- Complain --}}
Complain: {{ $child->complain ?? '-' }}
{{-- Prescription --}}
Prescription: @if($child->prescriptionItems && count($child->prescriptionItems) > 0)
    @foreach($child->prescriptionItems as $item)
  • {{ $item->drug_name }} - {{ $item->qty }} {{ $item->qty_unit }}, for {{ $item->days }} {{ $item->duration_type }} @if($item->notes)
    Note: {{ $item->notes }} @endif
  • @endforeach
@else No prescription added. @endif
@endforeach
@endif
@endif @endforeach
@else

No visits found.

@endif