%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 defined('BASEPATH') OR exit('No direct script access allowed'); class Dashboard extends MY_Controller { public function __construct() { parent::__construct(); $this->load->library('session'); if(empty($_SESSION['logged_user']['id'])) { redirect(LANG_URL . '/home'); } } /* * function: index * display by default active dashboard tab */ public function index($page = 0) { $data = array(); $head = array(); $arrSeo = $this->Public_model->getSeo('user_profile'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $data['user_details'] = $userprofdetails = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); $data['report'] = $this->Public_model->getReport($user_id); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $patientDetails = ''; $genderArray = array('Female'=>'1', 'Male'=>'2', 'Others'=>'3'); if($userprofdetails['phone']!=''){ $patientDetails = $this->getPatientDetails($userprofdetails['phone'],$_SESSION['logged_user']['his_registation_no']); // Get Gender Details $patientDetailsObj = $this->convertToObject($patientDetails['PatientList'][0]); if(@$patientDetailsObj->RegistrationId){ $RegistrationId = $patientDetailsObj->RegistrationId; $RegistrationNo = $patientDetailsObj->RegistrationNo; $Status = $patientDetailsObj->Status; if($RegistrationId>0) { $this->Public_model->updateCommonRecords('users_public', array('his_registation_id'=>$RegistrationId,'his_registation_no'=>$RegistrationNo, 'his_status'=>$Status), 'id',$user_id); $_SESSION['logged_user']['his_registation_id'] = $RegistrationId; $_SESSION['logged_user']['his_registation_no'] = $RegistrationNo; $_SESSION['logged_user']['his_status'] = $Status; //user_address_master } else { $dataResp = array(); $dataResp = array('title_name'=>$userprofdetails['title_name'], 'login_phone'=>$userprofdetails['phone'], 'RegistrationNo'=>$userprofdetails['tmp_regno'], 'login_email'=>$userprofdetails['email'], 'dob'=>date('Y/m/d',strtotime($userprofdetails['dob'])), 'gender'=>$genderArray[$userprofdetails['gender']], 'login_name'=>$userprofdetails['name'], 'address'=>$userprofdetails['address'], 'city_id'=>$userprofdetails['city_id'], 'state_id'=>$userprofdetails['state_id'], 'country'=>$userprofdetails['country_id']); print_r($dataResp); die; if($userprofdetails['tmp_regno']>0) { $resp = $this->setPatientDetails($dataResp); //print_r($resp); die; $RegistrationNo = $resp->RegistrationNo; if($RegistrationNo>0){ $this->Public_model->updateCommonRecords('users_public', array('his_registation_no'=>$RegistrationNo), 'id',$user_id); $_SESSION['logged_user']['his_registation_no'] = $RegistrationNo; } } } $addressExistArray = $this->Public_model->getCommonRecords('user_address_master', array('user_id'=>$user_id)); $addressArray = array(); $addressArray = array('user_id'=>$user_id, 'full_name'=>$userprofdetails['name'],'address'=>$userprofdetails['address'], 'city'=>$userprofdetails['city_id'], 'state'=>$userprofdetails['state_id']); if(empty($addressExistArray)){ $this->Public_model->saveCommonRecords('user_address_master', $addressArray); } else { $address_id = $addressExistArray[0]['address_id']; $this->Public_model->updateCommonRecords('user_address_master', $addressArray,'address_id',$address_id); } } else { $dataResp = array(); //print_r($userprofdetails); die; $dataResp = array('title_name'=>$userprofdetails['title_name'], 'login_phone'=>$userprofdetails['phone'], 'RegistrationNo'=>$userprofdetails['tmp_regno'], 'login_email'=>$userprofdetails['email'], 'dob'=>date('Y/m/d',strtotime($userprofdetails['dob'])), 'gender'=>$genderArray[$userprofdetails['gender']], 'login_name'=>$userprofdetails['name'], 'address'=>$userprofdetails['address'], 'city_id'=>$userprofdetails['city_id'], 'state_id'=>$userprofdetails['state_id'], 'country'=>$userprofdetails['country_id']); //print_r($dataResp); die; $resp = $this->setPatientDetails($dataResp); //print_r($resp); die; $RegistrationNo = $resp->RegistrationNo; $addressExistArray = $this->Public_model->getCommonRecords('user_address_master', array('user_id'=>$user_id)); $addressArray = array(); $addressArray = array('user_id'=>$user_id, 'full_name'=>$userprofdetails['name'],'address'=>$userprofdetails['address'], 'city'=>$userprofdetails['city_id'], 'state'=>$userprofdetails['state_id']); if(empty($addressExistArray)){ $this->Public_model->saveCommonRecords('user_address_master', $addressArray); } else { $address_id = $addressExistArray[0]['address_id']; $this->Public_model->updateCommonRecords('user_address_master', $addressArray,'address_id',$address_id); } if($RegistrationNo>0){ $this->Public_model->updateCommonRecords('users_public', array('his_registation_no'=>$RegistrationNo), 'id',$user_id); $_SESSION['logged_user']['his_registation_no'] = $RegistrationNo; // Save User Address } } } //Get City ID By State Name $this->render('dashboard',$head, $data); } /* * Function : convertToObject * * */ function convertToObject($array) { $object = new stdClass(); foreach ($array as $key => $value) { if (is_array($value)) { $value = convertToObject($value); } $object->$key = $value; } return $object; } /* * function: booking * display by default active booking tab */ public function booking($page = 0) { $data = array(); $arrSeo = $this->Public_model->getSeo('dashboard'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $data['user_details'] = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); $data['report'] = $this->Public_model->getReport($user_id); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $data['action'] = 'booking'; $this->render('dashboard',$data); } /* * function: report * display by default active report tab */ public function report($page = 0) { $data = array(); $arrSeo = $this->Public_model->getSeo('dashboard'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $data['user_details'] = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); $data['report'] = $this->Public_model->getReport($user_id); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $data['action'] = 'report'; $this->render('dashboard',$data); } /* * function: earn * display by default active earn tab */ public function earn($page = 0) { $data = array(); $arrSeo = $this->Public_model->getSeo('dashboard'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $data['user_details'] = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $data['action'] = 'earn'; $this->render('dashboard',$data); } /* * function: payment * display by default active payment tab */ public function payment($page = 0) { $data = array(); $data['user_details'] = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); $data['report'] = $this->Public_model->getReport($user_id); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $data['action'] = 'payment'; $this->render('dashboard',$data); } /* * function: address * display by default active address tab */ public function address($page = 0) { $data = array(); $arrSeo = $this->Public_model->getSeo('dashboard'); $head['title'] = @$arrSeo['title']; $head['description'] = @$arrSeo['description']; $data['user_details'] = $user_details = $_SESSION['logged_user']; $user_id = $_SESSION['logged_user']['id']; // Get Address From HIS API $myAddress = $this->GetPatientAddressList($_SESSION['logged_user']['his_registation_no'], $_SESSION['logged_user']['phone']); // Get Data from User Address Master Table $data['address'] = $this->Public_model->getPublicDetails('user_address_master','user_id',$user_id,'array'); $data['report'] = $this->Public_model->getReport($user_id); // Get All Cart Items of user id $data['oderArray'] = $this->Public_model->getOrderDetails($user_id); $data['action'] = 'address'; $this->render('dashboard',$data); } /* * Function : GetPatientAddressList * */ public function GetPatientAddressList($RegistrationNo, $MobRegId) { $post = ["FacilityID"=>FACILITY_ID,"RegistrationNo"=>"$RegistrationNo","MobRegId"=>$MobRegId]; $response = phpcurlpostdataapi('GetPatientAddressList',json_encode($post)); return $response; } /* * Function : getPatientDetails * */ public function getPatientDetails($mob = '', $RegistrationNo='' ) { $post = ["FacilityCode"=> FACILITY_ID,"MobileNo"=>"$mob","RegistrationNo"=>$RegistrationNo,"EmailId"=>"","DOB"=>"","PatientName"=>"","NationalityId"=> 0,"UnRegAppointment"=> 0]; //print_r($post); die; $response = phpcurlpostdataapi('GetPatientList', json_encode($post)); return $response; } /* * 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; } }