Update Perbaikan Pemanggilan Tabel Controller Patient
This commit is contained in:
parent
951d5598ad
commit
ea9e7dde26
@ -24,7 +24,7 @@ class Patient extends Controller {
|
|||||||
$startDate = $this->request->getVar('startDate');
|
$startDate = $this->request->getVar('startDate');
|
||||||
$endDate = $this->request->getVar('endDate');
|
$endDate = $this->request->getVar('endDate');
|
||||||
|
|
||||||
$builder = $this->db->table('Patient');
|
$builder = $this->db->table('patient');
|
||||||
|
|
||||||
if ($name !== null) {
|
if ($name !== null) {
|
||||||
$sql = "LOWER(CONCAT_WS(' ', IFNULL(prefix,''), IFNULL(name_first,''), IFNULL(name_middle,''), IFNULL(name_last,''), IFNULL(name_maiden,''), IFNULL(suffix,'')))";
|
$sql = "LOWER(CONCAT_WS(' ', IFNULL(prefix,''), IFNULL(name_first,''), IFNULL(name_middle,''), IFNULL(name_last,''), IFNULL(name_maiden,''), IFNULL(suffix,'')))";
|
||||||
@ -72,7 +72,7 @@ class Patient extends Controller {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$builder = $this->db->table('Patient');
|
$builder = $this->db->table('patient');
|
||||||
$patient = $builder->where('InternalPID', $InternalPID)->get()->getRowArray();
|
$patient = $builder->where('InternalPID', $InternalPID)->get()->getRowArray();
|
||||||
|
|
||||||
// Data pasien tidak ada mengembalikan - success 200
|
// Data pasien tidak ada mengembalikan - success 200
|
||||||
@ -245,7 +245,7 @@ class Patient extends Controller {
|
|||||||
'City' => 'permit_empty',
|
'City' => 'permit_empty',
|
||||||
];
|
];
|
||||||
|
|
||||||
$existingPatient = $this->db->table('Patient')->where('InternalPID', $InternalPID)->get()->getRowArray();
|
$existingPatient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRowArray();
|
||||||
|
|
||||||
// Mengembalikan 404
|
// Mengembalikan 404
|
||||||
if (empty($existingPatient)) {
|
if (empty($existingPatient)) {
|
||||||
@ -275,7 +275,7 @@ class Patient extends Controller {
|
|||||||
return $this->failValidationError('No data provided for update.');
|
return $this->failValidationError('No data provided for update.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->table('Patient')->where('PatientID', $InternalPID)->update($data);
|
$this->db->table('patient')->where('PatientID', $InternalPID)->update($data);
|
||||||
|
|
||||||
// Sukses & Insert = 201 - Kirim data patient ID
|
// Sukses & Insert = 201 - Kirim data patient ID
|
||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
@ -300,14 +300,14 @@ class Patient extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cari data pasien
|
// Cari data pasien
|
||||||
$patient = $this->db->table('Patient')->where('InternalPID', $InternalPID)->get()->getRow();
|
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRow();
|
||||||
|
|
||||||
if (!$patient) {
|
if (!$patient) {
|
||||||
return $this->failNotFound("Patient ID with {$InternalPID} not found.");
|
return $this->failNotFound("Patient ID with {$InternalPID} not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hapus data pasien berdasarkan pat_num
|
// Hapus data pasien berdasarkan pat_num
|
||||||
$this->db->table('Patient')->where('InternalPID', $InternalPID)->delete();
|
$this->db->table('patient')->where('InternalPID', $InternalPID)->delete();
|
||||||
|
|
||||||
// Mengembalikan 200
|
// Mengembalikan 200
|
||||||
return $this->respondDeleted([
|
return $this->respondDeleted([
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user