Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function listjadwal_post()
- {
- $username = trim($this->post('username'));
- $tanggal = $this->post('tanggal');
- $spesialis = $this->post('spesialis');
- $dokter = $this->post('dokter');
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username tidak ditemukan.',
- ];
- } elseif ($tanggal == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Tanggal harus diisi.',
- ];
- } else {
- $tgl_jadwal = date('Y-m-d', strtotime($tanggal));
- $hari = getDay($tgl_jadwal);
- if ($spesialis == '') {
- $listData = $this->db->order_by('dokter_name', 'asc')->get_where('v_jadwal', array('jadwal_hari' => $hari))->result();
- } elseif ($spesialis != '' && $dokter == '') {
- $listData = $this->db->order_by('dokter_name', 'asc')->get_where('v_antrian', array('jadwal_hari' => $hari, 'spesialis_id' => $spesialis))->result();
- } else {
- $listData = $this->db->order_by('dokter_name', 'asc')->get_where('v_antrian', array('jadwal_hari' => $hari, 'spesialis_id' => $spesialis, 'dokter_id' => $dokter))->result();
- }
- if (count($listData) == 0) {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Tidak Ada Jadwal Praktek',
- ];
- } else {
- foreach ($listData as $r) {
- $response['items'][] = [
- 'resp_error' => false,
- 'resp_msg' => 'success',
- 'spesialis_name' => $r->spesialis_name,
- 'dokter_name' => trim($r->dokter_name),
- 'jadwal_hari' => strtoupper($r->jadwal_hari),
- 'jam' => date('H:i', strtotime($r->jadwal_mulai)) . ' s/d ' . date('H:i', strtotime($r->jadwal_selesai)),
- 'gedung_name' => trim($r->gedung_name),
- 'klinik_name' => trim($r->klinik_name),
- 'keterangan' => trim($r->jadwal_keterangan),
- ];
- }
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement