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');
$AlternatePID = $this->request->getVar('AlternatePID');
$Prefix = $this->request->getVar('Prefix');
$name = $this->request->getVar('name');
$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');
@ -108,40 +108,42 @@ class Patient extends Controller {
$data = [
"PatientID" => $input['PatientID'] ?? null,
"AlternatePID" => $input['AlternateID'] ?? null,
"Prefix" => $input['Title'] ?? null,
"AlternatePID" => $input['AlternatePID'] ?? null,
"Prefix" => $input['Prefix'] ?? 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,
"PlaceOfBirth" => $input['PlaceOfBirthdate'] ?? null,
"BirthDate" => $input['Birthdate'] ?? null,
"Street1" => $input['Street1'] ?? null,
"Street2" => $input['Street2'] ?? null,
"Street3" => null,
"Gender" => isset($input['Gender']) ? (int) $input['Gender'] : null,
"PlaceOfBirth" => $input['PlaceOfBirth'] ?? null,
"BirthDate" => $input['BirthDate'] ?? null,
"Street_1" => $input['Street_1'] ?? null,
"Street_2" => $input['Street_2'] ?? null,
"Street_3" => null,
"City" => $input['City'] ?? null,
"Province" => $input['Province'] ?? null,
"ZIP" => null,
"CountryID" => null,
"EmailAddress1" => $input['Email1'] ?? null,
"EmailAddress2" => $input['Email2'] ?? null,
"ZIP" => $input['ZIP'] ?? null,
"CountryID" => isset($input['CountryID']) ? (int) $input['CountryID'] : null,
"Emailaddress1" => $input['Emailaddress1'] ?? null,
"Emailaddress2" => $input['Emailaddress2'] ?? null,
"Phone" => $input['Phone'] ?? null,
"MobilePhone" => $input['Mobile'] ?? null,
"Mobilephone" => $input['Mobilephone'] ?? null,
"Mother" => $input['Mother'] ?? null,
"AccountNumber" => null,
"RaceID" => ((int) $input['Race']) ?? null,
"AccountNumber" => isset($input['AccountNumber']) ? (int) $input['AccountNumber'] : null,
"RaceID" => isset($input['RaceID']) ? (int) $input['RaceID'] : null,
"MaritalStatus" => $input['MaritalStatus'] ?? null,
"ReligionID" => ((int) $input['Religion']) ?? null,
"EthnicID" => ((int) $input['Ethnic']) ?? null,
"Citizenship" => null,
"DeathIndicator" => ((int) $input['Death']) ?? null,
"DeathDateTime" => $input['DeathTime'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"ReligionID" => isset($input['ReligionID']) ? (int) $input['ReligionID'] : null,
"EthnicID" => isset($input['EthnicID']) ? (int) $input['EthnicID'] : null,
"Citizenship" => $input['Citizenship'] ?? null,
"DeathIndicator" => isset($input['DeathIndicator']) ? (int) $input['DeathIndicator'] : null,
"DeathDateTime" => $input['DeathDateTime'] ?? 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,
"IdentityIDType" => $input['IdentityIDType'] ?? null,
"IdentityID" => $input['IdentityID'] ?? null
@ -196,45 +198,88 @@ class Patient extends Controller {
$input = $this->request->getJSON(true);
$data = [
"InternalPID" => $input['InternalPID'] ?? null,
"PatientID" => $input['PatientID'] ?? null,
"AlternatePID" => $input['AlternateID'] ?? null,
"Prefix" => $input['Title'] ?? null,
"AlternatePID" => $input['AlternatePID'] ?? null,
"Prefix" => $input['Prefix'] ?? 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,
"NameAlias" => null,
"Gender" => isset($input['Gender']) ? (int) $input['Gender'] : null,
"PlaceOfBirth" => $input['PlaceOfBirth'] ?? null,
"BirthDate" => $input['BirthDate'] ?? null,
"Street1" => $input['Street1'] ?? null,
"Street2" => $input['Street2'] ?? null,
"Street3" => null,
"Street_1" => $input['Street_1'] ?? null,
"Street_2" => $input['Street_2'] ?? null,
"Street_3" => null,
"City" => $input['City'] ?? null,
"Province" => $input['Province'] ?? null,
"ZIP" => null,
"CountryID" => null, // int
"EmailAddress1" => $input['Email1'] ?? null,
"EmailAddress2" => $input['Email2'] ?? null,
"ZIP" => $input['ZIP'] ?? null,
"CountryID" => isset($input['CountryID']) ? (int) $input['CountryID'] : null,
"Emailaddress1" => $input['Emailaddress1'] ?? null,
"Emailaddress2" => $input['Emailaddress2'] ?? null,
"Phone" => $input['Phone'] ?? null,
"MobilePhone" => $input['Mobile'] ?? null,
"Mother" => ((int) $input['Mother']) ?? null, //int
"AccountNumber" => null, //int
"RaceID" => ((int) $input['Race']) ?? null, //int
"Mobilephone" => $input['Mobilephone'] ?? null,
"Mother" => $input['Mother'] ?? null,
"AccountNumber" => isset($input['AccountNumber']) ? (int) $input['AccountNumber'] : null,
"RaceID" => isset($input['RaceID']) ? (int) $input['RaceID'] : null,
"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'),
"ReligionID" => isset($input['ReligionID']) ? (int) $input['ReligionID'] : null,
"EthnicID" => isset($input['EthnicID']) ? (int) $input['EthnicID'] : null,
"Citizenship" => $input['Citizenship'] ?? null,
"DeathIndicator" => isset($input['DeathIndicator']) ? (int) $input['DeathIndicator'] : null,
"DeathDateTime" => $input['DeathDateTime'] ?? 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,
"IdentityIDType" => $input['IdentityIDType'] ?? 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 = [
'NameFirst' => 'required|min_length[3]|max_length[255]',