@php
// Switching tabs on the report form and saving each one leaves
// both ultrasound_obstetric_details and
// ultrasound_general_findings rows in place (see
// ImagingReportController@create) — if staff filled in both,
// both print, not just whichever was saved most recently.
$hasObstetric = $report->UltrasoundObstetric !== null;
$hasGeneral = $report->UltrasoundGeneral !== null;
$printTitle = match (true) {
$hasObstetric && $hasGeneral => 'Ultrasound Report',
$report->report_category === 'ultrasound_obstetric' => 'Obstetric Ultrasound Report',
$report->report_category === 'ultrasound_general' => 'General Diagnostic Ultrasound Report',
$report->report_category === 'xray' => 'X-ray Report',
default => 'Imaging Report',
};
$patient = $imageRequest->Appointment?->Patient ?? $imageRequest->Pat;
@endphp
@include('layouts.print_header', ['printTitle' => $printTitle])
@php
$age = $patient?->dob ? \Carbon\Carbon::parse($patient->dob)->age : null;
$age = ($age !== null && $age >= 0 && $age < 130) ? $age . ' yrs' : '-';
@endphp
@if (in_array($report->report_category, ['ultrasound_obstetric', 'ultrasound_general']))
@if ($hasObstetric)
@php $d = $report->UltrasoundObstetric; @endphp
@php
// stored as "weeks.days" (3.4 = 3 weeks 4 days)
$w = function ($v) {
if ($v === null || $v === '') return '-';
$wk = (int) floor((float) $v);
$dy = min(6, max(0, (int) round(((float) $v - $wk) * 10)));
return $wk . ' week' . ($wk == 1 ? '' : 's') . ($dy ? ' ' . $dy . ' day' . ($dy == 1 ? '' : 's') : '');
};
$placenta = trim(implode(' ', array_filter([$d?->placenta_condition, $d?->placenta_position, $d?->placenta_other])));
@endphp
@endif
@if ($hasGeneral)
@php $g = $report->UltrasoundGeneral; @endphp
Patient name
{{ $patient?->name }}
Patient ID
{{ $patient?->patient_id }}
Age / Gender
{{ $age }} / {{ ucfirst($patient?->gender ?? '-') }}
Address
{{ $patient?->address ?: '-' }}
Scan date
{{ \Carbon\Carbon::parse($imageRequest->date)->format('d M, Y') }}
Print date
{{ now()->format('d M, Y') }}
Requesting doctor
{{ $imageRequest->Dr?->name ?: '-' }}
Pregnancy Report
Gravida
{{ $d?->gravida ?? '-' }}
Para
{{ $d?->para ?? '-' }}
Gestational age
{{ $w($d?->gestational_age_weeks) }}
EDD
{{ $d?->edd ? \Carbon\Carbon::parse($d->edd)->format('d M, Y') : '-' }}
Fetal condition
{{ $d?->fetal_condition ?: '-' }}
Fetal sex
{{ ucfirst($d?->fetal_sex ?: '-') }}
FHR
{{ $d?->fhr ? $d->fhr . ' bpm' : '-' }}
Presentation
{{ ucfirst($d?->presentation ?: '-') }}
Fetal biometry
BPD — biparietal diameter
{{ $w($d?->bpd) }}
HC — head circumference
{{ $w($d?->hc_cm) }}
FL — femur length
{{ $w($d?->fl_cm) }}
AC — abdominal circumference
{{ $w($d?->ac_cm) }}
EFW — estimated fetal weight
{{ $d?->efw_kg !== null ? rtrim(rtrim(number_format((float) $d->efw_kg, 3), '0'), '.') . ' kg' : '-' }}
Amniotic fluid
{{ ucfirst($d?->amniotic_fluid ?: '-') }}
Placenta
{{ $placenta ?: '-' }}
General Diagnostic Report
Liver & gallbladder{{ $g?->liver_gallbladder }}
Spleen{{ $g?->spleen }}
Kidneys & urinary tract{{ $g?->kidneys_urinary_tract }}
Uterus & adnexa{{ $g?->uterus_adnexa }}
@if ($g?->other_findings)
Other findings{{ $g?->other_findings }}
@endif
@endif
@elseif ($report->report_category === 'xray')
@php $x = $report->Xray; @endphp
X-ray Report
Region examined{{ $x?->region_examined }}
View / projection{{ $x?->view_projection }}
Findings{{ $x?->findings }}
Impression{{ $x?->impression }}
@else
Report
Findings{{ $report->findings }}
Impression{{ $report->impression }}
@endif
@if ($report->conclusion)
Conclusion
{{ $report->conclusion }}
@endif
@if ($report->next_appointment_date)
Next appointment{{ \Carbon\Carbon::parse($report->next_appointment_date)->format('d M, Y') }}
@endif
{{ $report->ReportingDoctor?->name ?: ($imageRequest->Dr?->name ?: 'Doctor') }}
Signature
Signature
Date
{{ now()->format('d M, Y') }}
{{ now()->format('d M, Y') }}