"invalid action" ]); } function searchDPJP(PostgresDb $db, string $q) { $query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp FROM public.m_dokter WHERE kdsmf LIKE '%BEDAH%'"; if ($q != '') { $query .= " AND (namadokter ILIKE '%$q%' OR kode_dpjp ILIKE '%$q%')"; } $sql_dokter_bedah = $db->query($query); $query .= " LIMIT 10"; $arr_dokter_bedah = array(); foreach ($sql_dokter_bedah->fetchAll() as $ds) { array_push($arr_dokter_bedah, $ds); } echo json_encode([ "message" => "success get dokter", "data" => $arr_dokter_bedah ]); } function searchDokterAnestesi(PostgresDb $db, string $q) { $query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp FROM public.m_dokter WHERE kdsmf LIKE '%ANESTHESI%'"; if ($q != '') { $query .= " AND (namadokter ILIKE '%$q%' OR kode_dpjp ILIKE '%$q%')"; } $query .= " LIMIT 10"; $sql_dokter_anestesi = $db->query($query); $arr_dokter_anestesi = array(); foreach ($sql_dokter_anestesi->fetchAll() as $ds) { array_push($arr_dokter_anestesi, $ds); } echo json_encode([ "message" => "success get dokter", "data" => $arr_dokter_anestesi ]); } function searchTindakan(PostgresDb $db, string $q) { $query = "SELECT kode as code, keterangan as str from icd_cm"; if ($q != '') { $query .= " where kode ilike '$q%' OR keterangan ilike '%$q%'"; } $query .= " LIMIT 10"; $sql_tindakan = $db->query($query); $result = array(); foreach($sql_tindakan->fetchAll() as $t) { array_push($result, $t); } echo json_encode([ "message" => "success get tindakan", "data" => $result ]); } ?>