From fb9be5f40f6ec11f730f5786b78e542294c1250a Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Mon, 25 Aug 2025 09:02:10 +0700 Subject: [PATCH] Update menambahkan kolom Custodian di patient --- app/Controllers/Patient.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 0313bd5..790a893 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -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, ];