fix(abdm): improve patient name formatting and single document testing

This commit is contained in:
DevSoftTech Server 2026-10-08 20:56:38 +05:30
parent 3ed80ac293
commit e8a33ba1f4
2 changed files with 14 additions and 4 deletions

View File

@ -26,7 +26,11 @@ class TestAbdmPdf extends BaseCommand
$_SERVER['REQUEST_METHOD'] = 'GET';
$get = [];
if ($consentReqId !== '') {
$get['consent_request_id'] = $consentReqId;
if (is_numeric($consentReqId) && strlen($consentReqId) < 10) {
$get['doc_id'] = (int) $consentReqId;
} else {
$get['consent_request_id'] = $consentReqId;
}
}
$_GET = $get;

View File

@ -2242,9 +2242,15 @@ class Patient extends BaseController
}
}
$patientName = trim((string) (($patientRow['title'] ?? '') . ' ' . ($patientRow['p_fname'] ?? '') . ' ' . ($patientRow['p_lname'] ?? '')));
if ($patientName === '' || $patientName === '0') {
$patientName = trim((string) ($patientRow['p_fname'] ?? ''));
$title = trim((string) ($patientRow['title'] ?? ''));
$fname = trim((string) ($patientRow['p_fname'] ?? ''));
$lname = trim((string) ($patientRow['p_lname'] ?? ''));
if ($lname === '0' || strtolower($lname) === 'null') {
$lname = '';
}
$patientName = trim($title . ' ' . $fname . ($lname !== '' ? ' ' . $lname : ''));
if ($patientName === '') {
$patientName = 'Patient #' . $pno;
}
$genderVal = (int) ($patientRow['gender'] ?? 0);
$genderStr = $genderVal === 1 ? 'Male' : ($genderVal === 2 ? 'Female' : ($genderVal === 3 ? 'Other' : '-'));