This commit is contained in:
mikael-zakaria 2025-08-05 11:38:20 +07:00
commit a367ffbd13

View File

@ -19,11 +19,11 @@ class Patient extends Controller {
$PatientID = $this->request->getVar('PatientID');
$Name = $this->request->getVar('Name');
$BirthDate = $this->request->getVar('BirthDate');
$qname = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
$builder = $this->db->table('patient');
$builder->select("InternalPID, PatientID, $qname as FullName, Gender, BirthDate");
if ($Name !== null) {
$sql = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
$sql = $qname;
$rawSql = new RawSql($sql);
$builder->like($rawSql, $Name, 'both');
}