diff --git a/application/controllers/klinik/screening/Screening.php b/application/controllers/klinik/screening/Screening.php index 35b6661a..eeabe9cd 100644 --- a/application/controllers/klinik/screening/Screening.php +++ b/application/controllers/klinik/screening/Screening.php @@ -530,8 +530,13 @@ class Screening extends MY_Controller $form_id = intval($item['M_ScreeningFormID'] ?? 0); if (!$form_id) continue; - // Simpan label sebagai JSON string agar json_decode di search() bekerja - $stored_value = json_encode($item['answer_label'] ?? ''); + // Simpan sebagai JSON object + $answer_type = $item['answer_type'] ?? 'single'; + if ($answer_type === 'text') { + $stored_value = json_encode(['value' => $item['answer_label'] ?? '']); + } else { + $stored_value = json_encode(['id' => $item['answer_id'] ?? '', 'label' => $item['answer_label'] ?? '']); + } $this->db_oneklinik->query( "INSERT INTO one_klinik.t_screening_answer