Consultation clinical record

Consultation #{{ $consultation->id }} • {{ $consultation->scheduled_at?->format('F j, Y \a\t g:i A') }} • Type: {{ $consultation->consultation_type }} • Status: {{ $consultation->status }}
Dr. {{ $consultation->doctor?->name ?? 'Unknown' }} • Patient: {{ $consultation->patient?->name ?? 'Unknown' }} @if(!empty($consultation->patient?->patient_number)) • Patient no.: {{ $consultation->patient->patient_number }} @endif
@if(!empty($consultation->reason))

Reason for consultation

{{ strip_tags($consultation->reason) }}
@endif @if(!empty($consultation->notes))

Consultation notes (internal)

{{ $consultation->notes }}
@endif @php $presentingComplaintLines = []; if (!empty($notes['presenting_complaints']) && is_array($notes['presenting_complaints'])) { foreach ($notes['presenting_complaints'] as $line) { if (is_string($line) && trim($line) !== '') { $presentingComplaintLines[] = trim($line); } elseif (is_array($line)) { $c = isset($line['complaint']) && is_string($line['complaint']) ? trim($line['complaint']) : ''; $d = isset($line['duration']) && is_string($line['duration']) ? trim($line['duration']) : ''; if ($c === '' && $d === '') { continue; } if ($c === '') { $presentingComplaintLines[] = '(duration: '.$d.')'; } elseif ($d === '') { $presentingComplaintLines[] = $c; } else { $presentingComplaintLines[] = $c.' — Duration: '.$d; } } } } @endphp @if(count($presentingComplaintLines) > 0)

Presenting complaint(s)

    @foreach($presentingComplaintLines as $line)
  1. {{ $line }}
  2. @endforeach
@elseif(!empty($notes['presenting_complaint']) && is_string($notes['presenting_complaint']) && trim($notes['presenting_complaint']) !== '')

Presenting complaint

{{ $notes['presenting_complaint'] }}
@endif @php $ros = $notes['review_of_systems'] ?? null; $rosBlocks = []; if (is_string($ros) && trim($ros) !== '') { $rosBlocks[] = ['label' => null, 'text' => trim($ros)]; } elseif (is_array($ros)) { $rosDefs = [ 'cns' => 'Central nervous system', 'respiratory' => 'Respiratory system', 'cardiovascular' => 'Cardiovascular system', 'digestive' => 'Digestive system', 'genitourinary' => 'Genital–urinary system', 'locomotor' => 'Locomotor system', 'other' => 'Other systems', ]; foreach ($rosDefs as $rk => $rlabel) { $t = isset($ros[$rk]) && is_string($ros[$rk]) ? trim($ros[$rk]) : ''; if ($t !== '') { $rosBlocks[] = ['label' => $rlabel, 'text' => $t]; } } } @endphp @if(count($rosBlocks) > 0)

Review of systems

@foreach($rosBlocks as $rb) @if(!empty($rb['label']))

{{ $rb['label'] }}

@endif
{{ $rb['text'] }}
@endforeach
@endif @php $simpleTextFields = [ 'history_of_presenting_complaint' => 'History of presenting complaint', 'past_medical_history' => 'Past medical history', 'past_surgical_history' => 'Past surgical history', 'growth_and_development' => 'Growth and development', 'immunization_history' => 'Immunization history', 'family_history' => 'Family history', 'social_history' => 'Social history', 'summary_of_history' => 'Summary of history', 'differential_diagnosis' => 'Differential diagnosis', 'investigation_results' => 'Investigation results', 'final_diagnosis' => 'Final diagnosis', 'final_treatment' => 'Final treatment', ]; @endphp @foreach($simpleTextFields as $key => $label) @if(!empty($notes[$key]) && is_string($notes[$key]) && trim($notes[$key]) !== '')

{{ $label }}

{{ $notes[$key] }}
@endif @endforeach @if(!empty($notes['differential_diagnoses_icd11']) && is_array($notes['differential_diagnoses_icd11']))

Differential diagnoses (ICD-11)

@endif @if(!empty($notes['final_diagnosis_icd11']) && is_array($notes['final_diagnosis_icd11'])) @php $fd = $notes['final_diagnosis_icd11']; @endphp @if(!empty($fd['code'] ?? null) || !empty($fd['title'] ?? null))

Final diagnosis (ICD-11)

