Commit 31d78639 by Jansa Jose

check wait list

parent 46fc9ebb
...@@ -6687,7 +6687,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6687,7 +6687,7 @@ print_r(date('H:i',$ms));exit();*/
if(isset($data['date']) && strlen($data['date']) && isset($data['time']) && strlen($data['time'])&& isset($data['doctor_id']) && strlen($data['doctor_id']) && isset($data['clinic_id']) && strlen($data['clinic_id'])){ if(isset($data['date']) && strlen($data['date']) && isset($data['time']) && strlen($data['time'])&& isset($data['doctor_id']) && strlen($data['doctor_id']) && isset($data['clinic_id']) && strlen($data['clinic_id'])){
$result = $this->Webservice_model->check_wait_listed($data); $result = $this->Webservice_model->check_wait_listed($data);
if($result['status'] == 'success'){ if($result['status'] == 'success'){
$res = array('status'=>'success','data'=>array('is_booked'=>$result['booked'])); $res = array('status'=>'success','data'=>array('is_booked'=>$result['booked']),'is_return_avail'=>$result['is_return_avail']);
}else{ }else{
$res = array('status'=>'error','error'=>'error'); $res = array('status'=>'error','error'=>'error');
} }
......
...@@ -3406,7 +3406,39 @@ class Webservice_model extends CI_Model { ...@@ -3406,7 +3406,39 @@ class Webservice_model extends CI_Model {
}else{ }else{
$is_booking = false; $is_booking = false;
} }
$res = array('status'=>'success','booked'=>$is_booking);
$this->db->select('accept_return,return_timeperiod');
$this->db->where('id',$data['doctor_id']);
$check_doctor_status = $this->db->get('tbl_doctors')->row();
if($check_doctor_status->accept_return == '1'){
$old_date = date('Y-m-d',$data['date']);
$newdate = date("Y-m-d",strtotime($old_date." -".$check_doctor_status->return_timeperiod." day"));
$new_date = strtotime($newdate);
$this->db->where('doctor_id',$data['doctor_id']);
$this->db->where('clinic_id',$data['clinic_id']);
$this->db->where('patient_id',$patientid['userid']);
$this->db->where('free_visit_status',0);
$this->db->where('visit_type',0);
$this->db->where('date >=',$new_date);
$this->db->where('date <=',$data['date']);
$this->db->order_by('id','DESC');
$this->db->limit(1,0);
$old_book_res = $this->db->get('tbl_booking')->row();
if(isset($old_book_res) && $old_book_res != ''){
if($old_book_res->visit_type == '0'){
$visit = '1';
$is_return_avail = false;
}else{
$is_return_avail = true;
}
}else{
$is_return_avail = true;
}
}
$res = array('status'=>'success','booked'=>$is_booking,'is_return_avail'=>$is_return_avail);
return $res; return $res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment