@php $history = $patient->clinicalHistory; @endphp
@if($history)
{{-- Antecedentes --}}
@php
$antecedentes = ['allergies'=>'Alergias','diseases'=>'Enfermedades','current_medications'=>'Medicamentos','contraindications'=>'Contraindicaciones','special_conditions'=>'Condiciones especiales','medical_notes'=>'Notas médicas'];
$hasAntecedentes = collect($antecedentes)->filter(fn($l,$k) => !empty($history->$k))->isNotEmpty();
@endphp
@if($hasAntecedentes)
@foreach($antecedentes as $field => $label)
@if(!empty($history->{$field}))
{{ $label }}
{{ $history->{$field} }}
@endif
@endforeach
@endif
{{-- Evoluciones --}}
@if($history->evolutions->count())
@foreach($history->evolutions as $ev)
Motivo de consulta
{{ $ev->consultation_reason }}
@if($ev->diagnosis_notes)
Notas de diagnóstico
{{ $ev->diagnosis_notes }}
@endif
@if($ev->treatment_plan)
Plan de tratamiento
{{ $ev->treatment_plan }}
@endif
@if($ev->diagnoses->count())
Diagnósticos
@foreach($ev->diagnoses as $diag)
• {{ $diag->typeLabel() }}: {{ $diag->name }} @if($diag->cie10_code)({{ $diag->cie10_code }})@endif
@endforeach
@endif
@endforeach
@endif
{{-- Prescripciones --}}
@if($history->prescriptions->count())
@foreach($history->prescriptions as $rx)
@foreach($rx->items as $item)
• {{ $item->medication }}
@if($item->dose) {{ $item->dose }}@endif
@if($item->frequency) — {{ $item->frequency }}@endif
@if($item->duration) por {{ $item->duration }}@endif
@endforeach
@endforeach
@endif
@endif