From 5a3eb5a63ddfe049b49719cc1aa88f92a078d8ff Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Mon, 24 Nov 2025 15:17:33 +0700 Subject: [PATCH] Update Rules Patient Identity Fix Version --- app/Controllers/Patient/Patient.php | 12 ++++++------ app/Models/Patient/PatientModel.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Controllers/Patient/Patient.php b/app/Controllers/Patient/Patient.php index 75d5475..ac17f03 100644 --- a/app/Controllers/Patient/Patient.php +++ b/app/Controllers/Patient/Patient.php @@ -80,11 +80,11 @@ class Patient extends Controller { // Khusus untuk Override PATIDT $type = $input['PatIdt']['IdentifierType'] ?? null; $identifierRulesMap = [ - 'KTP' => 'required|regex_match[/^[0-9]{16}$/]', - 'PASS' => 'required|regex_match[/^[A-Za-z0-9]{6,9}$/]', - 'SSN' => 'required|regex_match[/^[0-9]{3}-[0-9]{2}-[0-9]{4}$/]', - 'SIM' => 'required|regex_match[/^[A-Za-z0-9]{12,14}$/]', - 'KTAS' => 'required|regex_match[/^[A-Za-z0-9]{12,15}$/]', + 'KTP' => 'required|regex_match[/^[0-9]{16}$/]', // 16 pas digit numeric + 'PASS' => 'required|regex_match[/^[A-Za-z0-9]{1,9}$/]', // alphanumeric max 9 + 'SSN' => 'required|regex_match[/^[0-9]{9}$/]', // numeric, pas 9 digit + 'SIM' => 'required|regex_match[/^[0-9]{19,20}$/]', // numeric 19–20 digit + 'KITAS' => 'required|regex_match[/^[0-9]{11}$/]', // numeric, pas 11 digit ]; if ($type === null || $type === '') { $identifierRule = 'permit_empty|max_length[255]'; @@ -126,7 +126,7 @@ class Patient extends Controller { $this->rules['PatIdt.IdentifierType'] = 'required'; $this->rules['PatIdt.Identifier'] = $identifierRule; } - + if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); } try { $InternalPID = $this->model->updatePatient($input); diff --git a/app/Models/Patient/PatientModel.php b/app/Models/Patient/PatientModel.php index 951ee0d..f78ef57 100644 --- a/app/Models/Patient/PatientModel.php +++ b/app/Models/Patient/PatientModel.php @@ -21,7 +21,7 @@ class PatientModel extends BaseModel { protected $deletedField = 'DelDate'; public function getPatients($filters = []) { - $qname = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))"; + $qname = "CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,''))"; $this->select("InternalPID, PatientID, $qname as FullName, Gender, Birthdate, EmailAddress1 as Email, MobilePhone");