Commit 7d480f8b by Jemsheer K D

Merge branch 'jansa' of https://gitlab.techware.co.in/IPok/IPok_Web into jansa

parents e1e339d4 140a56ca
...@@ -1283,7 +1283,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -1283,7 +1283,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
$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,'payment_type'=>$data['payment_mode'],'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'){
$doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$data['doctor_id']))->row(); $doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$data['doctor_id']))->row();
...@@ -1605,6 +1605,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -1605,6 +1605,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
$query = $data["query"]; $query = $data["query"];
$where = 'tbl_clinic.name LIKE '."'$query%'"; $where = 'tbl_clinic.name LIKE '."'$query%'";
$this->db->where($where); $this->db->where($where);
$this->db->where('tbl_clinic.id !=','0');
} }
if(isset($data['speciality']) && strlen($data['speciality'])){ if(isset($data['speciality']) && strlen($data['speciality'])){
...@@ -1741,6 +1742,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -1741,6 +1742,7 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
$this->db->join('tbl_doctors','tbl_doctors.id = tbl_booking.doctor_id','INNER'); $this->db->join('tbl_doctors','tbl_doctors.id = tbl_booking.doctor_id','INNER');
$this->db->where('tbl_authtoken.authtoken',$authtoken); $this->db->where('tbl_authtoken.authtoken',$authtoken);
$this->db->where('tbl_booking.payment_status','1'); $this->db->where('tbl_booking.payment_status','1');
$this->db->order_by('tbl_booking.id','DESC');
$query = $this->db->get(); $query = $this->db->get();
if($query->num_rows() > 0){ if($query->num_rows() > 0){
$result = array('status'=>'success','data'=>$query->result_array()); $result = array('status'=>'success','data'=>$query->result_array());
...@@ -1910,25 +1912,38 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -1910,25 +1912,38 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$query = $this->db->get_where('tbl_booking',array('medical_record_id'=>$data['medical_record_id']))->row(); $query = $this->db->get_where('tbl_booking',array('medical_record_id'=>$data['medical_record_id']))->row();
if($query){ if($query){
if($query->medical_record_id != '' || $query->medical_record_id != '0'){ if($query->medical_record_id != '' || $query->medical_record_id != '0'){
$this->db->update('tbl_medical_records',array('patient_review'=>encrypt_data($data['review'])),array('id'=>$data['medical_record_id'])); $med_data = $this->db->get_where('tbl_medical_records',array('id'=>$data['medical_record_id']))->row();
if($med_data->patient_review != ''){
$this->db->update('tbl_medical_records',array('patient_review'=>encrypt_data($data['review'])),array('id'=>$data['medical_record_id']));
$revw_data = $this->db->get_where('tbl_review',array('booking_id'=>$med_data['booking_id']))->row();
$this->db->update('tbl_review',array('review'=>$data['review']),array('booking_id'=>$med_data['booking_id']));
$insertid = $revw_data->id;
}else{
$this->db->update('tbl_medical_records',array('patient_review'=>encrypt_data($data['review'])),array('id'=>$data['medical_record_id']));
unset($data['medical_record_id']);
$this->db->insert('tbl_review',$data);
$insertid = $this->db->insert_id();
}
} }
} }
unset($data['medical_record_id']);
if($this->db->insert('tbl_review',$data)){
$insertid = $this->db->insert_id(); $this->db->insert('tbl_doctor_notifications',array('doctor_id'=>$data['doctor_id'],'type'=>'1','message'=>$msg,'time'=>$data['date'],'read_status'=>'0'));
$this->db->insert('tbl_doctor_notifications',array('doctor_id'=>$data['doctor_id'],'type'=>'1','message'=>$msg,'time'=>$data['date'],'read_status'=>'0')); $doctor_insert_id = $this->db->insert_id();
$doctor_insert_id = $this->db->insert_id();
$fcm_doctor = $this->db->get_where('tbl_authtoken_doctors',array('doctor_id'=>$data['doctor_id']))->row(); $fcm_doctor = $this->db->get_where('tbl_authtoken_doctors',array('doctor_id'=>$data['doctor_id']))->row();
$news['id'] = $doctor_insert_id; $news['id'] = $doctor_insert_id;
$news['type'] = "New Review"; $news['type'] = "New Review";
$news['message'] =$msg; $news['message'] =$msg;
$news['read_status'] = false; $news['read_status'] = false;
$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);
if($doctor_push){
$res = array("status"=>"success","msg" =>"Insertion Success",'data'=>array('id'=>$insertid,'review'=>$data['review'])); $res = array("status"=>"success","msg" =>"Insertion Success",'data'=>array('id'=>$insertid,'review'=>$data['review']));
}else{ }
else{
$res = array("status"=>"failed","msg" =>"Insertion failed"); $res = array("status"=>"failed","msg" =>"Insertion failed");
} }
}else{ }else{
...@@ -2555,7 +2570,9 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2555,7 +2570,9 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
} }
$ill = json_decode(decrypt_data($result['diseases'])); $ill = json_decode(decrypt_data($result['diseases']));
if($ill == ''){ // print_r( $ill );echo"<br>";
//print_r($ill->anamnese);exit();
if(!isset($ill->anamnese)){
$new = []; $new = [];
}else{ }else{
$new = array(); $new = array();
...@@ -2573,7 +2590,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2573,7 +2590,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
} }
$result['illness'] = $new; $result['illness'] = $new;
if($news['cause'] != ''){ if(isset($news)){
$others = $news; $others = $news;
}else{ }else{
$others = []; $others = [];
...@@ -2620,6 +2637,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2620,6 +2637,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$tot = $tot + ($value->amount * $value->quantity); $tot = $tot + ($value->amount * $value->quantity);
} }
$result['services'] = $bud; $result['services'] = $bud;
$result['total'] = $tot ;
} }
unset($result['budget']); unset($result['budget']);
...@@ -2631,7 +2649,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2631,7 +2649,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
} }
unset($result['images']); unset($result['images']);
unset($result['booking_id']); unset($result['booking_id']);
$result['total'] = $tot ;
$res = array('status'=>'success','data'=>$result); $res = array('status'=>'success','data'=>$result);
} }
...@@ -3776,7 +3794,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -3776,7 +3794,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$this->db->update('tbl_medical_records',array('other_observations'=>encrypt_data($data['observations']),'images'=>$data['images']),array('booking_id'=>$data['booking_id'])); $this->db->update('tbl_medical_records',array('other_observations'=>encrypt_data($data['observations']),'images'=>$data['images']),array('booking_id'=>$data['booking_id']));
$doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$doctor_id))->row(); $doctor_wallet = $this->db->get_where('tbl_wallet_details',array('doctor_id'=>$doctor_id))->row();
$earn = $res->total_sum - (($res->total_sum * $res->ipok_fee)/100); $earn = $res->total_sum - (($res->total_sum * $res->ipok_fee)/100);
if($res->visit_type == '0'){ if($res->visit_type == '0' && $res->payment_type == '2'){
if($doctor_wallet){ if($doctor_wallet){
$redem_earn = decrypt_data($doctor_wallet->reedem_earn) + $earn; $redem_earn = decrypt_data($doctor_wallet->reedem_earn) + $earn;
$future_earn = decrypt_data($doctor_wallet->future_earn) - $earn; $future_earn = decrypt_data($doctor_wallet->future_earn) - $earn;
...@@ -4005,7 +4023,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -4005,7 +4023,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
} }
public function check_wait_listed($data){ public function check_wait_listed($data){
$check = $this->db->get_where('tbl_booking',array('doctor_id'=>$data['doctor_id'],'clinic_id'=>$data['clinic_id'],'date'=>$data['date'],'time'=>$data['time'])); $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'));
if($check->num_rows() > 0){ if($check->num_rows() > 0){
$is_booking = true; $is_booking = true;
}else{ }else{
......
...@@ -1146,7 +1146,6 @@ public function save_medicalrecord_finaldata() ...@@ -1146,7 +1146,6 @@ public function save_medicalrecord_finaldata()
exit(); exit();
} }
} }
} }
......
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