Commit 003cfe0a by Jansa Jose

Merge branch 'master' into client

parents c4d6db12 15f87708
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); exit(0); header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); exit(0);
} }
class Webservice extends CI_Controller { class Webservice extends CI_Controller {
...@@ -2471,6 +2470,72 @@ class Webservice extends CI_Controller { ...@@ -2471,6 +2470,72 @@ class Webservice extends CI_Controller {
print json_encode($res); print json_encode($res);
} }
public function cancel_booking_resend_cron($type=null){
$this->db->insert('tbl_crone',array("msg"=>"inserted Successfully","insert_date"=>date('Y-m-d h:i')));
if(isset($type) && !empty($type)){
$result = $this->db->query('SELECT * FROM `tbl_waiting_list_id_crone` WHERE booking_id ='.$type)->result_array();
}else{
$result = $this->db->query('SELECT * FROM `tbl_waiting_list_id_crone` WHERE TIMESTAMPDIFF(minute, `push_time`, NOW()) > 15 AND status = 1')->result_array();
}
foreach ($result as $key => $value){
$book_data = $this->db->get_where('tbl_booking',array('id'=>$value['booking_id']))->row_array();
$booked_data = $this->db->get_where('tbl_booking',array('id'=>$value['free_booking_id']))->row_array();
$this->db->update('tbl_waiting_list_id_crone',array('status'=>'0'),array('id'=>$value['id']));
$this->db->select('tbl_booking.id');
$this->db->from('tbl_waiting_list_id_crone');
$this->db->join('tbl_booking','tbl_booking.id = tbl_waiting_list_id_crone.booking_id');
$this->db->where('tbl_booking.doctor_id',$book_data['doctor_id']);
$this->db->where('tbl_booking.clinic_id',$book_data['clinic_id']);
$this->db->where('tbl_waiting_list_id_crone.book_date',$value['book_date']);
$this->db->where('tbl_waiting_list_id_crone.status','0');
$inserted_id = $this->db->get()->result_array();
if(count($inserted_id)> 0){
foreach ($inserted_id as $keys => $values) {
$newarray[] = $values['id'];
}
$inserted_id = $newarray;
}else{
$inserted_id = '';
}
$nextday = $value['book_date'];
$next_day_consult = $this->Webservice_model->wait_list_data($book_data,$nextday,$inserted_id);
if(count($next_day_consult) > 0){
$fcm_user = $this->db->get_where('tbl_authtoken',array('userid'=>$next_day_consult[0]['patient_id']))->row();
$doctr_data = $this->db->get_where('tbl_doctors',array('id'=>$next_day_consult[0]['doctor_id']))->row_array();
$special = $this->db->get_where('tbl_specialization',array('id'=>$doctr_data['specialization']))->row();
$conslt_time = date('Y-m-d h:i:s');
$msg3 = "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',$booked_data['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[0]['patient_id'],'type'=>'4','message'=>$msg3,'time'=>strtotime($conslt_time),'booking_id'=>$next_day_consult[0]['id'],'read_status'=>'0','free_booking_id'=>$value['free_booking_id']));
$new_patient_insert_id = $this->db->insert_id();
$fcm_user_new = $this->db->get_where('tbl_authtoken',array('userid'=>$next_day_consult[0]['patient_id']))->row();
$new['id'] = $new_patient_insert_id;
$new['type'] = "Consultation Updates";
$new['booking_id'] = $next_day_consult[0]['id'];
$new['booking_date'] = $book_data['date'];
$new['doctor_id'] = $book_data['doctor_id'];
$new['doctor_name'] = $doctr_data['name'];
$new['doctor_specialization'] = $special->specialization_name;
$new['message'] = $msg3;
$new['time'] = $conslt_time;
$new['to'] =$fcm_user_new->fcm_token;
$user_type = '1';
$push = $this->Webservice_model->push_sent($new,$user_type);
$this->db->insert('tbl_waiting_list_id_crone',array('booking_id'=>$next_day_consult[0]['id'],'push_time'=>$conslt_time,'book_time'=>$value['book_time'],'free_booking_id'=>$value['free_booking_id'],'book_date'=>$value['book_date']));
}
}
}
/*..........................................................................................*/ /*..........................................................................................*/
/*..................................get promocode hospital list.............................*/ /*..................................get promocode hospital list.............................*/
...@@ -7140,10 +7205,16 @@ class Webservice extends CI_Controller { ...@@ -7140,10 +7205,16 @@ class Webservice extends CI_Controller {
$data = (array) json_decode(file_get_contents("php://input")); $data = (array) json_decode(file_get_contents("php://input"));
if(isset($headers['Auth']) && strlen($headers['Auth'])) { if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']); $check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){ if($check_authToken){
if(isset($data['id']) && strlen(trim($data['id']," ")) > 0 && isset($data['booking_id']) && strlen(trim($data['booking_id']," ")) > 0 && isset($data['doctor_id']) && strlen(trim($data['doctor_id']," ")) > 0) { if(isset($data['id']) && strlen(trim($data['id']," ")) > 0 && isset($data['booking_id']) && strlen(trim($data['booking_id']," ")) > 0 && isset($data['doctor_id']) && strlen(trim($data['doctor_id']," ")) > 0) {
$result = $this->Webservice_model->reject_consultation_date_change($data); $result = $this->Webservice_model->reject_consultation_date_change($data);
if($result){
$this->cancel_booking_resend_cron($data['booking_id']);
$res = array('status'=>'success');
}else{
$res = array('status'=>'error','error'=>'error','message'=>'Something Went Wrong.. Try Again Later..!');
}
}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
...@@ -7168,28 +7239,44 @@ class Webservice extends CI_Controller { ...@@ -7168,28 +7239,44 @@ class Webservice extends CI_Controller {
print json_encode($res); print json_encode($res);
} }
public function accept_consultation_date_change(){
header('Content-type: application/json');
$headers = apache_request_headers();
$data = (array) json_decode(file_get_contents("php://input"));
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){
if(isset($data['id']) && strlen(trim($data['id']," ")) > 0 && isset($data['booking_id']) && strlen(trim($data['booking_id']," ")) > 0 && isset($data['doctor_id']) && strlen(trim($data['doctor_id']," ")) > 0) {
$result = $this->Webservice_model->accept_consultation_date_change($data);
//print_r($result);exit();
if($result){
$res = array('status'=>'success');
}else{
$res = array('status'=>'error','error'=>'error','message'=>'Something Went Wrong.. Try Again Later..!');
}
}else{
$res = array(
"status"=> "error",
"error"=> "required",
"message"=> "All Field is required"
);
}
}else{
$res = array(
"status"=> "error",
"error"=> "Not Valid",
"message"=> "Authtoken is not valid"
);
}
}else{
$res = array(
"status"=> "error",
"error"=> "required",
"message"=> "Authtoken is required"
);
}
print json_encode($res);
}
} }
?>
\ No newline at end of file
...@@ -2271,7 +2271,6 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2271,7 +2271,6 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
}else{ }else{
$nowin_server_addoffset = date('Y-m-d H:i:s',strtotime('-'.$new_time[0].' hour -'.$new_time[1].' minutes',strtotime($nowin_server))); $nowin_server_addoffset = date('Y-m-d H:i:s',strtotime('-'.$new_time[0].' hour -'.$new_time[1].' minutes',strtotime($nowin_server)));
} }
$nowin_server_addoffset = strtotime($nowin_server_addoffset); $nowin_server_addoffset = strtotime($nowin_server_addoffset);
$this->db->select('name,specialization'); $this->db->select('name,specialization');
...@@ -2301,7 +2300,14 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2301,7 +2300,14 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$user_type = '1'; $user_type = '1';
$push = $this->push_sent($new,$user_type); $push = $this->push_sent($new,$user_type);
//$ress = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doctor_id'],'clinic_id'=>$query['clinic_id'],'booking_status'=>'0','date >'=>$query['date']))->row_array();
// echo $this->db->last_query();exit();
/* if($ress){
$cron_res = $this->cancel_booking_resend_cron($ress,$data);
}*/
$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){
$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'));
...@@ -2334,20 +2340,20 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2334,20 +2340,20 @@ 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{
$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'],'payment_status'=>'1'))->row_array(); $nextday = $query['date'];
$next_day_consult = $this->wait_list_data($query,$nextday,'');
if(count($next_day_consult) > 0){
if($next_day_consult){ $msg3 = "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',$query['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$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'=>'4','message'=>$msg3,'time'=>$conslt_time,'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'=>$msg3,'time'=>$conslt_time,'booking_id'=>$next_day_consult[0]['id'],'read_status'=>'0','free_booking_id'=>$data['booking_id']));
$new_patient_insert_id = $this->db->insert_id(); $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(); $fcm_user_new = $this->db->get_where('tbl_authtoken',array('userid'=>$next_day_consult[0]['patient_id']))->row();
$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'] = $query['date']; $new['booking_date'] = $query['date'];
$new['doctor_id'] = $query['doctor_id']; $new['doctor_id'] = $query['doctor_id'];
$new['doctor_name'] = $doctr_data['name']; $new['doctor_name'] = $doctr_data['name'];
...@@ -2357,6 +2363,8 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2357,6 +2363,8 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$new['to'] =$fcm_user_new->fcm_token; $new['to'] =$fcm_user_new->fcm_token;
$user_type = '1'; $user_type = '1';
$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']));
} }
} }
if($query['visit_type'] == '0' && $query['payment_type'] == '2'){ if($query['visit_type'] == '0' && $query['payment_type'] == '2'){
...@@ -2380,6 +2388,31 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2380,6 +2388,31 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
return $res; return $res;
} }
public function wait_list_data($query,$nextday,$insertid){
//print_r($insertid);exit();
$this->db->order_by('id','ASC');
if(isset($insertid) && !empty($insertid)){
$this->db->where_not_in('id', $insertid);
}
//$this->db->limit('1','1');
$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();
/*print_r(date('y-m-d h:i:s',$nextday));
echo $this->db->last_query();
print_r($next_day_consult);*/
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);
}
}
//.................get promocode hospital list //.................get promocode hospital list
public function get_promocode_hospital_list($id,$lat,$lng){ public function get_promocode_hospital_list($id,$lat,$lng){
...@@ -3479,7 +3512,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -3479,7 +3512,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$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',$query->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',$todays_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'=>$todays_consult['patient_id'],'type'=>'4','message'=>$text,'time'=>$conslt_time,'booking_id'=>$todays_consult['id'],'read_status'=>'0')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$todays_consult['patient_id'],'type'=>'4','message'=>$text,'time'=>$conslt_time,'booking_id'=>$todays_consult['id'],'read_status'=>'0','free_booking_id'=>$data['booking_id']));
$cancel_patient_insert_id = $this->db->insert_id(); $cancel_patient_insert_id = $this->db->insert_id();
...@@ -4364,7 +4397,6 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -4364,7 +4397,6 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
}else{ }else{
$data['telephone'] = ''; $data['telephone'] = '';
} }
return $query; return $query;
} }
...@@ -4551,18 +4583,35 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -4551,18 +4583,35 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
} }
public function reject_consultation_date_change($data){ public function reject_consultation_date_change($data){
$this->db->delete('tbl_patient_notification',array('id'=>$id)); $result = $this->db->get_where('tbl_patient_notification',array('id'=>$data['id']))->row();
if($result){
if($this->db->delete('tbl_patient_notification',array('id'=>$data['id']))){
$this->db->update('tbl_waiting_list_id_crone',array('status'=>'0'),array('booking_id'=>$data['id']));
return true;
}
}
} }
public function accept_consultation_date_change($data){
$result = $this->db->get_where('tbl_patient_notification',array('id'=>$data['id']))->row();
if($result){
$book_data = $this->db->get_where('tbl_patient_notification',array('id'=>$data['free_booking_id']))->row_array();
$update_data = array(
'booking_status'=>'1',
'date'=>$book_data['date'],
'time'=>$book_data['time'],
'time_start'=>$book_data['time_start'],
'time_end'=>$book_data['time_end'],
);
$this->db->delete('tbl_patient_notification',array('id'=>$data['id']));
$this->db->delete('tbl_waiting_list_id_crone',array('booking_id'=>$data['id']));
if($this->db->update('tbl_booking',$update_data,array('id'=>$data['booking_id']))){
return true;
}
}
}
/*............................................................................................*/ /*............................................................................................*/
} }
?>
\ No newline at end of file
...@@ -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();
......
...@@ -30,7 +30,9 @@ public function index() ...@@ -30,7 +30,9 @@ public function index()
$completed_consultation = $this->Patient_model->get_patient_completed_consultation($userdata['id']); $completed_consultation = $this->Patient_model->get_patient_completed_consultation($userdata['id']);
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']); //get all confirmed and waiting list bookings $confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
//echo $this->db->last_query();exit();
//get all confirmed and waiting list bookings
/*$canceled_consultation = $this->Patient_model->get_patient_canceled_consultation($userdata['id']); //get all canceled bookings*/ /*$canceled_consultation = $this->Patient_model->get_patient_canceled_consultation($userdata['id']); //get all canceled bookings*/
$policy = $this->Patient_model->get_policy(); $policy = $this->Patient_model->get_policy();
...@@ -87,6 +89,10 @@ public function getBooking() ...@@ -87,6 +89,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()
{ {
...@@ -137,9 +143,11 @@ public function cancelBooking() ...@@ -137,9 +143,11 @@ public function cancelBooking()
/*------------------------------------------------*/ /*------------------------------------------------*/
$check_waiting_list = $this->Patient_model->check_waiting_list($result); $check_waiting_list = $this->Patient_model->check_waiting_list($result);
// print_r($check_waiting_list); echo "<br>";
//check any user Exist in waiting List on that date if true ; //check any user Exist in waiting List on that date if true ;
if($check_waiting_list['count']>0) if($check_waiting_list['count']>0)
{ {
//echo "yes"; exit();
$this->Patient_model->change_waitinglist_to_confirmed($check_waiting_list['booking_id']); $this->Patient_model->change_waitinglist_to_confirmed($check_waiting_list['booking_id']);
$booking_details_waiting = $this->Doctor_model->get_booking_details($check_waiting_list['booking_id']); $booking_details_waiting = $this->Doctor_model->get_booking_details($check_waiting_list['booking_id']);
...@@ -196,23 +204,26 @@ public function cancelBooking() ...@@ -196,23 +204,26 @@ 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']))); //echo "no";exit();
$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[0]['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[0]['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 +233,8 @@ public function cancelBooking() ...@@ -222,6 +233,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 +242,27 @@ public function cancelBooking() ...@@ -229,6 +242,27 @@ 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['doc_id'],'clinic_id'=>$query['clinic_id'],'booking_status'=>'0','date'=>$nextday,'payment_status'=>'1'))->result_array();
//echo $this->db->last_query();exit();
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()
{ {
......
...@@ -384,6 +384,8 @@ public function check_waiting_list($data) ...@@ -384,6 +384,8 @@ public function check_waiting_list($data)
$this->db->where('payment_status',1); $this->db->where('payment_status',1);
$this->db->group_by('id');
$query = $this->db->get(); $query = $this->db->get();
return $query->row_array(); return $query->row_array();
......
...@@ -403,7 +403,7 @@ function checkBooking($id) ...@@ -403,7 +403,7 @@ function checkBooking($id)
} }
function set_payment_status($id) function set_payment_status($id)
{ {
$update = array('payment_status' => '1'); $update = array('payment_status' => '1','payment_type'=>'2');
$this->db->where('tbl_booking.id',$id); $this->db->where('tbl_booking.id',$id);
$this->db->update('tbl_booking', $update); $this->db->update('tbl_booking', $update);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"description": "The CodeIgniter framework",
"name": "codeigniter/framework",
"type": "project",
"homepage": "https://codeigniter.com",
"license": "MIT",
"support": {
"forum": "http://forum.codeigniter.com/",
"wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
"irc": "irc://irc.freenode.net/codeigniter",
"source": "https://github.com/bcit-ci/CodeIgniter"
},
"require": { "require": {
"php": ">=5.3.7", "cboden/ratchet": "^0.4.1"
"ktamas77/firebase-php": "dev-master"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},
"require-dev": {
"mikey179/vfsStream": "1.1.*",
"phpunit/phpunit": "4.* || 5.*"
} }
} }
No preview for this file 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