load->model('Caregiver_model'); $this->load->model('email_template_management/Email_template_model'); $this->load->model('onboarding/Onboarding_model' , 'onboardModel'); $this->load->model('home/Home_model'); $this->load->helper('mail_frequency_helper'); $this->load->helper('docexpiredate_helper'); if (!$this->ion_auth->in_group(array('admin'))) { // echo $this->ion_auth->coordinator_permission('caregivers');die; if(!$this->ion_auth->coordinator_permission('caregivers')){ redirect('home/permission'); } } } public function index() { $data=['dlGvdftsdr'=>intval($this->input->get('dlGvdftsdr'))]; $this->load->view('home/dashboard'); // just the header file $this->load->view('patient/loader2'); $this->load->view('caregivers',$data ); $this->load->view('home/footer'); // just the header file } function url_exists() { $url = 'http://dev.wecuro.com/uploads/Documents/USER_001195/001195.pdf'; // $ab = curl_init($url) !== false; if(curl_init($url) !== false){ $ab = "true"; }else{ $ab = "false"; } echo $ab; } public function testMail(){ // echo "test mail";die; $config = Array( 'protocol' => 'smtp', // 'smtp_host' => 'STARTTLS://smtp.office365.com', 'smtp_host' => 'mail.google.com', 'smtp_port' => 26, 'smtp_user' => 'ujjwal@sentientgeeks.com', 'smtp_pass' => 'Ujjwal1985', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $email="molisena1995@gmail.com"; $this->load->library('email', $config); // $this->email->set_newline("\r\n"); $this->email->from('ujjwal@sentientgeeks.com', 'ujjwal'); $this->email->to($email); $this->email->subject("Test subject"); $this->email->message("test email"); // Set to, from, message, etc. if ($this->email->send()) { echo 'Your email was sent, thanks chamil.'; } else { $errorMail =$this->email->print_debugger(); _die($errorMail); // show_error($this->email->print_debugger()); } // echo mail("molisena1995@gmail.com","My subject","test msg"); } public function checkEmail(){ $email=$this->input->get('email'); $result=$this->Caregiver_model->checkEmail($email); echo $result; } public function pendingApplication() { $data = array("search"=>"pendingApplication"); $data['dlGvdftsdr']=intval($this->input->get('dlGvdftsdr')); $this->load->view('home/dashboard'); // just the header file $this->load->view('patient/loader2'); $this->load->view('caregivers',$data ); $this->load->view('home/footer'); // just the header file } public function view(){ $id=$_GET['id']; $data['caregiver']=$this->Caregiver_model->getNurseById($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('caregiverView',$data); $this->load->view('home/footer'); // just the header file } public function addNewCaregiver(){ $data['skills']=$this->Caregiver_model->caregiver_skill_list(); $this->load->view('home/dashboard'); // just the header file $this->load->view('addNewCaregiver',$data); $this->load->view('home/footer'); } public function addNewView($id=null) { if($id==null) redirect('caregivers/pendingApplication'); $data=array(); $eml=$_SESSION['email']; $data['userType']=$this->Caregiver_model->get_user_type($eml); $form_tab_status=$_SESSION['form_tab_status']; unset($_SESSION['form_tab_status']); $_SESSION['form_tab_status'] == ''; // $id = $this->input->get('id'); $id = base64_dec($id); $data['state_list']=$this->Caregiver_model->get_state_list(); $data['city_list']=$this->Caregiver_model->get_city_list(); $data['school_list']=$this->Caregiver_model->get_SchoolList(); $data['ethnicity_list']=$this->Caregiver_model->get_ethnicity_list(); $data['eyeColors']=$this->Caregiver_model->get_eyeColors(); $data['hairColors']=$this->Caregiver_model->get_hairColors(); $data['skills']=$this->Caregiver_model->caregiver_skill_list(); $data['language']=$this->Caregiver_model->get_language_list(); $data['country']=$this->Caregiver_model->get_country_list(); $data['time_slot']=$this->Caregiver_model->get_time_slot_list(); $data['ref_src_list']=$this->Caregiver_model->get_ref_src_list(); $data['services']=$this->Caregiver_model->get_service_list($id); $data['relation']=$this->Caregiver_model->get_relation(); $data['reason_for_leaving']=$this->Caregiver_model->get_reason_for_leaving(); $data['exp_by_condition']=$this->Caregiver_model->exp_by_condition(); $data['exp_by_demographics']=$this->Caregiver_model->exp_by_demographics(); $data['rn_exp']=$this->Caregiver_model->rn_exp(); $data['lpn_exp']=$this->Caregiver_model->lpn_exp(); $data['religious_preferences']=$this->Caregiver_model->religious_preferences(); $data['experience']=$this->Caregiver_model->get_caregiver_experience($id); $data['getNurseSkill']=$this->Caregiver_model->getNurseSkill($id); $data['getPrefShift']=$this->Caregiver_model->getShiftPref($id); $data['cg_services']=$this->Caregiver_model->get_cg_service_list(); $data['referral_source']=$this->Caregiver_model->get_referral_source(); if($id!="") { $data['cargiverService']=$this->Caregiver_model->get_CaregiverService_listById($id); } else { $data['cargiverService']=""; } //$data['tab']=1; if($id) { $data['nurse']=$this->Caregiver_model->getNurseById($id); $data['nurse']->emp_health_assessment=$this->Caregiver_model->get_health_assessmentById($id); // _die($data['nurse']); $data['nurse']->emp_tuberculosis_data=$this->Caregiver_model->get_tuberculosisById($id); $data['emp_phy_data']=$this->Caregiver_model->get_phy_dataById($id); $data['tuberculosis_status']=$this->Caregiver_model->getTuberStatus($id); $data['other_reference'] = $this->Caregiver_model->getOtherReferenceById($id); $data['licenses'] = $this->Caregiver_model->getLicensesById($id); $data['certificates'] = $this->Caregiver_model->getCertificatesById($id); $data['certificateDoc'] = $this->Caregiver_model->getCertificatesByStatus($id); // pre($data['nurse']);die; $data['documents']=$this->Caregiver_model->getNurseDocuments($data['nurse']->ion_user_id); // pre($data['documents']);die(); //$data['tabstatus']=$this->getTabStatus($id); $data['signature'] = $this->Caregiver_model->getSignatureInfo($id); $data['signature_type']=[]; foreach($data['signature'] as $sig){ $data['signature_type'][] = $sig->document_details; } if($form_tab_status==1) $data['tab']=1; else if($form_tab_status==2) $data['tab']=3; else if($form_tab_status==3) $data['tab']=3; else if($form_tab_status==4) $data['tab']=4; else if($form_tab_status==5) $data['tab']=10; // else if($form_tab_status==6) // $data['tab']=6; // else if($form_tab_status==7) // $data['tab']=7; // else if($form_tab_status==8) // $data['tab']=8; // else if($form_tab_status==9) // $data['tab']=9; // else if($form_tab_status==10) // $data['tab']=10; // else if($form_tab_status==11) // $data['tab']=11; else if($form_tab_status== 12 && $progress >= 100) $data['tab']=12; else $data['tab']=''; } // pre($data['nurse']);die; $this->load->view('home/dashboard'); $this->load->view('add_new',$data); $this->load->view('home/footer'); } public function getTabStatus($id) { $caregiverData=$this->Caregiver_model->getNurseById($id); $from_tab_status_pctg=json_decode($caregiverData->from_tab_status_pctg); //pre($caregiverData); //pre($from_tab_status_pctg); // 0 = Locked // 1 = opend // 2 = completed if($from_tab_status_pctg->form1!=0){ $tabstatus['basic']=2; }else{ $tabstatus['basic']=1; } if($from_tab_status_pctg->form2!=0 && $tabstatus['basic']==2){ $tabstatus['exp']=2; }else if($tabstatus['basic']==2){ $tabstatus['exp']=1; }else{ $tabstatus['exp']=0; } if($from_tab_status_pctg->form4!=0 && $tabstatus['exp']==2){ $tabstatus['emp']=2; }else if($tabstatus['exp']==2){ $tabstatus['emp']=1; }else{ $tabstatus['emp']=0; } if($from_tab_status_pctg->form5!=0 && $tabstatus['emp']==2){ $tabstatus['phy']=2; }else if($tabstatus['emp']==2){ $tabstatus['phy']=1; }else{ $tabstatus['phy']=0; } if($caregiverData->qualification_type==4){ $doc_per=24; }else if($caregiverData->qualification_type==5){ $doc_per=14; }else if($caregiverData->qualification_type==6 || $caregiverData->qualification_type==7){ $doc_per=17; } //pre($doc_per); if($from_tab_status_pctg->form11>=$doc_per && $tabstatus['phy']=2){ $tabstatus['doc']=2; }else if($tabstatus['phy']==2){ $tabstatus['doc']=1; }else{ $tabstatus['doc']=0; } if($from_tab_status_pctg->submited_for_verification=='yes' && $tabstatus['doc']==2){ $tabstatus['dis']=2; }else if($tabstatus['doc']==2){ $tabstatus['dis']=1; }else{ $tabstatus['dis']=0; } //return $tabstatus; echo json_encode($tabstatus); //pre($tabstatus); } public function addNewStep() { // pre($_POST); // die; $id = $this->input->post('id'); //print_r($id);die; $form_status = $this->input->post('form_status'); $form_mode = $this->input->post('form_mode'); $fname = $this->input->post('fname'); $lname = $this->input->post('lname'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); $qualification_type = $this->input->post('qualification_type'); $experience_id = $this->input->post('experience_id'); $years_of_exp = $this->input->post('years_of_exp'); $service = $this->input->post('service'); //$service=implode("/",$service); //print_r($service);die; //$password = $this->input->post('password'); $password = mt_rand(100000, 999999); $gender = $this->input->post('gender'); $marital_status = $this->input->post('marital_status'); $dependents = $this->input->post('dependents'); $hire_type = $this->input->post('hire_type'); $date_of_re_hire = $this->input->post('date_of_re_hire'); $dob = $this->input->post('dob'); $soc_sec = $this->input->post('soc_sec'); $country_of_birth = $this->input->post('country_of_birth'); $ethnicity = $this->input->post('ethnicity'); $height = $this->input->post('height_feet').'/'.$this->input->post('height_inches'); $weight = $this->input->post('weight'); $eye_color = $this->input->post('eye_color'); $hair_color = $this->input->post('hair_color'); $primary_langualge = $this->input->post('primary_langualge'); if($primary_langualge){$primary_langualge=implode("/",$primary_langualge);} $address1 = $this->input->post('address1'); //$direction1 = $this->input->post('direction1'); $state1 = $this->input->post('state1'); $county1 = $this->input->post('county1'); $zipcode1 = $this->input->post('zipcode1'); $lang1 = $this->input->post('lang1'); $long1 = $this->input->post('long1'); $city1 = $this->input->post('city1'); $address2 = $this->input->post('address2'); //$direction2 = $this->input->post('direction2'); $state2 = $this->input->post('state2'); $county2 = $this->input->post('county2'); $zipcode2 = $this->input->post('zipcode2'); $lang2 = $this->input->post('lang2'); $long2 = $this->input->post('long2'); $city2 = $this->input->post('city2'); $phone2 = $this->input->post('phone2'); $other_contact = $this->input->post('other_contact'); $alternative_email = $this->input->post('alternative_email'); $preferred_contact = $this->input->post('preferred_contact'); $oauth_provider = "general"; $oauth_uid = $this->input->post('oauth_uid'); $data = array(); if(empty($id)) { if ($this->ion_auth->email_check($email)) { $this->session->set_flashdata('feedback_error', 'This Email Address Is Already Registered'); redirect('caregivers/addNewCaregiver'); } else { if($hire_type=='Re-Hire' && $date_of_re_hire=='') { $this->session->set_flashdata('feedback_error', 'Enter re-hire daate.'); redirect('caregivers/addNewCaregiver'); } else { $username = $this->input->post('fname'); $dfg = 6; $this->ion_auth->register($username, $password, $email,$dfg,$oauth_uid,$oauth_provider); $ion_user_id = $this->db->get_where('users', array('email' => $email))->row()->id; // _die($ion_user_id); } } $created_by=$this->session->userdata('user_id'); $application_date=date ('Y-m-d', now()); if(isset($_POST['fname'])){ $data['fname'] = $fname; } if(isset($_POST['mid_name'])){ $data['mid_name'] = $_POST['mid_name']; } if(isset($_POST['lname'])){ $data['lname'] = $lname; } if(isset($_POST['email'])){ $data['email'] = $email;} //if(isset($_POST['dependents'])){ $data['dependents'] = $dependents; } if(isset($_POST['qualification_type'])){ $data['qualification_type'] = $_POST['qualification_type']; } if(isset($_POST['hire_type'])){ $data['hire_type'] = $hire_type; } if(isset($_POST['date_of_re_hire'])){ $data['date_of_re_hire'] = $date_of_re_hire; } if(isset($_POST['phone'])){ $data['phone'] = $phone; } $data['caregiver_id']=''.str_pad($ion_user_id, 6, "0", STR_PAD_LEFT); $data['ion_user_id'] = $ion_user_id; $data['application_date'] = $application_date; $data['created_by'] = $created_by; $data['form_status'] = 1; $data['status'] = 1; $pctg = array(); $pctg['form1']=0;$pctg['form2']=0;$pctg['form3']=0;$pctg['form4']=0;$pctg['form5']=0;$pctg['form6']=0;$pctg['form7']=0;$pctg['form8']=0;$pctg['form9']=0;$pctg['form10']=0;$pctg['form11']=0; $data['from_tab_status_pctg'] = json_encode($pctg); } else if($form_status==1) { $caregiver = $this->Caregiver_model->getNurseById($id); if($form_mode=='Edit') $status=$caregiver->form_status; else $status=$form_status; $data = array( 'fname' => $fname, 'lname' => $lname, 'email' => $email, 'phone' => $phone, 'years_of_exp' => $years_of_exp, 'preferred_contact' => $preferred_contact, 'form_status' => $status, 'state1' => $state1, 'county1' => $county1, 'zipcode1' => $zipcode1, 'lang1' => $lang1, 'long1' => $long1, 'city1' => $city1, 'other_contact' => $other_contact, 'alternative_email' => $alternative_email, 'live_with_patient' => $_POST['live_with_patient'], 'have_key' => $_POST['have_key'], ); $data2 = array( 'Emergency_Contact_Name' => $_POST['Emergency_Contact_Name'], 'Emergency_Contact_Relationship' => $_POST['Emergency_Contact_Relationship'], 'Emergency_Contact_Address' => $_POST['Emergency_Contact_Address'], 'Emergency_Contact_zipcode' => $_POST['Emergency_Contact_zipcode'], 'Emergency_Contact_Telephone' => $_POST['Emergency_Contact_Telephone'], 'Emergency_Contact_Cellphone' => $_POST['Emergency_Contact_Cellphone'], 'Emergency_Contact_Other' => $_POST['Emergency_Contact_Other'], 'Emergency_Contact_Email' => $_POST['Emergency_Contact_Email'], 'Emergency_Contact_Country' => $_POST['Emergency_Contact_Country'], 'Emergency_Contact_State' => $_POST['Emergency_Contact_State'], 'Emergency_Contact_City' => $_POST['Emergency_Contact_City'], ); $data3 = array( 'address2' => $address2, //'direction2' => $direction2, 'state2' => $state2, 'county2' => $county2, 'zipcode2' => $zipcode2, 'lang2' => $lang2, 'long2' => $long2, 'city2' => $city2, 'phone2' => $phone2, // 'employee_type'=> $employee_type, ); //echo '
'; print_r($data); echo ''; die; } else if($form_status==2) { $caregiver = $this->Caregiver_model->getNurseById($id); //echo '
'; print_r($caregiver); echo ''; die; if($form_mode=='Edit') { $status=$caregiver->form_status; $progress=$caregiver->progress; }else{ $status=$form_status; $progress=10; } $data = array( 'qualification_type' => $qualification_type, 'years_of_exp' => $years_of_exp, 'progress' => 20, 'form_status' => $status, ); //echo '
'; print_r($data); echo ''; exit; } else if($form_status==3) { $caregiver = $this->Caregiver_model->getNurseById($id); if($form_mode=='Edit') { $status=$caregiver->form_status; $progress=$caregiver->progress; }else{ $status=$form_status; $progress=30; } $data = array( 'gender' => $gender, 'marital_status' => $marital_status, 'dependents' => $dependents, 'dob' => $dob, 'soc_sec' => $soc_sec, //'country_of_birth' => $country_of_birth, 'ethnicity' => $ethnicity, // 'height' => $height, // 'weight' => $weight, 'eye_color' => $eye_color, 'hair_color' => $hair_color, 'primary_langualge' => $primary_langualge, 'form_status' => $status, 'progress' => $progress, ); $data3 = array( 'country_of_birth' => $country_of_birth, 'height' => $height, 'weight' => $weight, ); // $data2 = array( // 'Emergency_Contact_Name' => $_POST['Emergency_Contact_Name'], // 'Emergency_Contact_Relationship' => $_POST['Emergency_Contact_Relationship'], // 'Emergency_Contact_Address' => $_POST['Emergency_Contact_Address'], // 'Emergency_Contact_zipcode' => $_POST['Emergency_Contact_zipcode'], // 'Emergency_Contact_Telephone' => $_POST['Emergency_Contact_Telephone'], // 'Emergency_Contact_Cellphone' => $_POST['Emergency_Contact_Cellphone'], // 'Emergency_Contact_Other' => $_POST['Emergency_Contact_Other'], // 'Emergency_Contact_Email' => $_POST['Emergency_Contact_Email'], // 'Emergency_Contact_Country' => $_POST['Emergency_Contact_Country'], // 'Emergency_Contact_State' => $_POST['Emergency_Contact_State'], // 'Emergency_Contact_City' => $_POST['Emergency_Contact_City'], // ); } if (empty($id)) { //echo "caregiver table";die; // Adding New if ($this->Caregiver_model->email_check($email)) { $this->session->set_flashdata('feedback_error', 'This Email Address Is Already Registered'); redirect('caregivers/addNewCaregiver'); } else { if($form_status=='1') { $data3['employee_type']=$this->input->post('employee_type'); $cargiverId=$this->Caregiver_model->insertNurse($data,$data2,$data3); $caregiver=$this->Caregiver_model->getNurseByEmail($email); //email $name=$fname." ".$lname; //$email="ujjwalbinary@gmail.com"; //$password="12345"; $designation="caregiver"; $company="Hospital Management System"; $emaildata['emaildata'] = array( 'name' => $name, 'email' => $email, 'password' => $password, 'designation' => $designation, 'link' => base_url(), 'company' => $company ); $message= $this->load->view('email_template_management/email_caregiver',$emaildata,TRUE); $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject ='Caregiver Account confirmation'; send_email($from,$email,$subject,$message); // $message="Dear {name},
'; print_r($post); echo ''; die; $this->Caregiver_model->updateNurse($id, $data); $this->Caregiver_model->caregiversExperience($id, $post); $this->Caregiver_model->updateService($id, $service); $this->session->set_flashdata('feedback_success', 'Experience & skills Updated.'); } else if($form_status==3) { //echo '
'; print_r($data); echo ''; die; $this->Caregiver_model->updateNurse($id, $data,$data2,$data3); $this->session->set_flashdata('feedback_success', 'Personal Information Updated.'); } else if($form_status==4) { //echo '
'; print_r($data); echo ''; die; $this->Caregiver_model->updateNurse($id, $data); $this->session->set_flashdata('feedback_success', 'Contact Information Updated.'); } //$this->Caregiver_model->updateNurse($id, $data,$data2); redirect('caregivers/addNewView?id='.$id); //redirect($_SERVER['HTTP_REFERER']); } // Loading View // redirect('caregivers'); //} } /* | for the entry in mail_log table */ public function insertIntoMailLogTable($id,$ion_user_id,$type) { $data["caregiver_table_id"]=$id; $data["ion_user_id"]=$ion_user_id; $data["type"]=$type; $data["email_status"]=1; $data["send_status"]=0; $firstEmailData=$this->Caregiver_model->insertIntoMailLogTable($data,$emailsendDate); $emailsendDate=createDateTimeForNextEmails($firstEmailData); $futureEmailData=$this->Caregiver_model->insertIntoMailLogTable($data,$emailsendDate); } /* | Ending of entry in mail_log table */ public function empAppPectg($pid) { $total = 10; $mandateFields = array('dob'); $res = $this->Referral_model->getGeninfoPctg($pid); // echo "
"; print_r($res); die; foreach ($mandateFields as $value) { if($res->$value == '') { // echo $value .':'. $res->$value .'
'; $total = $total - 10; } } return ceil($total); } public function ChangePassword($id=null){ // $id = $this->input->get('id'); $id = base64_dec($id); $data['nurse']=$this->Caregiver_model->getNurseById($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('change_password',$data); $this->load->view('home/footer'); } public function pendingAcceptance(){ $data=['dlGvdftsdr'=>intval($this->input->get('dlGvdftsdr'))]; $this->load->view('home/dashboard'); // just the header file $this->load->view('patient/loader2'); $this->load->view('approval_list',$data); $this->load->view('home/footer'); } public function approvalForm($id=null){ if($id==null) redirect('caregivers/pendingAcceptance'); // $id = $this->input->get('id'); $id = base64_dec($id); $data = array(); $data['nurse']=$this->Caregiver_model->getNurseById($id); $data['nurse']->state1_name=$this->Caregiver_model->get_state_nameByid($data['nurse']->state1); $data['nurse']->state2_name=$this->Caregiver_model->get_state_nameByid($data['nurse']->state2); $data['nurse']->qualification=$this->Caregiver_model->caregiver_skill_NameByid($data['nurse']->qualification_type); $data['nurse']->avail_borough=$this->Caregiver_model->get_state_nameByid($data['nurse']->availability_borough); $data['nurse']->avail_time_slot=$this->Caregiver_model->get_time_slot_Byid($data['nurse']->availability_time_slot); $data['nurse']->ref_source=$this->Caregiver_model->get_ref_src_Byid($data['nurse']->referral_source); $data['nurse']->profesonal=$this->Caregiver_model->caregiver_skill_NameByid($data['nurse']->profession); $data['nurse']->pre_emp_skill=$this->Caregiver_model->caregiver_skill_NameByid($data['nurse']->pre_employment_skill); $data['nurse']->verification=$this->Caregiver_model->caregiver_verification($id); $data['nurse']->schoolList=$this->Caregiver_model->get_SchoolList(); $data['nurse']->emp_health_assessment=$this->Caregiver_model->get_health_assessmentById($id); $data['nurse']->emp_tuberculosis_data=$this->Caregiver_model->get_tuberculosisById($id); $data['documents']=$this->Caregiver_model->getNurseDocuments($data['nurse']->ion_user_id); $data['relation']=$this->Caregiver_model->get_relation(); if(isset($data['nurse']->verification->verified_tab)){ $verified_tab=json_decode($data['nurse']->verification->verified_tab); if($verified_tab->tab2==0){ $data['tab']=2; }else if($verified_tab->tab3==0){ $data['tab']=3; }else if($verified_tab->tab4==0){ $data['tab']=4; }else{ $data['tab']=5; } } // New $data['eyeColors']=$this->Caregiver_model->get_eyeColors(); $data['hairColors']=$this->Caregiver_model->get_hairColors(); $data['skills']=$this->Caregiver_model->caregiver_skill_list(); $data['language']=$this->Caregiver_model->get_language_list(); $employee_type = $data['nurse']->employee_type; $skill_name = $data['nurse']->skill_name; if($employee_type=='contrator' && ($skill_name=='RN' || $skill_name=='LPN')){ $caregiver_type = 'A'; }elseif($employee_type=='contrator' && ($skill_name=='HHA' || $skill_name=='PCA')){ $caregiver_type = 'B'; }elseif($employee_type=='inhouse' && ($skill_name=='RN' || $skill_name=='LPN')){ $caregiver_type = 'C'; }elseif($employee_type=='inhouse' && ($skill_name=='HHA' || $skill_name=='PCA')){ $caregiver_type = 'D'; } $data['getDisclosure'] = $this->Caregiver_model->getDisclosure($caregiver_type,$id); $data['non_medical_doc'] = $this->Caregiver_model->getNonMedicalDoc($id); // $data['us_auth_doc'] = $this->Caregiver_model->getUsAuthDoc($id); // $data['soc_sec_doc'] = $this->Caregiver_model->getSocialSecurityDoc($id); $data['us_auth_doc'] = $this->Caregiver_model->getDocumentsByShortCode($id,'CTZ1'); $data['soc_sec_doc'] = $this->Caregiver_model->getDocumentsByShortCode($id,'SSC'); $data['mal_prac_doc'] = $this->Caregiver_model->getDocumentsByShortCode($id,'MIC'); $data['prof_ref_doc'] = $this->Caregiver_model->getProfessionalReferenceDoc($id); $data['lic_doc'] = $this->Caregiver_model->getNursingLicenseDoc($id); $data['extra_disclosure_doc'] = $this->Caregiver_model->getExtraDisclosureDoc($id); $data['other_ref'] = $this->Caregiver_model->getOtherReferences2($id); $data['vaccine_doc'] = $this->Caregiver_model->getVaccineDoc($id); $data['certificate'] = $this->Caregiver_model->getCertificateById($id); $data['cpr_certificate'] = $this->Caregiver_model->getDocumentsByShortCode($id,'CPR'); $data['verified_tab'] = $this->Caregiver_model->getVerificationStatusById($id); $data['verified_tab_status'] = $this->Caregiver_model->getVerificationTabStatus($id); $cg_type=$data['nurse']->qualification_type; if($cg_type==4 || $cg_type==5){ foreach($data['verified_tab_status'] as $key=>$value){ if($value->tab_type==_VERIFY_BACKGROUND_){ unset($data['verified_tab_status'][$key]); } } } $data['tuberculosis_data'] = $this->Caregiver_model->getTuberculosis(); $data['get_phy_attestation']=$this->Caregiver_model->get_phy_attestation($id); $data['emp_phy_data']=$this->Caregiver_model->get_phy_dataById($id); $data['certificates'] = $this->Caregiver_model->getCertificatesById($id); $data['finger_print_info'] = $this->Caregiver_model->getFingerPrintInfo($id); $data['npi_doc'] = $this->Caregiver_model->getNPIdoc($id); // _die($data['other_ref']); $ionid=$data['nurse']->ion_user_id; $folder_name='USER_'.str_pad($ionid, 6, "0", STR_PAD_LEFT); $data['disclosrePdfPath']="uploads/Documents/".$folder_name."/"; $data['tuberculosis_status']=$this->Caregiver_model->getTuberStatus($id); $data['country']=$this->Caregiver_model->get_country_list(); $data['ethnicity_list']=$this->Caregiver_model->get_ethnicity_list(); $data['referral_source']=$this->Caregiver_model->get_referral_source(); // New // pre($data['us_auth_doc']); // pre($data['nurse']);die; //echo ''; print_r($verified_tab);die; $this->load->view('home/dashboard'); // just the header file // $this->load->view('approval_form',$data); $this->load->view('acceptance/acceptance',$data); $this->load->view('home/footer'); } public function saveApproval(){ $post=$this->input->post(); if($post['acceptCaregiver']=='NO'){ // pr($post); // echo 'rejected';die; $data['id']=$post['caregiver_id']; $data['rejection_reason']=$post['rejectionNote']; $result=$this->Caregiver_model->RejectAcceptance($data); if($result){ $this->session->set_flashdata('feedback_error', 'Rejected.'); }else{ $this->session->set_flashdata('feedback_error', 'Submission Error.'); } redirect('caregivers/pendingAcceptance'); } //echo 'accepted';die; $caregiver_id=$post['caregiver_id']; $caregiverData=$this->Caregiver_model->getNurseById($caregiver_id); //echo ''; print_r($caregiverData); echo '';die; $verified_by=$this->session->userdata('user_id'); $history_data=array( 'caregiver_id'=>$caregiver_id, 'verified_by'=>$verified_by, ); // $history_id=$this->Caregiver_model->addVerificationHistory($history_data); foreach ($post['varify_field'] as $key=> $value) { $data=array( 'verification_id'=>$history_id, 'verification_key'=>$value, 'verification_data'=>$post['varify_data'][$key], 'vaerification_file'=>$post['varify_file'][$key], ); //echo ''; print_r($data); echo ''; $this->Caregiver_model->addVerificationHistoryDetails($data); } $vdata=array( 'verification_status'=>'docverified', 'caregiver_id'=>''.str_pad($caregiver_id, 6, "0", STR_PAD_LEFT), 'verification_date'=>$savetime, ); $this->Caregiver_model->updateNurse($caregiver_id,$vdata); // ------------Send Push Notification -------------- $getFcmToken = $this->Caregiver_model->getFcmToken($caregiver_id); $fcm_token = $getFcmToken->fcm_token; $post_title='Notification From Admin'; $post_message='Your document has been verified by the admin'; $type='caregiver'; sendNotification($fcm_token,$post_title,$post_message,$type); // ------------Send Push Notification --------------- $name=$caregiverData->fname." ".$caregiverData->lname; $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject ='Caregiver approved successfully'; $emaildata['emaildata'] = array( 'name' =>$name ); $to = $caregiverData->email; $message= $this->load->view('email_template_management/cararegiver_approved',$emaildata,TRUE); send_email($from,$to,$subject,$message); redirect('caregivers/pendingAcceptance'); } #function for Push Notification // public function sendNotification($fcm_token,$post_title,$post_message) // { // $token = $fcm_token; // push token // $message = $post_message; // //echo $message;exit; // $this->load->library('fcm'); // $this->fcm->setTitle($post_title); // $this->fcm->setMessage($message); // $this->fcm->setIsBackground(false); // $payload = array('notification' => ''); // $this->fcm->setPayload($payload); // //$this->fcm->setImage('https://firebase.google.com/_static/9f55fd91be/images/firebase/lockup.png'); // /** // * Get the compiled notification data as an array // */ // // $json = $this->fcm->getPush(); // $msg = array // ( // 'body' => $post_message, // 'title' => $post_title, // 'icon' => 'myicon',/*Default Icon*/ // 'sound' => 1,/*Default sound*/ // 'priority'=> 'high', // 'show_in_foreground'=> true, // ); // // $json = json_encode($msg); // // _die($json); // $p = $this->fcm->send($token, $msg); // // print_r($p); // return $p; // } #function for Push Notification #----------------------------------------------- public function final_approve(){ $caregiver_id = $this->input->get('id'); $vdata=array( 'verification_status'=>'verified' ); $this->Caregiver_model->updateNurse($caregiver_id,$vdata); // ------------Send Push Notification -------------- $getFcmToken = $this->Caregiver_model->getFcmToken($caregiver_id); $fcm_token = $getFcmToken->fcm_token; $post_title='Notification From Admin'; $post_message='You have been approved as a caregiver'; $type='caregiver'; sendNotification($fcm_token,$post_title,$post_message,$type); // ------------Send Push Notification --------------- redirect('caregivers'); } public function caregiverSchedule(){ $data['caregiver_id']=$this->input->get('id'); //die; $data['caregiver']=$this->Caregiver_model->getNurseById($data['caregiver_id']); //$data['patients']=$this->Caregiver_model->getCaregiverPatient($data['caregiver_id']); $data['patientSchedule']=$this->Caregiver_model->caregiverScheduleById($data['caregiver_id']); $data['AvailableSchedule']=$this->Caregiver_model->availableScheduleById($data['caregiver_id']); $data['previousSchedule']=$this->Caregiver_model->previousScheduleById($data['caregiver_id']); // $data['master_schdule']=$this->Caregiver_model->masterScheduleList(); // $caregiverSchedule=$this->Caregiver_model->getCaregiverSchedule($data['caregiver_id']); // foreach($caregiverSchedule as $schedule){ // $data['caregiverScheduleid'][]=$schedule->schedule_master_id; // } //echo ''; print_r($data); echo '';die; $this->load->view('home/dashboard'); // just the header file $this->load->view('caregiver_schedule',$data); $this->load->view('home/footer'); } public function addSchedule(){ $data['weekday']=$this->Caregiver_model->masterScheduleWeekdayList(); $data['caregiver_id']=$this->input->get('id'); $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new_schedule',$data); $this->load->view('home/footer'); } public function saveCaregiverSchedule(){ //echo ''; print_r($schedule); echo ''; $post=$this->input->post(); $created_by=$this->session->userdata('user_id'); $created_on=date ('Y-m-d H:i:s', now()); $schedule_id=$post['schedule_id']; foreach($schedule_id as $schedule){ $data=array( 'caregiver_id'=>$post['caregiver_id'], 'schedule_master_id'=>$schedule, 'created_by'=>$created_by, 'created_on'=>$created_on, 'status'=>1, ); $this->Caregiver_model->saveCaregiverSchedule($data); } redirect('caregivers/caregiverSchedule?id='.$post['caregiver_id'].''); } public function getServices(){ $services=$this->Caregiver_model->getServices($_GET); echo $services; } /* function getExperienceDetails(){ $caregiver_type=$this->input->get('caregiver_type'); $caregiverId=$this->input->get('CargiverId'); $YearExperience=$this->input->get('YearExperience'); if($YearExperience>3){ $lvlThree=''; }else{ $lvlThree='disabled'; } if($YearExperience<1){ $lvlZero='disabled'; }else{ $lvlZero=''; } $exprience_head=$this->Caregiver_model->getServiceHeadByType($caregiver_type); $caregiver_experience=$this->Caregiver_model->get_caregiver_experience($caregiverId); foreach($caregiver_experience as $exp){ $exp_arr['experience_value'][$exp->experience_id]=$exp->experience_value; $group[] = $exp->group_id; } foreach($exp_arr['experience_value'] as $key=>$val){ $cg_exp_arr[]=$key; } // echo '';print_r($exp_arr['experience_value']); // echo '';print_r($group); // die; $output=''; foreach ($exprience_head as $exp_head) { $experience_level=$this->Caregiver_model->getExperienceByHeadId($caregiver_type,$exp_head->service_head_id); // echo 'Group';print_r($group); // echo 'Group';print_r($exp_head->service_head_id); // echo '
'; //die; if($exp_head->service_head_id==13 && $caregiver_type==4){ $check_required_class='PULMONARY'; $required_lvl_class='required-field'; }else if($exp_head->service_head_id==19 && $caregiver_type==4){ $check_required_class='WOUND'; $required_lvl_class='required-field'; }else if($exp_head->service_head_id==22 && $caregiver_type==4){ $check_required_class='IVTHERAPY'; $required_lvl_class='required-field'; }else if($exp_head->service_head_id==16 && $caregiver_type==4){ $check_required_class='GASTROINTESTINAL'; $required_lvl_class='required-field'; }else{ $check_required_class=''; $required_lvl_class=''; } // || () || ($exp_head->service_head_id==22 && $caregiver_type==4) || ($exp_head->service_head_id==16 && $caregiver_type==4)){ if(!in_array($exp_head->service_head_id,$group)){ $head_check='checked'; $style='style="display:none;"'; }else{ $head_check=''; $style=''; } $output.=''; $output.=''; } echo $output; //echo '$caregiver_type:'.$caregiver_type.'$caregiverId'.$caregiverId; }*/ function UpdatePassword(){ $id = $this->input->post('id'); $ionid = $this->input->post('ionid'); $password = $this->input->post('password'); $repassword = $this->input->post('repassword'); $email = $this->input->post('email'); if($password!=$repassword){ $this->session->set_flashdata('feedback_error', 'Confirm Password Not Matched!'); redirect('caregivers/ChangePassword/'.base64_enc($id)); }else if($password==""){ $this->session->set_flashdata('feedback_error', 'Password Can Not Blank!'); redirect('caregivers/ChangePassword/'.base64_enc($id)); }else if ($this->Caregiver_model->update_email_check($email,$ionid)) { $this->session->set_flashdata('feedback_error', 'This Email Address Is Already Registered'); redirect('caregivers/ChangePassword/'.base64_enc($id)); }else{ $password = $this->ion_auth_model->hash_password($password); $this->Caregiver_model->updateIonUser($email,$password,$id,$ionid); $this->session->set_flashdata('feedback_success', 'Password Updated Successfully'); redirect('caregivers/ChangePassword/'.base64_enc($id)); // redirect('CaregiversDashboard/ChangePassword/'.base64_enc($id)); } } // function abc() // { // $data['caregiver'] = $this->Caregiver_model->getNurseByLimitBySearch($limit, $start, $orderColumn, $orderType, $search, $searchIn); // // pre($data['caregiver']);die(); // foreach ($data['caregiver'] as $caregiver) { echo $caregiver->id; } // } function getNurse($searchIn="") { $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = ""; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; if(!empty($this->input->post('search')['value'])){ $search = $this->input->post('search')['value']; } $data['caregiver'] = $this->Caregiver_model->getNurseByLimitBySearch($limit, $start, $orderColumn, $orderType, $search, $searchIn); $datacount = $this->Caregiver_model->getNurseByLimitBySearchCount($limit, $start, $orderColumn, $orderType, $search, $searchIn); $sl=1; foreach ($data['caregiver'] as $caregiver) { $skill_arr=""; if ($this->ion_auth->in_group(array('admin'))|| $this->ion_auth->coordinator_permission('caregiver_menu')) { switch($searchIn) { case 'pendingApplication': default: $skill_name=$this->Caregiver_model->getSkillNameByid($caregiver->qualification_type); if($caregiver->status!='0'){ if($caregiver->verification_status!='verified'){ $options1 = ' ' . lang('edit') . ''; $options2=''; $options3=''; $options4=''; $options5=''; }else{ $options1=''; $options2=' ' . lang('Schedule') . ''; // $options3=' ' . lang('Deactive') . ''; // $options3=''; $options3 = ' ' . lang('View & Edit') . ''; $options4 = ' ' . lang('Compliance') . ''; $options5 = ' ' . lang('Send Mail') . ''; } }else{ $options4=''; $options3=' ' . lang('Active') . ''; $options1=''; $options2=''; $options5=''; } break; } } if($this->session->userdata('user_id')==1 && $this->ion_auth->in_group(array('admin')) && $this->input->post('dlGvdftsdr')==202){ $options6 = ' '; }else{ $options6=''; } // data-toggle="modal" data-target="#pctgElab" $progressData = json_decode($caregiver->from_tab_status_pctg); $progress = $progressData->form1+$progressData->form2+$progressData->form3+$progressData->form4+$progressData->form5+$progressData->form6+$progressData->form7+$progressData->form8+$progressData->form9+$progressData->form10+$progressData->form11; if($progress>=100){$progress=100;} $progress1 = $progress.'%'; $address= ''; // if($caregiver->address1){ // $address = $caregiver->address1; // } // if($caregiver->state1){ // $address = $address.','.$caregiver->state1; // } // if($caregiver->country1){ // $address = $address.','.$caregiver->country1; // } if($caregiver->city1){ $address = $caregiver->city1; } if($caregiver->zipcode1 && $address!=''){ $address = $address.','.$caregiver->zipcode1; }else if($caregiver->zipcode1 && $address==''){ $address = $caregiver->zipcode1; } $info[] = array( $sl, $skill_name, $caregiver->fname.' ' .$caregiver->lname, $caregiver->email, $caregiver->phone, $address, $progress1, $options1.' '.$options2.' '.$options3.' '.$options4.' '.$options5.' '.$options6, ); $sl++; } if (!empty($data['caregiver'])) { // $output = array( // "draw" => intval($requestData['draw']), // "recordsTotal" => $this->db->get_where('caregiver', array('status' => '1','verification_status'=>'verified'))->num_rows()-10, // "recordsFiltered" => $this->db->get_where('caregiver', array('status' => '1','verification_status'=>'verified'))->num_rows()-10, // "data" => $info // ); $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($datacount), "recordsFiltered" => count($datacount), "data" => $info ); } else { $output = array( // "draw" => 1, "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } function getApprovalList() { $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = ""; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; if(!empty($this->input->post('search')['value'])){ $search = $this->input->post('search')['value']; } $data['caregiver'] = $this->Caregiver_model->getSendApprovalList($limit, $start, $orderColumn, $orderType, $search); $dataCount = $this->Caregiver_model->getSendApprovalListCount($limit, $start, $orderColumn, $orderType, $search); $baseUrl=base_url(); $sr=0; // _die($data['caregiver']); foreach ($data['caregiver'] as $caregiver) { $skill_name=$this->Caregiver_model->getSkillNameByid($caregiver->qualification_type); $chatExist = $this->Caregiver_model->getChatListByUserID($caregiver->id); $examResultExist = $this->Caregiver_model->getExamResultByUserID($caregiver->id); $backGroundCheckRpt = $this->Caregiver_model->getBackgroundCheckReport($caregiver->id); $cgIdtype = $caregiver->id.'_'.$caregiver->qualification_type; if ($this->ion_auth->in_group(array('admin','Coordinator'))) { if($caregiver->verification_status =='unverified'){ $options1 = ' ' . lang('Approve') . ''; $options2 = ""; $options3 =""; $options4 =""; $options5 =""; $options6 =""; $options7 =""; } else{ $options1='Verified'; } if($caregiver->verification_status=='docverified'){ $options1 = ''; $options2 = "" . lang('Send onboard link') . ""; } } $options5 = ''; if($caregiver->verification_status=='docverified'){ if(count($chatExist)>0 || count($examResultExist)){ $options3 = "" . lang('Onboarding History') . ""; } else{ $options3 =""; $options4 =""; } if(count($backGroundCheckRpt) > 0) { $candidate_id = $backGroundCheckRpt[0]->order_id; $row_id = $backGroundCheckRpt[0]->id; if($backGroundCheckRpt[0]->completion_percentage < 100) { $options4 =" ".$backGroundCheckRpt[0]->report_status.""; $options5 =" Check Status"; } else { $options4 ="Approved"; } } else { $options4 = " " . lang('Send For Background check') . ""; } $options7=' ' . lang('Onboarding Disclosure') . ''; $options6 = ' ' . lang('Final Approve') . ''; } // if(count($chatExist)>0 || count($examResultExist)){ // $options3 = "" . lang('Onboarding History') . ""; // } // else{ // $options3 =""; // $options4 =""; // } // if(count($backGroundCheckRpt) > 0) // { // $candidate_id = $backGroundCheckRpt[0]->order_id; // $row_id = $backGroundCheckRpt[0]->id; // if($backGroundCheckRpt[0]->completion_percentage < 100) // { // $options4 =" ".$backGroundCheckRpt[0]->report_status.""; // $options5 =" Check Status"; // } // else // { // $options4 ="Approved"; // } // } // else // { // $options4 = " " . lang('Send For Background check') . ""; // } $option0 = ' ' . $caregiver->fname.' ' .$caregiver->lname . ''; if($this->session->userdata('user_id')==1 && $this->ion_auth->in_group(array('admin')) && $this->input->post('dlGvdftsdr')==202){ $options8 = ' '; }else{ $options8=''; } $progressData = json_decode($caregiver->from_tab_status_pctg); $progress = $progressData->form1+$progressData->form2+$progressData->form3+$progressData->form4+$progressData->form5+$progressData->form6+$progressData->form7+$progressData->form8+$progressData->form9+$progressData->form10+$progressData->form11; if($progress >= 100){ $progress = '100'; } $progress1 = $progress.'%'; $sr++; $info[] = array( // $caregiver->id, $sr, $skill_name, $option0, $caregiver->email, $caregiver->phone, // $progress1, $options1." ".$options2." ".$options3." ".$options4." ".$options5." ".$options7." ".$options6." ".$options8 ); } if (!empty($dataCount)) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($dataCount), "recordsFiltered" => count($dataCount), "data" => $info ); } else { $output = array( "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } function clearchecks() { $cg_email = $this->input->post("userEmail"); $cg_id = $this->input->post("userId"); $caregiver = $this->Caregiver_model->getNurseById($cg_id); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.accuratebackground.com/v3/candidate', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'firstName='.$caregiver->fname.'&lastName='.$caregiver->lname.'&phone='.$caregiver->phone.'&dateOfBirth='.$caregiver->dob.'&ssn='.$caregiver->soc_sec.'&email='.$cg_email.'&country=US®ion=CA&postalCode='.$caregiver->zipcode1.'&city='.$caregiver->city1.'&address=test', CURLOPT_HTTPHEADER => array( 'Authorization: Basic '.ACCURATE_AUTH, 'Content-Type: application/x-www-form-urlencoded' ), )); $response = curl_exec($curl); curl_close($curl); // echo $response; // die(); $result_json = $response; $responseArray = json_decode($result_json); $data = array( 'candidate_id'=>$responseArray->id, 'background_response'=>$result_json, 'cg_email'=>$cg_email, 'cg_id' => $cg_id ); $backGround_ID = $this->Caregiver_model->add_caregiver_background_check($data); // place order $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.accuratebackground.com/v3/order', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'candidateId='.$responseArray->id.'&packageType=PKG_EMPTY&workflow=EXPRESS&jobLocation.country=US&jobLocation.region='.$caregiver->city1.'&jobLocation.city='.$caregiver->city1.'©OfReport=false', CURLOPT_HTTPHEADER => array( 'Authorization: Basic OGViYWUwMmItZmFhNC00M2RiLWJkNzAtNzBjY2ViMTcxODk5OjBhMDQ4YmViLWUyYjktNDMzMS04ODcyLWE5Yjc3OGFmZDlhNA==', 'Content-Type: application/x-www-form-urlencoded' ), )); $orderResponse = curl_exec($curl); curl_close($curl); $orderObject = json_decode($orderResponse); $data = array( 'order_id'=>$orderObject->id, 'report_status'=>$orderObject->status, 'report_result'=>$orderObject->result, 'completion_percentage' => $orderObject->percentageComplete, 'background_response' => $orderResponse ); $this->Caregiver_model->update_caregiver_background_check($backGround_ID,$data); } function background_corn($cid,$row_id) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.accuratebackground.com/v3/order/'.$cid, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Authorization: Basic OGViYWUwMmItZmFhNC00M2RiLWJkNzAtNzBjY2ViMTcxODk5OjBhMDQ4YmViLWUyYjktNDMzMS04ODcyLWE5Yjc3OGFmZDlhNA==' ), )); $response = curl_exec($curl); curl_close($curl); $backGroundCheckRpt = $this->Caregiver_model->getBackgroundCheckReport($row_id); if($backGroundCheckRpt[0]->completion_percentage < 100) { $report_status = json_decode($response); $data = array( 'report_status' => $report_status->status, 'report_result' => $report_status->result, 'completion_percentage' => $report_status->percentageComplete, ); $this->Caregiver_model->update_caregiver_background_check($row_id,$data); echo json_encode($data); } else { $data = array( 'report_status' => $backGroundCheckRpt[0]->report_status, 'report_result' => $backGroundCheckRpt[0]->report_result, 'completion_percentage' => $backGroundCheckRpt[0]->completion_percentage, ); echo json_encode($data); } } function deactive() { $user_data = array(); $id = $this->input->get('id'); $user_data = $this->db->get_where('caregiver', array('id' => $id))->row(); $ion_user_id = $user_data->ion_user_id; $this->db->where('id', $ion_user_id); $this->db->update('users', array('active'=>0)); $this->db->where('id', $id); $this->db->update('caregiver', array('status'=>0)); //$this->db->delete('users'); //$this->Caregiver_model->delete($id); $this->session->set_flashdata('feedback_success', 'Deactive successfully.'); redirect('caregivers'); } function delete(){ // echo '1';die; // pre($_SESSION['user_id']);die; if($_SESSION['user_id']==1){ $caregiver_id = $this->input->get('id'); $caregiver_data = $this->db->get_where('caregiver', array('id' => $caregiver_id))->row(); // $email=$caregiver_data->email; // $this->db->where('id', 1); $this->db->where('email', $caregiver_data->email)->delete('caregiver_id'); $this->db->where('user_id', $caregiver_id)->delete('caregiver_video_query'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_verification'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_step3'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_step2'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_service_mapping'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_schedule'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_patient_mapping'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_patient_clock_in_out'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_other_references'); $this->db->where('user_id', $caregiver_id)->delete('caregiver_onboard_registration_token'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_licenses'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_finger_print_status'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_experience'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_doc_expire_details'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_document_signature'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('caregiver_certificate'); $this->db->where('cg_id', $caregiver_id)->delete('caregiver_background_check'); $this->db->where('caregiver_id', $caregiver_id)->delete('caregiver_availability'); $this->db->where('id', $caregiver_id)->delete('caregiver'); $this->db->where('userid', $caregiver_id)->delete('users_documents'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('user_health_assessments'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('user_physical_assessments'); $this->db->where('caregiver_table_id', $caregiver_id)->delete('user_tuberculosis_questionnaire'); echo 'deleted'; } } function active() { $user_data = array(); $id = $this->input->get('id'); $user_data = $this->db->get_where('caregiver', array('id' => $id))->row(); $ion_user_id = $user_data->ion_user_id; $this->db->where('id', $ion_user_id); $this->db->update('users', array('active'=>1)); $this->db->where('id', $id); $this->db->update('caregiver', array('status'=>1)); $this->session->set_flashdata('feedback_success', 'Activate successfully.'); redirect('caregivers'); } function test($id){ $this->Caregiver_model->updateCaregiverApplicationPercentage($id); } function getTimeOptionByDay(){ $day = $this->input->get('day'); $caregiver_id = $this->input->get('caregiver_id'); $output=''; $DayTime=$this->Caregiver_model->getTimeByDay($day); $caregiverSchedule=$this->Caregiver_model->getCaregiverSchedule($caregiver_id); $caregiverScheduleidArr=array(); foreach($caregiverSchedule as $schedule){ $caregiverScheduleidArr[]=$schedule->schedule_master_id; } foreach($DayTime as $time){ if (in_array($time->id, $caregiverScheduleidArr)){ $disabled="disabled"; }else{ $disabled=""; } $output.=''; } echo $output; } function deleteSchedule(){ $scheduleId = $this->input->get('id'); $caregiverId = $this->input->get('caregiverId'); $update_by=$this->session->userdata('user_id'); $result=$this->Caregiver_model->deleteSchedule($scheduleId,$caregiverId,$update_by); if($result) echo 'Deleted successfully.'; else echo 'Error.'; } function caregiverEventDetails(){ $id = $this->input->get('id'); //print_r($id); $caregiverSchedule=$this->Caregiver_model->getCaregiverEventSchedule($id); foreach($caregiverSchedule as $schedule){ $sed[]=$schedule; } echo json_encode($sed,true); } function caregiverEventSave(){ $post = $this->input->post(); $created_by=$this->session->userdata('user_id'); $created_on=date ('Y-m-d H:i:s', now()); $post['created_by']=$created_by; $post['created_on']=$created_on; $post['status']=1; $this->Caregiver_model->saveCaregiverSchedule($post); print_r($post); } function caregiverEventUpdate(){ $post = $this->input->post(); $event_id=$post['event_id']; $update_by=$this->session->userdata('user_id'); $update_on=date ('Y-m-d H:i:s', now()); $data['end']=$post['end']; $data['start']=$post['start']; $data['update_by']=$update_by; $data['update_on']=$update_on; $data['status']=1; $this->Caregiver_model->updateCaregiverEventSchedule($data,$event_id); print_r($data); } function caregiverEventDelete(){ $id = $this->input->post('id'); // $event_id=$post['event_id']; // $update_by=$this->session->userdata('user_id'); // $update_on=date ('Y-m-d H:i:s', now()); // $data['end']=$post['end']; // $data['start']=$post['start']; // $data['update_by']=$update_by; // $data['update_on']=$update_on; // $data['status']=1; $this->Caregiver_model->deleteCaregiverEventSchedule($id); // ------------Send Push Notification -------------- $getFcmToken = $this->Caregiver_model->getFcmTokenByScheduleId($id); $fcm_token = $getFcmToken->fcm_token; $post_title='Notification From Admin'; $post_message='Admin delete your patient schedule'; $type='caregiver'; sendNotification($fcm_token,$post_title,$post_message,$type); // ------------Send Push Notification --------------- //print_r($post); } /**********************************************************/ public function CheckAvailability(){ //print_r($_GET);die; echo $this->Caregiver_model->CheckAvailability($_GET); } public function saveAvailability(){ //print_r($_POST);die; unset($_POST['ci_csrf_token']); $success=$this->Caregiver_model->saveAvailability($_POST); if($success){ $this->session->set_flashdata('feedback_success', 'Availability Added.'); }else{ $this->session->set_flashdata('feedback_error', 'Availability Not Added.'); } redirect('caregivers/caregiverSchedule?id='.$_POST['caregiver_id']); } function getSchedule(){ $requestData = $_REQUEST; $caregiverId=$requestData['caregiverID']; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; if (!empty($search)) { $data['schedules'] = $this->Caregiver_model->getScheduleByLimitBySearch($limit, $start, $search,$orderColumn, $orderType,$caregiverId); } else { $data['schedules'] = $this->Caregiver_model->getScheduleByLimit($limit, $start,$orderColumn,$orderType,$caregiverId); } // //$sl=1; foreach ($data['schedules'] as $schedule) { $sdate=explode(' ',$schedule->start); $edate=explode(' ',$schedule->end); $info[] = array( //$sl, $sdate[0], $sdate[1], $edate[1], $schedule->patient_id, ); //$sl++; } //echo ''.$exp_head->service_head_name.'
'; $output.=''; $output.=''; $output.=''; $output.=' '; $output.=' '; $output.=''; foreach ($experience_level as $expLbl) { //echo ''; print_r($expLbl); //foreach($exp_arr['experience_value'] as $key=>$val){ if($key == $expLbl->id){ $exp_check="checked"; }else{ $exp_check=""; } } //echo $exp_arr['experience_value'][$expLbl->id]; if(in_array($expLbl->id, $cg_exp_arr)){ $exp_check="checked"; $required='value'; }else{ $exp_check=""; $required='none'; } $output.=''; $output.=' '; $output.=' '; $output.=''; } $output.=''; //foreach($exp_arr['experience_value'] as $key=>$val){ if($key == $expLbl->id && $val == 0){ $check_value="checked"; }else{ $check_value="";} } if(isset($exp_arr['experience_value'][$expLbl->id]) && $exp_arr['experience_value'][$expLbl->id]==0){ $check_value="checked"; }else{ $check_value="";} $output.=''; $output.=''; $output.=' '; $output.=' '; $output.=''; //foreach($exp_arr['experience_value'] as $key=>$val){ if($key == $expLbl->id && $val == 1){ $check_value="checked"; }else{ $check_value="";} } if(isset($exp_arr['experience_value'][$expLbl->id]) && $exp_arr['experience_value'][$expLbl->id]==1){ $check_value="checked"; }else{ $check_value="";} $output.=''; $output.=' '; $output.=' '; $output.=''; //foreach($exp_arr['experience_value'] as $key=>$val){ if($key == $expLbl->id && $val == 2){ $check_value="checked"; }else{ $check_value="";} } if(isset($exp_arr['experience_value'][$expLbl->id]) && $exp_arr['experience_value'][$expLbl->id]==2){ $check_value="checked"; }else{ $check_value="";} $output.=''; $output.=' '; $output.=' '; $output.=''; //foreach($exp_arr['experience_value'] as $key=>$val){ if($key == $expLbl->id && $val == 3){ $check_value="checked"; }else{ $check_value="";} } if(isset($exp_arr['experience_value'][$expLbl->id]) && $exp_arr['experience_value'][$expLbl->id]==3){ $check_value="checked"; }else{ $check_value="";} $output.=''; $output.=' '; $output.=' '; $output.=''; $output.=''; print_r($date); echo ''; //die; if (!empty($data['schedules'])) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($data['schedules']), "recordsFiltered" => count($data['schedules']), "data" => $info ); } else { $output = array( // "draw" => 1, "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } function checkaddress(){ $this->load->helper('map_helper'); $address=$_GET['address'].'+'.$_GET['zipcode']; //$response=address_info($_GET['address'],$_GET['zipcode']); // $response=map_address($address); $response=mapquest_address($_GET['address'],$_GET['zipcode']); //print_r($response);die; if($response){ $response['status_code']=200; }else{ $response['status_code']=404; } echo json_encode($response); } function checkEmergencyAddress(){ $response=address_info($_GET['address'],$_GET['zipcode']); echo json_encode($response); } public function internalProcess(){ $post=$this->input->post(); $caregiver_id=$post['caregiver_id']; $folder_name='uploads/Documents/USER_'.str_pad($post['caregiver_id'], 6, "0", STR_PAD_LEFT).'/'; $uploadData['folder_name']=$folder_name; $uploadData['NAME']='chrc'; $uploadData['NEW_FILENAME_START']='DOC'; //$uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf'; $uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf'); $uploadData['CONFIG']['max_size']='20480000'; $output=fileStore($_FILES,$uploadData); $post['chrc'] = $output['NEW_FILE_NAME']; $this->Caregiver_model->updateCaregiverVerification($post); redirect($_SERVER['HTTP_REFERER']); } function saveCaregiverPhysicalExamForm(){ // $post=$this->input->post(); // echo '';print_r($post);die; $id=$_POST['id']; $physicalExamForm = array(); if($this->input->post('height_feet')!=""){ $physicalExamForm['height_feet'] = $this->input->post('height_feet'); } if($this->input->post('height_inches')!=""){ $physicalExamForm['height_inches'] = $this->input->post('height_inches'); } if($this->input->post('weight')!=""){ $physicalExamForm['weight'] = $this->input->post('weight'); } if($this->input->post('blood_pressure')!=""){ $physicalExamForm['blood_pressure'] = $this->input->post('blood_pressure'); } if($this->input->post('pulse')!=""){ $physicalExamForm['pulse'] = $this->input->post('pulse'); } if($this->input->post('respiration')!=""){ $physicalExamForm['respiration'] = $this->input->post('respiration'); } if($this->input->post('heart')!=""){ $physicalExamForm['heart'] = $this->input->post('heart'); } if($this->input->post('lungs')!=""){ $physicalExamForm['lungs'] = $this->input->post('lungs'); } if($this->input->post('muscular_skeleta')!=""){ $physicalExamForm['muscular_skeleta'] = $this->input->post('muscular_skeleta'); } if($this->input->post('gu')!=""){ $physicalExamForm['gu'] = $this->input->post('gu'); } if($this->input->post('gi')!=""){ $physicalExamForm['gi'] = $this->input->post('gi'); } if($this->input->post('ppd1_testDate')!=""){ $physicalExamForm['ppd1_testDate'] = $this->input->post('ppd1_testDate'); } if($this->input->post('ppd1_result')!=""){ $physicalExamForm['ppd1_result'] = $this->input->post('ppd1_result'); } if($this->input->post('ppd1_resultDate')!=""){ $physicalExamForm['ppd1_resultDate'] = $this->input->post('ppd1_resultDate'); } if($this->input->post('ppd2_testDate')!=""){ $physicalExamForm['ppd2_testDate'] = $this->input->post('gi'); } if($this->input->post('ppd2_result')!=""){ $physicalExamForm['ppd2_result'] = $this->input->post('ppd2_result'); } if($this->input->post('ppd2_resultDate')!=""){ $physicalExamForm['ppd2_resultDate'] = $this->input->post('ppd2_resultDate'); } if($this->input->post('xray_testDate')!=""){ $physicalExamForm['xray_testDate'] = $this->input->post('xray_testDate'); } if($this->input->post('xray_result')!=""){ $physicalExamForm['xray_result'] = $this->input->post('xray_result'); } if($this->input->post('xray_resultDate')!=""){ $physicalExamForm['xray_resultDate'] = $this->input->post('xray_resultDate'); } if($this->input->post('rubella_testDate')!=""){ $physicalExamForm['rubella_testDate'] = $this->input->post('rubella_testDate'); } if($this->input->post('rubella_result')!=""){ $physicalExamForm['rubella_result'] = $this->input->post('rubella_result'); } if($this->input->post('rubella_resultDate')!=""){ $physicalExamForm['rubella_resultDate'] = $this->input->post('rubella_resultDate'); } if($this->input->post('rubeola_testDate')!=""){ $physicalExamForm['rubeola_testDate'] = $this->input->post('rubeola_testDate'); } if($this->input->post('rubeola_result')!=""){ $physicalExamForm['rubeola_result'] = $this->input->post('rubeola_result'); } if($this->input->post('rubeola_resultDate')!=""){ $physicalExamForm['rubeola_resultDate'] = $this->input->post('rubeola_resultDate'); } if($this->input->post('rubeola_details')!=""){ $physicalExamForm['rubeola_details'] = $this->input->post('rubeola_details'); } if($this->input->post('influenza_testDate')!=""){ $physicalExamForm['influenza_testDate'] = $this->input->post('influenza_testDate'); } if($this->input->post('influenza_resultDate')!=""){ $physicalExamForm['influenza_resultDate'] = $this->input->post('influenza_resultDate'); } if($this->input->post('Diphtheria')!=""){ $physicalExamForm['Diphtheria'] = $this->input->post('Diphtheria'); } if($this->input->post('Tetanus')!=""){ $physicalExamForm['Tetanus'] = $this->input->post('Tetanus'); } if($this->input->post('Mumps')!=""){ $physicalExamForm['Mumps'] = $this->input->post('Mumps'); } if($this->input->post('RubellaVaccine')!=""){ $physicalExamForm['RubellaVaccine'] = $this->input->post('RubellaVaccine'); } if($this->input->post('MeaslesVaccine1')!=""){ $physicalExamForm['MeaslesVaccine1'] = $this->input->post('MeaslesVaccine1'); } if($this->input->post('MeaslesVaccine2')!=""){ $physicalExamForm['MeaslesVaccine2'] = $this->input->post('MeaslesVaccine2'); } if($this->input->post('HB1')!=""){ $physicalExamForm['HB1'] = $this->input->post('HB1'); } if($this->input->post('HB2')!=""){ $physicalExamForm['HB2'] = $this->input->post('HB2'); } if($this->input->post('HB3')!=""){ $physicalExamForm['HB3'] = $this->input->post('HB3'); } if($this->input->post('DrugScreen')!=""){ $physicalExamForm['DrugScreen'] = $this->input->post('DrugScreen'); } if($this->input->post('lot_num')!=""){ $physicalExamForm['lot_num'] = $this->input->post('lot_num'); } if($this->input->post('lot_exp')!=""){ $physicalExamForm['lot_exp'] = $this->input->post('lot_exp'); } if($this->input->post('due_to_pregnancy')!=""){ $physicalExamForm['due_to_pregnancy'] = $this->input->post('due_to_pregnancy'); } if($this->input->post('list_of_medications')!=""){ $physicalExamForm['list_of_medications'] = $this->input->post('list_of_medications'); } if($this->input->post('eyeglasses')!=""){ $physicalExamForm['eyeglasses'] = $this->input->post('eyeglasses'); } if($this->input->post('hearingAid')!=""){ $physicalExamForm['hearingAid'] = $this->input->post('hearingAid'); } if($this->input->post('extended_periods')!=""){ $physicalExamForm['extended_periods'] = $this->input->post('extended_periods'); } if($this->input->post('extended_periods_explain')!=""){ $physicalExamForm['extended_periods_explain'] = $this->input->post('extended_periods_explain'); } if($this->input->post('disorders')!=""){ $physicalExamForm['disorders'] = $this->input->post('disorders'); } if($this->input->post('extended_periods_explain')!=""){ $physicalExamForm['extended_periods_explain'] = $this->input->post('extended_periods_explain'); } //$physicalExamFormJson = json_encode($physicalExamForm); $data=array(); $data['physical_exam_form']=json_encode($physicalExamForm); if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$id); }; $caregiver_verification_data=$this->Caregiver_model->caregiver_verification($id); $data=array(); $verified_tab=json_decode($caregiver_verification_data->verified_tab); $verified_tab->tab2=1; $data['verified_tab']=json_encode($verified_tab); $data['caregiver_id']=$id; $this->Caregiver_model->updateCaregiverVerification($data); redirect($_SERVER['HTTP_REFERER']); // echo '';print_r($data); // die; } function saveCaregiveremployeeHealthAssessment(){ //$post=$this->input->post(); //echo '';print_r($post);die; $id=$_POST['id']; $emp_health_assesment = array(); if($this->input->post('diabetes')!=""){ $emp_health_assesment['diabetes'] = $this->input->post('diabetes'); } if($this->input->post('kidney_disease')!=""){ $emp_health_assesment['kidney_disease'] = $this->input->post('kidney_disease'); } if($this->input->post('heart_disease')!=""){ $emp_health_assesment['heart_disease'] = $this->input->post('heart_disease'); } if($this->input->post('high_blood_pressure')!=""){ $emp_health_assesment['high_blood_pressure'] = $this->input->post('high_blood_pressure'); } if($this->input->post('arthritis')!=""){ $emp_health_assesment['arthritis'] = $this->input->post('arthritis'); } if($this->input->post('mental_illness')!=""){ $emp_health_assesment['mental_illness'] = $this->input->post('mental_illness'); } if($this->input->post('epilepsy')!=""){ $emp_health_assesment['epilepsy'] = $this->input->post('epilepsy'); } if($this->input->post('swelling_extremities')!=""){ $emp_health_assesment['swelling_extremities'] = $this->input->post('swelling_extremities'); } if($this->input->post('allergies')!=""){ $emp_health_assesment['allergies'] = $this->input->post('allergies'); } if($this->input->post('back_pain')!=""){ $emp_health_assesment['back_pain'] = $this->input->post('back_pain'); } if($this->input->post('pain_urination')!=""){ $emp_health_assesment['pain_urination'] = $this->input->post('pain_urination'); } if($this->input->post('change_bowel_habit')!=""){ $emp_health_assesment['change_bowel_habit'] = $this->input->post('change_bowel_habit'); } if($this->input->post('increased_thirst')!=""){ $emp_health_assesment['increased_thirst'] = $this->input->post('increased_thirst'); } if($this->input->post('persistent_lumps')!=""){ $emp_health_assesment['persistent_lumps'] = $this->input->post('persistent_lumps'); } if($this->input->post('infectious_disease')!=""){ $emp_health_assesment['infectious_disease'] = $this->input->post('infectious_disease'); } if($this->input->post('cancer')!=""){ $emp_health_assesment['cancer'] = $this->input->post('cancer'); } if($this->input->post('other_disability')!=""){ $emp_health_assesment['other_disability'] = $this->input->post('other_disability'); } if($this->input->post('cough_3_weeks')!=""){ $emp_health_assesment['cough_3_weeks'] = $this->input->post('cough_3_weeks'); } if($this->input->post('blood_sputum')!=""){ $emp_health_assesment['blood_sputum'] = $this->input->post('blood_sputum'); } if($this->input->post('shortness_breath')!=""){ $emp_health_assesment['shortness_breath'] = $this->input->post('shortness_breath'); } if($this->input->post('night_sweat')!=""){ $emp_health_assesment['night_sweat'] = $this->input->post('night_sweat'); } if($this->input->post('chest_pain')!=""){ $emp_health_assesment['chest_pain'] = $this->input->post('chest_pain'); } if($this->input->post('unexplained_weight_loss')!=""){ $emp_health_assesment['unexplained_weight_loss'] = $this->input->post('unexplained_weight_loss'); } if($this->input->post('appetite_loss')!=""){ $emp_health_assesment['appetite_loss'] = $this->input->post('appetite_loss'); } if($this->input->post('hoarseness')!=""){ $emp_health_assesment['hoarseness'] = $this->input->post('hoarseness'); } if($this->input->post('thirst_increase')!=""){ $emp_health_assesment['thirst_increase'] = $this->input->post('thirst_increase'); } if($this->input->post('fatigue')!=""){ $emp_health_assesment['fatigue'] = $this->input->post('fatigue'); } if($this->input->post('fever')!=""){ $emp_health_assesment['fever'] = $this->input->post('fever'); } if($this->input->post('positive_ppd')!=""){ $emp_health_assesment['positive_ppd'] = $this->input->post('positive_ppd'); } if($this->input->post('ppd_explain')!=""){ $emp_health_assesment['ppd_explain'] = $this->input->post('ppd_explain'); } if($this->input->post('under_care')!=""){ $emp_health_assesment['under_care'] = $this->input->post('under_care'); } if($this->input->post('under_care_explain')!=""){ $emp_health_assesment['under_care_explain'] = $this->input->post('under_care_explain'); } if($this->input->post('change_behaviour')!=""){ $emp_health_assesment['change_behaviour'] = $this->input->post('change_behaviour'); } if($this->input->post('change_behaviour_explain')!=""){ $emp_health_assesment['change_behaviour_explain'] = $this->input->post('change_behaviour_explain'); } if($this->input->post('prescription_medications')!=""){ $emp_health_assesment['prescription_medications'] = $this->input->post('prescription_medications'); } if($this->input->post('prescription_medications_explain')!=""){ $emp_health_assesment['prescription_medications_explain'] = $this->input->post('prescription_medications_explain'); } if($this->input->post('screening_test')!=""){ $emp_health_assesment['screening_test'] = $this->input->post('screening_test'); } if($this->input->post('screening_test_explain')!=""){ $emp_health_assesment['screening_test_explain'] = $this->input->post('screening_test_explain'); } if($this->input->post('past_illness')!=""){ $emp_health_assesment['past_illness'] = $this->input->post('past_illness'); } if($this->input->post('past_illness_explain')!=""){ $emp_health_assesment['past_illness_explain'] = $this->input->post('past_illness_explain'); } if($this->input->post('name_of_physician')!=""){ $emp_health_assesment['name_of_physician'] = $this->input->post('name_of_physician'); } if($this->input->post('tel_of_physician')!=""){ $emp_health_assesment['tel_of_physician'] = $this->input->post('tel_of_physician'); } // // echo '';print_r($echo '';print_r($data);); $data=array(); $data['emp_health_assesment']=json_encode($emp_health_assesment); // echo '';print_r($data); // die; if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$id); }; $caregiver_verification_data=$this->Caregiver_model->caregiver_verification($id); $data=array(); $verified_tab=json_decode($caregiver_verification_data->verified_tab); $verified_tab->tab3=1; $data['verified_tab']=json_encode($verified_tab); $data['caregiver_id']=$id; $this->Caregiver_model->updateCaregiverVerification($data); redirect($_SERVER['HTTP_REFERER']); } function saveHapatitisB(){ //$post=$this->input->post(); //echo '';print_r($post);die; $id=$_POST['id']; $hb_form = array(); if($this->input->post('Allergies')!=""){ $hb_form['Allergies'] = $this->input->post('Allergies'); } if($this->input->post('date_of_exposure')!=""){ $hb_form['date_of_exposure'] = $this->input->post('date_of_exposure'); } if($this->input->post('location')!=""){ $hb_form['location'] = $this->input->post('location'); } if($this->input->post('type_of_exposure')!=""){ $hb_form['type_of_exposure'] = $this->input->post('type_of_exposure'); } if($this->input->post('incident_report')!=""){ $hb_form['incident_report'] = $this->input->post('incident_report'); } if($this->input->post('report_completed')!=""){ $hb_form['report_completed'] = $this->input->post('report_completed'); } if($this->input->post('Initial_Dose_Type')!=""){ $hb_form['Initial_Dose_Type'] = $this->input->post('Initial_Dose_Type'); } if($this->input->post('Initial_Dose_Date')!=""){ $hb_form['Initial_Dose_Date'] = $this->input->post('Initial_Dose_Date'); } if($this->input->post('Initial_Dose')!=""){ $hb_form['Initial_Dose'] = $this->input->post('Initial_Dose'); } if($this->input->post('Initial_Dose_Site')!=""){ $hb_form['Initial_Dose_Site'] = $this->input->post('Initial_Dose_Site'); } if($this->input->post('Initial_Dose_Type2')!=""){ $hb_form['Initial_Dose_Type2'] = $this->input->post('Initial_Dose_Type2'); } if($this->input->post('Initial_Dose_Date2')!=""){ $hb_form['Initial_Dose_Date2'] = $this->input->post('Initial_Dose_Date2'); } if($this->input->post('Initial_Dose2')!=""){ $hb_form['Initial_Dose2'] = $this->input->post('Initial_Dose2'); } if($this->input->post('Initial_Dose_Site2')!=""){ $hb_form['Initial_Dose_Site2'] = $this->input->post('Initial_Dose_Site2'); } if($this->input->post('Initial_Dose_Type3')!=""){ $hb_form['Initial_Dose_Type3'] = $this->input->post('Initial_Dose_Type3'); } if($this->input->post('Initial_Dose_Date3')!=""){ $hb_form['Initial_Dose_Date3'] = $this->input->post('Initial_Dose_Date3'); } if($this->input->post('Initial_Dose3')!=""){ $hb_form['Initial_Dose3'] = $this->input->post('Initial_Dose3'); } if($this->input->post('Initial_Dose_Site3')!=""){ $hb_form['Initial_Dose_Site3'] = $this->input->post('Initial_Dose_Site3'); } if($this->input->post('Initial_Dose_Type4')!=""){ $hb_form['Initial_Dose_Type4'] = $this->input->post('Initial_Dose_Type4'); } if($this->input->post('Initial_Dose_Date4')!=""){ $hb_form['Initial_Dose_Date4'] = $this->input->post('Initial_Dose_Date4'); } if($this->input->post('Initial_Dose4')!=""){ $hb_form['Initial_Dose4'] = $this->input->post('Initial_Dose4'); } if($this->input->post('Initial_Dose_Site4')!=""){ $hb_form['Initial_Dose_Site4'] = $this->input->post('Initial_Dose_Site4'); } if($this->input->post('lab_date1')!=""){ $hb_form['lab_date1'] = $this->input->post('lab_date1'); } if($this->input->post('lab_type1')!=""){ $hb_form['lab_type1'] = $this->input->post('lab_type1'); } if($this->input->post('lab_result1')!=""){ $hb_form['lab_result1'] = $this->input->post('lab_result1'); } if($this->input->post('lab_action1')!=""){ $hb_form['lab_action1'] = $this->input->post('lab_action1'); } if($this->input->post('lab_date2')!=""){ $hb_form['lab_date2'] = $this->input->post('lab_date2'); } if($this->input->post('lab_type2')!=""){ $hb_form['lab_type2'] = $this->input->post('lab_type2'); } if($this->input->post('lab_result2')!=""){ $hb_form['lab_result2'] = $this->input->post('lab_result2'); } if($this->input->post('lab_action2')!=""){ $hb_form['lab_action2'] = $this->input->post('lab_action2'); } if($this->input->post('lab_date3')!=""){ $hb_form['lab_date3'] = $this->input->post('lab_date3'); } if($this->input->post('lab_type3')!=""){ $hb_form['lab_type3'] = $this->input->post('lab_type3'); } if($this->input->post('lab_result3')!=""){ $hb_form['lab_result3'] = $this->input->post('lab_result3'); } if($this->input->post('lab_action3')!=""){ $hb_form['lab_action3'] = $this->input->post('lab_action3'); } if($this->input->post('lab_date4')!=""){ $hb_form['lab_date4'] = $this->input->post('lab_date4'); } if($this->input->post('lab_type4')!=""){ $hb_form['lab_type4'] = $this->input->post('lab_type4'); } if($this->input->post('lab_result4')!=""){ $hb_form['lab_result4'] = $this->input->post('lab_result4'); } if($this->input->post('lab_action4')!=""){ $hb_form['lab_action4'] = $this->input->post('lab_action4'); } $data=array(); $data['hb_form']=json_encode($hb_form); // echo '';print_r($data); // die; if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$id); }; $caregiver_verification_data=$this->Caregiver_model->caregiver_verification($id); $data=array(); $verified_tab=json_decode($caregiver_verification_data->verified_tab); $verified_tab->tab4=1; $data['verified_tab']=json_encode($verified_tab); $data['caregiver_id']=$id; $this->Caregiver_model->updateCaregiverVerification($data); redirect($_SERVER['HTTP_REFERER']); } public function smail() { $data = array(); $tomail = $_REQUEST['tomail']; $cg_id = $_REQUEST['cg_id']; $token = md5($cg_id); $data['user_email'] = $tomail; $data['user_id'] = $cg_id; $data['token'] = $token; $this->Caregiver_model->saveOnboardToken($data); // Save token to database cgq_email($tomail,'caregiver exam',$token); // Send Push Notification $getFcmToken = $this->Caregiver_model->getFcmToken($cg_id); $fcm_token = $getFcmToken->fcm_token; $post_title='Notification From Admin'; $post_message='Onboarding Link has been sent by the admin'; $type='caregiver'; sendNotification($fcm_token,$post_title,$post_message,$type); } function onboardHistory($id="") { $decode_uri = urldecode($id); $decoded_base64_id = base64_dec($decode_uri); $array_str = explode("_",$decoded_base64_id); $data['cgid'] = $array_str[0]; $data['cgtype'] = $array_str[1]; $tokenAssgnVideo = $this->Caregiver_model->videoAssigned($data['cgid']); $data['assignVideo'] = json_decode($tokenAssgnVideo->videos); $data['vList'] = $this->Caregiver_model->getVideoInteractionList($data['cgtype'],$data['cgid']); $this->load->view('home/dashboard'); // just the header file $this->load->view('onboardHistory',$data); $this->load->view('home/footer'); // just the header file } function onboardDisclosure($id="") { $decode_uri = urldecode($id); $decoded_base64_id = base64_dec($decode_uri); $array_str = explode("_",$decoded_base64_id); $data['cgid'] = $array_str[0]; $data['cgtype'] = $array_str[1]; $caregiver_data=$this->Caregiver_model->getNurseById($data['cgid']); $data['type']=$this->Caregiver_model->typeOfCaregiver($caregiver_data->qualification_type,$caregiver_data->employee_type); $this->load->model('onboarding/Onboarding_model'); $data['disclosure']=$this->Onboarding_model->getOnboardingDisclosure($data['cgid'],$caregiver_data->ion_user_id,$data['type']); $data['email']=$caregiver_data->email; // _die($data['disclosure']); // $tokenAssgnVideo = $this->Caregiver_model->videoAssigned($data['cgid']); // $data['assignVideo'] = json_decode($tokenAssgnVideo->videos); // $data['vList'] = $this->Caregiver_model->getVideoInteractionList($data['cgtype'],$data['cgid']); $this->load->view('home/dashboard'); // just the header file $this->load->view('onboard_disclosure',$data); $this->load->view('home/footer'); // just the header file } function verify_onboarding_disclosure(){ $post=$this->input->post(); $res=$this->Caregiver_model->verifyDisclosure($post['caregiver_id'],$post['short_code']); // pre($res); if($res){ $respArray = array( 'status' => 'success', 'status_code'=>200, 'msg' => 'Successfully verified' ); echo json_encode($respArray); } } function chatHistory($videoId,$cgId) { $data['chistory'] = $this->Caregiver_model->getVideoInteractionChatHistory($videoId,$cgId); $data['nurse']=$this->Caregiver_model->getNurseById($cgId); $this->load->view('home/dashboard'); // just the header file $this->load->view('chatHistory',$data); $this->load->view('home/footer'); // just the header file } public function quizResult($videoId,$cgId) { $data['quizResult'] = $this->onboardModel->getQuizResult($videoId,"",$cgId); $data['quizResultPercentage'] = $this->onboardModel->getQuizResultPrecent($videoId,"",$cgId); // _die($data['quizResultPercentage']); $this->load->view('home/dashboard'); // just the header file $this->load->view('quizResult',$data); $this->load->view('home/footer'); // just the header file } public function getVideoList() { $requestData = $_REQUEST; $start = $requestData['start']; $cgtype = $requestData['cgtype']; $cgid = $requestData['cgid']; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; $search = $this->input->post('search')['value']; if (!empty($search)) { $data['name'] = $this->Caregiver_model->getVideoByLimitBySearch($limit, $start, $search,$orderColumn, $orderType,$cgtype ,$cgid); } else { $data['name'] = $this->Caregiver_model->getvideoByLimit($limit, $start, $orderColumn, $orderType,$cgtype ,$cgid); } $listCount = sizeof($data['name']); foreach ($data['name'] as $data) { static $slno = 1; $statusChk = ''; if($data->status == "0"){ $statusChk = ''; }else{ $statusChk = 'checked'; } $options1 = '' . lang('Chat History') .' '; $options2 = '' . lang('Quiz result') .' '; $info[] = array( $slno, $data->video_slug, $data->video_title, $options1 . ' ' . $options2 ); $slno++; } if ($listCount > 0) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($this->Caregiver_model->name_list()), "recordsFiltered" => count($this->Caregiver_model->name_list()), "data" => $info ); } else { $output = array( // "draw" => 1, "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } /* Caregiver Compliance */ public function compliance(){ $this->load->view('home/dashboard'); // just the header file $this->load->view('compliance_list'); $this->load->view('home/footer'); } function getCaregiverList() { $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = ""; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; if(!empty($this->input->post('search')['value'])){ $search = $this->input->post('search')['value']; } $data['caregiver'] = $this->Caregiver_model->getAllCaregiverList($limit, $start, $orderColumn, $orderType, $search); $dataCount = $this->Caregiver_model->getAllCaregiverListCount($limit, $start, $orderColumn, $orderType, $search); $baseUrl=base_url(); $sr=0; // _die($data['caregiver']); foreach ($data['caregiver'] as $caregiver) { $skill_name=$this->Caregiver_model->getSkillNameByid($caregiver->qualification_type); if ($this->ion_auth->in_group(array('admin','Coordinator'))) { $options1 = ' ' . lang('Show Docs') . ''; //$options1 = ' ' . lang('Show Docs') . ''; } $sr++; $info[] = array( // $caregiver->id, $sr, $skill_name, $caregiver->fname.' ' .$caregiver->lname, $caregiver->email, $caregiver->phone, $options1 ); } if (!empty($dataCount)) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($dataCount), "recordsFiltered" => count($dataCount), "data" => $info ); } else { $output = array( "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } public function show_docs($id=null){ $caregiver_id = base64_dec($id); // $id=$_GET['id']; $data['nurse']=$this->Caregiver_model->getNurseById($caregiver_id); // _die($data); $this->load->view('home/dashboard'); // just the header file $this->load->view('caregiver_doc_list',$data); $this->load->view('home/footer'); } function getCaregiverDocList() { $requestData = $_REQUEST; // _die($requestData); $start = $requestData['start']; $limit = $requestData['length']; $search = ""; $orderColumn=$requestData['order'][0]['column']; $orderType=$requestData['order'][0]['dir']; $caregiver_id = $requestData['caregiver_id']; if(!empty($this->input->post('search')['value'])){ $search = $this->input->post('search')['value']; } $nurse=$this->Caregiver_model->getNurseById($caregiver_id); $data['caregiver_doc'] = $this->Caregiver_model->getAllCaregiverDocs($caregiver_id,$limit, $start, $orderColumn, $orderType, $search); $dataCount = $this->Caregiver_model->getAllCaregiverDocsCount($caregiver_id,$limit, $start, $orderColumn, $orderType, $search); $baseUrl=base_url(); $sr=0; // _die($data['caregiver_doc']); foreach ($data['caregiver_doc'] as $caregiver) { if($caregiver->path !='' && $caregiver->file_name !=''){ $file =$baseUrl.$caregiver->path.$caregiver->file_name; }else{ $file = '#'; } if ($this->ion_auth->in_group(array('admin','Coordinator'))) { $options1 =''; // $options1 = ' ' . lang('view') . ''; $options2 = ' ' . lang('Update') . ' '; $options3 = ' ' . lang('Notify') . ''; } if($caregiver->date_completed!=null) { $date_completed = date("d-m-Y",strtotime($caregiver->date_completed)); } else { $date_completed = "Not set"; } if($caregiver->expiration_date!=null) { $expiration_date = date("d-m-Y",strtotime($caregiver->expiration_date)); } else { $expiration_date = "Not set"; } if($caregiver->file_name!=null){ $doc_uploaded = ' ' . lang('yes') . ''; }else{ $doc_uploaded = 'No'; } $sr++; $info[] = array( // $caregiver->id, $sr, $caregiver->documents_type, $caregiver->name, $doc_uploaded, $date_completed, $expiration_date, $options1.' ' .$options2.''.$options3 ); } if (!empty($dataCount)) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => count($dataCount), "recordsFiltered" => count($dataCount), "data" => $info ); } else { $output = array( "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } public function documents_update() { // pre($_POST);pre($_FILES);die; $ionid=$this->input->post('Ion_id'); $id=$this->input->post('id'); $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); $savetime=date ('Y-m-d H:i:s', now()); $doc_type=$this->input->post('doc_type'); $documentId=$this->input->post('doc_id'); $progress=$this->input->post('progress'); $usertype='Caregiver'; $folder_name='USER_'.str_pad($ionid, 6, "0", STR_PAD_LEFT); if (!is_dir('uploads/Documents/'.$folder_name)) { mkdir('./uploads/Documents/' . $folder_name, 0777, TRUE); } $uploadto="uploads/Documents/".$folder_name."/"; // pre($_FILES); if($_FILES[$doc_type]['name']){ if($_FILES[$doc_type]['name']){ //echo ''; print_r($this->input->post()); echo '';die; $file_name = $_FILES[$doc_type]['name']; $file_name_pieces = explode('.', $file_name); // pre($file_name_pieces);die; $count=count($file_name_pieces); $new_file_name = $doc_type.'_'.str_pad($ionid, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces[$count-1]; if($doc_type==_DOC_PHOTOCODE_){ $config = array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg", 'overwrite' => False, 'max_size' => "20480000", //'max_height' => "1768", //'max_width' => "2024" ); }else{ $config = array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg|pdf", 'overwrite' => False, 'max_size' => "20480000", //'max_height' => "1768", //'max_width' => "2024" ); } $this->load->library('Upload', $config); $this->upload->initialize($config); if ($this->upload->do_upload($doc_type)) { $path = $this->upload->data(); //$photo = $path['file_name']; } } if($path['file_name']!=""){ if($path['file_name']!=""){ $data = array( 'ion_user_id' => $ionid, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $path['file_name'], 'originalfilename' => $_FILES[$doc_type]['name'], 'documents_type' => $doc_type ); } // pre($data);die; $caregiverPer = json_decode($caregiver_data->from_tab_status_pctg); $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($ionid,$doc_type); // if($check_doc_exsist==0){ // $caregiver_details=$this->Caregiver_model->getNurseById($id); // $caregiverPer = json_decode($caregiver_details->from_tab_status_pctg); // if($doc_type==_DOC_PCACODE_){ // $caregiverPer->form11 = $caregiverPer->form11 + 2; // }else if($doc_type==_DOC_OTHERCODE_){ // $caregiverPer->form11 = $caregiverPer->form11; // }else if($doc_type==_DOC_SIDCODE_){ // $caregiverPer->form11 = $caregiverPer->form11; // }else if($doc_type==_DOC_SIDBACK_){ // $caregiverPer->form11 = $caregiverPer->form11; // }else if($doc_type==_DOC_PROFETIONAL_REFERENCE || $doc_type==_DOC_REFCODE_){ // // $doc1=$this->Caregiver_model->checkDocumentsExsist($ionid, _DOC_PROFETIONAL_REFERENCE); // if($doc_type==_DOC_PROFETIONAL_REFERENCE){ // $doc=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_REFCODE_); // }else{ // $doc=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_PROFETIONAL_REFERENCE); // } // if($doc==1){ // $caregiverPer->form11 = $caregiverPer->form11 + 1; // }else{ // $caregiverPer->form11 = $caregiverPer->form11; // } // } // else{ // $caregiverPer->form11 = $caregiverPer->form11 + 1; // } // //pr($caregiverPer);die; // $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); // $process= json_encode($caregiverPer); // if($caregiver_data->form_status<11) // $form_status=11; // else // $form_status=$caregiver_data->form_status; // $caregiverUpdate=array( // 'from_tab_status_pctg' => $process, // 'form_status' => $form_status, // ); // // pr($caregiverUpdate);die; // $this->Caregiver_model->updateNurse($id,$caregiverUpdate); // } // $doc1=$this->Caregiver_model->checkDocumentsExsist($ionid, _DOC_PROFETIONAL_REFERENCE); // $doc2=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_REFCODE_); $this->Caregiver_model->deleteNursePreDocuments($documentId); $documentId = $this->Caregiver_model->addNurseDocuments($data); if($path['file_name']!=""){ $activitydata = array( 'activity_description' => $doc_type .' Upload', 'request_data' => $path['file_name'], 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); } $this->Home_model->activity_log($activitydata); } }else{ // if($doc_type==_DOC_COVID_ || $doc_type==_DOC_DIPHTHERIA_CODE_ || $doc_type==_DOC_TETANUS_CODE_ || $doc_type==_DOC_MUMPS_CODE_ || $doc_type==_DOC_VAR_CODE_){ // $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($ionid,$doc_type); // if($check_doc_exsist==0){ // $caregiver_details=$this->Caregiver_model->getNurseById($id); // $caregiverPer = json_decode($caregiver_details->from_tab_status_pctg); // $caregiverPer->form11 = $caregiverPer->form11 + 1; // $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); // $process= json_encode($caregiverPer); // if($caregiver_data->form_status<11) // $form_status=11; // else // $form_status=$caregiver_data->form_status; // $caregiverUpdate=array( // 'from_tab_status_pctg' => $process, // 'form_status' => $form_status, // ); // $this->Caregiver_model->updateNurse($id,$caregiverUpdate); // } // $this->Caregiver_model->deleteNursePreDocuments($documentId); // $data = array( // 'ion_user_id' => $ionid, // 'userid' => $id, // 'user_type' => $usertype, // 'documents_type' => $doc_type // ); // $documentId = $this->Caregiver_model->addNurseDocuments($data); // $activitydata = array( // 'activity_description' => $doc_type .' Upload', // 'request_data' => '', // 'activity_user_id' => $ionid, // 'activity_user_type' => $usertype, // 'activity_time' => $savetime, // 'activity_page' => $_SERVER['REQUEST_URI'], // ); // $this->Home_model->activity_log($activitydata); // } } // pre($documentId);die; if($documentId){ // $remarks=$this->input->post($doc_type.'_remarks'); // $documents_no=$this->input->post($doc_type.'_documents_no'); $date_completed=$this->input->post('date_completed'); $expire_date=$this->input->post('expire_date'); $data = array( 'date_completed' => $date_completed, 'expiration_date'=>$expire_date ); $this->Caregiver_model->updateNurseDocuments($data,$documentId); // $haveExpireDoc=array("SFI","MIC","CPR"); // if(in_array($doc_type, $haveExpireDoc)){ // docExpireDate($id,$doc_type,null,$remarks); // } // $haveCompletedDoc=array("EHA","HBV","DSC"); // if(in_array($doc_type, $haveCompletedDoc)){ // docExpireDate($id,$doc_type,$remarks,null); // } // $activitydata = array( // 'activity_description' => $doc_type .' Remarks Update', // 'request_data' => serialize($_REQUEST), // 'activity_user_id' => $ionid, // 'activity_user_type' => $usertype, // 'activity_time' => $savetime, // 'activity_page' => $_SERVER['REQUEST_URI'], // ); // $this->Home_model->activity_log($activitydata); $output=array( 'upload'=>'success', 'msg'=>'Updated Successfully.', 'file_url'=>$uploadto.$path['file_name'], ); echo json_encode($output); // redirect('Caregivers/show_docs?'); // $this->session->set_flashdata('feedback_success', 'Updated Successfully.'); }else{ $output=array( 'upload'=>'failed', 'msg'=>'Check File Type.', 'file_url'=>$uploadto.$path['file_name'], ); echo json_encode($output); // $this->session->set_flashdata('feedback_error', 'Updated Successfully.'); } } public function doc_mail() { $tomail = $_REQUEST['tomail']; $cg_id = $_REQUEST['cg_id']; $doc_id = $_REQUEST['doc_id']; $getDocDetails = $this->Caregiver_model->getDocDetails($doc_id); $nurse=$this->Caregiver_model->getNurseById($cg_id); $cg_name = $nurse->fname.''.$nurse->lname; // $message = html_entity_decode($getDocDetails->message); $expiration_date = date("d-m-Y",strtotime($getDocDetails->expiration_date)); $val =str_replace("{name}",$cg_name,$getDocDetails->message); $message =str_replace("{expire_date}",$expiration_date,$val); // _die($getDocDetails); $subject = $getDocDetails->subject ? $getDocDetails->subject : $getDocDetails->name.' has expire!'; cgdoc_email($tomail,$subject,$message); // Send Push Notification // $getFcmToken = $this->Caregiver_model->getFcmToken($cg_id); // $fcm_token = $getFcmToken->fcm_token; // $post_title='Notification From Admin'; // $post_message='Onboarding Link has been sent by the admin'; // $type='caregiver'; // sendNotification($fcm_token,$post_title,$post_message,$type); } /* Caregiver Compliance */ public function send_caregiver_mail(){ // _die($_POST); $tomail = $this->input->post('to_mail'); $subject = $this->input->post('subject'); $message = $this->input->post('msg'); $ionid = $this->input->post('Ion_id'); $usertype = 'Admin'; cgdoc_email($tomail,$subject,$message); // _die(cgdoc_email($tomail,$subject,$message)); $activitydata = array( 'activity_description' => 'Mail Send', 'request_data' => $message, 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_page' => $_SERVER['REQUEST_URI'], ); activity_log($activitydata); $this->session->set_flashdata('feedback_success', 'Mail send successfully.'); redirect('caregivers'); } public function change_verification_status(){ // _die($_POST); // _die( $this->session->userdata('user_id')); $tab_type = $this->input->post('tab_type'); $cg_id = $this->input->post('cg_id'); $verified_id = $this->session->userdata('user_id'); $data = array( 'tab_type' => $tab_type, 'caregiver_table_id' => $cg_id, 'verification_date' => date ('Y-m-d', now()), 'verified_by' => $verified_id, 'status' => 1 ); $this->Caregiver_model->save_verification_statu($data); } public function save_caregiver_info(){ // pre($_POST);pre($_FILES);die; $primary_language = $this->input->post('primary_langualge'); if(($primary_language)!=""){ $primary_language=implode("/",$primary_language); } $id = $this->input->post('id'); $ionid=$this->input->post('Ion_id'); $doc_type=$this->input->post('doc_type'); $documentId=$this->input->post('doc_id'); $usertype='Caregiver'; $savetime=date ('Y-m-d H:i:s', now()); $data = array(); if(empty($id)) { //die; $this->session->set_flashdata('feedback_error', 'Data Saving Error.'); redirect($_SERVER['HTTP_REFERER']); } else { if($this->input->post('fname')!=""){ $data['fname'] = $this->input->post('fname'); } if($this->input->post('mid_name')!="" || $this->input->post('mid_name')==""){ $data['mid_name'] = $this->input->post('mid_name'); } if($this->input->post('lname')!=""){ $data['lname'] = $this->input->post('lname'); } if($this->input->post('email')!=""){ $data['email'] = $this->input->post('email'); } if($this->input->post('dob')!=""){ $data['dob'] = $this->input->post('dob'); } if($this->input->post('hire_date')!=""){ $data['hire_date'] = $this->input->post('hire_date'); } if($this->input->post('qualification_type')!=""){ $data['qualification_type'] = $this->input->post('qualification_type'); } if($this->input->post('address')!=""){ $data['address'] = $this->input->post('address'); } if($this->input->post('phone')!=""){ $data['phone'] = $this->input->post('phone'); } if($this->input->post('primary_langualge')!=""){ $data['primary_langualge'] = $primary_language; } if($this->input->post('eye_color')!=""){ $data['eye_color'] = $this->input->post('eye_color'); } if($this->input->post('hair_color')!=""){ $data['hair_color'] = $this->input->post('hair_color'); } if($this->input->post('address1')!=""){ $data['address1'] = $this->input->post('address1'); } // if($this->input->post('direction1')!=""){ $data['direction1'] = $this->input->post('direction1'); } if($this->input->post('state1')!=""){ $data['state1'] = $this->input->post('state1'); } if($this->input->post('county1')!=""){ $data['county1'] = $this->input->post('county1'); } if($this->input->post('zipcode1')!=""){ $data['zipcode1'] = $this->input->post('zipcode1'); } if($this->input->post('apt1')!=""){ $data['apartment1'] = $this->input->post('apt1'); } if($this->input->post('city1')!=""){ $data['city1'] = $this->input->post('city1'); } if($this->input->post('lang1')!=""){ $data['lang1'] = $this->input->post('lang1'); } if($this->input->post('long1')!=""){ $data['long1'] = $this->input->post('long1'); } if($this->input->post('gender')!=""){ $data['gender'] = $this->input->post('gender'); } if($this->input->post('ethnicity')!=""){ $data['ethnicity'] = $this->input->post('ethnicity'); } if($this->input->post('referral_source')!=""){ $data['referral_source'] = $this->input->post('referral_source'); } if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver',$data,$id); }; $data1 = array(); if($this->input->post('employee_type')!=""){ $data1['employee_type'] = $this->input->post('employee_type'); } if($this->input->post('country_of_birth')!=""){ $data1['country_of_birth'] = $this->input->post('country_of_birth'); } if(!empty($data1)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step3',$data1,$id); }; $data2 = array(); $physicalExamForm = array(); if($this->input->post('height_feet')!=""){ $physicalExamForm['height_feet'] = $this->input->post('height_feet'); } if($this->input->post('height_inches')!=""){ $physicalExamForm['height_inches'] = $this->input->post('height_inches'); } if($this->input->post('weight')!=""){ $physicalExamForm['weight'] = $this->input->post('weight'); } $physicalExamFormJson = json_encode($physicalExamForm); if($physicalExamFormJson!=""){ $data2['physical_exam_form'] = $physicalExamFormJson; } if(!empty($data2)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data2,$id); }; // File Upload $folder_name='USER_'.str_pad($ionid, 6, "0", STR_PAD_LEFT); if (!is_dir('uploads/Documents/'.$folder_name)) { mkdir('./uploads/Documents/' . $folder_name, 0777, TRUE); } $uploadto="uploads/Documents/".$folder_name."/"; if($_FILES[$doc_type]['name']){ //echo ''; print_r($this->input->post()); echo '';die; $file_name = $_FILES[$doc_type]['name']; $file_name_pieces = explode('.', $file_name); // pre($file_name_pieces);die; $count=count($file_name_pieces); $new_file_name = $doc_type.'_'.str_pad($ionid, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces[$count-1]; if($doc_type==_DOC_PHOTOCODE_){ $config = array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg", 'overwrite' => False, 'max_size' => "20480000", //'max_height' => "1768", //'max_width' => "2024" ); } $this->load->library('Upload', $config); $this->upload->initialize($config); if ($this->upload->do_upload($doc_type)) { $path = $this->upload->data(); //$photo = $path['file_name']; } if($path['file_name']!="" ){ $data = array( 'ion_user_id' => $ionid, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $path['file_name'], 'originalfilename' => $_FILES[$doc_type]['name'], 'documents_type' => $doc_type ); // pre($data);die; $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($ionid,$doc_type); // $doc1=$this->Caregiver_model->checkDocumentsExsist($ionid, _DOC_PROFETIONAL_REFERENCE); // $doc2=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_REFCODE_); $this->Caregiver_model->deleteNursePreDocuments($documentId); $documentId = $this->Caregiver_model->addNurseDocuments($data); $activitydata = array( 'activity_description' => $doc_type .' Upload', 'request_data' => $path['file_name'], 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); $this->Home_model->activity_log($activitydata); } } $this->session->set_flashdata('feedback_success', 'caregiver Information Updated.'); redirect($_SERVER['HTTP_REFERER']); } } public function save_us_authorization(){ $id = $this->input->post('id'); $ionid=$this->input->post('Ion_id'); if(empty($id)) { //die; $this->session->set_flashdata('feedback_error', 'Data Saving Error.'); redirect($_SERVER['HTTP_REFERER']); } else { $data = array(); $citizen = array( 'citizen'=>$this->input->post('citizen'), 'remain_permanently'=>$this->input->post('remain_permanently'), 'authorization_to_work'=>$this->input->post('authorization_to_work'), 'involved_as_defendant'=>$this->input->post('involved_as_defendant'), 'involved_as_defendant_explain'=>$this->input->post('involved_as_defendant_explain'), 'convicted'=>$this->input->post('convicted'), 'convicted_crime_explain'=>$this->input->post('convicted_crime_explain'), 'convicted_for_negligence'=>$this->input->post('convicted_for_negligence'), 'negligence_explain'=>$this->input->post('negligence_explain'), 'criminal_convictions'=>$this->input->post('criminal_convictions'), 'criminal_convictions_details'=>$this->input->post('criminal_convictions_details')); $citizenJson = json_encode($citizen); if($this->input->post('citizen')!=""){ $data['citizen'] = $citizenJson; } if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$id); }; $soc_data = array(); if($this->input->post('soc_sec')!=""){ $soc_data['soc_sec'] = $this->input->post('soc_sec'); } if(!empty($soc_data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver',$soc_data,$id); }; $this->session->set_flashdata('feedback_success', 'U.S. Work Authorization Successfully Updated.'); redirect($_SERVER['HTTP_REFERER']); } } /* | get modals Data (in Accpetence Page) */ function getVaccineUpdateModalFromAcceptencePg() { $cg_id=$_GET['cg_id']; $short_code=$_GET['short_code']; $nurse=$this->Caregiver_model->getNurseById($cg_id); $documents=$this->Caregiver_model->getNurseDocuments($nurse->ion_user_id); foreach($documents as $document){ $documentsid[$document->documents_type][]=$document->id; $date_completed[$document->documents_type][]=$document->date_completed; } $data['vaccine_doc']=$this->Caregiver_model->getVaccineDoc($cg_id); foreach($data['vaccine_doc'] as $doc){ if($doc->short_code==$short_code){ $remarks=$doc->remarks; } } // $remarks=1; $show_hide=''; $require=""; if($remarks==1 || $remarks==2 || $remarks==3 || $remarks==4){ $check1="checked"; $show_hide=''; $require="required"; }else{ $check1=""; } if($remarks==0){ $check2="checked"; $show_hide='style="display:none;"'; $require=""; }else{ $check2=""; } if($short_code==_DOC_COVID_){ $question="Covid-19 Vaccine"; }else if($short_code==_DOC_DIPHTHERIA_CODE_){ $question="Diphtheria Vaccine"; }else if($short_code==_DOC_FLU_VACCINECODE_){ $question="Flu Vaccine"; }else if($short_code==_DOC_MUMPS_CODE_){ $question="Mumps Vaccine"; }else if($short_code==_DOC_RUBELLACODE_){ $question="Rubella Vaccine"; }else if($short_code==_DOC_RBO_CODE_){ $question="Rubeola Vaccine"; }else if($short_code==_DOC_TETANUS_CODE_){ $question="Tetanus Vaccine"; }else if($short_code==_DOC_RRM_CODE_){ $question="RRM Vaccine"; }else if($short_code==_DOC_TDAP_CODE_){ $question="TDAP Vaccine"; }else if($short_code==_DOC_CHICKENPOXCODE_){ $question="Varicella/Chickenpox Vaccine"; }else{ $question="#"; } $row_html1=''; $que_html=""; if($short_code==_DOC_COVID_){ $slct0=$slct1=$slct2=$slct3=$slct4=""; if($remarks==0){$slct0="selected";} if($remarks==1){$slct1="selected";} if($remarks==2){$slct2="selected";} if($remarks==3){$slct3="selected";} if($remarks==4){$slct4="selected";} $que_html.=''; $html=$row_html1.$que_html.$file_html.$comDate_html.$row_html2; $doc_id=$documentsid[$short_code][0]; $response=[ 'status'=>'1', 'info'=>$html, 'doc_type'=>$short_code, 'doc_id'=>$doc_id, ]; echo json_encode($response); } function getReferencesUpdateModalFromAcceptencePg() { $cg_id=$_GET['cg_id']; $body_target=$_GET['body_target']; $data_type=$_GET['data_type']; $other_ref_id=$_GET['other_ref_id']; $nurse=$this->Caregiver_model->getNurseById($cg_id); $documents=$this->Caregiver_model->getNurseDocuments($nurse->ion_user_id); foreach($documents as $document){ $documentsid[$document->documents_type][]=$document->id; } $other_ref=$this->Caregiver_model->getOtherReferences3($other_ref_id); // pre($other_ref_id); $html=""; if($data_type=="add"){ $modal_title="Add References"; $name='other_References_Name'; $add='other_References_Address'; $tel='other_References_Telephone'; $file=_OTHER_REFERENCE_CODE; $name_val=""; $add_val=""; $tel_val=""; } if($data_type=="edit_other"){ $modal_title="Add References"; $name='other_References_Name'; $add='other_References_Address'; $tel='other_References_Telephone'; $file=_OTHER_REFERENCE_CODE; $name_val=!empty($other_ref->other_References_Name)?$other_ref->other_References_Name:""; $add_val=!empty($other_ref->other_References_Address)?$other_ref->other_References_Address:""; $tel_val=!empty($other_ref->other_References_Telephone)?$other_ref->other_References_Telephone:""; } if($data_type=="edit"){ $modal_title="Update References"; if($body_target=="professional1"){ $name='Profesonal_References_Name'; $add='Profesonal_References_Address'; $tel='Profesonal_References_Telephone'; $file=_DOC_PROFETIONAL_REFERENCE; $name_val=!empty($nurse->Profesonal_References_Name)?$nurse->Profesonal_References_Name:""; $add_val=!empty($nurse->Profesonal_References_Address)?$nurse->Profesonal_References_Address:""; $tel_val=!empty($nurse->Profesonal_References_Telephone)?$nurse->Profesonal_References_Telephone:""; } if($body_target=="professional2"){ $name='Personal_References_Name'; $add='Personal_References_Address'; $tel='Personal_References_Telephone'; $file=_DOC_REFCODE_; $name_val=!empty($nurse->Personal_References_Name)?$nurse->Personal_References_Name:""; $add_val=!empty($nurse->Personal_References_Address)?$nurse->Personal_References_Address:""; $tel_val=!empty($nurse->Personal_References_Telephone)?$nurse->Personal_References_Telephone:""; } } $html= ''; }else{ $que_class=$short_code."-remarks"; $que_id=$short_code."_remarks"; $que_name=$short_code."_remarks"; $que_html.=':'; } #file input $file_class=$short_code."-file"; $file_id=$short_code."_file"; $file_name=$short_code; $file_html=""; $file_html.=''; $file_html.=''; $file_html.=''; $file_html.=''; #file input #completed date input $cd_class=$short_code."-date-completed"; $cd_id=$short_code."_date_completed"; $cd_name=$short_code."_date_completed"; $comDate_html=""; $comDate_html.=''; $comDate_html.=''; $comDate_html.=''; $comDate_html.=''; #completed date input $row_html2=''; $doc_id=$documentsid[$file][0]; $response=[ 'status'=>'1', 'info'=>$html, 'modal_title'=>$modal_title, 'doc_type'=>$file, 'doc_id'=>$doc_id ]; echo json_encode($response); } function getNotesModal() { $cg_id=$_GET['cg_id']; $short_code=$_GET['short_code']; $notes=$this->Caregiver_model->getNotesByShortCode($cg_id,$short_code); if($notes){ $note=$notes->note; }else{ $note=""; } $html=""; $html.=''; $html.=''; // $full_name=$this->getFullNameFromShortCode($short_code); if($note==""){ $modal_title="Add Notes"; }else{ $modal_title="Edit Notes"; } $response=[ 'html'=>$html, 'modal_title'=>$modal_title ]; echo json_encode($response); } function getFullNameFromShortCode($short_code) { // if($short_code=="citizen"){ // $full_name="Citizen"; // } // if($short_code=="citizen"){ // $full_name="Citizen"; // } // if($short_code=="citizen"){ // $full_name="Citizen"; // } } function finalDocVerification() { $cg_id=$_GET['cg_id']; $res=$this->saveDocVerification($cg_id); $response=[ 'status'=>$res ]; echo json_encode($response); } function saveDocVerification($caregiver_id) { $caregiverData=$this->Caregiver_model->getNurseById($caregiver_id); $verified_by=$this->session->userdata('user_id'); $history_data=array( 'caregiver_id'=>$caregiver_id, 'verified_by'=>$verified_by, ); $vdata=array( 'verification_status'=>'docverified', 'caregiver_id'=>''.str_pad($caregiver_id, 6, "0", STR_PAD_LEFT), 'verification_date'=>$savetime, ); $this->Caregiver_model->updateNurse($caregiver_id,$vdata); // // ------------Send Push Notification -------------- // $getFcmToken=$this->Caregiver_model->getFcmToken($caregiver_id); // $fcm_token=$getFcmToken->fcm_token; // $post_title='Notification From Admin'; // $post_message='Your document has been verified by the admin'; // $type='caregiver'; // sendNotification($fcm_token,$post_title,$post_message,$type); // // ------------Send Push Notification --------------- $name=$caregiverData->fname." ".$caregiverData->lname; $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject='Caregiver approved successfully'; $emaildata['emaildata']=array( 'name'=>$name ); $to=$caregiverData->email; // $to="naransaha02@gmail.com"; $message=$this->load->view('email_template_management/cararegiver_approved',$emaildata,TRUE); send_email($from,$to,$subject,$message); return 1; } /* | get modals Data (in Accpetence Page) */ /* | Saving Data or Edited data from Accpetence Page */ function saveEditFromCaregiverAcceptencePage() { $post=$this->input->post(); unset($post['submit']); if(isset($post['form_type'])){ switch($post['form_type']){ case _VERIFY_BACKGROUND_: $resp=$this->saveBackGroundCheck($post); break; case _VERIFY_REFERENCE_: $resp=$this->saveReferences($post); break; case _VERIFY_EDUCATION_: $resp=$this->saveEducation($post); break; case _VERIFY_LICENSES_: $resp=$this->saveLicense($post); break; case _VERIFY_MALPACTICE_INS_: $resp=$this->saveMalpractice($post); break; case _VERIFY_DISCLOSURE_: $resp=$this->saveDisclosure($post); break; case _VERIFY_NPI_: $resp=$this->saveNPI($post); break; case _VERIFY_US_AUTH_: $resp=$this->saveUsAuth($post); break; case _VERIFY_VACCINE_: $resp=$this->saveVaccine($post); break; case _USER_ADDED_NOTES_: $resp=$this->saveUserNotes($post); break; // case _VERIFY_TUBER_QUES_: $resp=$this->saveTuberculosisDoc($post); break; //moli case _VERIFY_HEALTH_ASSESMENT_: $resp=$this->saveHealthAssessment($post); break; case _VERIFY_PHY_ATTESTATION_: $resp=$this->savePhysicalAttestation($post); break; case _VERIFY_TUBER_QUES_: $resp=$this->saveTuberculosisQuestionaire($post); break; case _VERIFY_PHYSICAL_EXAM_: $resp=$this->savePhysicalExamForm($post); break; case _VERIFY_DRUG_SCREEN_: $resp=$this->saveDrugScreen($post); break; case _VERIFY_CERTIFICATION_: $resp=$this->saveCertificate($post); break; //moli default: $resp=0; } } $data=[ 'response'=>$resp, ]; echo json_encode($data); } function saveBackGroundCheck($post) { if($post['perform_type']=="edit"){ $data=[]; $data['caregiver_table_id']=$post['cg_id']; $data['fingerprint_status']=$post['finger_print']; $data['submission_date']=$post['submission_date']!=""?$post['submission_date']:null; $data['submission_result']=$post['submission_result']; $data['received_date']=$post['results_receive_date']!=""?$post['results_receive_date']:null; $fingerPrintId=$this->Caregiver_model->saveFingerPrintStatus($data); $documentId=$this->saveDocument($post); $this->Caregiver_model->updateFingerPrintStatus($fingerPrintId,$documentId); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveReferences($post) { if($post['perform_type']=="add"){ if($post['other_References_Name']){ $data['other_References_Name']=$post['other_References_Name']; $data['other_References_Address']=$post['other_References_Address']; $data['other_References_Telephone']=$post['other_References_Telephone']; $data['documents_type']=$post['doc_type']; $otherRefId=$this->Caregiver_model->saveOtherReferences2($data,$post['cg_id']); $post['noDel']="yes"; $docId=$this->saveDocument($post); $otherRefId=$this->Caregiver_model->UpdateOtherReferences2($otherRefId,$docId); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } if($post['perform_type']=="edit"){ if($post['ref_type']=="professional1"){ $data['Profesonal_References_Name']=$post['Profesonal_References_Name']; $data['Profesonal_References_Address']=$post['Profesonal_References_Address']; $data['Profesonal_References_Telephone']=$post['Profesonal_References_Telephone']; } if($post['ref_type']=="professional2"){ $data['Personal_References_Name']=$post['Personal_References_Name']; $data['Personal_References_Address']=$post['Personal_References_Address']; $data['Personal_References_Telephone']=$post['Personal_References_Telephone']; $this->Caregiver_model->saveCaregiverStep('caregiver_step3',$data,$post['cg_id']); } $this->Caregiver_model->saveCaregiverStep('caregiver_step3',$data,$post['cg_id']); $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } if($post['perform_type']=="edit_other"){ $doc_type=$post['doc_type']; if($post['other_References_Name']){ $data['other_References_Name']=$post['other_References_Name']; $data['other_References_Address']=$post['other_References_Address']; $data['other_References_Telephone']=$post['other_References_Telephone']; $data['documents_type']=$post['doc_type']; $otherRefId=$post['other_ref_id']; if($_FILES[$doc_type]['name'] || $_POST['image']){ $post['noDel']="yes"; $docId=$this->saveDocument($post); $data['users_documents_id']=$docId; } $this->Caregiver_model->UpdateOtherReferences3($otherRefId,$data); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } } function saveEducation($post) { if($post['perform_type']=="edit"){ if($post['school']){ $schoolCount=count($post['school']); $school=$post['school']; for($i=0; $i<$schoolCount; $i++){ $educationBackground[$i]['school']=$post['school'][$i]; $educationBackground[$i]['location_school']=$post['location_school'][$i]; $educationBackground[$i]['edu_years']=$post['edu_years'][$i]; $educationBackground[$i]['certificate_date']=$post['certificate_date'][$i]; $educationBackground[$i]['major_subject']=$post['major_subject'][$i]; } $data['educationBackground']=json_encode($educationBackground); } $this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$post['cg_id']); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveLicense($post) { if($post['perform_type']=="edit"){ $data['nursing_license_type']=$post['nursing_license_type']; $data['nursing_license_number']=$post['nursing_license_number']; $this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$post['cg_id']); $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveMalpractice($post) { if($post['perform_type']=="edit"){ $data["malpractice_comp_name"]=$post['malpractice_comp_name']; $data["malpractice_insurence"]=$post['malpractice_insurence']; // don't know where mal nname and no will be saved $this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$post['cg_id']); $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveDisclosure($post) { if($post['perform_type']=="edit"){ $post['noDel']="yes"; $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveNPI($post) { if($post['perform_type']=="edit"){ $doc_type=$post['doc_type']; $post[$doc_type.'_remarks']=$post['npi_no']; unset($post['npi_no']); $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveUsAuth($post) { if($post['perform_type']=="edit"){ #saving citizen // _die($post); $data=[]; if($post['citizen']=='1'){ $remain_permanently=''; $auth_to_work=''; }else if($post['citizen']=='0' && $post['remain_permanently']=='1'){ $remain_permanently=$post['remain_permanently']; $auth_to_work=''; }else if($post['citizen']=='0' && $post['remain_permanently']=='0' && $post['authorization_to_work']=='1'){ $auth_to_work=$post['authorization_to_work']; $remain_permanently='0'; } $citizen=[ 'citizen'=>$post['citizen'], 'remain_permanently'=>$remain_permanently, 'authorization_to_work'=>$auth_to_work, 'involved_as_defendant'=>$post['involved_as_defendant'], 'involved_as_defendant_explain'=>$post['involved_as_defendant_explain'], 'convicted'=>$post['convicted'], 'convicted_crime_explain'=>$post['convicted_crime_explain'], 'convicted_for_negligence'=>$post['convicted_for_negligence'], 'negligence_explain'=>$post['negligence_explain'], 'criminal_convictions'=>$post['criminal_convictions'], 'criminal_convictions_details'=>$post['criminal_convictions_details'] ]; if($post['documents_type']!=""){ $data['documents_type'] = $post['documents_type']; } if($post['documents_type_c']!=""){ $data['second_documents_type'] = $post['documents_type_c']; }else{ $data['second_documents_type'] = ''; } $citizenJson=json_encode($citizen); if($post['citizen']!=""){ $data['citizen']=$citizenJson; } $this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$post['cg_id']); #saving citizen #saving social security number $data=[]; if($post['soc_sec']!=""){ $data['soc_sec']=$post['soc_sec']; } $this->Caregiver_model->saveCaregiverStep('caregiver',$data,$post['cg_id']); #saving social security number #saving document for($i=0;$i'; $html.=''; $html.=''; $html.='$value) { $post['doc_type']=$key; $post['doc_id']=$value; // _die($post); $this->saveDocument($post); } #saving document if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveVaccine($post) { if($post['perform_type']=="edit"){ $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveTuberculosisDoc($post) { if($post['perform_type']=="edit"){ $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } function saveUserNotes($post) { if($post['perform_type']=="edit"){ $data['userId']=$post['cg_id']; $data['created_by']=$this->session->userdata('user_id'); $data['updated_by']=$this->session->userdata('user_id'); $data['short_code']=$post['short_code']; $data['note']=$post['note']; $data['created_on']=gmdate("Y-m-d H:i:s"); $data['updated_on']=gmdate("Y-m-d H:i:s"); $data['status']=1; $this->Caregiver_model->saveNotes($data); return 1; } } function saveDocument($post) { $doc_type=$post['doc_type']; $id=$post['cg_id']; $progress=$post['ref-progress']; $documentId=$post['doc_id']; $usertype='Caregiver'; $savetime=date('Y-m-d H:i:s', now()); $nurse=$this->Caregiver_model->getNurseById($post['cg_id']); $ionid=$nurse->ion_user_id; $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); $folder_name='USER_'.str_pad($ionid, 6, "0", STR_PAD_LEFT); if(!is_dir('uploads/Documents/'.$folder_name)){ mkdir('./uploads/Documents/'.$folder_name, 0777, TRUE); } $uploadto="uploads/Documents/".$folder_name."/"; if($_FILES[$doc_type]['name'] || $_POST['image']){ if($_POST['image']){ $img=$_POST['image']; $image_parts=explode(";base64,", $img); $image_type_aux=explode("image/", $image_parts[0]); $image_type=$image_type_aux[1]; $image_base64=base64_decode($image_parts[1]); $file_name_pieces=uniqid().'.'.$image_type; $new_file_name=$doc_type.'_'.str_pad($ionid, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces; $file=$uploadto.$new_file_name; file_put_contents($file, $image_base64); } if($_FILES[$doc_type]['name']){ $file_name=$_FILES[$doc_type]['name']; $file_name_pieces = explode('.', $file_name); $count=count($file_name_pieces); $new_file_name=$doc_type.'_'.str_pad($ionid, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces[$count-1]; if($doc_type==_DOC_PHOTOCODE_){ $config=array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg", 'overwrite' => False, 'max_size' => "20480000", ); }else{ $config=array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg|pdf|docx", 'overwrite' => False, 'max_size' => "20480000", ); } $this->load->library('Upload', $config); $this->upload->initialize($config); if($this->upload->do_upload($doc_type)) { $path=$this->upload->data(); } } if($path['file_name']!="" || $image_base64!=""){ if($path['file_name']!=""){ $data=array( 'ion_user_id' => $ionid, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $path['file_name'], 'originalfilename' => $_FILES[$doc_type]['name'], 'documents_type' => $doc_type ); }else if($image_base64!=""){ $data = array( 'ion_user_id' => $ionid, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $new_file_name, 'originalfilename' => $file_name_pieces, 'documents_type' => $doc_type ); } $caregiverPer=json_decode($caregiver_data->from_tab_status_pctg); $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($ionid,$doc_type); if($check_doc_exsist==0){ $caregiver_details=$this->Caregiver_model->getNurseById($id); $caregiverPer=json_decode($caregiver_details->from_tab_status_pctg); if($doc_type==_DOC_PCACODE_){ $caregiverPer->form11=$caregiverPer->form11 + 2; }else if($doc_type==_DOC_OTHERCODE_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_SIDCODE_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_SIDBACK_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_PROFETIONAL_REFERENCE || $doc_type==_DOC_REFCODE_){ if($doc_type==_DOC_PROFETIONAL_REFERENCE){ $doc=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_REFCODE_); }else{ $doc=$this->Caregiver_model->checkDocumentsExsist($ionid,_DOC_PROFETIONAL_REFERENCE); } if($doc==1){ $caregiverPer->form11=$caregiverPer->form11 + 1; }else{ $caregiverPer->form11=$caregiverPer->form11; } }else if($doc_type==_DOC_CHEST_X_RAYCODE_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_TUBERCULOSIS_QUESTIONNAIRE){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_CITIZENSHIP_ONE_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_DOC_CITIZENSHIP_TWO_){ $caregiverPer->form11=$caregiverPer->form11; }else if($doc_type==_BACKGROUND_CHECK_DOC_){ $caregiverPer->form11=$caregiverPer->form11; }else if(($doc_type==_IV_CERTIFICATION) || ($doc_type==_BLS_CERTIFICATION) ||($doc_type==_ACLS_CERTIFICATION) ||($doc_type==_PALS_CERTIFICATION) ){ $caregiverPer->form11=$caregiverPer->form11; } else{ $caregiverPer->form11=$caregiverPer->form11 + 1; } $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); $process= json_encode($caregiverPer); if($caregiver_data->form_status<11){ $form_status=11; } else{ $form_status=$caregiver_data->form_status; } $caregiverUpdate=array( 'from_tab_status_pctg'=>$process, 'form_status'=>$form_status, ); $this->Caregiver_model->updateNurse($id,$caregiverUpdate); } if($post['noDel']!="" && $post['noDel']=="yes"){ }else{ $this->Caregiver_model->deleteNursePreDocuments($documentId); } $documentId=$this->Caregiver_model->addNurseDocuments($data); if($path['file_name']!=""){ $activitydata=array( 'activity_description' => $doc_type .' Upload', 'request_data' => $path['file_name'], 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); }else if($image_base64!=""){ $activitydata=array( 'activity_description' => $doc_type .' Upload', 'request_data' => $new_file_name, 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); } $this->Home_model->activity_log($activitydata); } } else{ if($doc_type==_DOC_DIPHTHERIA_CODE_ || $doc_type==_DOC_TETANUS_CODE_ || $doc_type==_DOC_MUMPS_CODE_ || $doc_type==_DOC_VAR_CODE_ || $doc_type==_DOC_NPICODE_){ $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($ionid,$doc_type); if($check_doc_exsist==0){ $caregiver_details=$this->Caregiver_model->getNurseById($id); $caregiverPer = json_decode($caregiver_details->from_tab_status_pctg); $caregiverPer->form11 = $caregiverPer->form11 + 1; $caregiver_data=$this->Caregiver_model->getNurseByIonId($ionid); $process= json_encode($caregiverPer); if($caregiver_data->form_status<11) $form_status=11; else $form_status=$caregiver_data->form_status; $caregiverUpdate=array( 'from_tab_status_pctg' => $process, 'form_status' => $form_status, ); $this->Caregiver_model->updateNurse($id,$caregiverUpdate); } $this->Caregiver_model->deleteNursePreDocuments($documentId); $data=array( 'ion_user_id' => $ionid, 'userid' => $id, 'user_type' => $usertype, 'documents_type' => $doc_type ); $documentId=$this->Caregiver_model->addNurseDocuments($data); $filePath_exist_check=$this->Caregiver_model->filePathExistCheck($documentId,$ionid,$id); if($filePath_exist_check->path=='' && $filePath_exist_check->file_name=='' ){ $get_filePath=$this->Caregiver_model->getfilePathFromPrvs($doc_type,$ionid,$id); $data_to_update=array( 'path' => $get_filePath->path, 'file_name' => $get_filePath->file_name, 'originalfilename' => $get_filePath->originalfilename, ); $this->Caregiver_model->updateNurseDocuments($data_to_update,$documentId); } $activitydata=array( 'activity_description' => $doc_type .' Upload', 'request_data' => '', 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); $this->Home_model->activity_log($activitydata); } } if($documentId){ $data=[]; if($post[$doc_type.'_documents_no']){ $documents_no=$post[$doc_type.'_documents_no']; $data["documents_no"]=$post[$doc_type.'_documents_no']; } if($post[$doc_type.'_remarks']){ $data['remarks']=$post[$doc_type.'_remarks']; } if($post[$doc_type.'_date_completed']){ $data['date_completed']=$post[$doc_type.'_date_completed']; } if($post[$doc_type.'_expire_date']){ $data['expiration_date']=$post[$doc_type.'_expire_date']; } $this->Caregiver_model->updateNurseDocuments($data,$documentId); $haveExpireDoc=array("SFI","MIC","CPR"); if(in_array($doc_type, $haveExpireDoc)){ docExpireDate($id,$doc_type,null,$remarks); } $haveCompletedDoc=array("EHA","HBV","DSC"); if(in_array($doc_type, $haveCompletedDoc)){ docExpireDate($id,$doc_type,$remarks,null); } $activitydata = array( 'activity_description' => $doc_type .' Remarks Update', 'request_data' => serialize($_REQUEST), 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); $this->Home_model->activity_log($activitydata); return $documentId; } // if($documentId){ // $remarks=$post[$doc_type.'_remarks']; // $documents_no=$post[$doc_type.'_documents_no']; // $date_completed=$post[$doc_type.'_date_completed']; // $data=array( // 'remarks' => $remarks, // 'documents_no'=>$documents_no, // 'date_completed'=>$date_completed // ); // $this->Caregiver_model->updateNurseDocuments($data,$documentId); // $haveExpireDoc=array("SFI","MIC","CPR"); // if(in_array($doc_type, $haveExpireDoc)){ // docExpireDate($id,$doc_type,null,$remarks); // } // $haveCompletedDoc=array("EHA","HBV","DSC"); // if(in_array($doc_type, $haveCompletedDoc)){ // docExpireDate($id,$doc_type,$remarks,null); // } // $activitydata = array( // 'activity_description' => $doc_type .' Remarks Update', // 'request_data' => serialize($_REQUEST), // 'activity_user_id' => $ionid, // 'activity_user_type' => $usertype, // 'activity_time' => $savetime, // 'activity_page' => $_SERVER['REQUEST_URI'], // ); // $this->Home_model->activity_log($activitydata); // } } // Moli function saveHealthAssessment($post){ $id=$post['cg_id']; $emp_health_assesment = array(); if($this->input->post('diabetes')!=""){ $emp_health_assesment['diabetes'] = $this->input->post('diabetes'); } if($this->input->post('kidney_disease')!=""){ $emp_health_assesment['kidney_disease'] = $this->input->post('kidney_disease'); } if($this->input->post('heart_disease')!=""){ $emp_health_assesment['heart_disease'] = $this->input->post('heart_disease'); } if($this->input->post('high_blood_pressure')!=""){ $emp_health_assesment['high_blood_pressure'] = $this->input->post('high_blood_pressure'); } if($this->input->post('arthritis')!=""){ $emp_health_assesment['arthritis'] = $this->input->post('arthritis'); } if($this->input->post('mental_illness')!=""){ $emp_health_assesment['mental_illness'] = $this->input->post('mental_illness'); } if($this->input->post('epilepsy')!=""){ $emp_health_assesment['epilepsy'] = $this->input->post('epilepsy'); } if($this->input->post('swelling_extremities')!=""){ $emp_health_assesment['swelling_extremities'] = $this->input->post('swelling_extremities'); } if($this->input->post('allergies')!=""){ $emp_health_assesment['allergies'] = $this->input->post('allergies'); } if($this->input->post('back_pain')!=""){ $emp_health_assesment['back_pain'] = $this->input->post('back_pain'); } if($this->input->post('pain_urination')!=""){ $emp_health_assesment['pain_urination'] = $this->input->post('pain_urination'); } if($this->input->post('change_bowel_habit')!=""){ $emp_health_assesment['change_bowel_habit'] = $this->input->post('change_bowel_habit'); } if($this->input->post('increased_thirst')!=""){ $emp_health_assesment['increased_thirst'] = $this->input->post('increased_thirst'); } if($this->input->post('persistent_lumps')!=""){ $emp_health_assesment['persistent_lumps'] = $this->input->post('persistent_lumps'); } if($this->input->post('infectious_disease')!=""){ $emp_health_assesment['infectious_disease'] = $this->input->post('infectious_disease'); } if($this->input->post('cancer')!=""){ $emp_health_assesment['cancer'] = $this->input->post('cancer'); } if($this->input->post('other_disability')!=""){ $emp_health_assesment['other_disability'] = $this->input->post('other_disability'); } // _die($emp_health_assesment); // $this->Caregiver_model->saveCaregivercertificate('caregiver_certificate',$data, $caregiver_table_id,$crt_type[$i]); if($emp_health_assesment){ $this->Caregiver_model->saveHealthCondition('user_health_assessments',$emp_health_assesment, $id); } return 1; } public function phyDocumentSave(){ // pre($_POST);pre($_FILES);die; $usertype='Caregiver'; $savetime=date ('Y-m-d H:i:s', now()); $data_type=$this->input->post('data_type'); $id=$this->input->post('id'); $Ion_id=$this->input->post('Ion_id'); $form_status=$this->input->post('form_status'); $progress=$this->input->post('progress'); $pre_update_data=$this->Caregiver_model->getNurseByIonId($Ion_id); if($pre_update_data->form_status->$form_status){ $form_status=$pre_update_data->form_status; } // pre($_POST);die; $folder_name='USER_'.str_pad($Ion_id, 6, "0", STR_PAD_LEFT); if (!is_dir('uploads/Documents/'.$folder_name)) { mkdir('./uploads/Documents/' . $folder_name, 0777, TRUE); } $uploadto="uploads/Documents/".$folder_name."/"; $doc_type=$this->input->post('doc_type'); $documentId=$this->input->post('doc_id'); if($_FILES[$doc_type]['name'] || $_POST['image']){ if($_POST['image']){ $img = $_POST['image']; $image_parts = explode(";base64,", $img); $image_type_aux = explode("image/", $image_parts[0]); $image_type = $image_type_aux[1]; $image_base64 = base64_decode($image_parts[1]); $file_name_pieces = uniqid() . '.'.$image_type; $new_file_name = $doc_type.'_'.str_pad($Ion_id, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces; $file = $uploadto . $new_file_name; file_put_contents($file, $image_base64); // pre($file);die; } if($_FILES[$doc_type]['name']){ $file_name = $_FILES[$doc_type]['name']; $file_name_pieces = explode('.', $file_name); $count=count($file_name_pieces); $new_file_name = $doc_type.'_'.str_pad($Ion_id, 6, "0", STR_PAD_LEFT).'_'.date('YmdHis').'_01.'.$file_name_pieces[$count-1]; $config = array( 'file_name' => $new_file_name, 'upload_path' => "./".$uploadto, 'allowed_types' => "gif|jpg|png|jpeg|pdf", 'overwrite' => False, 'max_size' => "20480000", //'max_height' => "1768", //'max_width' => "2024" ); $this->load->library('Upload', $config); $this->upload->initialize($config); if ($this->upload->do_upload($doc_type)) { $path = $this->upload->data(); //$photo = $path['file_name']; } } if($path['file_name']!="" || $image_base64!=""){ if($path['file_name']!=""){ $data = array( 'ion_user_id' => $Ion_id, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $path['file_name'], 'originalfilename' => $_FILES[$doc_type]['name'], 'documents_type' => $doc_type ); }else if($image_base64!=""){ $data = array( 'ion_user_id' => $Ion_id, 'userid' => $id, 'user_type' => $usertype, 'path' => $uploadto, 'file_name' => $new_file_name, 'originalfilename' => $file_name_pieces, 'documents_type' => $doc_type ); } // pre($data_type);die; $check_doc_exsist=$this->Caregiver_model->checkDocumentsExsist($Ion_id,$doc_type); if($check_doc_exsist==0){ $caregiver_data=$this->Caregiver_model->getNurseByIonId($Ion_id); $caregiverPer = json_decode($caregiver_data->from_tab_status_pctg); $caregiverPer->form11 = $caregiverPer->form11 + 0; $process= json_encode($caregiverPer); $caregiverUpdate=array( 'from_tab_status_pctg' => $process, 'form_status' => $form_status, ); //pre($caregiverUpdate);die; $this->Caregiver_model->updateNurse($id,$caregiverUpdate); } //die; $this->Caregiver_model->deleteNursePreDocuments($documentId); $documentId = $this->Caregiver_model->addNurseDocuments($data); if($path['file_name']!=""){ $data2 = array( 'documents_type' => $doc_type, 'users_documents_id' => $documentId ); $data3 = array( 'path' => $uploadto, 'file_name' => $path['file_name'], 'originalfilename' => $_FILES[$doc_type]['name'], 'type' => $doc_type , 'users_documents_id' => $documentId ); }else if($image_base64!=""){ $data2 = array( 'documents_type' => $doc_type , 'users_documents_id' => $documentId ); $data3 = array( 'path' => $uploadto, 'file_name' => $new_file_name, 'originalfilename' => $file_name_pieces, 'type' => $doc_type , 'users_documents_id' => $documentId ); } if($path['file_name']!=""){ $activitydata = array( 'activity_description' => $doc_type .' Upload', 'request_data' => $path['file_name'], 'activity_user_id' => $Ion_id, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); }else if($image_base64!=""){ $activitydata = array( 'activity_description' => $doc_type .' Upload', 'request_data' => $new_file_name, 'activity_user_id' => $Ion_id, 'activity_user_type' => $usertype, 'activity_time' => $savetime, 'activity_page' => $_SERVER['REQUEST_URI'], ); } $this->Home_model->activity_log($activitydata); } } if($data_type=='health_assessment'){ $phy_id = $this->input->post('health_assessment_id'); $this->Caregiver_model->updateHealthDocuments($data2,$id,$phy_id); }else if($data_type=='Education_Certifications'){ $certficateID=$this->input->post('certficateID'); $this->Caregiver_model->updateCertificateDocuments($data3,$id,$certficateID); } $output=array( 'response'=>1, 'upload'=>'success', 'msg'=>'Updated Successfully.', 'file_url'=>$uploadto.$path['file_name'], ); echo json_encode($output); return 1; } public function savePhysicalAttestation($post){ //Physical Assessment $physcialAssesmentArr = array(); if($this->input->post('prescription_medications')!=""){ $physcialAssesmentArr['prescription_medications']['status'] = $this->input->post('prescription_medications'); $physcialAssesmentArr['prescription_medications']['explain'] = $this->input->post('prescription_medications_explain'); } if($this->input->post('screening_test')!=""){ if($this->input->post('screening_test')==1) { $physcialAssesmentArr['screening_test']['status'] = $this->input->post('screening_test'); $physcialAssesmentArr['screening_test']['explain'] = ''; }else{ $physcialAssesmentArr['screening_test']['status'] = $this->input->post('screening_test'); $physcialAssesmentArr['screening_test']['explain'] = $this->input->post('screening_test_explain'); } } if($this->input->post('past_illness')!=""){ $physcialAssesmentArr['past_illness']['status'] = $this->input->post('past_illness'); $physcialAssesmentArr['past_illness']['explain'] = $this->input->post('past_illness_explain'); } if($this->input->post('physicaldefects')!=""){ $physcialAssesmentArr['physicaldefects']['status'] = $this->input->post('physicaldefects'); $physcialAssesmentArr['physicaldefects']['explain'] = $this->input->post('physicaldefects_explain'); } if($this->input->post('injured')!=""){ $physcialAssesmentArr['injured']['status'] = $this->input->post('injured'); $physcialAssesmentArr['injured']['explain'] = $this->input->post('injured_explain'); } if($this->input->post('defects')!=""){ $physcialAssesmentArr['defects']['status'] = $this->input->post('defects'); $physcialAssesmentArr['defects']['explain'] = $this->input->post('defects_explain'); } if($this->input->post('inVision')!=""){ $physcialAssesmentArr['inVision']['status'] = $this->input->post('inVision'); $physcialAssesmentArr['inVision']['explain'] = $this->input->post('inVision_explain'); } if($this->input->post('speach')!=""){ $physcialAssesmentArr['speach']['status'] = $this->input->post('speach'); $physcialAssesmentArr['speach']['explain'] = $this->input->post('speach_explain'); } //Physical Assessment // pre($physcialAssesmentArr);die; if($physcialAssesmentArr){ $this->Caregiver_model->savePhyAssessment('user_physical_assessments',$physcialAssesmentArr, $post['cg_id']); } if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } public function saveTuberculosisQuestionaire($post){ // _die($post); if($post['data_type'] == 'editDoc'){ $this->saveTuberculosisDoc($post); return 1; }else{ $tuberculosisArr = array(); if($this->input->post('cough_3_weeks')!=""){ $tuberculosisArr['cough_3_weeks'] = $this->input->post('cough_3_weeks'); } if($this->input->post('blood_sputum')!=""){ $tuberculosisArr['blood_sputum'] = $this->input->post('blood_sputum'); } if($this->input->post('shortness_breath')!=""){ $tuberculosisArr['shortness_breath'] = $this->input->post('shortness_breath'); } if($this->input->post('night_sweat')!=""){ $tuberculosisArr['night_sweat'] = $this->input->post('night_sweat'); } if($this->input->post('chest_pain')!=""){ $tuberculosisArr['chest_pain'] = $this->input->post('chest_pain'); } if($this->input->post('unexplained_weight_loss')!=""){ $tuberculosisArr['unexplained_weight_loss'] = $this->input->post('unexplained_weight_loss'); } if($this->input->post('appetite_loss')!=""){ $tuberculosisArr['appetite_loss'] = $this->input->post('appetite_loss'); } if($this->input->post('hoarseness')!=""){ $tuberculosisArr['hoarseness'] = $this->input->post('hoarseness'); } if($this->input->post('thirst_increase')!=""){ $tuberculosisArr['thirst_increase'] = $this->input->post('thirst_increase'); } if($this->input->post('fatigue')!=""){ $tuberculosisArr['fatigue'] = $this->input->post('fatigue'); } if($this->input->post('fever')!=""){ $tuberculosisArr['fever'] = $this->input->post('fever'); } if($tuberculosisArr){ $this->Caregiver_model->saveHealthCondition('user_tuberculosis_questionnaire',$tuberculosisArr, $post['cg_id']); } if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } } public function savePhysicalExamForm($post){ $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } public function saveDrugScreen($post){ //drugScreenArr $drugScreenArr = array(); if($this->input->post('change_behaviour')!=""){ $drugScreenArr['change_behaviour'] = $this->input->post('change_behaviour'); } if($this->input->post('change_behaviour_explain')!=""){ $drugScreenArr['change_behaviour_explain'] = $this->input->post('change_behaviour_explain'); } //drugScreenArr $drugScreenJson =json_encode($drugScreenArr); if($drugScreenJson !=""){ $data['drug_screen'] = $drugScreenJson; } if(!empty($data)) { $success=$this->Caregiver_model->saveCaregiverStep('caregiver_step2',$data,$post['cg_id']); }; $this->saveDocument($post); if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } public function update_verification_status($verification_id){ $verified_id = $this->session->userdata('user_id'); $data = array( 'verification_date' => date ('Y-m-d', now()), 'verified_by' => $verified_id, 'status' => 0 ); $this->Caregiver_model->update_verification_status($data,$verification_id); } public function getCTypeList(){ $short_code = $this->input->get('short_code'); $citizen_status = $this->input->get('citizen_status'); $output= $this->Caregiver_model->getCTypeCitizenList($short_code,$citizen_status); echo json_encode($output); } public function send_acceptance_mail(){ // _die($_POST); $tomail = $this->input->post('to_mail'); $subject = $this->input->post('subject'); $message = $this->input->post('msg'); $ionid = $this->input->post('Ion_id'); $usertype = 'Admin'; cgdoc_email($tomail,$subject,$message); // _die(cgdoc_email($tomail,$subject,$message)); $activitydata = array( 'activity_description' => 'Mail Send', 'request_data' => $message, 'activity_user_id' => $ionid, 'activity_user_type' => $usertype, 'activity_page' => $_SERVER['REQUEST_URI'], ); activity_log($activitydata); } public function saveCertificate($post){ // _die($post); if($post['data_type'] == 'DocCertificate'){ $this->saveDocument($post); }else{ $crt_type=$this->input->post('type'); $crt_status=$this->input->post('certificate_status'); $crt_certificate_number=$this->input->post('certificate_number'); $crt_certificate_exp_date=$this->input->post('certificate_exp_date'); $caregiver_table_id = $post['cg_id']; $crt_name = $this->input->post('name'); $cpr_type=$this->input->post('cpr_type'); $cpr_status=$this->input->post('cpr_status'); $cpr_certificate_number=$this->input->post('cpr_certificate_number'); $cpr_certificate_exp_date=$this->input->post('cpr_certificate_exp_date'); if($this->input->post('type')!=''){ if(count($crt_type) > 0){ for($i=0; $i Caregiver_model->saveCaregivercertificate('caregiver_certificate',$data, $caregiver_table_id,$crt_type[$i]); } } } if($cpr_type!=''){ $data1['documents_no'] = $cpr_certificate_number; $data1['expiration_date'] = $cpr_certificate_exp_date; $this->Caregiver_model->update_cpr_certificateDates($caregiver_table_id,$data1,$cpr_type); } } if($post['verification_id']){ $this->update_verification_status($post['verification_id']); } return 1; } // Moli /* | Saving Data or Edited data from Accpetence Page */ public function availableCaregivers(){ try{ $this->load->view('home/dashboard'); $this->load->view('available_caregivers'); $this->load->view('home/footer'); }catch(Exception $e){ $getMsg="Caregivers - availableCaregivers: ".$e->getMessage(); echo $getMsg; } } public function get_available_caregivers_list(){ try{ $request=(object)($this->input->post()); $data_list=[ 'start'=>$request->start, 'limit'=>$request->length, 'search'=>(isset($request->search['value'])&&!empty($request->search['value']))?($request->search['value']):"", 'order_column'=>$request->order[0]['column'], 'order_type'=>$request->order[0]['dir'], 'filter'=>$request->body['filter'] ]; $resData=$this->Caregiver_model->model_get_available_caregivers($data_list); $info=[]; $i=1; foreach($resData->data->open_cases as $data){ $info[]=[ $i, $data['service_type'], ''.$data['name'].'', $data['email'], $data['phone'], $data['main_city'].', '.$data['main_zipcode'] ]; $i++; } $response=json_encode([ "draw"=>intval($request->draw), "recordsTotal"=>$resData->data->total_count, "recordsFiltered"=>$resData->data->total_count, "data"=>$info, "query"=>$resData->data->query ]); echo $response; }catch(Exception $e){ $getMsg="Caregivers - get_available_caregivers_list: ".$e->getMessage(); echo $getMsg; } } } /* End of file nurse.php */ /* Location: ./application/modules/nurse/controllers/nurse.php */