Update Patient Soft Delete

This commit is contained in:
mikael-zakaria 2025-08-05 10:03:33 +07:00
parent 77a5746fe9
commit 2b8a2580fc

View File

@ -17,13 +17,8 @@ class Patient extends Controller {
try {
$InternalPID = $this->request->getVar('InternalPID');
$PatientID = $this->request->getVar('PatientID');
// $AlternatePID = $this->request->getVar('AlternatePID');
// $Prefix = $this->request->getVar('Prefix');
$Name = $this->request->getVar('Name');
// $Suffix = $this->request->getVar('Suffix');
$BirthDate = $this->request->getVar('BirthDate');
// $startDate = $this->request->getVar('StartDate');
// $endDate = $this->request->getVar('EndDate');
$builder = $this->db->table('patient');
@ -34,15 +29,7 @@ class Patient extends Controller {
}
if ($InternalPID !== null) { $builder->where('InternalPID', $InternalPID); }
if ($PatientID !== null) { $builder->where('PatientID', $PatientID); }
// if ($AlternatePID !== null) { $builder->where('AlternatePID', $pat_altnum); }
if ($BirthDate !== null) { $builder->where('BirthDate', $BirthDate); }
/*
if ($startDate !== null || $endDate !== null) {
$builder->join('requests', 'pat_id=patients.pat_id','left');
if ($start_date !== null) { $builder->where('requests.req_date >=', $start_date . ' 00:00:00'); }
if ($end_date !== null) { $builder->where('requests.req_date <=', $end_date . ' 23:59:00'); }
}
*/
$filteredPatients = $builder->get()->getResultArray();
@ -359,8 +346,8 @@ class Patient extends Controller {
return $this->failNotFound("Patient ID with {$InternalPID} not found.");
}
// Hapus data pasien berdasarkan pat_num
$this->db->table('patient')->where('InternalPID', $InternalPID)->delete();
// Update kolom DelDate sebagai soft delete
$this->db->table('patient')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
// Mengembalikan 200
return $this->respondDeleted([