Update Patient Create, Transtatusv2

This commit is contained in:
mikael-zakaria 2025-08-08 14:02:56 +07:00
parent fcf910f987
commit 8c82fd0414

View File

@ -182,6 +182,12 @@ class Patient extends Controller {
$this->db->table('patient')->insert($dataPatient);
$newInternalPatientId = $this->db->insertID();
$dbError = $this->db->error();
if (!empty($dbError['message'])) {
$this->db->transRollback();
return $this->failServerError('Insert patient failed: ' . $dbError['message']);
}
$dataPatidt['InternalPID'] = $newInternalPatientId;
$this->db->table('patidt')->insert($dataPatidt);
@ -190,8 +196,7 @@ class Patient extends Controller {
if ($this->db->transStatus() === false) {
$dbError = $this->db->error(); // ambil error terakhir
return $this->failServerError(
'Failed to create patient data (transaction rolled back): ' .
($dbError['message'] ?? 'Unknown database error')
'Failed to create patient data (transaction rolled back): ' . ($dbError['message'] ?? 'Unknown database error')
);
}