Commit e17bb024 by Jansa Jose

Merge branch 'jansa'

parents 47f7ebc4 4cf3745e
......@@ -7144,6 +7144,11 @@ class Webservice extends CI_Controller {
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->reject_consultation_date_change($data);
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",
......@@ -7168,6 +7173,45 @@ class Webservice extends CI_Controller {
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_doctor($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);
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);
}
......
......@@ -2301,7 +2301,14 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$user_type = '1';
$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();
if($ress){
$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'));
......@@ -2342,7 +2349,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$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['patient_id'],'type'=>'4','message'=>$msg3,'time'=>$conslt_time,'booking_id'=>$next_day_consult['id'],'read_status'=>'0','free_booking_id'=>$data['booking_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();
$new['id'] = $new_patient_insert_id;
......@@ -2380,6 +2387,10 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
return $res;
}
public function cancel_booking_resend_cron($res,$data){
}
//.................get promocode hospital list
public function get_promocode_hospital_list($id,$lat,$lng){
......@@ -3479,7 +3490,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 ?";
$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();
......@@ -4551,7 +4562,22 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
}
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']))){
return true;
}
}
}
public function accept_consultation_date_change($data){
$result = $this->db->get_where('tbl_patient_notification',array('id'=>$data['id']))->row();
if($result){
$this->db->delete('tbl_patient_notification',array('id'=>$data['id']));
if($this->db->update('tbl_booking',array('booking_status'=>1),array('id'=>$data['booking_id']))){
return true;
}
}
}
......
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