Update menambahkan kolom Custodian di patient

This commit is contained in:
mikael-zakaria 2025-08-25 09:02:10 +07:00
parent 850119316c
commit fb9be5f40f

View File

@ -99,6 +99,16 @@ class Patient extends Controller {
$patient["LinkTo"] = $patientLinkTo == [] ? null : $patientLinkTo;
}
if ($patient['Custodian'] != null) {
$patientCustodian = $this->db->table('patient')
->select('InternalPID, PatientID')
->whereIn('InternalPID', (int) $InternalPID)
->get()
->getResultArray();
$patient["Custodian"] = $patientCustodian == [] ? null : $patientCustodian[0];
}
$patidt = $this->db->table('patidt')
->select('IdentifierType, Identifier')
->where('InternalPID', (int) $InternalPID)
@ -205,6 +215,7 @@ class Patient extends Controller {
"Citizenship" => ($input['Citizenship'] ?? '') !== '' ? $input['Citizenship'] : null,
"DeathIndicator" => ($input['DeathIndicator'] ?? '') !== '' ? (int)$input['DeathIndicator'] : null,
"DeathDateTime" => ($input['DeathDateTime'] ?? '') !== '' ? $input['DeathDateTime'] : null,
"Custodian" => ($input['Custodian'] ?? '') !== '' ? $input['Custodian'] : null,
"CreateDate" => date('Y-m-d H:i:s'),
"DelDate" => null,
"LinkTo" => $LinkTo
@ -379,6 +390,7 @@ class Patient extends Controller {
"Citizenship" => ($input['Citizenship'] ?? null) === '' ? null : ($input['Citizenship'] ?? null),
"DeathIndicator" => ($input['DeathIndicator'] ?? null) === '' ? null : (isset($input['DeathIndicator']) ? (int)$input['DeathIndicator'] : null),
"DeathDateTime" => ($input['DeathDateTime'] ?? null) === '' ? null : ($input['DeathDateTime'] ?? null),
"Custodian" => ($input['Custodian'] ?? null) === '' ? null : ($input['Custodian'] ?? null),
"LinkTo" => $LinkTo,
];