From bedb1c922a2485d73506b07e3c24746dbcca13fc Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Thu, 6 Aug 2026 08:46:54 +0530 Subject: [PATCH] Show old UHID in patient search results --- app/Controllers/Patient.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 7690340..8407da0 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -465,6 +465,18 @@ class Patient extends BaseController return "TRIM(COALESCE(p.{$oldUhidField}, '')) != '' AND (" . implode(' OR ', $clauses) . ')'; } + protected function formatPatientCodeCell(int $patientId, string $patientCode, string $oldUhid = ''): string + { + $link = '' . esc($patientCode) . ''; + $oldUhid = trim($oldUhid); + + if ($oldUhid === '') { + return $link; + } + + return $link . '
' . esc($oldUhid) . ''; + } + protected function buildPatientSearchCondition(string $rowData, ?string $abhaField = null, ?string $oldUhidField = null): string { $escapedValue = $this->db->escape($rowData); @@ -590,10 +602,14 @@ class Patient extends BaseController foreach ($records as $index => $row) { $patientId = (int) ($row->id ?? 0); $age = esc(get_age_1($row->dob ?? null, $row->age ?? '', $row->age_in_month ?? '', $row->estimate_dob ?? '', $row->Last_Visit ?? null)); + $oldUhid = ''; + if ($oldUhidField !== null && $oldUhidField !== '' && isset($row->{$oldUhidField})) { + $oldUhid = (string) $row->{$oldUhidField}; + } $data[] = [ $start + $index + 1, - '' . esc($row->p_code ?? '') . '', + $this->formatPatientCodeCell($patientId, (string) ($row->p_code ?? ''), $oldUhid), esc(($row->p_fname ?? '') . ' {' . ($row->p_rname ?? '') . '}'), $age, esc($row->Last_Visit ?? ''),