%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php class Bookappointment extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model(array('Common_Model')); } public function index () { $head = array(); $data = array(); //$head['title'] = PORTAL_NAME; //$data['title'] = PORTAL_NAME; $record_num = @end($this->uri->segment_array()); $doctor_id = base64_decode($record_num); //die; // Get TitleId $data['titleArray'] = $this->Common_Model->getAllRecords('tbl_title_master', $col = ' * ', $condition=null, $order_by = NULL,$limit=NULL, $start=NULL); // State $data['stateArray'] = $this->Common_Model->getAllRecords('tbl_states', $col = ' * ', array('status'=>'1','country_id'=>'74'), $order_by = array('state_name'=>'asc'),$limit=NULL, $start=NULL); // State $data['cityArray'] = ''; //$this->Common_Model->getAllRecords('tbl_city', $col = ' * ', $condition=null, $order_by = NULL,$limit=NULL, $start=NULL); // Get Doctor Details $data['doctorDetails'] = $this->Common_Model->getSingleRecord('tbl_doctor_master','*',array('status'=>'1', 'id'=>$doctor_id)); //$doctorArray = $this->getDoctordetails('GetDoctorList', $doctor_id); //$data['doctorDetails'] = ''; //$doctorArray->DoctorList[0]; // Get All doctor Slots //$data['slotsArray'] = $this->getDoctorSlots(); $data['title'] = 'Book an Appointment'; $this->load->view('_parts/header',$data); $this->load->view('book-appointment',$data); $this->load->view('_parts/footer'); } /* * Function : getDoctordetails * */ public function getDoctordetails($api, $doctor_id) { $post = ["SpecializationId"=> 0,"FacilityCode"=> FACILITY_ID,"DoctorId"=> $doctor_id]; //print_r($post); //die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } /* * Function : getDoctorSlots * */ public function getDoctorSlots($api='GetDoctorSlots', $fromDate = '2022-05-20', $toDate= '2022-05-20', $dr_id='758') { $post = ["AppointmentStartDate"=> "$fromDate","AppointmentEndDate"=> "$toDate","FacilityCode"=>'2' ,"DoctorId"=> "$dr_id","isTeleConsultation"=> false]; //print_r($post); die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } /* * Function : get_availableslots * Available, Booked, */ public function get_availableslots() { $appointmentdate = date('Y-m-d',strtotime($_POST['appointmentdate'])); $dr_id = $_POST['dr_id']; $dravailableSlots = $this->getDoctorSlots('GetDoctorSlots',$appointmentdate, $appointmentdate, $dr_id); $template = ''; // Get All Holds Slots $dataTrnsRecords = $this->Common_Model->getAllRecords('tbl_slot_transaction_master ', $col = ' * ', array('dr_id'=>$dr_id, 'status'=>'2')); $holdSlotsIds = array(); foreach($dataTrnsRecords as $trow){ $holdSlotsIds[$trow->id] = $trow->slots; } //print_r($dravailableSlots->DoctorSlotsList); die; if(count($dravailableSlots->DoctorSlotsList)) { foreach($dravailableSlots->DoctorSlotsList as $row) { $stimeArray = explode(" ",$row->StartTime); $etimeArray = explode(" ",$row->EndTime); $timeSlots = $row->StartTime.'::'.$row->EndTime; if(in_array($timeSlots,$holdSlotsIds)) { $template .= '<label class="labcoms"> <span class="checkmark" style="color:red;"><strong>Hold</strong></span> </label>'; } else if($row->StatusText=='Available') { $template .= '<label class="labcoms"> <input type="radio" name="available_slots" id="available_slots" value="'.$row->StartTime.'::'.$row->EndTime.'""> <span class="checkmark" style="color:green;"><strong>'.$stimeArray[1].' - '.$etimeArray[1].'</strong></span> </label>'; } else { $template .= '<label class="labcoms"> <span class="checkmark" style="color:red;"><strong>Not Available</strong></span> </label>'; } } } else { $template = 'No slots available'; } echo $template; exit(); } /* * Function : setPatientDetails * */ public function setPatientDetails($data) { $dob = str_replace(array('-','/'),'-',$data['dob']); $post = ["FacilityCode"=> FACILITY_ID,"SourcePatientId"=>"","TitleId"=>$data['title_name'],"firstName"=> $data['login_name'],"middleName"=> '',"lastName"=> '',"dob"=>"$dob","gender"=>$data['gender'],"Address1"=>$data['address'],"Address2"=>'',"cityCode"=>$data['city_id'],"stateCode"=>$data['state_id'],"countryCode"=>$data['country'], "mobilePhone"=>$data['login_phone'],"PinCode"=>'',"MaritalStatus"=>'',"appointmentId"=>$data['RegistrationNo'],"NationalityId"=>"0","LeadSourceId"=>"","RegistrationSource"=>"0","NationalityId"=>"0","NationalityId"=>"0","PAddress1"=>$data['address'],"PAddress2"=>'',"PcityCode"=>$data['city_id'],"PstateCode"=>$data['state_id'],"PcountryCode"=>$data['country'],"PPinCode"=>'',"EmailId"=>$data['login_email']]; //print_r($post); //die; $response = postExistingRequest('CreatePatient',json_encode($post)); //print_r($response); die; return $response; } /* * Function : getdependantdetails * */ public function getActiveUserdetails() { $id = $_POST['user_id']; if($id){ $response = $this->Common_Model->getSingleRecord('tbl_dependant_registration ', $col = ' * ', array('id'=>$id, 'status'=>'1','is_dependant'=>'0')); //header('Content-type: application/json'); echo json_encode($response); } exit; } /* * Function : getdependantdetails * */ public function getdependantdetails() { $dependant_id = $_POST['dependant_id']; if($dependant_id){ $response = $this->Common_Model->getSingleRecord('tbl_dependant_registration ', $col = ' * ', array('id'=>$dependant_id, 'status'=>'1')); //header('Content-type: application/json'); echo json_encode($response); } exit; } /* * Function : get_citylist * */ public function get_citylist() { $state_id = $_POST['state_id']; if($state_id){ $data_records = $this->Common_Model->getAllRecords('tbl_city', $col = ' * ', array('state_id'=>$state_id, 'status'=>'1'), $order_by = NULL,$limit=NULL, $start=NULL); $response = array(); foreach($data_records as $row) { $response[$row->id] = $row->city_name; } header('Content-type: application/json'); echo json_encode($response); } exit; } /* * Function : get_statelist * */ public function get_statelist() { $country_id = $_POST['country_id']; if($country_id){ $data_records = $this->Common_Model->getAllRecords('tbl_states', $col = ' * ', array('country_id'=>$country_id, 'status'=>'1'), array('abbrevation'=>'ASC'), $limit=NULL, $start=NULL); $response = array(); foreach($data_records as $row) { $response[$row->id] = $row->state_name; } header('Content-type: application/json'); echo json_encode($response); } exit; } /* * Function : validateotp */ public function validateotp() { $tbl_name = "tbl_booking_confirmation"; $appointmentcount = $this->Common_Model->getAllRecordscount($tbl_name,'id', array('status'=>'1')); $appointmentID = 'SH'.$this->getRandomString('4').date('md').$appointmentcount; if($_POST){ $app_date = $_POST['appointment_date']; $dr_id = $_POST['dr_id']; $address = $_POST['address']; $slot_id = $_POST['slot_id']; $title_id = $_POST['title_id']; $full_name = $_POST['full_name']; $dob = $_POST['dob']; $age = $_POST['age']; $mobile_number = $_POST['mobile_number']; $city_id = $_POST['city_id']; $state_id = $_POST['state_id']; $country_id = $_POST['country_id']; $otp = $_POST['otp']; $insParmas = array(); $insParmas = array( 'order_id'=>$appointmentID, 'dr_id'=>$dr_id, 'slot_id'=>$slot_id, 'title_id'=>$title_id, 'full_name'=>$full_name, 'dob'=>$dob, 'age'=>$age, 'mobile_number'=>$mobile_number, 'city_id'=>$city_id, 'state_id'=>$state_id, 'country_id'=>$country_id, 'address'=>$address, 'status'=>'1' ); $tbl_name_otp = 'tbl_registrations_otp'; //saveinfo $recordArray = $this->Common_Model->getSingleRecord($tbl_name_otp, 'id,appointment_id,status', array('status'=>'1', 'mob'=>$mobile_number,'otp'=>$otp)); if($recordArray->id) { // Update validation status $this->Common_Model->updateinfo($tbl_name_otp,array('verify_status'=>'1','otp'=>''),'id', $recordArray->id); // Get Other Login Info $validate = $this->Common_Model->getSingleRecord($tbl_name, '*', array('status'=>'1', 'id'=>$recordArray->appointment_id)); $this->session->set_userdata('user_data',$validate); $resp = $recordArray->appointment_id; } else { $resp = '3001'; } // Send OTP to mobile number echo $resp; exit(); } exit(); } /* * Function : sendOTPSMS */ public function sendOTPSMS() { $tbl_name = "tbl_booking_confirmation"; $appointmentcount = $this->Common_Model->getAllRecordscount($tbl_name,'id', array('status'=>'1')); $appointmentID = 'SH'.$this->getRandomString('4').date('md').$appointmentcount; if($_POST){ $app_date = date('Y-m-d',strtotime($_POST['appointment_date'])); $dr_id = $_POST['dr_id']; $address = $_POST['address']; $slot_id = $_POST['slot_id']; $title_id = $_POST['title_id']; $full_name = $_POST['full_name']; $dob = date('Y-m-d',strtotime($_POST['dob'])); $age = $_POST['age']; $mobile_number = $_POST['mobile_number']; $city_id = $_POST['city_id']; $state_id = $_POST['state_id']; $country_id = $_POST['country_id']; $insParmas = array(); $insParmas = array( 'order_id'=>$appointmentID, 'dr_id'=>$dr_id, 'slot_id'=>$slot_id, 'title_id'=>$title_id, 'full_name'=>$full_name, 'dob'=>$dob, 'age'=>$age, 'mobile_number'=>$mobile_number, 'city_id'=>$city_id, 'state_id'=>$state_id, 'country_id'=>$country_id, 'address'=>$address, 'status'=>'1' ); //saveinfo $recordArray = $this->Common_Model->getSingleRecord($tbl_name, 'id', array('status'=>'1', 'dr_id'=>$dr_id, 'mobile_number'=>$mobile_number,'slot_id'=>$slot_id)); if($recordArray->id) { $insParmas['modifiedon '] = date('Y-m-d H:i:s'); $this->Common_Model->updateinfo($tbl_name,$insParmas,'id', $recordArray->id); $resp_id = $recordArray->id; } else { $insParmas['createdon '] = date('Y-m-d H:i:s'); $insParmas['last_login '] = date('Y-m-d H:i:s'); $resp_id = $this->Common_Model->saveinfo($tbl_name,$insParmas); } // Send OTP to mobile number $this->sendVerificationSMS($_POST, $resp_id); echo $resp_id; } exit(); } /* * Function : sendVerificationSMS */ public function sendVerificationSMS($post, $resp_id) { $mobile_no = $post['mobile_number']; $otp = generate_otp(); $tbl_name = 'tbl_registrations_otp'; // Validate the OTP $searchArray = array('mob'=>$mobile_no); $details = $this->Common_Model->getSingleRecord('tbl_registrations_otp','*',$searchArray); // Save OTP Details $data = array(); $data = array('mob'=>$mobile_no,'otp'=>$otp,'appointment_id'=>$resp_id); $data['is_valid'] = '1'; $data['createdon'] = date('Y-m-d H:i:s'); $time = date('Y-m-d H:i:s'); // expire the token after 1 hour $RESET_TOKEN_LIFE = '15 minutes'; $expireAt = date('Y-m-d H:i:s', strtotime($time . ' + ' . $RESET_TOKEN_LIFE)); $data['expire_at'] = $expireAt; $data['message'] = $message = $otp.' is your OTP for Sharda COVID19 Vaccination Online portal. OTP valid for only 15 minutes.'; if(empty($details)) { $response = $this->Common_Model->saveinfo($tbl_name,$data); } else { $this->Common_Model->updateinfo($tbl_name,$data,'id',$details->id); } return $sendSMS = send_sms($mobile_no,$message); } /* * Function : getRandomString */ function getRandomString($length = 6, $keyspace = '0123456789') { $pieces = []; $max = mb_strlen($keyspace, '8bit') - 1; for ($i = 0; $i < $length; ++ $i) { $pieces[] = $keyspace[rand(0, $max)]; } return implode('', $pieces); } } ?>