Update Patient Create, Transtatusv2
This commit is contained in:
parent
fcf910f987
commit
8c82fd0414
@ -182,6 +182,12 @@ class Patient extends Controller {
|
|||||||
$this->db->table('patient')->insert($dataPatient);
|
$this->db->table('patient')->insert($dataPatient);
|
||||||
$newInternalPatientId = $this->db->insertID();
|
$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;
|
$dataPatidt['InternalPID'] = $newInternalPatientId;
|
||||||
$this->db->table('patidt')->insert($dataPatidt);
|
$this->db->table('patidt')->insert($dataPatidt);
|
||||||
|
|
||||||
@ -190,8 +196,7 @@ class Patient extends Controller {
|
|||||||
if ($this->db->transStatus() === false) {
|
if ($this->db->transStatus() === false) {
|
||||||
$dbError = $this->db->error(); // ambil error terakhir
|
$dbError = $this->db->error(); // ambil error terakhir
|
||||||
return $this->failServerError(
|
return $this->failServerError(
|
||||||
'Failed to create patient data (transaction rolled back): ' .
|
'Failed to create patient data (transaction rolled back): ' . ($dbError['message'] ?? 'Unknown database error')
|
||||||
($dbError['message'] ?? 'Unknown database error')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user