Add patient list age fields

- Include Age and BirthdateConversion in patient list responses
- Keep Sex label transformation unchanged
- Preserve existing patient audit/update behavior
This commit is contained in:
mahdahar 2026-04-21 11:22:17 +07:00
parent 8fdaf0ade7
commit 4f87be295b

View File

@ -48,6 +48,16 @@ class PatientModel extends BaseModel {
$rows = ValueSet::transformLabels($rows, [
'Sex' => 'sex',
]);
foreach ($rows as &$row) {
$birthdate = $row['Birthdate'] ?? null;
$row['Age'] = empty($birthdate)
? ''
: $this->calculateAgeFromBirthdate($birthdate, null);
$row['BirthdateConversion'] = $this->formatedDateForDisplay($birthdate);
}
unset($row);
return $rows;
}