Commit 140a56ca by Jansa Jose

review

parent 5f751a19
...@@ -1912,25 +1912,38 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -1912,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{
......
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