Commit bb5e1cc1 by Jansa Jose

Merge branch 'jansa'

parents ef2aa8f6 c45c9f76
...@@ -2471,7 +2471,7 @@ class Webservice extends CI_Controller { ...@@ -2471,7 +2471,7 @@ class Webservice extends CI_Controller {
} }
public function cancel_booking_resend_cron($type=null){ public function cancel_booking_resend_cron($type=null){
$this->db->insert('tbl_crone',array('msg'=>"inserted Successfully",'insert_date'=>date('h:i')));
if(isset($type) && !empty($type)){ if(isset($type) && !empty($type)){
$result = $this->db->query('SELECT * FROM `tbl_waiting_list_id_crone` WHERE booking_id ='.$type)->result_array(); $result = $this->db->query('SELECT * FROM `tbl_waiting_list_id_crone` WHERE booking_id ='.$type)->result_array();
}else{ }else{
...@@ -2481,8 +2481,6 @@ class Webservice extends CI_Controller { ...@@ -2481,8 +2481,6 @@ class Webservice extends CI_Controller {
foreach ($result as $key => $value){ foreach ($result as $key => $value){
$book_data = $this->db->get_where('tbl_booking',array('id'=>$value['booking_id']))->row_array(); $book_data = $this->db->get_where('tbl_booking',array('id'=>$value['booking_id']))->row_array();
//if($book_data['booking_status'] == 0){
$this->db->update('tbl_waiting_list_id_crone',array('status'=>'0'),array('id'=>$value['id'])); $this->db->update('tbl_waiting_list_id_crone',array('status'=>'0'),array('id'=>$value['id']));
$this->db->select('tbl_booking.id'); $this->db->select('tbl_booking.id');
...@@ -2495,7 +2493,6 @@ class Webservice extends CI_Controller { ...@@ -2495,7 +2493,6 @@ class Webservice extends CI_Controller {
$this->db->where('tbl_waiting_list_id_crone.status','0'); $this->db->where('tbl_waiting_list_id_crone.status','0');
$inserted_id = $this->db->get()->result_array(); $inserted_id = $this->db->get()->result_array();
//print_r($inserted_id);exit();
if(count($inserted_id)> 0){ if(count($inserted_id)> 0){
foreach ($inserted_id as $keys => $values) { foreach ($inserted_id as $keys => $values) {
$newarray[] = $values['id']; $newarray[] = $values['id'];
...@@ -2504,7 +2501,7 @@ class Webservice extends CI_Controller { ...@@ -2504,7 +2501,7 @@ class Webservice extends CI_Controller {
}else{ }else{
$inserted_id = ''; $inserted_id = '';
} }
//print_r($inserted_id);exit();
$nextday = $value['book_date']; $nextday = $value['book_date'];
$next_day_consult = $this->Webservice_model->wait_list_data($book_data,$nextday,$inserted_id); $next_day_consult = $this->Webservice_model->wait_list_data($book_data,$nextday,$inserted_id);
......
...@@ -2309,7 +2309,6 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2309,7 +2309,6 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$ress = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'date'=>$query['date'],'time'=>$query['time'],'booking_status'=>'0'))->row_array(); $ress = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'date'=>$query['date'],'time'=>$query['time'],'booking_status'=>'0'))->row_array();
if($ress){ if($ress){
//echo "if";exit();
$this->db->update('tbl_booking',array('booking_status'=>'1'),array('id'=>$ress['id'])); $this->db->update('tbl_booking',array('booking_status'=>'1'),array('id'=>$ress['id']));
$this->db->insert('tbl_patient_notification',array('patient_id'=>$ress['patient_id'],'type'=>'0','message'=>$msg2,'time'=>$conslt_time,'booking_id'=>$query['id'],'read_status'=>'0')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$ress['patient_id'],'type'=>'0','message'=>$msg2,'time'=>$conslt_time,'booking_id'=>$query['id'],'read_status'=>'0'));
$patient_insert_id = $this->db->insert_id(); $patient_insert_id = $this->db->insert_id();
...@@ -2341,9 +2340,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2341,9 +2340,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$doctor_type = '2'; $doctor_type = '2';
$doctor_push = $this->push_sent($news,$doctor_type); $doctor_push = $this->push_sent($news,$doctor_type);
}else{ }else{
//echo "no";exit();
//$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $query['date'])));
//$this->db->order_by('date','ASC');
$nextday = $query['date']; $nextday = $query['date'];
$next_day_consult = $this->wait_list_data($query,$nextday,''); $next_day_consult = $this->wait_list_data($query,$nextday,'');
if(count($next_day_consult) > 0){ if(count($next_day_consult) > 0){
...@@ -2368,10 +2365,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2368,10 +2365,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$push = $this->push_sent($new,$user_type); $push = $this->push_sent($new,$user_type);
$this->db->insert('tbl_waiting_list_id_crone',array('booking_id'=>$next_day_consult[0]['id'],'push_time'=> date('Y-m-d h:i:s'),'book_time'=>$query['time'],'free_booking_id'=>$data['booking_id'],'book_date'=>$query['date'])); $this->db->insert('tbl_waiting_list_id_crone',array('booking_id'=>$next_day_consult[0]['id'],'push_time'=> date('Y-m-d h:i:s'),'book_time'=>$query['time'],'free_booking_id'=>$data['booking_id'],'book_date'=>$query['date']));
}/*else{ }
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday)));
$next_day_consult = $this->wait_list_data($query,$nextday);
}*/
} }
if($query['visit_type'] == '0' && $query['payment_type'] == '2'){ if($query['visit_type'] == '0' && $query['payment_type'] == '2'){
$doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$query['doctor_id']))->row(); $doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$query['doctor_id']))->row();
......
...@@ -251,6 +251,8 @@ public function cancelBooking() ...@@ -251,6 +251,8 @@ public function cancelBooking()
$user_type = '1'; $user_type = '1';
$push_status =push_sent($new,$user_type); $push_status =push_sent($new,$user_type);
}else{ }else{
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date']))); $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(); $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();
......
...@@ -87,6 +87,10 @@ public function getBooking() ...@@ -87,6 +87,10 @@ public function getBooking()
print json_encode($result); print json_encode($result);
} }
public function dsfsd(){
$this->Webservice->cancel_booking_resend_cron();
}
/*FUNCTION FOR CANCELING BOOKING - PATIENT DASHBOARD*/ /*FUNCTION FOR CANCELING BOOKING - PATIENT DASHBOARD*/
public function cancelBooking() public function cancelBooking()
{ {
...@@ -196,23 +200,25 @@ public function cancelBooking() ...@@ -196,23 +200,25 @@ public function cancelBooking()
}//if no user exist in waiting list on that particular date. check on next date. }//if no user exist in waiting list on that particular date. check on next date.
else{ else{
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date']))); $nextday = $booking_details['book_date'];
$next_day_consult = $this->wait_list_data($booking_details,$nextday,'');
//$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(); //$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']); $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']); $fcm_user = $this->Home_model->get_patient_fcm($next_day_consult['patient_id']);
if($next_day_consult){ if(count($next_day_consult) > 0){
$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 ?"; $text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult[0]['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')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult[0]['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$next_day_consult[0]['id'],'free_booking_id'=>$_POST['booking_id'],'read_status'=>'0'));
$new_patient_insert_id = $this->db->insert_id(); $new_patient_insert_id = $this->db->insert_id();
$fcm_user = $this->Home_model->get_patient_fcm($next_day_consult['patient_id']); $fcm_user = $this->Home_model->get_patient_fcm($next_day_consult[0]['patient_id']);
$new['id'] = $new_patient_insert_id; $new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Updates"; $new['type'] = "Consultation Updates";
$new['booking_id'] = $next_day_consult['id']; $new['booking_id'] = $next_day_consult[0]['id'];
$new['booking_date'] = $booking_details['book_date']; $new['booking_date'] = $booking_details['book_date'];
$new['doctor_id'] = $booking_details['doc_id']; $new['doctor_id'] = $booking_details['doc_id'];
$new['doctor_name'] = $doctor_data_waiting['dr_name']; $new['doctor_name'] = $doctor_data_waiting['dr_name'];
...@@ -222,6 +228,8 @@ public function cancelBooking() ...@@ -222,6 +228,8 @@ public function cancelBooking()
$new['to'] =$fcm_user['fcm_token']; $new['to'] =$fcm_user['fcm_token'];
$user_type = '1'; $user_type = '1';
$push_status =push_sent($new,$user_type); $push_status =push_sent($new,$user_type);
$this->db->insert('tbl_waiting_list_id_crone',array('booking_id'=>$next_day_consult[0]['id'],'push_time'=> date('Y-m-d h:i:s'),'book_time'=>$booking_details['book_time'],'free_booking_id'=>$_POST['booking_id'],'book_date'=>$booking_details['book_date']));
} }
} }
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']); $confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
...@@ -229,6 +237,26 @@ public function cancelBooking() ...@@ -229,6 +237,26 @@ public function cancelBooking()
$this->load->view('patient_dash_scheduled_booking',$template); $this->load->view('patient_dash_scheduled_booking',$template);
} }
public function wait_list_data($query,$nextday,$insertid){
$this->db->order_by('id','ASC');
if(isset($insertid) && !empty($insertid)){
$this->db->where_not_in('id', $insertid);
}
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'booking_status'=>'0','date'=>$nextday,'payment_status'=>'1'))->result_array();
if(count($next_day_consult) > 0){
return $next_day_consult;
}else{
if(isset($insertid) && !empty($insertid)){
$insert_id = $insertid;
}else{
$insert_id = '';
}
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday)));
return $this->wait_list_data($query,$nextday,$insert_id);
}
}
/*FUNCTION FOR CHECKING CANCELLATION POLICY - PATIENT DASHBOARD*/ /*FUNCTION FOR CHECKING CANCELLATION POLICY - PATIENT DASHBOARD*/
public function check_cancelBooking() public function check_cancelBooking()
{ {
......
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