From 475c10a6d610821ecb3f6054af03a847e0540b4a Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Mon, 4 Aug 2025 13:21:13 +0700 Subject: [PATCH] Update Index untuk search --- app/Controllers/Patient.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index ccd97ef..af2e706 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -15,24 +15,26 @@ class Patient extends Controller { // OK - Done public function index() { try { + $InternalPID = $this->request->getVar('InternalPID'); $PatientID = $this->request->getVar('PatientID'); - $AlternatePID = $this->request->getVar('AlternatePID'); - $Prefix = $this->request->getVar('Prefix'); - $name = $this->request->getVar('Name'); - $Suffix = $this->request->getVar('Suffix'); + // $AlternatePID = $this->request->getVar('AlternatePID'); + // $Prefix = $this->request->getVar('Prefix'); + $Name = $this->request->getVar('Name'); + // $Suffix = $this->request->getVar('Suffix'); $BirthDate = $this->request->getVar('BirthDate'); - $startDate = $this->request->getVar('StartDate'); - $endDate = $this->request->getVar('EndDate'); + // $startDate = $this->request->getVar('StartDate'); + // $endDate = $this->request->getVar('EndDate'); $builder = $this->db->table('patient'); - if ($name !== null) { + if ($Name !== null) { $sql = "LOWER(CONCAT_WS(' ', IFNULL(prefix,''), IFNULL(name_first,''), IFNULL(name_middle,''), IFNULL(name_last,''), IFNULL(name_maiden,''), IFNULL(suffix,'')))"; $rawSql = new RawSql($sql); - $builder->like($rawSql, $name, 'both'); + $builder->like($rawSql, $Name, 'both'); } - if ($PatientID !== null) { $builder->where('PatientID', $pat_num); } - if ($AlternatePID !== null) { $builder->where('AlternatePID', $pat_altnum); } + if ($InternalPID !== null) { $builder->where('InternalPID', $InternalPID); } + if ($PatientID !== null) { $builder->where('PatientID', $PatientID); } + // if ($AlternatePID !== null) { $builder->where('AlternatePID', $pat_altnum); } if ($BirthDate !== null) { $builder->where('BirthDate', $pat_dob); } /* if ($startDate !== null || $endDate !== null) {