This commit is contained in:
Dr Masroor Ehsan 2025-01-07 13:13:28 +06:00
parent 97564b6274
commit 24163fb2c5
3 changed files with 28 additions and 4 deletions

View File

@ -27,12 +27,18 @@ public function show()
$this->decodeKeys(); $this->decodeKeys();
$study = Study::with(['details'])->findOrFail($this->key); $study = Study::with(['details'])->findOrFail($this->key);
$fmtD = 'M d, Y'; $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 <span class="text-muted ms-2">%s</span>', $study->patient_birthdate->age, $study->patient_birthdate->format($fmtD));
} else {
$age = '';
}
$data = [ $data = [
'Patient Name' => $study->patient_name, 'Patient Name' => $study->patient_name,
'Patient Id' => $study->patient_id, 'Patient Id' => $study->patient_id,
'Patient Sex' => $study->patient_sex, 'Sex' => sprintf('<i class="me-2 fa-light %s"></i> %s', $study->gender_icon, $study->gender_name),
'Patient Birthdate' => $study->patient_birthdate?->format($fmtD) ?? '', 'Age' => $age,
'Accession #' => $study->accession_number, 'Accession #' => $study->accession_number,
'Modality' => $study->modality, 'Modality' => $study->modality,
'Study Date' => $study->study_date->format($fmtDT), 'Study Date' => $study->study_date->format($fmtDT),

View File

@ -307,4 +307,22 @@ protected function casts(): array
'patient_birthdate' => 'immutable_date', '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',
};
}
} }

View File

@ -9,7 +9,7 @@
<tr> <tr>
@foreach ($chunk as $key => $value) @foreach ($chunk as $key => $value)
<td class="table-active fw-bold">{{ $key }}</td> <td class="table-active fw-bold">{{ $key }}</td>
<td class="fw-medium">{{ $value }}</td> <td class="fw-medium">{!! $value !!}</td>
@endforeach @endforeach
</tr> </tr>
@endforeach @endforeach