{{ $fd['code'] ?? '' }} {{ $fd['title'] ?? '' }}
@endif @endif @php $mp = $notes['management_plan'] ?? null; $isStructured = is_array($mp); $ipv = $isStructured ? ($mp['in_person_visit'] ?? null) : null; $hasIpv = is_array($ipv) && (!empty($ipv['revisit_history'] ?? null) || !empty($ipv['general_examination'] ?? null) || !empty($ipv['system_examination'] ?? null)); $rx = $isStructured ? ($mp['prescription'] ?? null) : null; $hasRx = is_array($rx) && !empty($rx['medications'] ?? null); $hasMpContent = $isStructured && (!empty($mp['treatment'] ?? null) || !empty($mp['investigation_radiology'] ?? null) || !empty($mp['investigation_laboratory'] ?? null) || !empty($mp['investigation_interventional'] ?? null) || !empty($mp['referrals'] ?? null) || $hasIpv || $hasRx); @endphp @if ($hasMpContent)

Management plan

@if(!empty($mp['treatment'] ?? null))

Treatment

{{ $mp['treatment'] }}
@endif @if($hasRx)

Prescription

@if(!empty($rx['instructions'] ?? null))
{{ $rx['instructions'] }}
@endif @endif @if(!empty($mp['investigation_radiology'] ?? null) || !empty($mp['investigation_laboratory'] ?? null) || !empty($mp['investigation_interventional'] ?? null))

Investigation

@if(!empty($mp['investigation_radiology'] ?? null))

Radiology: {{ $mp['investigation_radiology'] }}

@endif @if(!empty($mp['investigation_laboratory'] ?? null))

Laboratory: {{ $mp['investigation_laboratory'] }}

@endif @if(!empty($mp['investigation_interventional'] ?? null))

Interventional: {{ $mp['investigation_interventional'] }}

@endif @endif @if(!empty($mp['referrals'] ?? null))

Referrals

{{ $mp['referrals'] }}
@endif @if($hasIpv)

In-person visit

@if(!empty($ipv['revisit_history'] ?? null))

Doctor revisits history:

{{ $ipv['revisit_history'] }}
@endif @if(!empty($ipv['general_examination'] ?? null))

General examination:

@php $ge = $ipv['general_examination']; @endphp @if(is_array($ge)) @php $geLines = []; if(!empty($ge['appearance'] ?? null)) $geLines[] = 'General appearance: ' . $ge['appearance']; if(!empty($ge['jaundice'] ?? null)) $geLines[] = 'Jaundice: ' . $ge['jaundice']; if(!empty($ge['anemia'] ?? null)) $geLines[] = 'Anemia: ' . $ge['anemia']; if(!empty($ge['cyanosis'] ?? null)) $geLines[] = 'Cyanosis: ' . $ge['cyanosis']; if(!empty($ge['clubbing'] ?? null)) $geLines[] = 'Clubbing: ' . $ge['clubbing']; if(!empty($ge['oedema'] ?? null)) $geLines[] = 'Oedema: ' . $ge['oedema']; if(!empty($ge['lymphadenopathy'] ?? null)) $geLines[] = 'Lymphadenopathy: ' . $ge['lymphadenopathy']; if(!empty($ge['dehydration'] ?? null)) $geLines[] = 'Dehydration: ' . $ge['dehydration']; @endphp
{{ implode("\n", $geLines) }}
@else
{{ $ge }}
@endif @endif @if(!empty($ipv['system_examination'] ?? null))

System examination:

{{ is_string($ipv['system_examination']) ? $ipv['system_examination'] : json_encode($ipv['system_examination']) }}
@endif @elseif(is_string($ipv) && trim($ipv) !== '')

In-person visit

{{ $ipv }}
@endif
@elseif (is_string($mp) && trim($mp) !== '')

Management plan

{{ $mp }}
@endif @php $oc = $notes['outcome'] ?? null; $hasOutcome = is_array($oc) && ( (!empty($oc['doctor_notes']) && is_string($oc['doctor_notes']) && trim($oc['doctor_notes']) !== '') || array_key_exists('patient_reports_improved', $oc) ); @endphp @if($hasOutcome)

Outcome

@if(!empty($oc['doctor_notes']) && is_string($oc['doctor_notes']) && trim($oc['doctor_notes']) !== '')

Clinician

{{ $oc['doctor_notes'] }}
@endif @if(array_key_exists('patient_reports_improved', $oc))

Patient follow-up

Reports improved: @if($oc['patient_reports_improved'] === true) Yes @elseif($oc['patient_reports_improved'] === false) No @else Not recorded @endif @if(!empty($oc['patient_reported_at'])) ({{ $oc['patient_reported_at'] }}) @endif

@endif
@endif @if(count($uploads) > 0)

Patient-uploaded investigation files

@foreach($uploads as $u) @if(is_array($u))

{{ ($u['category'] ?? '') === 'radiology' ? 'Radiology' : 'Laboratory' }}: {{ $u['label'] ?? $u['original_filename'] ?? 'File' }}

@endif @endforeach
@endif