diff --git a/app/Commands/TestAbdmPdf.php b/app/Commands/TestAbdmPdf.php index 452a7d0..0ca4739 100644 --- a/app/Commands/TestAbdmPdf.php +++ b/app/Commands/TestAbdmPdf.php @@ -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; diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 27ddd15..68de2f3 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -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' : '-'));