@extends('layouts.master') @section('title', $title) @section('content')
Patient : {{ $imageRequest->Appointment?->Patient?->name ?? $imageRequest->Pat?->name }} Gender : {{ $imageRequest->Appointment?->Patient?->gender ?? $imageRequest->Pat?->gender }} Age : @php $dob = $imageRequest->Appointment?->Patient?->dob ?? $imageRequest->Pat?->dob; @endphp {{ $dob ? \Carbon\Carbon::now()->diffInYears(\Carbon\Carbon::parse($dob)) : '-' }} Image type : {{ $imageRequest->img?->name }} Date : {{ \Carbon\Carbon::parse($imageRequest->date)->format('d M, Y') }} Status : @if ($report?->status == 'Processed') Processed @elseif ($report?->status == 'Draft') Draft @else Pending @endif
@csrf {{-- Defaults to finalizing the report; the Draft button below overrides this right before submit — same convention as Lab's Prepare Result. --}}
{{-- the reporting doctor is the doctor who requested the imaging (set on save) --}} {{-- Which fieldset renders is normally looked up from the request's own image type (image_types.report_template) — see ImagingReportController@categoryFor. An ultrasound is the one case staff get to choose for themselves: Pregnancy and General are both right there as tabs on this same page, defaulting to whichever the image type points at, switchable before saving. The hidden report_category field carries whichever tab is active at submit time; the controller only lets it move between these two, never into xray/generic. --}} @if (in_array($category, ['ultrasound_obstetric', 'ultrasound_general'])) {{-- ultrasound: the doctor picks the report type — one of the templates (App\Services\UltrasoundTemplates) or the two older quick forms --}} @php $tabs = collect($templates)->map(fn ($t) => $t['short'])->all() + ['ultrasound_obstetric' => 'Pregnancy (quick)', 'ultrasound_general' => 'General (abdomen)']; $isTpl = fn ($k) => str_starts_with($k, 'us_'); @endphp @foreach ($templates as $k => $tpl)
{{ $tpl['title'] }}
@include('patient_mangement.appointment.image.report._template', [ 'tplKey' => $k, 'tpl' => $tpl, 'patientInfo' => $patientInfo, 'values' => $report?->template === $k ? ($report->report_data ?? []) : [], ])
@endforeach
@include('patient_mangement.appointment.image.report._ultrasound_obstetric', ['details' => $report?->UltrasoundObstetric])
@include('patient_mangement.appointment.image.report._ultrasound_general', ['findings' => $report?->UltrasoundGeneral])
@elseif ($category === 'xray') @include('patient_mangement.appointment.image.report._xray', ['findings' => $report?->Xray]) @else @include('patient_mangement.appointment.image.report._generic') @endif
{{-- a template has its own Impression / Recommendations --}}
@endsection @section('page_css') @endsection @section('page_js') @endsection