Commit 92b82d6e by Jansa Jose

waiting list

parent caa326a2
......@@ -2322,17 +2322,17 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
}else{
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $query['date'])));
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$query['time']))->row_array();
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$query['time'],'payment_status'=>'1'))->row_array();
if($next_day_consult){
$msg3 = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult['time_start'])." can be changed to ".date('d.m.Y h:i a',$query['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult['patient_id'],'type'=>'0','message'=>$msg3,'time'=>$conslt_time,'booking_id'=>$query['id'],'read_status'=>'0'));
$this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult['patient_id'],'type'=>'4','message'=>$msg3,'time'=>$conslt_time,'booking_id'=>$next_day_consult['id'],'read_status'=>'0'));
$new_patient_insert_id = $this->db->insert_id();
$fcm_user_new = $this->db->get_where('tbl_authtoken',array('userid'=>$next_day_consult['patient_id']))->row();
$new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Confirmation";
$new['type'] = "Consultation Updates";
$new['booking_id'] = $next_day_consult['id'];
$new['booking_date'] = $query['date'];
$new['doctor_id'] = $query['doctor_id'];
......
......@@ -225,6 +225,61 @@ public function cancelBooking()
$this->Patient_model->change_waitinglist_to_confirmed($check_waiting_list['booking_id']);
}
*/
$todays_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$booking_details['doc_id'],'clinic_id'=>$booking_details['clinic_id'],'date'=>$booking_details['book_date'],'booking_status'=>'0','time'=>$booking_details['book_time'],'payment_status'=>'1'))->row_array();
if($todays_consult){
$doctor_data = $this->Doctor_model->get_single_doctor($userdata['id']);
$text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$todays_consult['time_start'])." can be changed to ".date('d.m.Y h:i a',$booking_details['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$this->db->insert('tbl_patient_notification',array('patient_id'=>$todays_consult['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$todays_consult['id'],'read_status'=>'0'));
$new_patient_insert_id = $this->db->insert_id();
$fcm_user_new = $this->Home_model->get_patient_fcm($booking_details['pat_id']);
$new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Updates";
$new['booking_id'] = $todays_consult['id'];
$new['booking_date'] = $booking_details['book_date'];
$new['doctor_id'] = $booking_details['doc_id'];
$new['doctor_name'] = $userdata['name'];
$new['doctor_specialization'] = $doctor_data['dr_specialization'];
$new['message'] = $text;
$new['time'] = strtotime($nowin_server);
$new['to'] =$fcm_user_new['fcm_token'];
$user_type = '1';
$push_status =push_sent($new,$user_type);
}else{
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date'])));
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$booking_details['doc_id'],'clinic_id'=>$booking_details['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$booking_details['book_time'],'payment_status'=>'1'))->row_array();
$fcm_user_new = $this->Home_model->get_patient_fcm($next_day_consult['patient_id']);
if($next_day_consult){
$text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult['time_start'])." can be changed to ".date('d.m.Y h:i a',$booking_details['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$next_day_consult['id'],'read_status'=>'0'));
$new_patient_insert_id = $this->db->insert_id();
$fcm_user_new = $this->db->get_where('tbl_authtoken',array('userid'=>$next_day_consult['patient_id']))->row();
$new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Updates";
$new['booking_id'] = $next_day_consult['id'];
$new['booking_date'] = $todays_consult['book_date'];
$new['doctor_id'] = $result['doc_id'];
$new['doctor_name'] = $userdata['name'];
$new['doctor_specialization'] = $doctor_data['dr_specialization'];
$new['message'] = $text;
$new['time'] = strtotime($nowin_server);
$new['to'] =$fcm_user_new['fcm_token'];
$user_type = '1';
$push_status =push_sent($new,$user_type);
}
}
$day_appointment = $this->Doctor_model->get_doctor_appointments_day($userdata['id'],$_POST['selectedDate']);
foreach ($day_appointment as $key => $value)
{
......
......@@ -137,7 +137,7 @@ public function cancelBooking()
/*------------------------------------------------*/
$check_waiting_list = $this->Patient_model->check_waiting_list($result);
//print_r($check_waiting_list);die();
//check any user Exist in waiting List on that date if true ;
if($check_waiting_list['count']>0)
{
$this->Patient_model->change_waitinglist_to_confirmed($check_waiting_list['booking_id']);
......@@ -194,6 +194,35 @@ public function cancelBooking()
}
/*------------------------------------------------*/
}//if no user exist in waiting list on that particular date. check on next date.
else{
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date'])));
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$booking_details['doc_id'],'clinic_id'=>$booking_details['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$booking_details['book_time'],'payment_status'=>'1'))->row_array();
$doctor_data_waiting = $this->Doctor_model->get_single_doctor($next_day_consult['doctor_id']);
$fcm_user = $this->Home_model->get_patient_fcm($next_day_consult['patient_id']);
if($next_day_consult){
$text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult['time_start'])." can be changed to ".date('d.m.Y h:i a',$result['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$next_day_consult['id'],'read_status'=>'0'));
$new_patient_insert_id = $this->db->insert_id();
$fcm_user = $this->Home_model->get_patient_fcm($next_day_consult['patient_id']);
$new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Updates";
$new['booking_id'] = $next_day_consult['id'];
$new['booking_date'] = $booking_details['book_date'];
$new['doctor_id'] = $booking_details['doc_id'];
$new['doctor_name'] = $doctor_data_waiting['dr_name'];
$new['doctor_specialization'] = $doctor_data_waiting['dr_specialization'];
$new['message'] = $text;
$new['time'] = strtotime($nowin_server);
$new['to'] =$fcm_user['fcm_token'];
$user_type = '1';
$push_status =push_sent($new,$user_type);
}
}
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
$template['confirmed_consultation'] = $confirmed_consultation;
......
......@@ -1144,10 +1144,10 @@ else
if(empty($patient_data['pt_customer_id']))
{
$create_customer = array('email'=>$patient_data['pt_email'],'name'=>decrypt_data($patient_data['pt_name']),/*'cpf_cnpj'=>$patient_data['pt_cpf'],*/'zip_code' => decrypt_data($patient_data['pt_zip_code']),'street'=>decrypt_data($patient_data['pt_street_add']),'number'=>decrypt_data($patient_data['pt_number']),'complement'=>decrypt_data($patient_data['pt_complement']));
//print_r($create_customer);echo"<br>";exit();
$request = load_curl('https://api.iugu.com/v1/customers',$create_customer);
$customer = json_decode($request);
//print_r($customer); echo "<pre><br>";
$this->Patient_model->update_profile($patient_data['patientid'],array('customer_id' => $customer->id ));
$patient_data['pt_customer_id'] = $customer->id;
}
......
......@@ -382,6 +382,7 @@ public function get_booking_details($book_id)
{
$this->db->select("tbl_booking.id as book_id,
tbl_booking.date as book_date,
tbl_booking.clinic_id,
tbl_booking.time as book_time,
tbl_booking.total_sum as book_price,
tbl_booking.visit_type as visit_type,
......
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