Commit e1376688 by Jansa Jose

dr profile

parent 62d235f5
......@@ -36,7 +36,6 @@ class Webservice extends CI_Controller {
function main_Registration($data){
$type = 'user';
$check_result = $this->Webservice_model->dataExist($data,$type);
//print_r($check_result);exit();
if($check_result['message'] == 'success')
{
if(isset($data['cpf'])){
......@@ -277,7 +276,6 @@ class Webservice extends CI_Controller {
function login(){
header('Content-type: application/json');
$data =(array) json_decode(file_get_contents("php://input"));
//$data=$_POST;
if(isset($data['username']) && strlen($data['username']) && isset($data['password']) && strlen($data['password']))
{
......@@ -357,17 +355,14 @@ class Webservice extends CI_Controller {
function facebook_login() {
header('Content-type: application/json');
//$data =(array) json_decode(file_get_contents("php://input"));
$data=$_POST;
if(isset($data['uid']) && strlen($data['uid']) && isset($data['access_token']) && strlen($data['access_token']) && isset($data['name']) && strlen($data['name']))
{
$status=false;
$check_result = $this->Webservice_model->is_uid_exist_patient($data['uid']);
//print_r($check_result);exit();
if($check_result['status'] == 'exist'){
$userData = $this->Webservice_model->get_userdata_patient_by_uid($data['uid']);
//print_r($userData);exit();
if($userData['status']=='success'){
$bystander_data=$this->Webservice_model->get_patient_depend($userData['userdata']['id']);
$result_1 = $this->get_patient_fulldata($userData,$bystander_data);
......@@ -381,10 +376,6 @@ class Webservice extends CI_Controller {
if($userData['status']=='success'){
$bystander_data=$this->Webservice_model->get_patient_depend($userData['userdata']['id']);
$result_2 = $this->get_patient_fulldata($userData,$bystander_data);
//print_r($result_1);echo"<br>";
//print_r($result_2);echo"<br>";
//print_r($result_1['data']['user']['user_id']);echo "<br>";
//print_r($result_2['data']['user']['user_id']);exit();
if($result_1['data']['user']['user_id'] == $result_2['data']['user']['user_id']){
$this->Webservice_model->update_patient_fbuid($result_2['data']['user']['user_id'],$data);
$res = $result_2;
......@@ -456,18 +447,9 @@ class Webservice extends CI_Controller {
header('Content-type: application/json');
$data =(array) json_decode(file_get_contents("php://input"));
//$data = $_POST;
//print json_encode($data);die();
//print_r($data);die();
// if(isset($data['username']) && strlen($data['username'])){
// }
if((isset($data['username']) && strlen($data['username'])) || (isset($data['email']) && strlen($data['email']))){
// {
$type = 'user';
$check_result = $this->Webservice_model->dataExist($data,$type);
//print_r($check_result);exit();
if(!isset($data['username'])){
$data['username'] = '';
}
......@@ -533,7 +515,6 @@ class Webservice extends CI_Controller {
function facebook_registration(){
header('Content-type: application/json');
//$data =(array) json_decode(file_get_contents("php://input"));
$data = $_POST;
if(isset($data['uid']) && strlen($data['uid']) && isset($data['access_token']) && strlen($data['access_token']) && isset($data['email']) && strlen($data['email']) && isset($data['dob']) && strlen($data['dob']) && isset($data['gender']) && strlen($data['gender']) && isset($data['zip_code']) && strlen($data['zip_code']) && isset($data['street_address']) && strlen($data['street_address']) && isset($data['locality']) && strlen($data['locality']) && isset($data['number']) && strlen($data['number']) && isset($_FILES['profile_photo']))
{
......@@ -680,8 +661,6 @@ class Webservice extends CI_Controller {
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = $_GET['auth_token'];
//print_r(apache_request_headers()); exit;
if(isset($headers['Auth']) && strlen($headers['Auth'])){
......@@ -815,7 +794,6 @@ class Webservice extends CI_Controller {
$res = array( "status"=> "success");
$data1 = array(
//"location_id"=>$key,
"location_name"=>$value['location_name'],
"location_latitude"=>$value['location_lattitude'],
"location_longitude"=>$value['location_longitude']
......@@ -863,7 +841,6 @@ class Webservice extends CI_Controller {
function update_fcm_token(){
header('Content-type: application/json');
//$data = $_POST;
$headers = apache_request_headers();
$data =(array) json_decode(file_get_contents("php://input"));
if(isset($headers['Auth']) && strlen($headers['Auth'])){
......@@ -920,7 +897,6 @@ class Webservice extends CI_Controller {
if($check_authToken){
$result_doctor_specialisation = $this->Webservice_model->get_doctor_specialisation();
if($result_doctor_specialisation['status'] == 'success'){
//print_r($result_doctor_specialisation['data']);
$specialization = array();
foreach ($result_doctor_specialisation['data'] as $key => $value)
{
......@@ -973,9 +949,7 @@ class Webservice extends CI_Controller {
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = (array) json_decode(file_get_contents("php://input"));
$data = $_GET;
//print_r($data);die();
$value_photos = array();
$value_phone = array();
......@@ -998,10 +972,6 @@ class Webservice extends CI_Controller {
$new = array();
}
/*foreach (explode(',',$result['data']['phone']) as $key => $value) {
$dd_phn = $value;
array_push($value_phone, $dd_phn);
}*/
foreach (explode(',',$result['data']['photos']) as $key => $value) {
$dd_pic = $value;
array_push($value_photos, $dd_pic);
......@@ -1109,7 +1079,6 @@ class Webservice extends CI_Controller {
function review_list(){
header('Content-type: application/json');
//$data = (array) json_decode(file_get_contents("php://input"));
$data = $_GET;
$headers = apache_request_headers();
$per_page = 20;
......@@ -1223,10 +1192,9 @@ class Webservice extends CI_Controller {
function doctor_booking(){
header('Content-type: application/json');
//$data = $_POST;
$headers = apache_request_headers();
$data = (array) json_decode(file_get_contents("php://input"));
//print_r($data);exit();
if(isset($headers['Auth']) && strlen($headers['Auth'])){
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){
......@@ -1285,7 +1253,6 @@ class Webservice extends CI_Controller {
function clinic_specialisation(){
header('Content-type: application/json');
//$data = (array) json_decode(file_get_contents('php://input'));
$data = $_POST;
$headers = apache_request_headers();
if(isset($headers['Auth'])){
......@@ -1345,7 +1312,6 @@ class Webservice extends CI_Controller {
function search_doctor(){
header('Content-type: application/json');
// $data = json_decode(file_get_contents('php://input'));
$headers = apache_request_headers();
$data = $_GET;
......@@ -1353,8 +1319,6 @@ class Webservice extends CI_Controller {
if(isset($headers['Auth'])){
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){
/*if((isset($data['query']) && strlen($data['query'])) || (isset($data['speciality']) && strlen($data['speciality'])) || (isset($data['clinic_id']) && strlen($data['clinic_id'])) || (isset($data['date']) && strlen($data['date'])) || (isset($data['others']) && strlen($data['others'])) || (isset($data['location_name']) && strlen($data['location_name']) && isset($data['location_latitude']) && strlen($data['location_latitude']) && isset($data['location_longitude']) && strlen($data['location_longitude'])))
{*/
if(!empty($data)){
if(isset($data['page']) && strlen($data['page'])){
$currentpage = $data['page'];
......@@ -1407,7 +1371,6 @@ class Webservice extends CI_Controller {
$res = array(
"status"=> "success",
"data"=> array('doctor'=>[])
//"message"=> "No data"
);
}
else if($search_query_result == null){
......@@ -1450,7 +1413,6 @@ class Webservice extends CI_Controller {
$get_location = $this->Webservice_model->get_location($headers['Auth']);
if($get_location['status'] == 'success'){
//print_r($get_location);
$result = $this->Webservice_model->search_doctor_query($data,$get_location['data']['location_latitude'],$get_location['data']['location_longitude']);
}
......@@ -1470,7 +1432,6 @@ class Webservice extends CI_Controller {
function search_clinic(){
header('Content-type: application/json');
// $data = json_decode(file_get_contents('php://input'));
$headers = apache_request_headers();
$data = $_GET;
$res =array('status'=>'success');
......@@ -1573,15 +1534,6 @@ class Webservice extends CI_Controller {
header('Content-type: application/json');
$headers = apache_request_headers();
$data = $_GET;
/*$value = "05:30";
$time = explode(':',$value);
$ms = $time[0]*60000 + $time[1]*1000;
print_r($ms);echo "<br>";
print_r(date('H:i',$ms));exit();*/
/*$time = 19800;
print_r(date('H:i:sT',$time));die();*/
if(isset($headers['Auth']) && strlen($headers['Auth'])){
......@@ -1602,7 +1554,6 @@ print_r(date('H:i',$ms));exit();*/
$schedule = json_decode($schedule,true);
$time = $data['offset'];
$new_time = date('H:i',$time);
//print_r($time);exit();
$new_time = explode(':',$new_time);
$nowin_server = date("Y-m-d TH:i:s");
if($data['offset'] > 0){
......@@ -1865,13 +1816,12 @@ print_r(date('H:i',$ms));exit();*/
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){
if(isset($data['doctor_id']) && strlen($data['doctor_id']) && isset($data['month']) && strlen($data['month']) && isset($data['year']) && strlen($data['year']) && isset($data['clinic_id']) && strlen($data['clinic_id'])){
$result_booked = $this->Webservice_model->get_doctor_dates($data);
//print_r($result_booked);exit();
$result_booked = $this->Webservice_model->get_doctor_dates($data);
if($result_booked['status'] == 'success'){
$res = array("status" => "success",
"data" => array("available"=>array(),"not_available" =>array()));
$db_day_array = array();
//print_r($result_booked['data']);
$db_day_array = array();
if($result_booked['data'] != '""'){
$schedule_data = json_decode($result_booked['data']);
foreach ($schedule_data as $key => $value) {
......@@ -1881,7 +1831,7 @@ print_r(date('H:i',$ms));exit();*/
$db_day_array[] = [];
}
$time = strtotime($data['month']. $data['year']);
//print_r($time);exit();
$search_form = date('Y-m-01',$time);
$search_to = date('Y-m-t',$time);
$req_month_number = date('m',strtotime($data['month']));
......@@ -1893,14 +1843,12 @@ print_r(date('H:i',$ms));exit();*/
for($i = $search_form; $i <= $search_to ; $i++){
if((($tod_month_number <= $req_month_number)&& ($year_today == $data['year'])) || ((($req_month_number <= $tod_month_number) || ($req_month_number >= $tod_month_number))&& ($year_today <= $data['year']))){
$day = strtolower(date('D',strtotime($i)));
//print_r($day);
if(in_array($day, $db_day_array)){
if(count($result_booked['leave']) > 0){
foreach ($result_booked['leave'] as $key => $value) {
if((date('j',$value->start_date) <= date('j',strtotime($i))) && (date('j',$value->end_date) >= date('j',strtotime($i))) &&(date('F',$value->start_date) == $data['month']) && (date('F',$value->end_date) == $data['month']) && (date('Y',$value->start_date) == $data['year']) && (date('Y',$value->end_date) == $data['year'])) {
array_push($res['data']['not_available'], date('j',strtotime($i)));
}else{
//array_push($res['data']['available'], date('j',strtotime($i)));
if(strtotime($i) < strtotime($date_today)){
array_push($res['data']['not_available'], date('j',strtotime($i)));
}else{
......@@ -1909,7 +1857,6 @@ print_r(date('H:i',$ms));exit();*/
}
}
}else{
//array_push($res['data']['available'], date('j',strtotime($i)));
if(strtotime($i) < strtotime($date_today)){
array_push($res['data']['not_available'], date('j',strtotime($i)));
}else{
......@@ -1979,7 +1926,6 @@ print_r(date('H:i',$ms));exit();*/
else{
$res = array(
"status"=> "success",
//"error"=> "No Data",
"data"=> array('booking_list'=>[])
);
}
......@@ -2102,7 +2048,6 @@ print_r(date('H:i',$ms));exit();*/
public function add_dependent(){
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = (array) json_decode(file_get_contents("php://input"));
$data = $_POST;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
......@@ -2140,9 +2085,6 @@ print_r(date('H:i',$ms));exit();*/
}else{
$new_data = array();
foreach ($result as $key => $value) {
//$dob=date('Y-m-d',$value->dob);
//$diff = (date('Y') - date('Y',strtotime($dob)));
//print_r($diff);exit();
$new_data[$key]['dependent_id'] =$value->id;
$new_data[$key]['dependent_name'] =$value->dependent_name;
$new_data[$key]['dependent_relation'] =$value->relation;
......@@ -2510,7 +2452,6 @@ print_r(date('H:i',$ms));exit();*/
if($check_authToken){
if(isset($id) && strlen(trim($id," ")) > 0){
$promo_distance_result = $this->promo_distance_query($id,$headers);
// echo"<pre>"; print_r($promo_distance_result); echo "</pre>";exit();
if($promo_distance_result['status'] == 'success'){
$res = array(
"status"=> "success",
......@@ -2570,7 +2511,6 @@ print_r(date('H:i',$ms));exit();*/
$headers = apache_request_headers();
$data = (array) json_decode(file_get_contents("php://input"));
//$data = $_POST;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){
......@@ -2712,8 +2652,7 @@ print_r(date('H:i',$ms));exit();*/
public function faq(){
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = (array) json_decode(file_get_contents("php://input"));
//$page = $_GET['page'];
$per_page=20;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
......@@ -3034,7 +2973,6 @@ print_r(date('H:i',$ms));exit();*/
$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){
......@@ -3424,12 +3362,9 @@ print_r(date('H:i',$ms));exit();*/
public function main_Registration_doctor($data){
$type = 'doctor';
$check_result = $this->Webservice_model->dataExist($data,$type);
//print_r($check_result);exit();
if($check_result['message'] == 'success')
{
$data['password'] = md5($data['password']);
// $data['dob'] = strtotime($data['dob']);
$data['cep'] = $data['zip_code'];
$data['complement'] = $data['landmark'];
$data['about'] = $data['biodata'];
......@@ -3439,7 +3374,6 @@ print_r(date('H:i',$ms));exit();*/
$ch = curl_init();
$area = $data['zip_code'];
$url = "https://maps.googleapis.com/maps/api/geocode/json?address=${area}&key=AIzaSyDMcP8sMKFPmLROvIf3g1U86_Vg5ur41nQ";
//print_r($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
......@@ -3514,9 +3448,7 @@ print_r(date('H:i',$ms));exit();*/
public function doctor_registration(){
header('Content-type: application/json');
// $data =(array) json_decode(file_get_contents("php://input"));
$data = $_POST;
//print_r($data);die();
if(isset($data['name']) && strlen($data['name']) && isset($data['username']) && strlen($data['username']) && isset($data['email']) && strlen($data['email']) && isset($data['password']) && strlen($data['password']) && isset($data['dob']) && strlen($data['dob']) && isset($data['gender']) && strlen($data['gender']) && isset($data['zip_code']) && strlen($data['zip_code']) && isset($data['street_address']) && strlen($data['street_address']) && isset($data['locality']) && strlen($data['locality']) && isset($data['number']) && strlen($data['number']) && isset($_FILES['profile_photo']) && isset($data['cpf']) && strlen($data['cpf']) && isset($data['rg']) && strlen($data['rg']) && isset($data['crm']) && strlen($data['crm']) && isset($data['landmark']) && strlen($data['landmark']) && isset($data['biodata']) && strlen($data['biodata']) &&isset($data['specialization_id']) && strlen($data['specialization_id']))
{
$res = $this->main_Registration_doctor($data);
......@@ -3647,13 +3579,10 @@ print_r(date('H:i',$ms));exit();*/
function doctor_login(){
header('Content-type: application/json');
$data =(array) json_decode(file_get_contents("php://input"));
//$data=$_POST;
if(isset($data['username']) && strlen($data['username']) && isset($data['password']) && strlen($data['password']))
{
$result=$this->Webservice_model->doctor_login($data);
//$result['userdata']['specialization_id'] = $result['userdata']['specialization'];
//echo"<pre>";print_r($result);echo"</pre>";exit();
if($result['status']=='success'){
$res = $this->get_doctor_fulldata($result,'');
}
......@@ -3678,13 +3607,10 @@ print_r(date('H:i',$ms));exit();*/
public function facebook_registration_doctor(){
header('Content-type: application/json');
// $data =(array) json_decode(file_get_contents("php://input"));
$data = $_POST;
//print_r($data);exit()
if(isset($data['uid']) && strlen($data['uid']) && isset($data['access_token']) && strlen($data['access_token']) && isset($data['email']) && strlen($data['email']) && isset($data['dob']) && strlen($data['dob']) && isset($data['gender']) && strlen($data['gender']) && isset($data['zip_code']) && strlen($data['zip_code']) && isset($data['street_address']) && strlen($data['street_address']) && isset($data['locality']) && strlen($data['locality']) && isset($data['number']) && strlen($data['number']) && isset($_FILES['profile_photo']) && isset($data['cpf']) && strlen($data['cpf']) && isset($data['rg']) && strlen($data['rg']) && isset($data['crm']) && strlen($data['crm']) && isset($data['landmark']) && strlen($data['landmark']) && isset($data['biodata']) && strlen($data['biodata']) &&isset($data['specialization_id']) && strlen($data['specialization_id']))
{
$result = $this->Webservice_model->is_this_uid_exit_doctor($data);
//echo"<pre>";print_r($result);echo"</pre>";exit();
if($result['status'] == 'success'){
$fileName = $result['userdata']['id'].'_'.$_FILES['profile_photo']['name'];
$config = set_upload_options('../assets/uploads/profilepic/doctors/');
......@@ -3734,17 +3660,15 @@ print_r(date('H:i',$ms));exit();*/
public function facebook_login_doctor(){
header('Content-type: application/json');
//$data =(array) json_decode(file_get_contents("php://input"));
$data=$_POST;
if(isset($data['uid']) && strlen($data['uid']) && isset($data['access_token']) && strlen($data['access_token']) && isset($data['name']) && strlen($data['name']))
{
$status=false;
$check_result = $this->Webservice_model->is_uid_exist($data['uid']);
//print_r($check_result);exit();
if($check_result['status'] == 'exist'){
$userData = $this->Webservice_model->get_userdata_doctor_by_uid($data['uid']);
//print_r($userData);exit();
if($userData['status']=='success'){
$result_1 = $this->get_doctor_fulldata($userData,'');
$status=true;
......@@ -3753,7 +3677,6 @@ print_r(date('H:i',$ms));exit();*/
$check_result = $this->Webservice_model->email_exist_doctor($data['email']);
if($check_result['status'] == 'exist'){
$userData = $this->Webservice_model->get_userdata_doctor($data['email']);
//print_r($userData);
if($userData['status']=='success'){
$result_2 = $this->get_doctor_fulldata($userData,'');
if($result_1['data']['doctor_id'] == $result_2['data']['doctor_id']){
......@@ -3773,8 +3696,6 @@ print_r(date('H:i',$ms));exit();*/
}else{
$res=$result_1;
}
}
else if($userData['status'] == 'fail'){
$status=false;
......@@ -3822,7 +3743,6 @@ print_r(date('H:i',$ms));exit();*/
}else{
$auth = $userData['userdata']['authtoken'];
}
//echo"<pre>";print_r($userData);echo"</pre>";exit();
if($userData['userdata']['specialization_id'] == ''){
$userData['userdata']['specialization_id'] = '';
......@@ -4014,10 +3934,8 @@ print_r(date('H:i',$ms));exit();*/
public function update_fcm_token_doctor(){
header('Content-type: application/json');
//$data = $_POST;
$headers = apache_request_headers();
//$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'])){
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']);
......@@ -4064,12 +3982,10 @@ print_r(date('H:i',$ms));exit();*/
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = $_POST;
$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){
//print_r($data);exit();
if(isset($data['consultation_duration']) && strlen(trim($data['consultation_duration']," ")) > 0 && isset($data['consultation_fee']) && strlen(trim($data['consultation_fee']," ")) > 0 && isset($data['is_home_consultation_available']) && isset($data['is_return_consultation_available'])){
$authtoken = $this->Webservice_model->get_doctorid_frm_authtoken($headers['Auth']);
$result = $this->Webservice_model->configure_consultation($data,$authtoken->doctor_id);
......@@ -4341,7 +4257,6 @@ print_r(date('H:i',$ms));exit();*/
header('Content-type: application/json');
$headers = apache_request_headers();
//$page = $_GET['page'];
$per_page=20;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
......@@ -4429,8 +4344,7 @@ print_r(date('H:i',$ms));exit();*/
public function get_doctor_faq_list(){
header('Content-type: application/json');
$headers = apache_request_headers();
//$data = (array) json_decode(file_get_contents("php://input"));
//$page = $_GET['page'];
$per_page=20;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']);
......@@ -4514,7 +4428,6 @@ print_r(date('H:i',$ms));exit();*/
header('Content-type: application/json');
$headers = apache_request_headers();
//$page = $_GET['page'];
$per_page=20;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']);
......@@ -4597,7 +4510,6 @@ print_r(date('H:i',$ms));exit();*/
header('Content-type: application/json');
$headers = apache_request_headers();
//$page = $_GET['page'];
$per_page=20;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']);
......@@ -4676,12 +4588,11 @@ print_r(date('H:i',$ms));exit();*/
print json_encode($res);
}
public function doctor_app_feedback(){
public function doctor_app_feedback(){
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){
......@@ -4730,7 +4641,6 @@ print_r(date('H:i',$ms));exit();*/
$headers = apache_request_headers();
$data = (array) json_decode(file_get_contents("php://input"));
//$data = $_POST;
if(isset($headers['Auth']) && strlen($headers['Auth'])) {
$check_authToken = $this->Webservice_model->check_auth_token_doctor($headers['Auth']);
if($check_authToken){
......@@ -4887,7 +4797,7 @@ print_r(date('H:i',$ms));exit();*/
$notificationresult = $this->Webservice_model->get_patient_medical_record_list($authtoken->doctor_id,0,0,$id);
$result = $this->Webservice_model->get_patient_medical_record_list($authtoken->doctor_id,$start,$per_page,$id);
//print_r($result);exit()
$medicalArray = array();
if(count($notificationresult['medical']) > 0){
$total = count($notificationresult['medical']);
......@@ -5280,11 +5190,6 @@ print_r(date('H:i',$ms));exit();*/
}
$notifArray = array();
// if($result != false){
// $total = count($result);
// }else{
// $total = 0;
// }
if($total_count >= $per_page){
$totalPages = (int)($total_count % $per_page ==0
? $total_count / $per_page
......@@ -5293,15 +5198,13 @@ print_r(date('H:i',$ms));exit();*/
else{
$totalPages = 1;
}
//print_r($result);exit;
if($result != ''){
foreach ($result as $key => $value) {
$value->read_status = $value->read_status!=0 ? true : false;
array_push($notifArray, $value);
}
}
//print_r($notifArray);echo"<br>";
//print_r($result);exit;
if($result != ''){
......@@ -5791,7 +5694,7 @@ print_r(date('H:i',$ms));exit();*/
print json_encode($res);
}
/*
public function encrypt_data(){
$data = '24048';
$new = encrypt_data($data);
......@@ -5799,7 +5702,7 @@ print_r(date('H:i',$ms));exit();*/
print_r($new);echo"<br>";
print_r($neww);
exit();
}
}*/
public function set_prescriptions(){
header('Content-type: application/json');
......@@ -5889,7 +5792,6 @@ print_r(date('H:i',$ms));exit();*/
);
}
print json_encode($res);
}
public function get_budget_basic_data(){
......@@ -6053,7 +5955,6 @@ print_r(date('H:i',$ms));exit();*/
"message"=> "Email is required"
);
}
print json_encode($res);
}
......@@ -6071,18 +5972,11 @@ print_r(date('H:i',$ms));exit();*/
if(isset($_FILES['photo'])){
//echo "s";
if (!is_dir("./../assets/uploads/medicalrecord/booking".$data['booking_id'])) {
/*$oldmask = umask(0);
mkdir("./../assets/uploads/medicalrecord/booking".$data['booking_id'], 777,true);
//umask($oldmask);
//chmod("./../assets/uploads/medicalrecord/booking".$data['booking_id'], 0777);*/
$oldmask = umask(0);
mkdir("./../assets/uploads/medicalrecord/booking".$data['booking_id'], 0777);
umask($oldmask);
}
//print_r($_FILES['photo']);
//exit();
$files = $_FILES;
$config = set_upload_options('./../assets/uploads/medicalrecord/booking'.$data['booking_id']);
$this->load->library('upload', $config);
......@@ -6258,7 +6152,7 @@ print_r(date('H:i',$ms));exit();*/
$type = '1';
$notificationresult = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,$start,$per_page,$type);
//print_r($result);exit();
$transArray = array();
if($notificationresult['status'] != 'failed'){
$total = count($notificationresult['data']);
......@@ -6361,9 +6255,7 @@ print_r(date('H:i',$ms));exit();*/
}
if($result['status'] == 'success'){
foreach ($result['data'] as $key => $value) {
array_push($transArray, $value);
}
}
......@@ -6588,9 +6480,7 @@ print_r(date('H:i',$ms));exit();*/
}
if($result['status'] != 'failed'){
foreach ($result['data'] as $key => $value) {
array_push($bankArray, $value);
}
}
......@@ -6752,37 +6642,7 @@ print_r(date('H:i',$ms));exit();*/
}
/*public function push_sents() {
$data1 = "SELECT * FROM settings WHERE id = '0' ";
$query1 = $this->db->query($data1);
$rs = $query1->row();
$key = $rs->api_key;
$data = "{ \"notification\": { \"title\": \"hi\", \"text\": \"hellonewmessage\" , \"sound\": \"default\" }, \"time_to_live\": 60, \"data\" : {\"response\" : {\"status\" : \"success\", \"data\" : {\"id\" : \"12\"}}}, \"collapse_key\" : \"trip\", \"priority\":\"high\", \"to\" : \"fS8vuhzQKwg:APA91bEJbAw_Hgy8AfMv42GWJEow71yToWBzhhRnT5uOcFmrsLl4Ir3ONZqgvPKoksK5lCbKT8e9DS2oOOylm1VEUoCH4MntbYcdodqj1PcQhdxv2fJdMJzK0kBU4eCyYXC6wx-U8tOw\"}";
$ch = curl_init("https://fcm.googleapis.com/fcm/send");
$header = array('Content-Type: application/json', 'Authorization: key='.$key);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
}*/
public function get_vacation_dates(){
public function get_vacation_dates(){
header('Content-type: application/json');
$data = $_GET;
......@@ -7049,7 +6909,6 @@ print_r(date('H:i',$ms));exit();*/
$create_charge['items'] = $items;
$create_charge['payer'] = array('cpf_cnpj' => $patient_data['pt_cpf'], 'name' => $patient_data['pt_name'], 'email' => $patient_data['pt_email']);
$create_charge['payer']['address'] = array('zip_code' => $patient_data['pt_zip_code'], 'street' => $patient_data['pt_street_add'], 'number' => $patient_data['pt_number'], 'complement' => $patient_data['pt_complement']);
//print_r($create_charge);die();
$request = load_curl('https://api.iugu.com/v1/charge', $create_charge);
$charge = json_decode($request);
......
......@@ -12,7 +12,6 @@ class Webservice_model extends CI_Model {
function check_auth_token($authtoken){
$query = $this->db->get_where('tbl_authtoken',array('authtoken'=>$authtoken));
// echo $this->db->last_query();exit();
if($query->num_rows() > 0){
return true;
}
......@@ -76,11 +75,8 @@ class Webservice_model extends CI_Model {
$return_array = array('status'=>'fail');
}
}else{
//$data['name'] = encrypt_data($data['name']);
$data['about'] = encrypt_data($data['about']);
//$data['price'] = encrypt_data($data['price']);
$data['about'] = encrypt_data($data['about']);
$data['gender'] = encrypt_data($data['gender']);
//$data['domiciliary_status'] = encrypt_data($data['domiciliary_status']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['cep'] = encrypt_data($data['cep']);
......@@ -107,11 +103,8 @@ class Webservice_model extends CI_Model {
unset($query['dob']);
$query['dob'] = $query_date->dob;
//$query['name'] = decrypt_data($query['name']);
$query['about'] = decrypt_data($query['about']);
//$query['price'] = decrypt_data($query['price']);
$query['gender'] = decrypt_data($query['gender']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['cep'] = decrypt_data($query['cep']);
......@@ -235,8 +228,6 @@ class Webservice_model extends CI_Model {
function is_this_uid_exit_doctor($data){
$query = $this->db->get_where('tbl_doctors',array('uid'=>$data['uid']))->row();
//echo $this->db->last_query();
//echo"<pre>";print_r($query);echo"</pre>";exit();
if($query){
if($query->email == $data['email']){
$return_array = $this->update_doctor_registration_data($data,$query);
......@@ -259,7 +250,6 @@ class Webservice_model extends CI_Model {
function is_this_uid_exit_patient($data){
$query = $this->db->get_where('tbl_registration',array('uid'=>$data['uid'],'access_token'=>$data['access_token']))->row();
//echo"<pre>";print_r($query);echo"</pre>";exit();
if($query){
if($query->email == $data['email']){
$return_array = $this->update_patient_registration_data($data,$query);
......@@ -281,8 +271,6 @@ class Webservice_model extends CI_Model {
//....................if uid exist for doctor thn update doctor registration data
function update_doctor_registration_data($data,$query){
//$data['password'] = md5($data['password']);
//$data['dob'] = $data['dob'];
$data['cep'] = encrypt_data($data['zip_code']);
$data['complement'] = encrypt_data($data['landmark']);
......@@ -291,9 +279,6 @@ class Webservice_model extends CI_Model {
$data['gender'] = encrypt_data(strtoupper($data['gender']));
$data['username'] = $data['uid'];
$data['is_registration_completed'] = 1;
//$data['name'] = encrypt_data($data['name']);
//$data['price'] = encrypt_data($data['price']);
//$data['domiciliary_status'] = encrypt_data($data['domiciliary_status']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['street_address'] = encrypt_data($data['street_address']);
......@@ -325,9 +310,6 @@ class Webservice_model extends CI_Model {
$query['complement'] = decrypt_data($query['landmark']);
$query['about'] = decrypt_data($query['biodata']);
$query['gender'] = decrypt_data($query['gender']);
//$query['name'] = decrypt_data($query['name']);
//$query['price'] = decrypt_data($query['price']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -344,8 +326,6 @@ class Webservice_model extends CI_Model {
//....................if uid exist for patient thn update patient registration data
function update_patient_registration_data($data,$query){
//$data['password'] = md5($data['password']);
//$data['dob'] = encrypt_data($data['dob']);
$data['username'] = $data['uid'];
$new = array();
$type = 'user';
......@@ -495,7 +475,6 @@ class Webservice_model extends CI_Model {
$this->db->join('tbl_authtoken_doctors', 'tbl_authtoken_doctors.doctor_id = tbl_doctors.id');
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization');
$query = $this->db->get_where("tbl_doctors",array("username"=>$data['username'],"password"=>md5($data['password'])))->row_array();
//print_r($query);exit();
if(count($query) < 0 || $query == ''){
$this->db->select('tbl_doctors.*,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken');
$this->db->join('tbl_authtoken_doctors', 'tbl_authtoken_doctors.doctor_id = tbl_doctors.id');
......@@ -513,9 +492,6 @@ class Webservice_model extends CI_Model {
$query_email['complement'] = decrypt_data($query_email['complement']);
$query_email['about'] = decrypt_data($query_email['about']);
$query_email['gender'] = decrypt_data($query_email['gender']);
//$query_email['name'] = decrypt_data($query_email['name']);
//$query_email['price'] = decrypt_data($query_email['price']);
//$query_email['domiciliary_status'] = decrypt_data($query_email['domiciliary_status']);
$query_email['rg'] = decrypt_data($query_email['rg']);
$query_email['crm'] = decrypt_data($query_email['crm']);
$query_email['street_address'] = decrypt_data($query_email['street_address']);
......@@ -533,9 +509,6 @@ class Webservice_model extends CI_Model {
$query_email['complement'] = decrypt_data($query_email['complement']);
$query_email['about'] = decrypt_data($query_email['about']);
$query_email['gender'] = decrypt_data($query_email['gender']);
//$query_email['name'] = decrypt_data($query_email['name']);
//$query_email['price'] = decrypt_data($query_email['price']);
//$query_email['domiciliary_status'] = decrypt_data($query_email['domiciliary_status']);
$query_email['rg'] = decrypt_data($query_email['rg']);
$query_email['crm'] = decrypt_data($query_email['crm']);
$query_email['street_address'] = decrypt_data($query_email['street_address']);
......@@ -681,9 +654,6 @@ class Webservice_model extends CI_Model {
$query['complement'] = decrypt_data($query['landmark']);
$query['about'] = decrypt_data($query['biodata']);
$query['gender'] = decrypt_data($query['gender']);
//$query['name'] = decrypt_data($query['name']);
//$query['price'] = decrypt_data($query['price']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -716,9 +686,6 @@ class Webservice_model extends CI_Model {
$query['complement'] = decrypt_data($query['landmark']);
$query['about'] = decrypt_data($query['biodata']);
$query['gender'] = decrypt_data($query['gender']);
//$query['name'] = decrypt_data($query['name']);
//$query['price'] = decrypt_data($query['price']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -759,7 +726,6 @@ class Webservice_model extends CI_Model {
else{
$return_array = array('status'=>'fail');
}
//echo $this->db->last_query();exit();
return $return_array;
}
......@@ -769,10 +735,8 @@ class Webservice_model extends CI_Model {
$data['is_registration_completed'] = 0;
$data['name'] = encrypt_data($data['name']);
$data['about'] = encrypt_data($data['about']);
//$data['price'] = encrypt_data($data['price']);
$data['about'] = encrypt_data($data['about']);
$data['gender'] = encrypt_data($data['gender']);
//$data['domiciliary_status'] = encrypt_data($data['domiciliary_status']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['cep'] = encrypt_data($data['cep']);
......@@ -797,7 +761,6 @@ class Webservice_model extends CI_Model {
unset($query['dob']);
$query['dob'] = $query_date->dob;
//$query['name'] = decrypt_data($query['name']);
$query['about'] = decrypt_data($query['about']);
$query['price'] = decrypt_data($query['price']);
$query['gender'] = decrypt_data($query['gender']);
......@@ -922,7 +885,6 @@ class Webservice_model extends CI_Model {
$res['booking_count'] = $this->db->count_all('tbl_booking');
$res['charity_count'] = $this->db->count_all('tbl_charity');
$this->db->select('count(id) as count');
//$query = $this->db->get_where('tbl_patient_notification',array('patient_id'=>$id))->result();
$query = $this->notification_list_unread_count($id);
$res['notification_count'] = $query->count;
return $res;
......@@ -1036,7 +998,6 @@ class Webservice_model extends CI_Model {
function get_specialisation(){
$this->db->select("DISTINCT(tbl_specialization.specialization_name) as name,tbl_specialization.id");
//$this->db->group_by('tbl_specialization.specialization_name');
$query = $this->db->get_where("tbl_specialization");
if ($query->num_rows() > 0) {
$return_array = array('status'=>'success','data'=>array('specializations'=>$query->result_array()));
......@@ -1077,9 +1038,6 @@ class Webservice_model extends CI_Model {
$query['complement'] = decrypt_data($query['complement']);
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
//$query['name'] = decrypt_data($query['name']);
//$query['price'] = decrypt_data($query['price']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -1103,7 +1061,6 @@ class Webservice_model extends CI_Model {
$this->db->limit($per_page,$start);
}
$query = $this->db->get_where("tbl_review",array("tbl_review.doctor_id"=>$id))->result_array();
//echo $this->db->last_query();exit();
if(count($query)> 0){
foreach ($query as $key => $value) {
$query[$key]['name'] = decrypt_data($value['name']);
......@@ -1144,7 +1101,6 @@ class Webservice_model extends CI_Model {
if(isset($data['promocode_id']) && strlen(trim($data['promocode_id']," ")) > 0){
$res = $this->get_promocode_result($data);
//echo"<pre>";print_r(count($res['data']['promo_data']));echo"</pre>";exit();
if($res['status'] == 'success'){
$patientid = $query->row_array();
$return_array = $this->doctor_booking_wth_promocode($data,$res['data'],$patientid);
......@@ -1185,8 +1141,6 @@ class Webservice_model extends CI_Model {
$this->db->order_by('id','DESC');
$this->db->limit(1,0);
$res = $this->db->get('tbl_booking')->row();
//echo $this->db->last_query();exit();
//print_r($res);exit();
if($res){
$visit = $res;
}else{
......@@ -1243,7 +1197,6 @@ class Webservice_model extends CI_Model {
$check = $this->db->get_where('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'date'=>$data['date'],'time'=>$data['time'],'payment_status'=>'1'));
$this->db->select('name,profile_pic,specialization');
$doctr_data = $this->db->get_where('tbl_doctors',array('id'=>$data['doctor_id']))->row_array();
//print_r($doctr_data);exit();
$special = $this->db->get_where('tbl_specialization',array('id'=>$doctr_data['specialization']))->row();
$fcm_user = $this->db->get_where('tbl_authtoken',array('userid'=>$patientid['userid']))->row();
$conslt_time = date('Y-m-d h:i:s');
......@@ -1251,8 +1204,6 @@ class Webservice_model extends CI_Model {
$settngs = $this->db->get('settings')->row();
$ipokefees = $settngs->ipok_fee;
if($check->num_rows() <= 0){
//$patientid = $query->row_array();
//$offset=5.5*60*60;
$date_def = date('Y-m-d',$data['date']);
$times = explode('-', $data['time']);
$start_time = strtotime($date_def.$times[0]);
......@@ -1484,26 +1435,19 @@ class Webservice_model extends CI_Model {
}
$query = $this->db->get();
//echo $this->db->last_query();exit();
//print_r($this->db->last_query());die();
if ($query->num_rows() > 0) {
$querys = $query->result_array();
//echo "<pre>";print_r($querys);exit();
if(isset($data['date']) && strlen($data['date'])){
$day = date('D',$data['date']);
$day = strtolower($day);
$date = $data['date'];
$leave_query = $this->db->query("SELECT * FROM `tbl_doctor_leave` WHERE ($date >= `tbl_doctor_leave`.`start_date` AND $date <= `tbl_doctor_leave`.`end_date`)")->result();
//echo $this->db->last_query();
if($leave_query){
//echo"s";
foreach ($leave_query as $key => $value) {
foreach ($querys as $keys => $values) {
if(($values['doctor_id'] == $value->doctor_id ) && ($values['clinic_id'] == $value->clinic_id)){
//echo"n".$values['clinic_id'].'-'.$values['doctor_id']."<br>";
unset($querys[$keys]);
}else{
//echo"s".$values['clinic_id'].'-'.$values['doctor_id'];
$consult = $this->db->get_where('tbl_consultation',array('clinic_id'=>$values['clinic_id'],'doctor_id'=>$values['doctor_id']))->row();
if($consult){
if($consult->date != '""'){
......@@ -1512,7 +1456,6 @@ class Webservice_model extends CI_Model {
$new_array_day = array();
$new_array_day[] = $consult_value->day;
}
// print_r($new_array_day);
if(!in_array($day, $new_array_day)){
unset($querys[$keys]);
}
......@@ -1525,7 +1468,6 @@ class Webservice_model extends CI_Model {
}
}else{
foreach ($querys as $keys => $values) {
//echo"s".$values['clinic_id'].'-'.$values['doctor_id'];
$consult = $this->db->get_where('tbl_consultation',array('clinic_id'=>$values['clinic_id'],'doctor_id'=>$values['doctor_id']))->row();
if($consult){
if($consult->date != '""'){
......@@ -1534,7 +1476,6 @@ class Webservice_model extends CI_Model {
$new_array_day = array();
$new_array_day[] = $consult_value->day;
}
//print_r($new_array_day);
if(!in_array($day, $new_array_day)){
unset($querys[$keys]);
}
......@@ -1545,7 +1486,6 @@ class Webservice_model extends CI_Model {
}
}
}
//echo"<pre>";print_r($querys);exit();
$return_array = array('status'=>'success','data'=>$querys);
}
else{
......@@ -1590,7 +1530,6 @@ class Webservice_model extends CI_Model {
$this->db->where($where);
}
$query = $this->db->get();
//echo $this->db->last_query();exit();
if ($query->num_rows() > 0) {
$return_array = array('status'=>'success','data'=>$query->result_array());
}
......@@ -1693,7 +1632,6 @@ class Webservice_model extends CI_Model {
}else{
$result = array('status'=>'success');
}
//print_r($result);exit();
return $result;
}
......@@ -1729,11 +1667,8 @@ class Webservice_model extends CI_Model {
//........................ Register Doctor
function register_doctor($data){
//$data['name'] = encrypt_data($data['name']);
$data['about'] = encrypt_data($data['about']);
//$data['price'] = encrypt_data($data['price']);
$data['about'] = encrypt_data($data['about']);
$data['gender'] = encrypt_data($data['gender']);
//$data['domiciliary_status'] = encrypt_data($data['domiciliary_status']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['cep'] = encrypt_data($data['cep']);
......@@ -1751,11 +1686,8 @@ class Webservice_model extends CI_Model {
$query = $query->row_array();
unset($query['dob']);
$query['dob'] = $query_date->dob;
//$query['name'] = decrypt_data($query['name']);
$query['about'] = decrypt_data($query['about']);
//$query['price'] = decrypt_data($query['price']);
$query['gender'] = decrypt_data($query['gender']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['cep'] = decrypt_data($query['cep']);
......@@ -1939,11 +1871,9 @@ class Webservice_model extends CI_Model {
$this->db->limit($per_page,$start);
}
$query = $this->db->get('tbl_recent_chats')->result();
//echo $this->db->last_query();exit();
if(count($query) > 0){
foreach ($query as $key => $value) {
$query[$key]->patient_name = decrypt_data($value->patient_name);
//$query[$key]->doctor_name = decrypt_data($value->doctor_name);
}
return $query;
}else{
......@@ -2005,13 +1935,10 @@ class Webservice_model extends CI_Model {
function get_dependent_list_users($auth){
$this->db->select('userid');
$rslt = $this->db->get_where('tbl_authtoken',array('authtoken'=>$auth))->row();
//echo $this->db->last_query();
//print_r($rslt);
if($rslt){
$this->db->select('dependent_name,id as dependent_id,image as dependent_image,dob as age,relation as dependent_relation');
$res = $this->db->get_where('tbl_patient_dependent',array('patient_id'=>$rslt->userid))->result();
$res = array("status"=>"success","data"=>$res);
//echo $this->db->last_query();exit();
}else{
$res = array("status"=>"failed","msg" =>"Invalid Auth token");
}
......@@ -2029,10 +1956,8 @@ class Webservice_model extends CI_Model {
$this->db->join("tbl_clinic","tbl_clinic.id = tbl_booking.clinic_id");
$this->db->join("tbl_specialization","tbl_specialization.id = tbl_doctors. specialization");
$this->db->where("tbl_booking.id",$id);
//$this->db->where("tbl_booking.date >= '".$date."'");
$result = $this->db->get()->row();
//$result[$key]->consultation_fee = decrypt_data($value->consultation_fee);
$this->db->where('doctor_id',$result->doctor_id);
$this->db->where('clinic_id',$result->clinic_id);
$clinic_details = $this->db->get('tbl_consultation')->row();
......@@ -2058,15 +1983,12 @@ class Webservice_model extends CI_Model {
$actual = ($result->consultation_fee * $fee->ipok_fee)/100 ;
$result->tax = $actual;
$result->cancellation_policy = strip_tags($cancel_rslt->cancelation_policy);
// $result->cancellation_policy = preg_replace("/&nbsp;|\r\n/",'',$result->cancellation_policy);
//$result->cancellation_policy = preg_replace("/&nbsp;|\r\n/",'',$result->cancellation_policy);
//$result->cancellation_policy = preg_replace('/&#39;/',"'",$result->cancellation_policy);
//print_r($clinic_details);exit();
$days = json_decode($clinic_details->date);
//echo"<pre>"; print_r($days); echo"</pre>";
if($days != ''){
$doctr_days = array();
foreach ($days as $key => $value) {
//print_r($value->time->start);exit();
$doctr_days[$key] = $value->day.' :'. $value->time->start .'-'. $value->time->end ;
}
$doctorday = implode(', ',$doctr_days);
......@@ -2126,13 +2048,11 @@ class Webservice_model extends CI_Model {
public function get_promocode_list(){
$now = strtotime(date('Y-m-d 0:0:0'));
//print_r($now); exit();
$this->db->select('id,promo_name as title,valid_to as date,description,image');
$this->db->where('valid_from <=',$now);
$this->db->where('valid_to >=',$now);
$this->db->where('status','1');
$query = $this->db->get('tbl_promocode')->result();
//echo $this->db->last_query();exit();
if(count($query) > 0){
$res = array("status"=>"success","data"=>$query);
}else{
......@@ -2156,8 +2076,8 @@ class Webservice_model extends CI_Model {
/*$offset=5.5*60*60; //converting 5 hours to seconds.
$dateFormat="Y-m-d h:i:sA";
$now_date=gmdate($dateFormat, time()+$offset);
$now = strtotime($now_date);*/
//$canceltime = $data['offset']/(1000);
$now = strtotime($now_date);
$canceltime = $data['offset']/(1000);*/
$new_time = date('H:i',$data['offset']);
$new_time = explode(':',$new_time);
$nowin_server = date("Y-m-d TH:i:s");
......@@ -2268,7 +2188,6 @@ class Webservice_model extends CI_Model {
$this->db->where('tbl_doctors.id',$value);
$res = $this->db->get()->result();
foreach ($res as $key => $values) {
//$res[$key]->fee = decrypt_data($values->fee);
$new_array[] = $values;
}
$result = array("status"=>"success","data"=>$new_array);
......@@ -2333,7 +2252,6 @@ class Webservice_model extends CI_Model {
//......................insert app feedback
public function insert_app_feedback($data){
//print_r($data);exit();
if($this->db->insert('tbl_app_feedback',$data)){
$res = array('status'=>'success');
}else{
......@@ -2392,7 +2310,6 @@ class Webservice_model extends CI_Model {
$this->db->select('tbl_clinic.name as clinic_name,tbl_clinic.id as clinic_id,tbl_charity_service.amount,tbl_clinic.profile_photo as clinic_photo');
$this->db->join('tbl_clinic','tbl_clinic.id = tbl_charity_service.clinic_id');
$query = $this->db->get_where('tbl_charity_service',array('tbl_charity_service.charity_id'=>$id))->result();
//print_r($query);exit();
if(count($query) > 0){
foreach ($query as $key => $value) {
$amount = explode(',',$value->amount);
......@@ -2450,7 +2367,6 @@ class Webservice_model extends CI_Model {
// ........................add save card
public function save_card($data){
//print_r($data);exit();
if($this->db->insert('tbl_card_details',$data)){
$res = $res = array('status'=>'success');
}else{
......@@ -2506,9 +2422,7 @@ class Webservice_model extends CI_Model {
$this->db->join('tbl_registration','tbl_registration.id = tbl_booking.patient_id');
$this->db->where('tbl_booking.id',$id);
$result = $this->db->get('tbl_booking')->row_array();
//echo"<pre>";print_r($result);echo"</pre>";
if($result){
//$result['consultation_fee'] = decrypt_data($result['consultation_fee']);
$fee = $this->db->get('settings')->row();
if(isset($result['patient_review'])){
$result['review'] = decrypt_data($result['patient_review']);
......@@ -2543,7 +2457,6 @@ class Webservice_model extends CI_Model {
}
$ill = json_decode(decrypt_data($result['diseases']));
// print_r($ill);echo"<br>";
if($ill == ''){
$new = [];
}else{
......@@ -2552,7 +2465,6 @@ class Webservice_model extends CI_Model {
$i=0;
foreach ($ill->anamnese as $key => $value) {
if($key != 'others'){
//print_r($key); echo" - "; print_r($value);echo"<br>";
$new[$i]['name'] = $key;
$new[$i]['cause'] = $value;
}else{
......@@ -2561,7 +2473,6 @@ class Webservice_model extends CI_Model {
}
$i++;
}
//print_r($news);echo"<br>";exit();
$result['illness'] = $new;
if($news['cause'] != ''){
......@@ -2611,7 +2522,6 @@ class Webservice_model extends CI_Model {
$result['services'] = $bud;
}
unset($result['budget']);
//echo"<pre>";print_r(json_decode($result['images']));echo "</pre>";exit();
$images = json_decode($result['images']);
if($images == ''){
......@@ -2621,8 +2531,7 @@ class Webservice_model extends CI_Model {
}
unset($result['images']);
unset($result['booking_id']);
// unset($result['id']);
//echo "<pre>";print_r($result);echo"</pre>";exit();
$res = array('status'=>'success','data'=>$result);
}
}else{
......@@ -2693,7 +2602,6 @@ class Webservice_model extends CI_Model {
//....................configure consultation by doctor
public function configure_consultation($data,$doctor_id){
//print_r($data);exit();
$doc_query = $this->db->get_where('tbl_doctors',array('id'=>$doctor_id));
if($data['is_home_consultation_available']){
......@@ -2713,7 +2621,7 @@ class Webservice_model extends CI_Model {
}else{
$data['timeperiod'] = 0;
}
//echo "<pre>";print_r($data);exit();
if($doc_query->num_rows() > 0){
$this->db->update('tbl_doctors',array('consultation_duration'=>$data['consultation_duration'],'price'=>$data['consultation_fee'],' domiciliary_status'=>$data['home_consultation_available'],'accept_return'=>$data['return_consultation_available'],'return_timeperiod'=>$data['timeperiod']),array('id'=>$doctor_id));
$res = $this->db->get_where("tbl_doctors",array("id"=>$doctor_id))->row_array();
......@@ -2728,9 +2636,8 @@ class Webservice_model extends CI_Model {
}else{
$res['domiciliary_status'] = false;
}
//echo $this->db->last_query();exit();
$return_array = array('status'=>'success','data'=>array('doctor_id'=>$doctor_id,'is_return_consultation_available'=>$res['accept_return'],'is_home_consultation_available'=>$res['domiciliary_status'],'consultation_price'=>$res['price'],'consultation_duration'=>$res['consultation_duration'],'return_consultation_time_period'=>$res['return_timeperiod']));
//print_r($return_array);exit();
}else{
$return_array = array('status'=>'failed','message'=>'Doctor Id Doesnot Exist');
......@@ -2751,7 +2658,6 @@ class Webservice_model extends CI_Model {
public function get_doctor_agenda($clinic_id,$doctor_id){
$query = $this->db->get_where('tbl_consultation',array('clinic_id'=>$clinic_id,'doctor_id'=>$doctor_id))->row();
//echo $this->db->last_query();
if($query){
$doc_res = $this->db->get_where('tbl_doctors',array('id'=>$doctor_id))->row();
......@@ -2766,7 +2672,6 @@ class Webservice_model extends CI_Model {
$primary[$key]['break_start_time'] = strtotime($this->string->default_date.$value->time->break_from);
$primary[$key]['break_end_time'] = strtotime($this->string->default_date.$value->time->break_to);
}
//echo"<pre>";print_r($primary);echo"</pre>";exit();
}else{
$primary = [];
}
......@@ -2781,7 +2686,6 @@ class Webservice_model extends CI_Model {
$secondary[$key]['break_start_time'] = strtotime($this->string->default_date.$value->time->break_from);
$secondary[$key]['break_end_time'] = strtotime($this->string->default_date.$value->time->break_to);
}
//echo"<pre>";print_r($secondary);echo"</pre>";exit();
}else{
$secondary = [];
}
......@@ -2794,7 +2698,6 @@ class Webservice_model extends CI_Model {
$vacation[$key]['start_time'] = $value->start_date;
$vacation[$key]['end_time'] = $value->end_date;
}
//echo"<pre>";print_r($vacation);echo"</pre>";exit();
if(decrypt_data($doc_res->domiciliary_status) == '1'){
$home_status = true;
}else{
......@@ -2846,7 +2749,6 @@ class Webservice_model extends CI_Model {
$decode_time = json_decode($value['date_secondary'],true);
}
//echo"<pre>";print_r($decode_time);echo"</pre>";exit();
if(!empty($decode_time)){
$valueday = $this->get_dayname($value_day->id);
foreach($decode_time as $db_k => $db_v) {
......@@ -2857,7 +2759,6 @@ class Webservice_model extends CI_Model {
$flag = 1;
$get_fullname_day = $this->get_fulldayname($valueday);
$nameday[] = $get_fullname_day;
//print_r($nameday);exit();
}
}
}
......@@ -2892,7 +2793,6 @@ class Webservice_model extends CI_Model {
));
array_push($insert_array_exist,$res);
}
//print_r($insert_array_exist);exit();
$newData = json_encode($insert_array_exist);
if($type == '0'){
$this->db->update('tbl_consultation',array('date'=>$newData,'active_schedule'=>$data['activated_schedule']),array('doctor_id'=>$doctor_id,'clinic_id'=>$data['clinic_id']));
......@@ -2910,7 +2810,6 @@ class Webservice_model extends CI_Model {
}else{
$return_array = array('status'=>'failed','message'=>'Doctor Id doesnot exist');
}
//print_r($return_array);exit();
return $return_array;
}
......@@ -2960,7 +2859,6 @@ class Webservice_model extends CI_Model {
}
$new_query = array_merge($query_default,$query);
//echo"<pre>";print_r($new_query);exit();
if(count($new_query) > 0){
foreach ($new_query as $key => $value) {
$location = $value['street_address'].','.$value['locality'].','.$value['number'].','.$value['complement'];
......@@ -3019,12 +2917,7 @@ class Webservice_model extends CI_Model {
}*/
if(count($result) > 0){
foreach ($result as $key => $value) {
// //$dob=date('Y-m-d',$value->dob);
// $diff = (date('Y') - date('Y',decrypt_data($value->dob)));
// //$value->age = $diff;
// $result[$key]->age = $diff;
$result[$key]->name = decrypt_data($value->name);
// $result[$key]->dob = decrypt_data($value->dob);
}
return $result;
}else{
......@@ -3086,7 +2979,7 @@ class Webservice_model extends CI_Model {
$new[$key]['time_start'] = $value->time_start;
}
//echo"<pre>";print_r($query);echo"</pre>";exit();
if(count($query) > 0){
$return_array = array('status'=>'success','data'=>array('patient_id'=>$pat_details->id,'patient_name'=>decrypt_data($pat_details->name),'patient_profile_photo'=>$pat_details->profile_photo,'patient_age'=>$diff),'medical'=>$new);
......@@ -3119,7 +3012,6 @@ class Webservice_model extends CI_Model {
}
$this->db->order_by('tbl_booking.date','ASC');
$reslt = $this->db->get()->result();
//echo $this->db->last_query();exit();
if(count($reslt) > 0){
foreach ($reslt as $key => $value) {
$reslt[$key]->patient_name = decrypt_data($value->patient_name);
......@@ -3144,7 +3036,7 @@ class Webservice_model extends CI_Model {
$this->db->where('id',$data['medical_record_id']);
$res = $this->db->get('tbl_medical_records')->row();
//echo "<pre>";print_r($res);echo"</pre>";exit();
if($res){
$diff = (date('Y') - date('Y',$result->dob));
$result->patient_age = $diff;
......@@ -3174,7 +3066,7 @@ class Webservice_model extends CI_Model {
$anamnese = array();
$anamse_details = json_decode(decrypt_data($res->diseases));
//echo"<pre>";print_r($anamse_details);echo"</pre><br>";exit();
if(isset($anamse_details)){
foreach ($anamse_details->anamnese as $key => $value) {
$ke = strtolower($key);
......@@ -3217,11 +3109,11 @@ class Webservice_model extends CI_Model {
$prescrib = json_decode(decrypt_data($res->prescribtions));
$med = array();
//print_r($prescrib);echo"<br>";
if(isset($prescrib)){
foreach ($prescrib as $key => $value) {
$med_data = $this->db->get_where('tbl_medicine',array('medicine_name'=>$value->name,'medicine_dosage'=>$value->quantity))->row();
//print_r($med_data);
$med[$key]['id'] = $med_data->id;
$med[$key]['medicine_name'] = $value->name;
$med[$key]['dosage'] = $value->procedure;
......@@ -3279,7 +3171,7 @@ class Webservice_model extends CI_Model {
$result->attached_images = [];
}
$result->other_observations = strip_tags(decrypt_data($res->other_observations));
//echo "<pre>";print_r($result);echo"</pre>";exit();
$return_array = array('status'=>'success','data'=>$result);
}else{
......@@ -3290,15 +3182,12 @@ class Webservice_model extends CI_Model {
public function get_doctor_notification_list($doctorid,$start,$per_page){
//$this->db->select('id,type,message,read_status');
//SELECT IIF(Obsolete = 'N' or InStock = 'Y', 1, 0) as Saleable, * FROM Product
$this->db->select("read_status,id,type,message");
$this->db->order_by('tbl_doctor_notifications.id','DESC');
if($start!=0 || $per_page!=0){
$this->db->limit($per_page,$start);
}
$result = $this->db->get_where('tbl_doctor_notifications',array('doctor_id'=>$doctorid))->result();
// echo $this->db->last_query();
if(count($result) > 0){
return $result;
}else{
......@@ -3371,8 +3260,6 @@ class Webservice_model extends CI_Model {
$this->db->select('consultation_duration,price as consultation_price,domiciliary_status,accept_return,return_timeperiod as return_consultation_time_period');
$query = $this->db->get_where('tbl_doctors',array('id'=>$doctor_id))->row();
if($query){
//$query->consultation_price = decrypt_data($query->consultation_price);
//$query->domiciliary_status = decrypt_data($query->domiciliary_status);
if($query->accept_return == '0'){
$query->is_return_consultation_available = false;
}else{
......@@ -3436,8 +3323,6 @@ class Webservice_model extends CI_Model {
foreach ($med as $key => $values) {
$med_array[] = $values->medicine_name;
}
//print_r($med_array);exit();
}
if($value->id == '1'){
if(count($res)>0){
......@@ -3497,7 +3382,7 @@ class Webservice_model extends CI_Model {
$this->db->select("CAST(AES_DECRYPT(observation,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as observation");
$this->db->where("CAST(AES_DECRYPT(exam_procedure,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) = '$value->exam_procedure'");
$proc = $this->db->get('tbl_exams')->result();
//echo $this->db->last_query();exit();
$new['exams'][$key]['name'] = $value->exam_procedure;
foreach ($proc as $key1 => $value1) {
$new['exams'][$key]['observations'][] =$value1->observation;
......@@ -3995,7 +3880,7 @@ class Webservice_model extends CI_Model {
unset($res->locality);
unset($res->number);
unset($res->complement);
//print_r($res);exit();
if(isset($res->telephone) && (($res->telephone != '') || $res->telephone != null)){
$new[0] = decrypt_data($res->telephone);
$res->phone =$new;
......@@ -4091,8 +3976,8 @@ class Webservice_model extends CI_Model {
$this->db->where('tbl_booking.id',$id);
$this->db->where('tbl_booking.payment_status','0');
$this->db->where('tbl_booking.booking_status!=4');
$data =$this->db->get()->row_array();
//print_r($data);die();
$data =$this->db->get()->row_array();
return $data;
}
......@@ -4140,7 +4025,6 @@ class Webservice_model extends CI_Model {
$data =$this->db->get()->row_array();
$data['dr_bio'] = decrypt_data($data['dr_bio']);
//$data['dr_price'] = decrypt_data($data['dr_price']);
$data['dr_gender'] = decrypt_data($data['dr_gender']);
$data['dr_neighbourhood'] = decrypt_data($data['dr_neighbourhood']);
$data['dr_rua'] = decrypt_data($data['dr_rua']);
......@@ -4149,6 +4033,12 @@ class Webservice_model extends CI_Model {
$data['dr_rg'] = decrypt_data($data['dr_rg']);
$data['dr_crm'] = decrypt_data($data['dr_crm']);
$data['dr_cep'] = decrypt_data($data['dr_cep']);
if(isset($data['dr_telephone']) && $data['dr_telephone'] != ''){
$data['dr_telephone'] = decrypt_data($data['dr_telephone']);
}else{
$data['dr_telephone'] = '';
}
return $data;
}
......@@ -4160,7 +4050,6 @@ class Webservice_model extends CI_Model {
$query = $this->db->get()->row_array();
$query['about'] = decrypt_data($query['about']);
//$query['price'] = decrypt_data($query['price']);
$query['gender'] = decrypt_data($query['gender']);
$query['street_address'] = decrypt_data($query['street_address']);
$query['locality'] = decrypt_data($query['locality']);
......@@ -4169,7 +4058,11 @@ class Webservice_model extends CI_Model {
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['cep'] = decrypt_data($query['cep']);
//$query['domiciliary_status'] = decrypt_data($query['domiciliary_status']);
if(isset($data['telephone']) && $data['telephone'] != ''){
$data['telephone'] = decrypt_data($data['telephone']);
}else{
$data['telephone'] = '';
}
return $query;
}
......@@ -4340,14 +4233,9 @@ class Webservice_model extends CI_Model {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_close($ch);
$out = curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
//print_r($response);
curl_close($ch);
......
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