Use opd_no on OPD history header

This commit is contained in:
DevSoftTech Server 2026-07-25 21:20:10 +05:30
parent 4e060b9b98
commit 39b5fc7c3e
2 changed files with 8 additions and 6 deletions

View File

@ -986,7 +986,9 @@ class Patient extends BaseController
$opdFields = $this->db->getFieldNames('opd_master') ?? [];
$opdSelect = [
'opd_id',
'opd_no',
'opd_code',
'doc_id',
'doc_name',
'apointment_date',
];
@ -1001,12 +1003,12 @@ class Patient extends BaseController
$totalOpdVisits = count($opdList);
$lastVisitDate = '';
$lastVisitSrNo = '';
$lastVisitOpdNo = '';
if ($totalOpdVisits > 0 && !empty($opdList[0]['apointment_date'])) {
$lastVisitDate = (string) $opdList[0]['apointment_date'];
}
if ($totalOpdVisits > 0) {
$lastVisitSrNo = trim((string) ($opdList[0]['queue_no'] ?? ''));
$lastVisitOpdNo = trim((string) (($opdList[0]['opd_no'] ?? '') !== '' ? $opdList[0]['opd_no'] : ($opdList[0]['opd_code'] ?? '')));
}
$opdIds = array_column($opdList, 'opd_id');
@ -1119,7 +1121,7 @@ class Patient extends BaseController
'opdGroups' => $opdGroups,
'totalOpdVisits' => $totalOpdVisits,
'lastVisitDate' => $lastVisitDate,
'lastVisitSrNo' => $lastVisitSrNo,
'lastVisitOpdNo' => $lastVisitOpdNo,
'backUrl' => $backUrl,
'backTitle' => $backTitle,
]);

View File

@ -21,7 +21,7 @@ $abhaIsVerified = $abhaVerifiedStatus === 'VERIFIED' || ($abhaKycVerified && $ab
$totalOpdVisits = (int) ($totalOpdVisits ?? 0);
$lastVisitDateRaw = trim((string) ($lastVisitDate ?? ''));
$lastVisitDateLabel = $lastVisitDateRaw !== '' ? date('d-m-Y', strtotime($lastVisitDateRaw)) : 'Not available';
$lastVisitSrNo = trim((string) ($lastVisitSrNo ?? ''));
$lastVisitOpdNo = trim((string) ($lastVisitOpdNo ?? ''));
$patientAge = trim((string) get_age_1($patient->dob ?? null, $patient->age ?? '', $patient->age_in_month ?? '', $patient->estimate_dob ?? ''));
$genderRaw = trim((string) ($patient->xgender ?? $patient->gender ?? ''));
@ -81,7 +81,7 @@ if ($patientPhotoPath === '') {
<span><strong>Age:</strong> <?= $patientAge !== '' ? esc($patientAge) : 'Not available' ?></span>
<span><strong>Gender:</strong> <?= esc($patientGender) ?></span>
<span><strong>Last Visit:</strong> <?= esc($lastVisitDateLabel) ?></span>
<span><strong>OPD Sr No.:</strong> <?= $lastVisitSrNo !== '' ? esc($lastVisitSrNo) : 'Not available' ?></span>
<span><strong>OPD No.:</strong> <?= $lastVisitOpdNo !== '' ? esc($lastVisitOpdNo) : 'Not available' ?></span>
<span><strong>No. of Visit:</strong> <?= esc((string) $totalOpdVisits) ?></span>
</div>
</div>
@ -203,7 +203,7 @@ if ($patientPhotoPath === '') {
<span class="text-muted ms-2">Dr. <?= esc($group['doc_name']) ?></span>
</div>
<div class="text-muted text-end">
<?= esc($group['opd_date']) ?> <?= esc($group['queue_no']) ?>
<?= esc($group['opd_date']) ?> <?= esc($group['queue_no'] !== '' ? $group['queue_no'] : ($group['rx_queue_no'] ?? '')) ?>
</div>
</div>