Update Patient, semua variabel menjadi PascalCase mengikuti Penamaan Kolom DB_2

This commit is contained in:
mikael-zakaria 2025-08-04 11:01:03 +07:00
parent 06f62fdde0
commit 8bf8a8536e

View File

@ -18,11 +18,11 @@ class Patient extends Controller {
$PatientID = $this->request->getVar('PatientID'); $PatientID = $this->request->getVar('PatientID');
$AlternatePID = $this->request->getVar('AlternatePID'); $AlternatePID = $this->request->getVar('AlternatePID');
$Prefix = $this->request->getVar('Prefix'); $Prefix = $this->request->getVar('Prefix');
$name = $this->request->getVar('name'); $name = $this->request->getVar('Name');
$Suffix = $this->request->getVar('Suffix'); $Suffix = $this->request->getVar('Suffix');
$BirthDate = $this->request->getVar('BirthDate'); $BirthDate = $this->request->getVar('BirthDate');
$startDate = $this->request->getVar('startDate'); $startDate = $this->request->getVar('StartDate');
$endDate = $this->request->getVar('endDate'); $endDate = $this->request->getVar('EndDate');
$builder = $this->db->table('patient'); $builder = $this->db->table('patient');
@ -108,40 +108,42 @@ class Patient extends Controller {
$data = [ $data = [
"PatientID" => $input['PatientID'] ?? null, "PatientID" => $input['PatientID'] ?? null,
"AlternatePID" => $input['AlternateID'] ?? null, "AlternatePID" => $input['AlternatePID'] ?? null,
"Prefix" => $input['Title'] ?? null, "Prefix" => $input['Prefix'] ?? null,
"NameFirst" => $input['NameFirst'] ?? null, "NameFirst" => $input['NameFirst'] ?? null,
"NameMiddle" => $input['NameMiddle'] ?? null, "NameMiddle" => $input['NameMiddle'] ?? null,
"NameMaiden" => $input['NameMaiden'] ?? null, "NameMaiden" => $input['NameMaiden'] ?? null,
"NameLast" => $input['NameLast'] ?? null, "NameLast" => $input['NameLast'] ?? null,
"Suffix" => $input['Suffix'] ?? null, "Suffix" => $input['Suffix'] ?? null,
"NameAlias" => null, "NameAlias" => null,
"Gender" => ((int) $input['Gender']) ?? null, "Gender" => isset($input['Gender']) ? (int) $input['Gender'] : null,
"PlaceOfBirth" => $input['PlaceOfBirthdate'] ?? null, "PlaceOfBirth" => $input['PlaceOfBirth'] ?? null,
"BirthDate" => $input['Birthdate'] ?? null, "BirthDate" => $input['BirthDate'] ?? null,
"Street1" => $input['Street1'] ?? null, "Street_1" => $input['Street_1'] ?? null,
"Street2" => $input['Street2'] ?? null, "Street_2" => $input['Street_2'] ?? null,
"Street3" => null, "Street_3" => null,
"City" => $input['City'] ?? null, "City" => $input['City'] ?? null,
"Province" => $input['Province'] ?? null, "Province" => $input['Province'] ?? null,
"ZIP" => null, "ZIP" => $input['ZIP'] ?? null,
"CountryID" => null, "CountryID" => isset($input['CountryID']) ? (int) $input['CountryID'] : null,
"EmailAddress1" => $input['Email1'] ?? null, "Emailaddress1" => $input['Emailaddress1'] ?? null,
"EmailAddress2" => $input['Email2'] ?? null, "Emailaddress2" => $input['Emailaddress2'] ?? null,
"Phone" => $input['Phone'] ?? null, "Phone" => $input['Phone'] ?? null,
"MobilePhone" => $input['Mobile'] ?? null, "Mobilephone" => $input['Mobilephone'] ?? null,
"Mother" => $input['Mother'] ?? null, "Mother" => $input['Mother'] ?? null,
"AccountNumber" => null, "AccountNumber" => isset($input['AccountNumber']) ? (int) $input['AccountNumber'] : null,
"RaceID" => ((int) $input['Race']) ?? null, "RaceID" => isset($input['RaceID']) ? (int) $input['RaceID'] : null,
"MaritalStatus" => $input['MaritalStatus'] ?? null, "MaritalStatus" => $input['MaritalStatus'] ?? null,
"ReligionID" => ((int) $input['Religion']) ?? null, "ReligionID" => isset($input['ReligionID']) ? (int) $input['ReligionID'] : null,
"EthnicID" => ((int) $input['Ethnic']) ?? null, "EthnicID" => isset($input['EthnicID']) ? (int) $input['EthnicID'] : null,
"Citizenship" => null, "Citizenship" => $input['Citizenship'] ?? null,
"DeathIndicator" => ((int) $input['Death']) ?? null, "DeathIndicator" => isset($input['DeathIndicator']) ? (int) $input['DeathIndicator'] : null,
"DeathDateTime" => $input['DeathTime'] ?? null, "DeathDateTime" => $input['DeathDateTime'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"LinkTo" => $input['LinkTo'] ?? null, "LinkTo" => $input['LinkTo'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"DelDate" => null,
// Field tambahan dari struktur sebelumnya (bisa dihapus jika tidak dipakai)
"PatientComment" => $input['PatientComment'] ?? null, "PatientComment" => $input['PatientComment'] ?? null,
"IdentityIDType" => $input['IdentityIDType'] ?? null, "IdentityIDType" => $input['IdentityIDType'] ?? null,
"IdentityID" => $input['IdentityID'] ?? null "IdentityID" => $input['IdentityID'] ?? null
@ -196,45 +198,88 @@ class Patient extends Controller {
$input = $this->request->getJSON(true); $input = $this->request->getJSON(true);
$data = [ $data = [
"InternalPID" => $input['InternalPID'] ?? null,
"PatientID" => $input['PatientID'] ?? null, "PatientID" => $input['PatientID'] ?? null,
"AlternatePID" => $input['AlternateID'] ?? null, "AlternatePID" => $input['AlternatePID'] ?? null,
"Prefix" => $input['Title'] ?? null, "Prefix" => $input['Prefix'] ?? null,
"NameFirst" => $input['NameFirst'] ?? null, "NameFirst" => $input['NameFirst'] ?? null,
"NameMiddle" => $input['NameMiddle'] ?? null, "NameMiddle" => $input['NameMiddle'] ?? null,
"NameMaiden" => $input['NameMaiden'] ?? null, "NameMaiden" => $input['NameMaiden'] ?? null,
"NameLast" => $input['NameLast'] ?? null, "NameLast" => $input['NameLast'] ?? null,
"Suffix" => $input['Suffix'] ?? null, "Suffix" => $input['Suffix'] ?? null,
"NameAlias" => null, "NameAlias" => null,
"Gender" => ((int) $input['Gender']) ?? null, //int "Gender" => isset($input['Gender']) ? (int) $input['Gender'] : null,
"PlaceOfBirth" => $input['PlaceOfBirthdate'] ?? null, "PlaceOfBirth" => $input['PlaceOfBirth'] ?? null,
"BirthDate" => $input['BirthDate'] ?? null, "BirthDate" => $input['BirthDate'] ?? null,
"Street1" => $input['Street1'] ?? null, "Street_1" => $input['Street_1'] ?? null,
"Street2" => $input['Street2'] ?? null, "Street_2" => $input['Street_2'] ?? null,
"Street3" => null, "Street_3" => null,
"City" => $input['City'] ?? null, "City" => $input['City'] ?? null,
"Province" => $input['Province'] ?? null, "Province" => $input['Province'] ?? null,
"ZIP" => null, "ZIP" => $input['ZIP'] ?? null,
"CountryID" => null, // int "CountryID" => isset($input['CountryID']) ? (int) $input['CountryID'] : null,
"EmailAddress1" => $input['Email1'] ?? null, "Emailaddress1" => $input['Emailaddress1'] ?? null,
"EmailAddress2" => $input['Email2'] ?? null, "Emailaddress2" => $input['Emailaddress2'] ?? null,
"Phone" => $input['Phone'] ?? null, "Phone" => $input['Phone'] ?? null,
"MobilePhone" => $input['Mobile'] ?? null, "Mobilephone" => $input['Mobilephone'] ?? null,
"Mother" => ((int) $input['Mother']) ?? null, //int "Mother" => $input['Mother'] ?? null,
"AccountNumber" => null, //int "AccountNumber" => isset($input['AccountNumber']) ? (int) $input['AccountNumber'] : null,
"RaceID" => ((int) $input['Race']) ?? null, //int "RaceID" => isset($input['RaceID']) ? (int) $input['RaceID'] : null,
"MaritalStatus" => $input['MaritalStatus'] ?? null, "MaritalStatus" => $input['MaritalStatus'] ?? null,
"ReligionID" => ((int) $input['Religion']) ?? null, //int "ReligionID" => isset($input['ReligionID']) ? (int) $input['ReligionID'] : null,
"EthnicID" => ((int) $input['Ethnic']) ?? null, //int "EthnicID" => isset($input['EthnicID']) ? (int) $input['EthnicID'] : null,
"Citizenship" => null, "Citizenship" => $input['Citizenship'] ?? null,
"DeathIndicator" => ((int) $input['Death']) ?? null, //int "DeathIndicator" => isset($input['DeathIndicator']) ? (int) $input['DeathIndicator'] : null,
"DeathDateTime" => $input['DeathTime'] ?? null, "DeathDateTime" => $input['DeathDateTime'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"LinkTo" => $input['LinkTo'] ?? null, "LinkTo" => $input['LinkTo'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"DelDate" => null,
// Field tambahan dari struktur sebelumnya (bisa dihapus jika tidak dipakai)
"PatientComment" => $input['PatientComment'] ?? null, "PatientComment" => $input['PatientComment'] ?? null,
"IdentityIDType" => $input['IdentityIDType'] ?? null, "IdentityIDType" => $input['IdentityIDType'] ?? null,
"IdentityID" => $input['IdentityID'] ?? null "IdentityID" => $input['IdentityID'] ?? null
]; ];
// $data = [
// "PatientID" => $input['PatientID'] ?? null,
// "AlternatePID" => $input['AlternateID'] ?? null,
// "Prefix" => $input['Title'] ?? null,
// "NameFirst" => $input['NameFirst'] ?? null,
// "NameMiddle" => $input['NameMiddle'] ?? null,
// "NameMaiden" => $input['NameMaiden'] ?? null,
// "NameLast" => $input['NameLast'] ?? null,
// "Suffix" => $input['Suffix'] ?? null,
// "NameAlias" => null,
// "Gender" => ((int) $input['Gender']) ?? null, //int
// "PlaceOfBirth" => $input['PlaceOfBirthdate'] ?? null,
// "BirthDate" => $input['BirthDate'] ?? null,
// "Street1" => $input['Street1'] ?? null,
// "Street2" => $input['Street2'] ?? null,
// "Street3" => null,
// "City" => $input['City'] ?? null,
// "Province" => $input['Province'] ?? null,
// "ZIP" => null,
// "CountryID" => null, // int
// "EmailAddress1" => $input['Email1'] ?? null,
// "EmailAddress2" => $input['Email2'] ?? null,
// "Phone" => $input['Phone'] ?? null,
// "MobilePhone" => $input['Mobile'] ?? null,
// "Mother" => ((int) $input['Mother']) ?? null, //int
// "AccountNumber" => null, //int
// "RaceID" => ((int) $input['Race']) ?? null, //int
// "MaritalStatus" => $input['MaritalStatus'] ?? null,
// "ReligionID" => ((int) $input['Religion']) ?? null, //int
// "EthnicID" => ((int) $input['Ethnic']) ?? null, //int
// "Citizenship" => null,
// "DeathIndicator" => ((int) $input['Death']) ?? null, //int
// "DeathDateTime" => $input['DeathTime'] ?? null,
// "CreateDate" => date('Y-m-d H:i:s'),
// "LinkTo" => $input['LinkTo'] ?? null,
// "PatientComment" => $input['PatientComment'] ?? null,
// "IdentityIDType" => $input['IdentityIDType'] ?? null,
// "IdentityID" => $input['IdentityID'] ?? null
// ];
$rules = [ $rules = [
'NameFirst' => 'required|min_length[3]|max_length[255]', 'NameFirst' => 'required|min_length[3]|max_length[255]',