Update Patient Create, Transtatus

This commit is contained in:
mikael-zakaria 2025-08-08 13:59:24 +07:00
parent 8acfac74d9
commit fcf910f987

View File

@ -129,6 +129,9 @@ class Patient extends Controller {
"DeathDateTime" => $input['DeathDateTime'] ?? null,
"CreateDate" => date('Y-m-d H:i:s'),
"DelDate" => null,
// Linkto
// Mother
// AccountNumber
];
$rulesDataPatient = [
@ -185,7 +188,11 @@ class Patient extends Controller {
$this->db->transComplete();
if ($this->db->transStatus() === false) {
return $this->failServerError('Failed to create patient data (transaction rolled back)');
$dbError = $this->db->error(); // ambil error terakhir
return $this->failServerError(
'Failed to create patient data (transaction rolled back): ' .
($dbError['message'] ?? 'Unknown database error')
);
}
return $this->respondCreated([