Commit e8a4b4d7 by Jansa Jose

search

parent 996f9652
......@@ -35,10 +35,17 @@ class Webservice_model extends CI_Model {
function registration($data,$type) {
$data['is_registration_completed'] = 1;
if($data['gender'] == 'male' || $data['gender'] == 'MALE'){
$data['gender'] = 0;
}else if($data['gender'] == 'female' || $data['gender'] == 'FEMALE'){
$data['gender'] = 1;
}else{
$data['gender'] = 2;
}
if($type == 'user'){
$data['name'] = encrypt_data($data['name']);
$data['rg'] = encrypt_data($data['rg']);
$data['gender'] = encrypt_data($data['gender']);
//$data['gender'] = encrypt_data($data['gender']);
$data['weight'] = encrypt_data($data['weight']);
$data['height'] = encrypt_data($data['height']);
$data['blood_group'] = encrypt_data($data['blood_group']);
......@@ -51,16 +58,19 @@ class Webservice_model extends CI_Model {
$insertid = $this->db->insert_id();
$this->db->query("update tbl_registration set dob = AES_ENCRYPT(".$data['dob'].",'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA')where id = ".$insertid);
$this->db->select("tbl_registration.*,CASE when gender='0' then 'MALE' when gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender");
$query = $this->db->get_where("tbl_registration",array("id"=>$insertid))->row_array();
$this->db->select("CAST(AES_DECRYPT(`dob`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dob");
$this->db->where('id',$insertid);
$query_date = $this->db->get('tbl_registration')->row();
unset($query['dob']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['dob'] = $query_date->dob;
$query['name'] = decrypt_data($query['name']);
$query['rg'] = decrypt_data($query['rg']);
$query['gender'] = decrypt_data($query['gender']);
//$query['gender'] = decrypt_data($query['gender']);
$query['weight'] = decrypt_data($query['weight']);
$query['height'] = decrypt_data($query['height']);
$query['blood_group'] = decrypt_data($query['blood_group']);
......@@ -76,7 +86,7 @@ class Webservice_model extends CI_Model {
}
}else{
$data['about'] = encrypt_data($data['about']);
$data['gender'] = encrypt_data($data['gender']);
//$data['gender'] = encrypt_data($data['gender']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['cep'] = encrypt_data($data['cep']);
......@@ -91,7 +101,7 @@ class Webservice_model extends CI_Model {
$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.*,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender");
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization');
$query = $this->db->get_where("tbl_doctors",array("tbl_doctors.id"=>$insertid));
......@@ -104,7 +114,8 @@ class Webservice_model extends CI_Model {
unset($query['dob']);
$query['dob'] = $query_date->dob;
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['cep'] = decrypt_data($query['cep']);
......@@ -277,7 +288,7 @@ class Webservice_model extends CI_Model {
$data['complement'] = encrypt_data($data['landmark']);
$data['about'] = encrypt_data($data['biodata']);
$data['specialization'] = $data['specialization_id'];
$data['gender'] = encrypt_data(strtoupper($data['gender']));
//$data['gender'] = encrypt_data(strtoupper($data['gender']));
$data['username'] = $data['uid'];
$data['is_registration_completed'] = 1;
$data['rg'] = encrypt_data($data['rg']);
......@@ -285,7 +296,13 @@ class Webservice_model extends CI_Model {
$data['street_address'] = encrypt_data($data['street_address']);
$data['locality'] = encrypt_data($data['locality']);
$data['number'] = encrypt_data($data['number']);
if($data['gender'] == 'male' || $data['gender'] == 'MALE'){
$data['gender'] = 0;
}else if($data['gender'] == 'female' || $data['gender'] == 'FEMALE'){
$data['gender'] = 1;
}else{
$data['gender'] = 2;
}
unset($data['zip_code']);
unset($data['landmark']);
unset($data['biodata']);
......@@ -296,7 +313,7 @@ class Webservice_model extends CI_Model {
$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->select("tbl_doctors.*,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender");
$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('tbl_doctors.id'=>$query->id))->row_array();
......@@ -310,7 +327,8 @@ class Webservice_model extends CI_Model {
$query['cep'] = decrypt_data($query['cep']);
$query['complement'] = decrypt_data($query['complement']);
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -330,7 +348,7 @@ class Webservice_model extends CI_Model {
$data['username'] = $data['uid'];
$data['name'] = encrypt_data($data['name']);
$data['rg'] = encrypt_data($data['rg']);
$data['gender'] = encrypt_data($data['gender']);
//$data['gender'] = encrypt_data($data['gender']);
$data['weight'] = encrypt_data($data['weight']);
$data['height'] = encrypt_data($data['height']);
$data['blood_group'] = encrypt_data($data['blood_group']);
......@@ -339,6 +357,13 @@ class Webservice_model extends CI_Model {
$data['locality'] = encrypt_data($data['locality']);
$data['number'] = encrypt_data($data['number']);
$data['landmark'] = encrypt_data($data['landmark']);
if($data['gender'] == 'male' || $data['gender'] == 'MALE'){
$data['gender'] = 0;
}else if($data['gender'] == 'female' || $data['gender'] == 'FEMALE'){
$data['gender'] = 1;
}else{
$data['gender'] = 2;
}
$new = array();
$type = 'user';
$data['is_registration_completed'] = 1;
......@@ -367,9 +392,13 @@ class Webservice_model extends CI_Model {
$this->db->where('id',$query->id);
$query_date = $this->db->get('tbl_registration')->row();
$this->db->select("tbl_registration.*,
CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender")
$rslt = $this->db->get_where('tbl_registration',array('uid'=>$data['uid']))->row_array();
unset($rslt['dob']);
$rslt['dob'] = $query_date->dob;
$rslt['gender'] = $rslt['pt_gender'];
unset($rslt['pt_gender']);
$result = array('status'=>'success','userdata'=>$rslt);
$ress = 'true';
}
......@@ -381,12 +410,13 @@ class Webservice_model extends CI_Model {
}
if($ress == 'true'){
$this->db->select("tbl_registration.*,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->select("tbl_registration.*,CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id');
$query = $this->db->get_where("tbl_registration",array('tbl_registration.id'=>$query->id))->row_array();
$query['name'] = decrypt_data($query['name']);
$query['rg'] = decrypt_data($query['rg']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['weight'] = decrypt_data($query['weight']);
$query['height'] = decrypt_data($query['height']);
$query['blood_group'] = decrypt_data($query['blood_group']);
......@@ -418,7 +448,8 @@ class Webservice_model extends CI_Model {
//....................user login
function login($data){
$this->db->select("tbl_registration.*,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->select("tbl_registration.*,
CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id', 'inner');
$querys = $this->db->get_where("tbl_registration",array("username"=>$data['username'],"password"=>md5($data['password'])));
$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id', 'inner');
......@@ -432,7 +463,8 @@ class Webservice_model extends CI_Model {
$query['name'] = decrypt_data($query['name']);
$query['rg'] = decrypt_data($query['rg']);
$query['dob'] = $querydate->dob_new;
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['weight'] = decrypt_data($query['weight']);
$query['height'] = decrypt_data($query['height']);
$query['blood_group'] = decrypt_data($query['blood_group']);
......@@ -452,7 +484,8 @@ class Webservice_model extends CI_Model {
$query_email['name'] = decrypt_data($query_email['name']);
$query_email['rg'] = decrypt_data($query_email['rg']);
$query_email['dob'] = $querydate->dob_new;
$query_email['gender'] = decrypt_data($query_email['gender']);
$query_email['gender'] = $query_email['pt_gender'];
unset($query['pt_gender']);
$query_email['weight'] = decrypt_data($query_email['weight']);
$query_email['height'] = decrypt_data($query_email['height']);
$query_email['blood_group'] = decrypt_data($query_email['blood_group']);
......@@ -481,12 +514,13 @@ class Webservice_model extends CI_Model {
//....................doctor login
function doctor_login($data){
$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->select("tbl_doctors.*,
CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,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');
$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();
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->select("tbl_doctors.*,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,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');
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization');
$query_email = $this->db->get_where("tbl_doctors",array("email"=>$data['username'],"password"=>md5($data['password'])))->row_array();
......@@ -501,7 +535,8 @@ class Webservice_model extends CI_Model {
$query_email['cep'] = decrypt_data($query_email['cep']);
$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['gender'] = $query_email['pt_gender'];
unset($query_email['pt_gender']);
$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']);
......@@ -518,7 +553,8 @@ class Webservice_model extends CI_Model {
$query_email['cep'] = decrypt_data($query_email['cep']);
$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['gender'] = $query_email['gender'];
unset($query_email['pt_gender']);
$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']);
......@@ -617,7 +653,8 @@ class Webservice_model extends CI_Model {
//.............. Get User(Patient) data based on email
function get_userdata($data){
$this->db->select("tbl_registration.*,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->select("tbl_registration.*,
CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id', 'inner');
$query_userdatas = $this->db->get_where("tbl_registration",array("email"=>$data));
if($query_userdatas->num_rows() > 0){
......@@ -630,7 +667,8 @@ class Webservice_model extends CI_Model {
$query_userdata['dob'] = $query_userdata['dob'] == "" ? "" : $query_userdata['dob'];
$query_userdata['name'] = $query_userdata['name']==""? "" :decrypt_data($query_userdata['name']);
$query_userdata['rg'] = $query_userdata['rg']==""? "" : decrypt_data($query_userdata['rg']);
$query_userdata['gender'] = $query_userdata['gender']==""? "" : decrypt_data($query_userdata['gender']);
$query_userdata['gender'] = $query_userdata['gender']==""? "" :$query_userdata['pt_gender'];
unset($query_userdata['pt_gender'])
$query_userdata['weight'] = $query_userdata['weight']==""? "" : decrypt_data($query_userdata['weight']);
$query_userdata['height'] = $query_userdata['height']==""? "" : decrypt_data($query_userdata['height']);
$query_userdata['blood_group'] = $query_userdata['blood_group']==""? "" : decrypt_data($query_userdata['blood_group']);
......@@ -652,7 +690,8 @@ class Webservice_model extends CI_Model {
//.............. Get doctor data based on email
function get_userdata_doctor($data){
$this->db->select('tbl_doctors.*,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name');
$this->db->select("tbl_doctors.*,
CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name");
$this->db->join('tbl_authtoken_doctors', 'tbl_authtoken_doctors.doctor_id = tbl_doctors.id', 'inner');
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization');
$query_userdata = $this->db->get_where("tbl_doctors",array("email"=>$data));
......@@ -669,7 +708,8 @@ class Webservice_model extends CI_Model {
$query['cep'] = $query['cep'] == "" ? "" :decrypt_data($query['cep']);
$query['complement'] = $query['complement'] == "" ? "" : decrypt_data($query['complement']);
$query['about'] = $query['about'] == "" ? "" :decrypt_data($query['about']);
$query['gender'] = $query['gender'] == "" ? "" :decrypt_data($query['gender']);
$query['gender'] = $query['gender'] == "" ? "" :$query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = $query['rg'] == "" ? "" :decrypt_data($query['rg']);
$query['crm'] = $query['crm'] == "" ? "" :decrypt_data($query['crm']);
$query['street_address'] = $query['street_address'] == "" ? "" :decrypt_data($query['street_address']);
......@@ -691,7 +731,8 @@ class Webservice_model extends CI_Model {
//.............. Get doctor data based on uid
function get_userdata_doctor_by_uid($data){
$this->db->select('tbl_doctors.*,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name');
$this->db->select("tbl_doctors.*,
CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken_doctors.doctor_id ,tbl_authtoken_doctors.authtoken,tbl_specialization.id as specialization_id,tbl_specialization.specialization_name");
$this->db->join('tbl_authtoken_doctors', 'tbl_authtoken_doctors.doctor_id = tbl_doctors.id', 'left');
$this->db->join('tbl_specialization','tbl_specialization.id = tbl_doctors. specialization','left');
$query_userdata = $this->db->get_where("tbl_doctors",array("uid"=>$data));
......@@ -706,7 +747,8 @@ class Webservice_model extends CI_Model {
$query['cep'] = $query['cep']== ""? "": decrypt_data($query['cep']);
$query['complement'] = $query['complement']== ""? "": decrypt_data($query['complement']);
$query['about'] = $query['about']== ""? "": decrypt_data($query['about']);
$query['gender'] = $query['gender']== ""? "": decrypt_data($query['gender']);
$query['gender'] = $query['gender']== ""? "": $query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = $query['rg']== ""? "": decrypt_data($query['rg']);
$query['crm'] = $query['crm']== ""? "": decrypt_data($query['crm']);
$query['street_address'] = $query['street_address']== ""? ""
......@@ -731,7 +773,8 @@ class Webservice_model extends CI_Model {
function get_userdata_patient_by_uid($data){
//$this->db->select("tbl_registration.*,CAST(AES_DECRYPT(`tbl_registration.dob`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dob_new,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->select("tbl_registration.*,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->select("tbl_registration.*,
CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_authtoken.userid ,tbl_authtoken.authtoken");
$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id', 'left');
$query_userdatas = $this->db->get_where("tbl_registration",array("uid"=>$data));
if($query_userdatas->num_rows() > 0){
......@@ -747,7 +790,8 @@ class Webservice_model extends CI_Model {
$query_userdata['rg'] = $query_userdata['rg'] == "" ? "" :decrypt_data($query_userdata['rg']);
/*$query_userdata['dob'] = $query_userdata['dob_new'];
unset($query_userdata['dob_new']);*/
$query_userdata['gender'] = $query_userdata['gender'] == "" ? "" :decrypt_data($query_userdata['gender']);
$query_userdata['gender'] = $query_userdata['gender'] == "" ? "" :$query_userdata['pt_gender'];
unset($query_userdata['pt_gender']);
$query_userdata['weight'] = $query_userdata['weight'] == "" ? "" :decrypt_data($query_userdata['weight']);
$query_userdata['height'] = $query_userdata['height'] == "" ? "" :decrypt_data($query_userdata['height']);
$query_userdata['blood_group'] = $query_userdata['blood_group'] == "" ? "" :decrypt_data($query_userdata['blood_group']);
......@@ -1051,14 +1095,15 @@ class Webservice_model extends CI_Model {
function get_doctor_profile($doctorid){
$this->db->select('tbl_doctors.*,
$this->db->select("tbl_doctors.*,
CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender
tbl_specialization.specialization_name,
tbl_specialization.sub_name,
tbl_clinic.street_address as location_name,
tbl_clinic.location_lattitude,tbl_clinic.location_longitude,
COUNT(DISTINCT(tbl_review.review_id)) as reviewcount,
GROUP_CONCAT(DISTINCT(tbl_doctors_photos.photo_url) SEPARATOR ",") as photos
');
");
$this->db->join('tbl_clinic_doctors', 'tbl_clinic_doctors.doctor_id = tbl_doctors.id','INNER');
$this->db->join('tbl_clinic', 'tbl_clinic.id = tbl_clinic_doctors.clinic_id','INNER');
$this->db->join('tbl_doctors_photos', 'tbl_doctors_photos.doctor_id = tbl_doctors.id','LEFT');
......@@ -1076,7 +1121,8 @@ class Webservice_model extends CI_Model {
$query['cep'] = decrypt_data($query['cep']);
$query['complement'] = decrypt_data($query['complement']);
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['street_address'] = decrypt_data($query['street_address']);
......@@ -1726,7 +1772,7 @@ class Webservice_model extends CI_Model {
//........................ Register Doctor
function register_doctor($data){
$data['about'] = encrypt_data($data['about']);
$data['gender'] = encrypt_data($data['gender']);
//$data['gender'] = encrypt_data($data['gender']);
$data['rg'] = encrypt_data($data['rg']);
$data['crm'] = encrypt_data($data['crm']);
$data['cep'] = encrypt_data($data['cep']);
......@@ -1734,6 +1780,14 @@ class Webservice_model extends CI_Model {
$data['locality'] = encrypt_data($data['locality']);
$data['number'] = encrypt_data($data['number']);
$data['complement'] = encrypt_data($data['complement']);
if($data['gender'] == 'male' || $data['gender'] == 'MALE'){
$data['gender'] = 0;
}else if($data['gender'] == 'female' || $data['gender'] == 'FEMALE'){
$data['gender'] = 1;
}else{
$data['gender'] = 2;
}
if($this->db->insert('tbl_doctors', $data)){
$insertid = $this->db->insert_id();
$this->db->query("update tbl_doctors set dob = AES_ENCRYPT(".$data['dob'].",'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA')where id = ".$insertid);
......@@ -1741,11 +1795,16 @@ class Webservice_model extends CI_Model {
$this->db->select("CAST(AES_DECRYPT(`dob`,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dob");
$this->db->where('id',$insertid);
$query_date = $this->db->get('tbl_doctors')->row();
$this->db->select("tbl_doctors.*,
CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender");
$query = $this->db->get('tbl_doctors');
$query = $query->row_array();
unset($query['dob']);
$query['dob'] = $query_date->dob;
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['rg'] = decrypt_data($query['rg']);
$query['crm'] = decrypt_data($query['crm']);
$query['cep'] = decrypt_data($query['cep']);
......@@ -4050,14 +4109,14 @@ class Webservice_model extends CI_Model {
public function get_single_patient($id)
{
$this->db->select("tbl_registration.id as patientid,tbl_registration.name as pt_name,tbl_registration.username as pt_username,tbl_registration.profile_photo as pt_pic,tbl_registration.gender as pt_gender,tbl_registration.email as pt_email,CAST(AES_DECRYPT(`tbl_registration`.`dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as pt_dob,tbl_registration.number as pt_number,tbl_registration.blood_group as pt_blood_group,tbl_registration.weight as pt_weight,tbl_registration.height as pt_height,tbl_registration.street_address as pt_street_add,tbl_registration.locality as pt_locality,tbl_registration.zip_code as pt_zip_code,tbl_registration.landmark as pt_complement,tbl_registration.rg as pt_rg,tbl_registration.cpf as pt_cpf,tbl_registration.customer_id as pt_customer_id
$this->db->select("tbl_registration.id as patientid,tbl_registration.name as pt_name,tbl_registration.username as pt_username,tbl_registration.profile_photo as pt_pic,
CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_registration.email as pt_email,CAST(AES_DECRYPT(`tbl_registration`.`dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as pt_dob,tbl_registration.number as pt_number,tbl_registration.blood_group as pt_blood_group,tbl_registration.weight as pt_weight,tbl_registration.height as pt_height,tbl_registration.street_address as pt_street_add,tbl_registration.locality as pt_locality,tbl_registration.zip_code as pt_zip_code,tbl_registration.landmark as pt_complement,tbl_registration.rg as pt_rg,tbl_registration.cpf as pt_cpf,tbl_registration.customer_id as pt_customer_id
");
$this->db->from('tbl_registration');
$this->db->where('tbl_registration.id',$id);
$data =$this->db->get()->row_array();
$data['pt_name'] = decrypt_data($data['pt_name']);
$data['pt_gender'] = decrypt_data($data['pt_gender']);
$data['pt_name'] = decrypt_data($data['pt_name']);
$data['pt_number'] = decrypt_data($data['pt_number']);
$data['pt_blood_group'] = decrypt_data($data['pt_blood_group']);
$data['pt_weight'] = decrypt_data($data['pt_weight']);
......@@ -4075,7 +4134,7 @@ class Webservice_model extends CI_Model {
public function get_single_doctor($id)
{
$this->db->select("tbl_doctors.id as doctorid,tbl_doctors.name as dr_name,tbl_doctors.profile_pic as dr_pic,tbl_doctors.email as dr_email,tbl_doctors.username as dr_username,CAST(AES_DECRYPT(tbl_doctors.dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dr_dob,tbl_doctors.about as dr_bio,tbl_doctors.specialization as dr_specialization_id,tbl_doctors.price as dr_price,tbl_doctors.consultation_duration as dr_consult_duration,tbl_doctors.accept_return as dr_accept_return,tbl_doctors.return_timeperiod as dr_return_timeperiod,tbl_doctors.gender as dr_gender,tbl_doctors.locality as dr_neighbourhood,tbl_doctors.street_address as dr_rua,tbl_doctors.number as dr_number,tbl_doctors.telephone as dr_telephone,tbl_doctors.complement as dr_complement,tbl_doctors.rg as dr_rg,tbl_doctors.cpf as dr_cpf,tbl_doctors.crm as dr_crm,tbl_doctors.cep as dr_cep,tbl_specialization.specialization_name AS dr_specialization");
$this->db->select("tbl_doctors.id as doctorid,tbl_doctors.name as dr_name,tbl_doctors.profile_pic as dr_pic,tbl_doctors.email as dr_email,tbl_doctors.username as dr_username,CAST(AES_DECRYPT(tbl_doctors.dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dr_dob,tbl_doctors.about as dr_bio,tbl_doctors.specialization as dr_specialization_id,tbl_doctors.price as dr_price,tbl_doctors.consultation_duration as dr_consult_duration,tbl_doctors.accept_return as dr_accept_return,tbl_doctors.return_timeperiod as dr_return_timeperiod,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as dr_gender,tbl_doctors.locality as dr_neighbourhood,tbl_doctors.street_address as dr_rua,tbl_doctors.number as dr_number,tbl_doctors.telephone as dr_telephone,tbl_doctors.complement as dr_complement,tbl_doctors.rg as dr_rg,tbl_doctors.cpf as dr_cpf,tbl_doctors.crm as dr_crm,tbl_doctors.cep as dr_cep,tbl_specialization.specialization_name AS dr_specialization");
$this->db->from('tbl_doctors');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
......@@ -4083,7 +4142,6 @@ class Webservice_model extends CI_Model {
$data =$this->db->get()->row_array();
$data['dr_bio'] = decrypt_data($data['dr_bio']);
$data['dr_gender'] = decrypt_data($data['dr_gender']);
$data['dr_neighbourhood'] = decrypt_data($data['dr_neighbourhood']);
$data['dr_rua'] = decrypt_data($data['dr_rua']);
$data['dr_number'] = decrypt_data($data['dr_number']);
......@@ -4102,13 +4160,14 @@ class Webservice_model extends CI_Model {
function get_single_doctor_row($id)
{
$this->db->select("*");
$this->db->select("*,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender");
$this->db->from("tbl_doctors");
$this->db->where("tbl_doctors.id",$id);
$query = $this->db->get()->row_array();
$query['about'] = decrypt_data($query['about']);
$query['gender'] = decrypt_data($query['gender']);
$query['gender'] = $query['pt_gender'];
unset($query['pt_gender']);
$query['street_address'] = decrypt_data($query['street_address']);
$query['locality'] = decrypt_data($query['locality']);
$query['number'] = decrypt_data($query['number']);
......
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