Update Index untuk search2

This commit is contained in:
mikael-zakaria 2025-08-04 15:23:49 +07:00
parent 475c10a6d6
commit 77a5746fe9

View File

@ -28,14 +28,14 @@ class Patient extends Controller {
$builder = $this->db->table('patient'); $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,'')))"; $sql = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
$rawSql = new RawSql($sql); $rawSql = new RawSql($sql);
$builder->like($rawSql, $Name, 'both'); $builder->like($rawSql, $Name, 'both');
} }
if ($InternalPID !== null) { $builder->where('InternalPID', $InternalPID); } if ($InternalPID !== null) { $builder->where('InternalPID', $InternalPID); }
if ($PatientID !== null) { $builder->where('PatientID', $PatientID); } if ($PatientID !== null) { $builder->where('PatientID', $PatientID); }
// if ($AlternatePID !== null) { $builder->where('AlternatePID', $pat_altnum); } // if ($AlternatePID !== null) { $builder->where('AlternatePID', $pat_altnum); }
if ($BirthDate !== null) { $builder->where('BirthDate', $pat_dob); } if ($BirthDate !== null) { $builder->where('BirthDate', $BirthDate); }
/* /*
if ($startDate !== null || $endDate !== null) { if ($startDate !== null || $endDate !== null) {
$builder->join('requests', 'pat_id=patients.pat_id','left'); $builder->join('requests', 'pat_id=patients.pat_id','left');