Commit a1e52b2a by Dixon Joseph

Merge branch 'jansa' into dixon

parents 78604019 70bf47d1
...@@ -41,9 +41,18 @@ class Webservice extends CI_Controller { ...@@ -41,9 +41,18 @@ class Webservice extends CI_Controller {
{ {
if(isset($data['cpf'])){ if(isset($data['cpf'])){
$ress = $this->cpf_valid($data['cpf']); $ress = $this->cpf_valid($data['cpf']);
if((isset($ress)) && ($ress == 1)){ if((isset($ress)) && ($ress == 1)){
$res = $this->registration_processing_user($data,$type); /*$is_cpf = $this->Webservice_model->is_cpf_exist($data['cpf']);
if($is_cpf['status'] == 'success'){*/
$res = $this->registration_processing_user($data,$type);
/*}else{
$res = array(
"status"=> "error",
"error"=> "CPF Exist",
"message"=> "CPF Already Exist"
);
}*/
}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
...@@ -1098,7 +1107,7 @@ class Webservice extends CI_Controller { ...@@ -1098,7 +1107,7 @@ class Webservice extends CI_Controller {
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -1143,7 +1152,7 @@ class Webservice extends CI_Controller { ...@@ -1143,7 +1152,7 @@ class Webservice extends CI_Controller {
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -1155,7 +1164,7 @@ class Webservice extends CI_Controller { ...@@ -1155,7 +1164,7 @@ class Webservice extends CI_Controller {
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -2652,7 +2661,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -2652,7 +2661,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -2688,7 +2697,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -2688,7 +2697,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -2698,7 +2707,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -2698,7 +2707,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('faq_list'=>[]), "data"=>array('faq_list'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -3024,7 +3033,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3024,7 +3033,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -3048,9 +3057,9 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3048,9 +3057,9 @@ print_r(date('H:i',$ms));exit();*/
$totalPages = (int)($total / $per_page); $totalPages = (int)($total / $per_page);
} }
else{ else{
$totalPages = 1; $totalPages = 0;
} }
if($result != ''){ if($result != false){
foreach (array_slice($result,$start,$per_page) as $key => $value) { foreach (array_slice($result,$start,$per_page) as $key => $value) {
array_push($notiArray, $value); array_push($notiArray, $value);
...@@ -3067,7 +3076,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3067,7 +3076,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -3077,7 +3086,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3077,7 +3086,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('unread_count'=>$total_count,'notification_list'=>[]), "data"=>array('unread_count'=>$total_count,'notification_list'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -3115,7 +3124,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3115,7 +3124,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -3147,7 +3156,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3147,7 +3156,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -3157,7 +3166,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -3157,7 +3166,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('recent_chats'=>[]), "data"=>array('recent_chats'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4253,7 +4262,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4253,7 +4262,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4290,7 +4299,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4290,7 +4299,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -4300,7 +4309,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4300,7 +4309,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('reviews'=>[]), "data"=>array('reviews'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4337,7 +4346,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4337,7 +4346,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4372,7 +4381,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4372,7 +4381,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' =>$per_page) 'per_page' =>$per_page)
); );
...@@ -4382,7 +4391,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4382,7 +4391,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('faq_list'=>[]), "data"=>array('faq_list'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' =>$currentpage+1,
'per_page' =>$per_page) 'per_page' =>$per_page)
); );
} }
...@@ -4420,7 +4429,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4420,7 +4429,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4454,7 +4463,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4454,7 +4463,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -4464,7 +4473,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4464,7 +4473,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('patients'=>[]), "data"=>array('patients'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4502,7 +4511,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4502,7 +4511,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4535,7 +4544,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4535,7 +4544,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -4545,7 +4554,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4545,7 +4554,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('anniversaries'=>[]), "data"=>array('anniversaries'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4772,7 +4781,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4772,7 +4781,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4807,7 +4816,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4807,7 +4816,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>$result['data'], 'data'=>$result['data'],
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
...@@ -4816,7 +4825,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4816,7 +4825,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>$result['data'], 'data'=>$result['data'],
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4861,7 +4870,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4861,7 +4870,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4894,7 +4903,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4894,7 +4903,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>$result['data'], 'data'=>$result['data'],
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
...@@ -4903,7 +4912,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4903,7 +4912,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>array('consultations'=>[]), 'data'=>array('consultations'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -4940,7 +4949,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4940,7 +4949,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -4975,7 +4984,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4975,7 +4984,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>$result['data'], 'data'=>$result['data'],
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
...@@ -4984,7 +4993,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -4984,7 +4993,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>array('consultations'=>[]), 'data'=>array('consultations'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -5021,7 +5030,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5021,7 +5030,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -5054,7 +5063,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5054,7 +5063,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>$result['data'], 'data'=>$result['data'],
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
...@@ -5063,7 +5072,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5063,7 +5072,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>array('consultations'=>[]), 'data'=>array('consultations'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -5146,7 +5155,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5146,7 +5155,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -5185,7 +5194,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5185,7 +5194,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>array('unread_count'=>$total_count,'notifications'=>$notifArray), 'data'=>array('unread_count'=>$total_count,'notifications'=>$notifArray),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
...@@ -5194,7 +5203,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5194,7 +5203,7 @@ print_r(date('H:i',$ms));exit();*/
'data'=>array('unread_count'=>$total_count,'notifications'=>[]), 'data'=>array('unread_count'=>$total_count,'notifications'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' =>$page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -5408,7 +5417,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5408,7 +5417,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -5444,7 +5453,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5444,7 +5453,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -5454,7 +5463,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5454,7 +5463,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('recent_chats'=>[]), "data"=>array('recent_chats'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -6115,7 +6124,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6115,7 +6124,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -6150,7 +6159,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6150,7 +6159,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -6160,7 +6169,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6160,7 +6169,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('consultation'=>[]), "data"=>array('consultation'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -6198,7 +6207,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6198,7 +6207,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -6233,7 +6242,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6233,7 +6242,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -6243,7 +6252,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6243,7 +6252,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('consultation'=>[]), "data"=>array('consultation'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -6425,7 +6434,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6425,7 +6434,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -6459,7 +6468,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6459,7 +6468,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -6469,7 +6478,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6469,7 +6478,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('banks'=>[]), "data"=>array('banks'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -6507,7 +6516,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6507,7 +6516,7 @@ print_r(date('H:i',$ms));exit();*/
$page_no = $_GET['page']; $page_no = $_GET['page'];
} }
else{ else{
$currentpage = 1; $currentpage = 0;
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
...@@ -6541,7 +6550,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6541,7 +6550,7 @@ print_r(date('H:i',$ms));exit();*/
), ),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
...@@ -6551,7 +6560,7 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6551,7 +6560,7 @@ print_r(date('H:i',$ms));exit();*/
"data"=>array('withdrawal_history'=>[]), "data"=>array('withdrawal_history'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total, 'total' => $total,
'current_page' => $page_no, 'current_page' => $currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
} }
...@@ -6853,171 +6862,178 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -6853,171 +6862,178 @@ print_r(date('H:i',$ms));exit();*/
if (isset($data['month']) && strlen($data['month']) && isset($data['year']) && strlen($data['year']) && isset($data['first_name']) && strlen($data['first_name']) && isset($data['last_name']) && strlen($data['last_name']) && isset($data['card_number']) && strlen($data['card_number']) && isset($data['cvv']) && strlen($data['cvv']) && isset($data['booking_id']) && strlen($data['booking_id'])) { if (isset($data['month']) && strlen($data['month']) && isset($data['year']) && strlen($data['year']) && isset($data['first_name']) && strlen($data['first_name']) && isset($data['last_name']) && strlen($data['last_name']) && isset($data['card_number']) && strlen($data['card_number']) && isset($data['cvv']) && strlen($data['cvv']) && isset($data['booking_id']) && strlen($data['booking_id'])) {
$authtoken = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']); $authtoken = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']);
$data['user_id'] = $authtoken->userid; $data['user_id'] = $authtoken->userid;
$get_booked_payed_data = $this->Webservice_model->get_booked_payed_data($data['booking_id']); $payed_data = $this->Webservice_model->get_booked_payed_data($data['booking_id']);
$check_markbooking = $this->Webservice_model->checkBooking($data['booking_id']); if($payed_data['status'] == 'success' && ($payed_data['is_result'] == '0' || $payed_data['is_result'] == '1')){
$booking_details = $this->Webservice_model->get_booking_details($data['booking_id']); $check_markbooking = $this->Webservice_model->checkBooking($data['booking_id']);
$patient_data = $this->Webservice_model->get_single_patient($booking_details['patient_id']); $booking_details = $this->Webservice_model->get_booking_details($data['booking_id']);
$doctor_data = $this->Webservice_model->get_single_doctor($booking_details['doctor_id']); $patient_data = $this->Webservice_model->get_single_patient($booking_details['patient_id']);
$doctor_data = $this->Webservice_model->get_single_doctor($booking_details['doctor_id']);
$time = $data['offset']; $time = $data['offset'];
$new_time = date('H:i', $time); $new_time = date('H:i', $time);
$new_time = explode(':', $new_time); $new_time = explode(':', $new_time);
$nowin_server = date("Y-m-d TH:i:s"); $nowin_server = date("Y-m-d TH:i:s");
if ($data['offset'] > 0) { if ($data['offset'] > 0) {
$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)));
} 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)));
} }
$payment_token = array('account_id' => $this->config->item('id'), 'method' => 'credit_card', 'test' => true, ); $payment_token = array('account_id' => $this->config->item('id'), 'method' => 'credit_card', 'test' => true, );
$payment_token['data'] = array('number' => $data['card_number'], 'verification_value' => $data['cvv'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'month' => $data['month'], 'year' => $data['year']); $payment_token['data'] = array('number' => $data['card_number'], 'verification_value' => $data['cvv'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'month' => $data['month'], 'year' => $data['year']);
$request = load_curl('https://api.iugu.com/v1/payment_token', $payment_token); $request = load_curl('https://api.iugu.com/v1/payment_token', $payment_token);
$token = json_decode($request); $token = json_decode($request);
if ($check_markbooking['count'] != 1) { if ($check_markbooking['count'] != 1) {
$res = array('status' => 'fail', 'payment_status' => '0', 'message' => 'No Booking Found'); $res = array('status' => 'fail', 'payment_status' => '0', 'message' => 'No Booking Found');
} }
elseif(!empty($token->errors->number)) { elseif(!empty($token->errors->number)) {
$res = array('status' => 'fail', 'payment_status' => '0', 'message' => 'Invalid Card Provided'); $res = array('status' => 'fail', 'payment_status' => '0', 'message' => 'Invalid Card Provided');
}
else {
if (empty($patient_data['pt_customer_id'])) {
$create_customer = array('email' => $patient_data['pt_email'], 'name' => $patient_data['pt_name'], 'cpf_cnpj' => $patient_data['pt_cpf'], 'zip_code' => $patient_data['pt_zip_code'], 'street' => $patient_data['pt_street_add'], 'number' => $patient_data['pt_number'], 'complement' => $patient_data['pt_complement']);
$request = load_curl('https://api.iugu.com/v1/customers', $create_customer);
$customer = json_decode($request);
$this->Webservice_model->update_profile($patient_data['patientid'], array('customer_id' => $customer->id));
$patient_data['pt_customer_id'] = $customer->id;
} }
else {
if (empty($patient_data['pt_customer_id'])) {
$create_customer = array('email' => $patient_data['pt_email'], 'name' => $patient_data['pt_name'], 'cpf_cnpj' => $patient_data['pt_cpf'], 'zip_code' => $patient_data['pt_zip_code'], 'street' => $patient_data['pt_street_add'], 'number' => $patient_data['pt_number'], 'complement' => $patient_data['pt_complement']);
$request = load_curl('https://api.iugu.com/v1/customers', $create_customer);
$customer = json_decode($request);
$this->Webservice_model->update_profile($patient_data['patientid'], array('customer_id' => $customer->id));
$patient_data['pt_customer_id'] = $customer->id;
}
$create_payment_method = array('description' => 'Booking Payment', 'token' => $token->id); $create_payment_method = array('description' => 'Booking Payment', 'token' => $token->id);
$request = load_curl('https://api.iugu.com/v1/customers/'.$patient_data['pt_customer_id'].'/payment_methods', $create_payment_method); $request = load_curl('https://api.iugu.com/v1/customers/'.$patient_data['pt_customer_id'].'/payment_methods', $create_payment_method);
$payment_method = json_decode($request); $payment_method = json_decode($request);
$create_charge = array('customer_payment_method_id' => $payment_method->id, 'customer_id' => $patient_data['pt_customer_id'], 'email' => $patient_data['pt_email']); $create_charge = array('customer_payment_method_id' => $payment_method->id, 'customer_id' => $patient_data['pt_customer_id'], 'email' => $patient_data['pt_email']);
$items = array('description' => 'Doctor Visit', 'price_cents' => $booking_details['total_sum'] * 100, 'quantity' => 1); $items = array('description' => 'Doctor Visit', 'price_cents' => $booking_details['total_sum'] * 100, 'quantity' => 1);
$create_charge['items'] = $items; $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'] = 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']); $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(); //print_r($create_charge);die();
$request = load_curl('https://api.iugu.com/v1/charge', $create_charge); $request = load_curl('https://api.iugu.com/v1/charge', $create_charge);
$charge = json_decode($request); $charge = json_decode($request);
if (isset($charge->success)and isset($charge->LR)and($charge->success == true)and($charge->LR == '00')) { if (isset($charge->success)and isset($charge->LR)and($charge->success == true)and($charge->LR == '00')) {
/*CODE FOR DOCTOR NOTIFICATION ON CONFIRMED CONSULTATION*/ /*CODE FOR DOCTOR NOTIFICATION ON CONFIRMED CONSULTATION*/
/*CODE FOR WALLET INSERTION*/ /*CODE FOR WALLET INSERTION*/
/*------------------------------------------------*/ /*------------------------------------------------*/
$wallet = $this->Webservice_model->get_wallet_for_doctor($booking_details['doctor_id']); $wallet = $this->Webservice_model->get_wallet_for_doctor($booking_details['doctor_id']);
if (empty($wallet)) { if (empty($wallet)) {
$wallet = array('reedem_earn' => 0, 'future_earn' => 0, 'total_earn' => 0); $wallet = array('reedem_earn' => 0, 'future_earn' => 0, 'total_earn' => 0);
} }
$earn = $booking_details['total_sum'] - (($booking_details['total_sum'] * $booking_details['ipok_fee']) / 100); $earn = $booking_details['total_sum'] - (($booking_details['total_sum'] * $booking_details['ipok_fee']) / 100);
$wallet['future_earn'] = $wallet['future_earn'] + $earn; $wallet['future_earn'] = $wallet['future_earn'] + $earn;
$wallet['total_earn'] = $wallet['total_earn'] + $earn; $wallet['total_earn'] = $wallet['total_earn'] + $earn;
$this->Webservice_model->update_wallet($booking_details['doctor_id'], $wallet); $this->Webservice_model->update_wallet($booking_details['doctor_id'], $wallet);
if ($booking_details['booking_status'] == 0) { if ($booking_details['booking_status'] == 0) {
/*------------------------------------------------*/ /*------------------------------------------------*/
/*CODE FOR SENTING WAITING LIST NOTIFICATION FOR PAID VISIT - PATIENT NOTIFICATION*/ /*CODE FOR SENTING WAITING LIST NOTIFICATION FOR PAID VISIT - PATIENT NOTIFICATION*/
$text_pat = 'Your appointment was scheduled in the system as waiting, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', doctor '.$doctor_data['dr_name']; $text_pat = 'Your appointment was scheduled in the system as waiting, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', doctor '.$doctor_data['dr_name'];
$notification_pat = array('patient_id' => $booking_details['patient_id'], 'type' => 0, 'message' => $text_pat, 'read_status' => 0, 'time' => strtotime($nowin_server), 'booking_id' => $_POST['booking_id']); $notification_pat = array('patient_id' => $booking_details['patient_id'], 'type' => 0, 'message' => $text_pat, 'read_status' => 0, 'time' => strtotime($nowin_server), 'booking_id' => $_POST['booking_id']);
$patient_insert_id = $this->Webservice_model->insert_notification_patient($notification_pat); $patient_insert_id = $this->Webservice_model->insert_notification_patient($notification_pat);
$fcm_user = $this->Webservice_model->get_patient_fcm($booking_details['patient_id']); $fcm_user = $this->Webservice_model->get_patient_fcm($booking_details['patient_id']);
if (!empty($fcm_user['fcm_token'])) { if (!empty($fcm_user['fcm_token'])) {
$pat_push_obj['id'] = $patient_insert_id; $pat_push_obj['id'] = $patient_insert_id;
$pat_push_obj['type'] = "Waiting List"; $pat_push_obj['type'] = "Waiting List";
$pat_push_obj['booking_id'] = $_POST['booking_id']; $pat_push_obj['booking_id'] = $_POST['booking_id'];
$pat_push_obj['booking_date'] = $booking_details['date']; $pat_push_obj['booking_date'] = $booking_details['date'];
$pat_push_obj['doctor_id'] = $booking_details['doctor_id']; $pat_push_obj['doctor_id'] = $booking_details['doctor_id'];
$pat_push_obj['doctor_name'] = $doctor_data['dr_name']; $pat_push_obj['doctor_name'] = $doctor_data['dr_name'];
$pat_push_obj['doctor_specialization'] = $doctor_data['dr_specialization']; $pat_push_obj['doctor_specialization'] = $doctor_data['dr_specialization'];
$pat_push_obj['message'] = $text_pat; $pat_push_obj['message'] = $text_pat;
$pat_push_obj['time'] = strtotime($nowin_server); $pat_push_obj['time'] = strtotime($nowin_server);
$pat_push_obj['to'] = $fcm_user['fcm_token']; $pat_push_obj['to'] = $fcm_user['fcm_token'];
$user_type = '1'; //patient push $user_type = '1'; //patient push
$push_status = $this->Webservice_model->push_sent($pat_push_obj, $user_type); $push_status = $this->Webservice_model->push_sent($pat_push_obj, $user_type);
} }
/*------------------------------------------------*/ /*------------------------------------------------*/
} else { } else {
/*CODE FOR SENTING NOTIFICATION - DOCTOR NOTIFICATION*/ /*CODE FOR SENTING NOTIFICATION - DOCTOR NOTIFICATION*/
/*------------------------------------------------*/ /*------------------------------------------------*/
$text = 'A new appointment was scheduled in the system, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', patient '.$patient_data['pt_name']; $text = 'A new appointment was scheduled in the system, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', patient '.$patient_data['pt_name'];
$notification = array('doctor_id' => $booking_details['doctor_id'], 'type' => 2, 'message' => $text, 'read_status' => 0, 'time' => strtotime($nowin_server)); $notification = array('doctor_id' => $booking_details['doctor_id'], 'type' => 2, 'message' => $text, 'read_status' => 0, 'time' => strtotime($nowin_server));
$doctor_insert_id = $this->Webservice_model->insert_notification_doctor($notification); $doctor_insert_id = $this->Webservice_model->insert_notification_doctor($notification);
$fcm_doctor = $this->Webservice_model->get_doctor_fcm($booking_details['doctor_id']); $fcm_doctor = $this->Webservice_model->get_doctor_fcm($booking_details['doctor_id']);
if (!empty($fcm_doctor['fcm_token'])) { if (!empty($fcm_doctor['fcm_token'])) {
$doc_push_obj['id'] = $doctor_insert_id; $doc_push_obj['id'] = $doctor_insert_id;
$doc_push_obj['type'] = "New Consultation"; $doc_push_obj['type'] = "New Consultation";
$doc_push_obj['message'] = $text; $doc_push_obj['message'] = $text;
$doc_push_obj['read_status'] = false; $doc_push_obj['read_status'] = false;
$doc_push_obj['to'] = $fcm_doctor['fcm_token']; $doc_push_obj['to'] = $fcm_doctor['fcm_token'];
$user_type = '2'; $user_type = '2';
$push_status = $this->Webservice_model->push_sent($doc_push_obj, $user_type); $push_status = $this->Webservice_model->push_sent($doc_push_obj, $user_type);
} }
/*------------------------------------------------*/ /*------------------------------------------------*/
/*CODE FOR SENTING NOTIFICATION - PATIENT NOTIFICATION*/ /*CODE FOR SENTING NOTIFICATION - PATIENT NOTIFICATION*/
/*------------------------------------------------*/ /*------------------------------------------------*/
$text_pat = 'Your appointment was scheduled in the system, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', doctor '.$doctor_data['dr_name']; $text_pat = 'Your appointment was scheduled in the system, on '.date('d.m.Y', $booking_details['time_start']).' at '.date('H:i a', $booking_details['time_start']).', doctor '.$doctor_data['dr_name'];
$notification_pat = array('patient_id' => $booking_details['patient_id'], 'type' => 0, 'message' => $text_pat, 'read_status' => 0, 'time' => strtotime($nowin_server), 'booking_id' => $data['booking_id']); $notification_pat = array('patient_id' => $booking_details['patient_id'], 'type' => 0, 'message' => $text_pat, 'read_status' => 0, 'time' => strtotime($nowin_server), 'booking_id' => $data['booking_id']);
$patient_insert_id = $this->Webservice_model->insert_notification_patient($notification_pat); $patient_insert_id = $this->Webservice_model->insert_notification_patient($notification_pat);
$fcm_user = $this->Webservice_model->get_patient_fcm($booking_details['patient_id']); $fcm_user = $this->Webservice_model->get_patient_fcm($booking_details['patient_id']);
if (!empty($fcm_user['fcm_token'])) { if (!empty($fcm_user['fcm_token'])) {
$pat_push_obj['id'] = $patient_insert_id; $pat_push_obj['id'] = $patient_insert_id;
$pat_push_obj['type'] = "Consultation Confirmation"; $pat_push_obj['type'] = "Consultation Confirmation";
$pat_push_obj['booking_id'] = $data['booking_id']; $pat_push_obj['booking_id'] = $data['booking_id'];
$pat_push_obj['booking_date'] = $booking_details['date']; $pat_push_obj['booking_date'] = $booking_details['date'];
$pat_push_obj['doctor_id'] = $booking_details['doctor_id']; $pat_push_obj['doctor_id'] = $booking_details['doctor_id'];
$pat_push_obj['doctor_name'] = $doctor_data['dr_name']; $pat_push_obj['doctor_name'] = $doctor_data['dr_name'];
$pat_push_obj['doctor_specialization'] = $doctor_data['dr_specialization']; $pat_push_obj['doctor_specialization'] = $doctor_data['dr_specialization'];
$pat_push_obj['message'] = $text_pat; $pat_push_obj['message'] = $text_pat;
$pat_push_obj['time'] = strtotime($nowin_server); $pat_push_obj['time'] = strtotime($nowin_server);
$pat_push_obj['to'] = $fcm_user['fcm_token']; $pat_push_obj['to'] = $fcm_user['fcm_token'];
$user_type = '1'; //patient push $user_type = '1'; //patient push
$push_status = $this->Webservice_model->push_sent($pat_push_obj, $user_type); $push_status = $this->Webservice_model->push_sent($pat_push_obj, $user_type);
}
/*------------------------------------------------*/
} }
/*------------------------------------------------*/ $result = $this->Webservice_model->set_payment_status($data['booking_id']);
}
$result = $this->Webservice_model->set_payment_status($data['booking_id']);
//$res = array('status' => 'success', 'payment_status' => '1', 'message' => 'payment success', 'booking_date' => date('d/m/Y', $check_markbooking['booking_date']), 'booking_slot' => $check_markbooking['booking_slot']); //$res = array('status' => 'success', 'payment_status' => '1', 'message' => 'payment success', 'booking_date' => date('d/m/Y', $check_markbooking['booking_date']), 'booking_slot' => $check_markbooking['booking_slot']);
$res = array('status' => 'success', 'data' =>array('booking_id'=>$data['booking_id'])); $res = array('status' => 'success', 'data' =>array('booking_id'=>$data['booking_id']));
} else { } else {
// $res = array('status' => 'fail', 'payment_status'=>'0','message'=>$charge->message); // $res = array('status' => 'fail', 'payment_status'=>'0','message'=>$charge->message);
$res = array('status' => 'error', 'payment_status' => '0', 'message' => $charge->errors); $res = array('status' => 'error', 'payment_status' => '0', 'message' => $charge->errors);
}
} }
}else{
$res = array(
"status" => "error",
"error" => "error",
"message" => $payed_data['message']);
} }
} else { } else {
$res = array( $res = array(
......
...@@ -78,6 +78,10 @@ class Webservice_model extends CI_Model { ...@@ -78,6 +78,10 @@ class Webservice_model extends CI_Model {
}else{ }else{
if($this->db->insert('tbl_doctors', $data)){ if($this->db->insert('tbl_doctors', $data)){
$insertid = $this->db->insert_id(); $insertid = $this->db->insert_id();
$this->db->insert('tbl_clinic_doctors',array('doctor_id'=>$insertid,'clinic_id'=> 0));
$this->db->insert('tbl_consultation',array('doctor_id'=>$insertid,'clinic_id'=> 0,'date'=>'""','date_secondary'=>'""','active_schedule'=> 0));
$this->db->select('tbl_specialization.id as specialization_id,tbl_specialization.specialization_name,tbl_doctors.*'); $this->db->select('tbl_specialization.id as specialization_id,tbl_specialization.specialization_name,tbl_doctors.*');
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization'); $this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization');
$query = $this->db->get_where("tbl_doctors",array("tbl_doctors.id"=>$insertid)); $query = $this->db->get_where("tbl_doctors",array("tbl_doctors.id"=>$insertid));
...@@ -1048,7 +1052,7 @@ class Webservice_model extends CI_Model { ...@@ -1048,7 +1052,7 @@ class Webservice_model extends CI_Model {
$end_time = strtotime($date_def.$times[1]); $end_time = strtotime($date_def.$times[1]);
$msg = "Your booking for doctor ".$doctr_data['name']." at time ".$data['time']." is confirmed"; $msg = "Your booking for doctor ".$doctr_data['name']." at time ".$data['time']." is confirmed";
$msg2 = "You have a new booking on ".date('jS F Y',$data['date'])." at ".date('h:i A',$start_time); $msg2 = "You have a new booking on ".date('jS F Y',$data['date'])." at ".date('h:i A',$start_time);
if($this->db->insert('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'patient_id'=>$patientid['userid'],'ipok_fee'=>$ipokefees,'date'=>$data['date'],'time'=>$data['time'],'booking_status'=>'1','payment_status'=>$payment_status,'free_visit_status'=>$free_visit_status,'visit_type'=>$visit,'amount'=>$data['amount'],'promo_name'=>$promo_name,'promo_amount'=>$new_amnt,'total_sum'=>$diff,'time_start'=>$start_time,'time_end'=>$end_time,'requested_date'=>time()))){ if($this->db->insert('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'patient_id'=>$patientid['userid'],'ipok_fee'=>$ipokefees,'date'=>$data['date'],'time'=>$data['time'],'booking_status'=>'1','payment_status'=>$payment_status,'free_visit_status'=>$free_visit_status,'visit_type'=>$visit,'amount'=>$data['amount'],'promo_name'=>$promo_name,'promo_amount'=>$new_amnt,'payment_type'=>$data['payment_mode'],'total_sum'=>$diff,'time_start'=>$start_time,'time_end'=>$end_time,'requested_date'=>time()))){
$insert_id = $this->db->insert_id(); $insert_id = $this->db->insert_id();
if($visit == '0'){ if($visit == '0'){
...@@ -1065,7 +1069,7 @@ class Webservice_model extends CI_Model { ...@@ -1065,7 +1069,7 @@ class Webservice_model extends CI_Model {
} }
} }
if(!$is_payment_required){ //if(!$is_payment_required){
$this->db->insert('tbl_patient_notification',array('patient_id'=>$patientid['userid'],'type'=>'0','message'=>$msg,'time'=>$conslt_time,'booking_id'=>$insert_id,'read_status'=>'0')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$patientid['userid'],'type'=>'0','message'=>$msg,'time'=>$conslt_time,'booking_id'=>$insert_id,'read_status'=>'0'));
$patient_insert_id = $this->db->insert_id(); $patient_insert_id = $this->db->insert_id();
...@@ -1093,7 +1097,7 @@ class Webservice_model extends CI_Model { ...@@ -1093,7 +1097,7 @@ class Webservice_model extends CI_Model {
$news['to'] = $fcm_doctor->fcm_token; $news['to'] = $fcm_doctor->fcm_token;
$doctor_type = '2'; $doctor_type = '2';
$doctor_push = $this->push_sent($news,$doctor_type); $doctor_push = $this->push_sent($news,$doctor_type);
} //}
$return_array = array('status'=>'success','data'=>array('booking_id'=>$insert_id,'is_waiting'=>false,'is_payment_required'=>$is_payment_required)); $return_array = array('status'=>'success','data'=>array('booking_id'=>$insert_id,'is_waiting'=>false,'is_payment_required'=>$is_payment_required));
} }
else{ else{
...@@ -1105,10 +1109,10 @@ class Webservice_model extends CI_Model { ...@@ -1105,10 +1109,10 @@ class Webservice_model extends CI_Model {
$times = explode('-', $data['time']); $times = explode('-', $data['time']);
$start_time = strtotime($date_def.$times[0]); $start_time = strtotime($date_def.$times[0]);
$end_time = strtotime($date_def.$times[1]); $end_time = strtotime($date_def.$times[1]);
$msg = "Your booking for doctor ".$doctr_data->name." at time ".$data['time']." is in Waiting list"; $msg = "Your booking for doctor ".$doctr_data['name']." at time ".$data['time']." is in Waiting list";
if($this->db->insert('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'patient_id'=>$patientid['userid'],'ipok_fee'=>$ipokefees,'date'=>$data['date'],'time'=>$data['time'],'booking_status'=>'0','payment_status'=>$payment_status,'free_visit_status'=>$free_visit_status,'visit_type'=>$visit,'amount'=>$data['amount'],'promo_name'=>$promo_name,'promo_amount'=>$new_amnt,'total_sum'=>$diff,'time_start'=>$start_time,'time_end'=>$end_time,'requested_date'=>time()))){ if($this->db->insert('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'patient_id'=>$patientid['userid'],'ipok_fee'=>$ipokefees,'date'=>$data['date'],'time'=>$data['time'],'booking_status'=>'0','payment_status'=>$payment_status,'free_visit_status'=>$free_visit_status,'visit_type'=>$visit,'amount'=>$data['amount'],'promo_name'=>$promo_name,'promo_amount'=>$new_amnt,'payment_type'=>$data['payment_mode'],'total_sum'=>$diff,'time_start'=>$start_time,'time_end'=>$end_time,'requested_date'=>time()))){
$insert_id = $this->db->insert_id(); $insert_id = $this->db->insert_id();
if(!$is_payment_required){ //if(!$is_payment_required){
$this->db->insert('tbl_patient_notification',array('patient_id'=>$patientid['userid'],'type'=>'1','message'=>$msg,'time'=>$conslt_time,'booking_id'=>$insert_id,'read_status'=>'0')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$patientid['userid'],'type'=>'1','message'=>$msg,'time'=>$conslt_time,'booking_id'=>$insert_id,'read_status'=>'0'));
$patient_insert_id = $this->db->insert_id(); $patient_insert_id = $this->db->insert_id();
...@@ -1125,7 +1129,7 @@ class Webservice_model extends CI_Model { ...@@ -1125,7 +1129,7 @@ class Webservice_model extends CI_Model {
$new['to'] =$fcm_user->fcm_token; $new['to'] =$fcm_user->fcm_token;
$user_type = '3'; $user_type = '3';
$user_push = $this->push_sent($new,$user_type); $user_push = $this->push_sent($new,$user_type);
} //}
$return_array = array('status'=>'failed','data' =>array('booking_id'=>$insert_id,'is_waiting'=>true,'is_payment_required'=>$is_payment_required)); $return_array = array('status'=>'failed','data' =>array('booking_id'=>$insert_id,'is_waiting'=>true,'is_payment_required'=>$is_payment_required));
} }
...@@ -1162,6 +1166,16 @@ class Webservice_model extends CI_Model { ...@@ -1162,6 +1166,16 @@ class Webservice_model extends CI_Model {
//............................ get clinic specialisation //............................ get clinic specialisation
function is_cpf_exist($cpf){
$res = $this->db->get_where('tbl_cpf_number',array('cpf'=>$cpf))->row();
if($res){
$query = array('status'=>'error');
}else{
$query = array('status'=>'success');
}
return $query;
}
function get_clinic_specialisation(){ function get_clinic_specialisation(){
$this->db->select("DISTINCT(tbl_specialization.specialization_name),tbl_clinic_specialization.clinic_id,tbl_specialization.id"); $this->db->select("DISTINCT(tbl_specialization.specialization_name),tbl_clinic_specialization.clinic_id,tbl_specialization.id");
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_clinic_specialization.specialization_id'); $this->db->join('tbl_specialization','tbl_specialization.id = tbl_clinic_specialization.specialization_id');
...@@ -2649,10 +2663,23 @@ class Webservice_model extends CI_Model { ...@@ -2649,10 +2663,23 @@ class Webservice_model extends CI_Model {
$this->db->select('tbl_clinic.id,tbl_clinic.name,tbl_clinic.email,tbl_clinic.profile_photo,tbl_clinic.location_lattitude,tbl_clinic.location_longitude,tbl_clinic.street_address,tbl_clinic.locality,tbl_clinic.number,tbl_clinic.complement'); $this->db->select('tbl_clinic.id,tbl_clinic.name,tbl_clinic.email,tbl_clinic.profile_photo,tbl_clinic.location_lattitude,tbl_clinic.location_longitude,tbl_clinic.street_address,tbl_clinic.locality,tbl_clinic.number,tbl_clinic.complement');
$this->db->join('tbl_clinic','tbl_clinic_doctors.clinic_id = tbl_clinic.id'); $this->db->join('tbl_clinic','tbl_clinic_doctors.clinic_id = tbl_clinic.id');
$this->db->where('tbl_clinic_doctors.doctor_id',$id); $this->db->where('tbl_clinic_doctors.doctor_id',$id);
$this->db->order_by('tbl_clinic.id','ASC');
$query = $this->db->get('tbl_clinic_doctors')->result(); $query = $this->db->get('tbl_clinic_doctors')->result();
array_splice($query, 0, 1);
if(count($query) > 0){ $this->db->select('tbl_clinic.id,tbl_clinic.name,tbl_clinic.email,tbl_clinic.profile_photo,tbl_doctors.default_latitude as location_lattitude,tbl_doctors.default_longitude as location_longitude,tbl_doctors.street_address,tbl_doctors.locality,tbl_doctors.number,tbl_doctors.complement');
foreach ($query as $key => $value) { $this->db->from('tbl_clinic_doctors');
$this->db->join('tbl_clinic','tbl_clinic_doctors.clinic_id = tbl_clinic.id');
$this->db->join('tbl_doctors','tbl_clinic_doctors.doctor_id = tbl_doctors.id');
$this->db->where('tbl_clinic_doctors.clinic_id','0');
$this->db->where('tbl_clinic_doctors.doctor_id',$id);
$query_default = $this->db->get()->result();
$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; $location = $value->street_address.','.$value->locality.','.$value->number.','.$value->complement;
$new[$key]['id'] = $value->id; $new[$key]['id'] = $value->id;
$new[$key]['name'] = $value->name; $new[$key]['name'] = $value->name;
...@@ -3865,22 +3892,28 @@ class Webservice_model extends CI_Model { ...@@ -3865,22 +3892,28 @@ class Webservice_model extends CI_Model {
$this->db->update('tbl_booking', $update); $this->db->update('tbl_booking', $update);
} }
// public function get_booked_payed_data($id){ public function get_booked_payed_data($id){
// $booked_data = $this->db->get_where('tbl_booking',array('id'=>$id))->row_array(); $booked_data = $this->db->get_where('tbl_booking',array('id'=>$id))->row_array();
// if($booked_data){ if($booked_data){
// $check = $this->db->get_where('tbl_booking',array('doctor_id'=>$booked_data['doctor_id'],'clinic_id'=>$booked_data['clinic_id'],'date'=>$booked_data['date'],'time'=>$booked_data['time'],'payment_status'=>'1')); $check = $this->db->get_where('tbl_booking',array('doctor_id'=>$booked_data['doctor_id'],'clinic_id'=>$booked_data['clinic_id'],'date'=>$booked_data['date'],'time'=>$booked_data['time'],'payment_status'=>'1'));
// if($check->num_rows() <= '0'){ if($check->num_rows() <= '0'){
// $is_result = 0; $is_result = 0;
// }else if($check->num_rows() == '1'){ $res = array('status'=>'success','is_result'=>$is_result);
// $is_result = 1; }else if($check->num_rows() == '1'){
// }else if($check->num_rows() >= '1'){ $is_result = 1;
// $is_result = 2; $this->db->update('tbl_booking',array('booking_status'=>'0'),array('id'=>$id));
// } $res = array('status'=>'success','is_result'=>$is_result);
}else if($check->num_rows() >= '1'){
// return $is_result; $is_result = 2;
$this->db->update('tbl_booking',array('booking_status'=>'4'),array('id'=>$id));
// } $res = array('status'=>'error','is_result'=>$is_result,'message'=>'
// } Selected Doctor Not Available');
}
}else{
$res = array('status'=>'error','message'=>'No Booking Found');
}
return $res;
}
/*function push_sent($fcm_data,$type) { /*function push_sent($fcm_data,$type) {
......
...@@ -983,6 +983,7 @@ class Home extends CI_Controller { ...@@ -983,6 +983,7 @@ class Home extends CI_Controller {
//print_r($data); //print_r($data);
<<<<<<< HEAD
$data['password'] = md5($data['password']); $data['password'] = md5($data['password']);
...@@ -990,6 +991,8 @@ class Home extends CI_Controller { ...@@ -990,6 +991,8 @@ class Home extends CI_Controller {
unset($data['month']); unset($data['month']);
unset($data['year']); unset($data['year']);
=======
>>>>>>> jansa
//$this->Doctor_model->assignDoctors_default($this->session->userdata('UserData')['id'],''); //$this->Doctor_model->assignDoctors_default($this->session->userdata('UserData')['id'],'');
$result = $this->Home_model->register_doctor($data); $result = $this->Home_model->register_doctor($data);
......
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