diff --git a/app/Http/Controllers/Staff/StudiesController.php b/app/Http/Controllers/Staff/StudiesController.php index 28c30b5..cbc8290 100644 --- a/app/Http/Controllers/Staff/StudiesController.php +++ b/app/Http/Controllers/Staff/StudiesController.php @@ -27,12 +27,18 @@ public function show() $this->decodeKeys(); $study = Study::with(['details'])->findOrFail($this->key); $fmtD = 'M d, Y'; - $fmtDT = 'M d, Y h:i A'; + //$fmtDT = 'M d, Y h:i A D'; + $fmtDT = 'F j, Y h:i A (l)'; + if (! is_null($study->patient_birthdate)) { + $age = sprintf('%sY %s', $study->patient_birthdate->age, $study->patient_birthdate->format($fmtD)); + } else { + $age = ''; + } $data = [ 'Patient Name' => $study->patient_name, 'Patient Id' => $study->patient_id, - 'Patient Sex' => $study->patient_sex, - 'Patient Birthdate' => $study->patient_birthdate?->format($fmtD) ?? '', + 'Sex' => sprintf(' %s', $study->gender_icon, $study->gender_name), + 'Age' => $age, 'Accession #' => $study->accession_number, 'Modality' => $study->modality, 'Study Date' => $study->study_date->format($fmtDT), diff --git a/app/Models/Study.php b/app/Models/Study.php index 8033ddd..2c47e3e 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -307,4 +307,22 @@ protected function casts(): array 'patient_birthdate' => 'immutable_date', ]; } + + public function getGenderIconAttribute(): string + { + return match (strtolower($this->patient_sex ?? '')) { + 'f' => 'fa-venus text-danger', + 'm' => 'fa-mars text-primary', + default => 'fa-genderless', + }; + } + + public function getGenderNameAttribute(): string + { + return match (strtolower($this->patient_sex ?? '')) { + 'f' => 'Female', + 'm' => 'Male', + default => 'Other', + }; + } } diff --git a/resources/views/staff/studies/show-details.blade.php b/resources/views/staff/studies/show-details.blade.php index 38f5ee8..7bc2efd 100644 --- a/resources/views/staff/studies/show-details.blade.php +++ b/resources/views/staff/studies/show-details.blade.php @@ -9,7 +9,7 @@