load->library('form_validation'); $this->load->model('generate_bill/Generate_bill_model'); $this->load->model('Referral_model'); $this->load->model('patient/Patient_model'); $this->load->model('physician/Physician_model'); $this->load->model('md_order/Md_order_model'); $this->load->model('email_template_management/Email_template_model'); $this->load->helper('map_helper'); $this->load->helper('download'); // if (!$this->ion_auth->in_group('admin','Caregiver')) { // redirect('home/permission'); // } } public function index() { $this->load->view('home/dashboard'); // just the header file $this->load->view('patient'); $this->load->view('home/footer'); // just the header file } public function viewPatient() { $pid =$_GET['id']; $data['pid']=$_GET['id']; $allData = $this->Referral_model->getWherevalue($pid)[0]; $data['datas'] = $allData; $allDataIns = $this->Referral_model->getWherevalueInsInfo($pid)[0]; $data['dataIns'] = $allDataIns; /*assessment*/ $data['asmData'] = $this->Referral_model->getWhereAssessment($pid)[0]; /*assessment end*/ $this->load->view('home/dashboard'); // just the header file $this->load->view('patientView',$data); $this->load->view('home/footer'); } public function ReferralFrom($pid=null) { // if($pid==null) redirect('referral/approval'); // echo $pid;die; $pid = base64_dec($pid); // echo $pid;die; // if($this->input->get('pid')!=""){ $pid = $this->input->get('pid'); }; if ($pid != '') { $data['pid'] = $pid; $allData = $this->Referral_model->getWherevalue($pid)[0]; $data['pdata'] = $allData; $pdocsTRACH = $this->Referral_model->getPatientDoc($pid,'TRACH'); $data['TRACHdocs'] = $pdocsTRACH; $pdocsPAGD = $this->Referral_model->getPatientDoc($pid,'PAGD'); $data['PAGDdocs'] = $pdocsPAGD; $pdocsINSD = $this->Referral_model->getPatientDoc($pid,'INSD'); $data['INSDdocs'] = $pdocsINSD; // echo $allData->level_of_service; die(); $data['serviceActivityTherapy'] = servicetherapy($allData->level_of_service); // $mdData = $this->Referral_model->getWhereMdOrders($pid)[0]; // $data['mddata'] = $mdData; $insdata = $this->Referral_model->getWherevalueInsInfo($pid)[0]; $data['idata'] = $insdata; } $data['langs'] = $this->Referral_model->getLanguages(); $data['preferal'] = $this->Referral_model->getReferalSource(); $data['lvlService'] = $this->Referral_model->getLevelService(); $data['accessType'] = $this->Referral_model->getAccessType(); $data['tubes'] = $this->Referral_model->getTubeType(); $data['eleDep'] = $this->Referral_model->getEleDep(); $data['micd'] = $this->Referral_model->getICD(); $data['payerType'] = $this->Referral_model->getPayertype(); $data['vendorList'] = $this->Referral_model->getvendorLists(); $data['insuranceCompanyList'] = $this->Referral_model->insuranceCompanyList(); $data['patientList'] = $this->Referral_model->patientLists(); $data['relationList'] = $this->Referral_model->relationLists(); $data['rnId'] = $this->Referral_model->getValueFrom('master_cg_skills','name','RN')[0]->id; $data['lnpId'] = $this->Referral_model->getValueFrom('master_cg_skills','name','LNP')[0]->id; $data['dataIns'] = $this->Referral_model->getWherevalueInsInfo($pid)[0]; #service for specific choosen Level of Service needed $data['type_of_service_need']=$this->Referral_model->getServiceHeads($id="",$data['pdata']->level_of_service); #service for specific choosen Level of Service needed // pre($data['pdata']);die(); $this->load->view('home/dashboard'); $this->load->view('edit_referral',$data); $this->load->view('home/footer'); } public function editReferal() { // pre($this->input->post());die(); if($this->input->post('pid')!=""){$pid = $this->input->post('pid');} if ($pid == ''){ $email=$this->input->post('email'); $fname=$this->input->post('fname'); $lname=$this->input->post('lname'); #if patient do not have email then create custom one if($email==""){ for($i=1; $i<99999; $i++){ $email=$fname.$i."@hms.com"; $checkEmail=$this->Referral_model->checkMail($email); if($checkEmail==0){if($this->ion_auth->email_check($email)){continue;}else{break;}}else{continue;} } } #if patient do not have email then create custom one #Registration to the patient_details table & to the other tables related to the patient $data = array(); $pctg = array(); $pctg['form1']=0;$pctg['form2']=0;$pctg['form3']=0;$pctg['form4']=0;$pctg['form5']=0;$pctg['form6']=0; $data['patient_id'] = rand(10000,99999); if($this->input->post('fname')!=""){ $data['first_name'] = $this->input->post('fname'); }if($this->input->post('form_status')!=""){ $data['from_tab_status'] = json_encode(array($this->input->post('form_status'))); $data['from_tab_status_pctg'] = json_encode($pctg); }if ($this->ion_auth->email_check($email)) { $this->session->set_flashdata('feedback_error','This Email Address Is Already Registered'); redirect('referral/ReferralFrom'); } $data["patient_email"]=$email; $pid=$this->Referral_model->insertNewReferral($data); #Registration to the patient_details table & to the other tables related to the patient #registration to the user // $username = $data['first_name']; if($this->input->post('form_status')!=""){ $data['telephone'] = $this->input->post('telephone'); $len_tel=strlen($data['telephone']); $telephone=""; for($i=0;$i<$len_tel;$i++){ $k=$data['telephone'][$i]; if(is_numeric($k)){$telephone.=$data['telephone'][$i];} } } $username = $fname; $password = mt_rand(100000, 999999); $dfg = 5; $oauth_uid = $this->input->post('oauth_uid'); $oauth_provider = "general"; $ion_user_id=$this->ion_auth->register($username, $password, $email,$dfg,$oauth_uid,$oauth_provider); $ion_username=$this->db->get_where('users', array('id' =>$ion_user_id))->row()->username; #registration to the user #update the patient table with ion_user_id $data = array(); $data['ion_user_id']=$ion_user_id; $this->Referral_model->updateReferralTable($data, 'patient_details', $pid); #update the patient table with ion_user_id #After Registration Send an activation Mail to the Patient Registered Email Id $name=$fname." ".$lname; $designation="patient"; $company="Hospital Management System"; $emaildata['emaildata'] = array( 'name' => $name, 'username' => $ion_username, 'email' => $email, 'password' => $password, 'designation' => $designation, 'link' => base_url(), 'company' => $company ); $message = $this->load->view('email_template_management/email_patient',$emaildata,TRUE); $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject ='Patient Account confirmation'; send_email($from,$email,$subject,$message); #After Registration Send an activation Mail to the Patient Registered Email Id } $pdata = $this->Referral_model->getWherevalue($pid)[0]; $tabStat = json_decode($pdata->from_tab_status); // which tab is filled $tabStatPctg = json_decode($pdata->from_tab_status_pctg); // what percent of the tab is filled if($this->input->post('form_status')!="") { $currentFromNo = $this->input->post('form_status'); } if($this->input->post('tabPgs')!="") { $tabPtgs = $this->input->post('tabPgs'); } $remarks = $this->input->post("pagreeDoc_remarks"); $documentsupload="no"; if(!empty($_FILES['pagreeDoc']['name'][0])) { $fileRet = $this->documentsSave2($_FILES,$pid,'pagreeDoc','PAGD',$remarks); $documentsupload="yes"; } $remarks = $this->input->post("insDoc_remarks"); if(!empty($_FILES['insDoc']['name'][0])) { $fileRet = $this->documentsSave2($_FILES,$pid,'insDoc','INSD',$remarks); $documentsupload="yes"; } # update patient_details table $data = array(); # json format patient contact address section if($this->input->post('addrZipcode1')!="") { $patientAddress = array( 'address' => $this->input->post('address1'), 'Apartment' => $this->input->post('AddrApartment1'), 'City' => $this->input->post('addrCity1'), 'State' => $this->input->post('addrState1'), 'Zipcode' => $this->input->post('addrZipcode1'), 'County' => $this->input->post('addrCounty1') ); $patientAddressJson = json_encode($patientAddress); } # end of json format patient contact address section # json format patient alternate address section if($this->input->post('altZipcode')!="") { $patientAltAddress = array( 'address'=>$this->input->post('alt_address'), 'Apartment'=>$this->input->post('altApartment'), 'City'=>$this->input->post('AltCity'), 'State'=>$this->input->post('altState'), 'Zipcode'=>$this->input->post('altZipcode'), 'County'=>$this->input->post('county2') ); $patientAltAddressJson = json_encode($patientAltAddress); } # end of json format patient alternate address section if($this->input->post('patient_agreement_Document_Verified')!="") { $data['patient_auth_stat'] = 1; } if($this->input->post('ins_agreement_doc_Verified')!="") { $data['insurance_auth_stat'] = 1; } if($this->input->post('pt_refrance_type')!="") { $data['reference_information'] = $this->input->post('pt_refrance_type'); } if($this->input->post('pt_refrance_value')!="") { $data['reference_id'] = $this->input->post('pt_refrance_value'); } if($this->input->post('vend_refrance_value')!="") { $data['reference_id'] = $this->input->post('vend_refrance_value'); } if($this->input->post('referal_contact')!="") { $data['referral_contact'] = $this->input->post('referal_contact'); } if($this->input->post('referal_type')!="") { $data['referral_type'] = $this->input->post('referal_type'); } if($this->input->post('referal_recive_date')!="") { $data['referral_date'] = $this->input->post('referal_recive_date'); } if($this->input->post('distance')!="") { $data['distance'] = $this->input->post('distance'); } if($this->input->post('form_status')!="") { $data['form_status'] = $this->input->post('form_status'); } if($this->input->post('level_service')!="") { $data['level_of_service'] = $this->input->post('level_service'); } if($this->input->post('fname')!="") { $data['first_name'] = $this->input->post('fname'); } if($this->input->post('lname')!="") { $data['last_name'] = $this->input->post('lname'); } if($this->input->post('dob')!="") { $data['dob'] = $this->input->post('dob'); } if($this->input->post('telephone')!="") { $data['telephone'] = $this->input->post('telephone'); } if($this->input->post('cellphone')!="") { $data['cellphone'] = $this->input->post('cellphone'); } if($this->input->post('gender')!="") { $data['gender'] = $this->input->post('gender'); } if($this->input->post('pnalguage')!="") { $data['primary_language'] = implode(",",$this->input->post('pnalguage')); } if($this->input->post('socsec')!="") { $data['soc_sec_no'] = $this->input->post('socsec'); } if($this->input->post('merital_stat')!="") { $data['marital_stat'] = $this->input->post('merital_stat'); } if($this->input->post('lang1')!="") { $data['latitude'] = $this->input->post('lang1'); } if($this->input->post('long1')!="") { $data['longitude'] = $this->input->post('long1'); } if($this->input->post('addrZipcode1')!="") { $data['address'] = $patientAddressJson; } if($this->input->post('altZipcode')!="") { $data['alt_address'] = $patientAltAddressJson; } if($this->input->post('heightInch')!="") { $data['height'] = $this->input->post('height').','.$this->input->post('heightInch'); } if($this->input->post('weight')!="") { $data['weight'] = $this->input->post('weight'); } if($this->input->post('direction')!="") { $data['direction'] = $this->input->post('direction'); } if($this->input->post('level_care')!="") { $data['level_of_care'] = $this->input->post('level_care'); } // if($this->input->post('service_activity')!="") // { // $service_activityExp = explode('~', $this->input->post('service_activity')); // $data['service_type_required'] = $service_activityExp[0]; // if($service_activityExp[0]=='Service') // { // $data['service_ids'] = $service_activityExp[1]; // } // else // { // $data['therapy_ids'] = $service_activityExp[1]; // } // } if($this->input->post('service_activity')!=""){ $data['service_ids'] = $this->input->post('service_activity'); } if($this->input->post('type_access')!="") { $data['type_access'] = implode(",",$this->input->post('type_access')); } if($this->input->post('primaryCarePhyMdInfo')!="") { $data['primaryCarePhyMdNpi'] = $this->input->post('primaryCarePhyMdInfo'); } // patient agreement data $patient_agreement = array( 'client_representatives'=>$this->input->post('client_representatives'), 'relationship'=>$this->input->post('relationship'), 'witness'=>$this->input->post('witness'), 'i_authorize_the_staff_to_provide_services'=>$this->input->post('i_authorize_the_staff_to_provide_services'), 'the_services_provided_by_caregiver_pro_homecare'=>$this->input->post('the_services_provided_by_caregiver_pro_homecare'), 'i_give_my_consent_and_authorization_for_release'=>$this->input->post('i_give_my_consent_and_authorization_for_release'), 'i_authorize_caregiver_pro_home'=>$this->input->post('i_authorize_caregiver_pro_home'), 'i_understand_that_it_would_be_prudent'=>$this->input->post('i_understand_that_it_would_be_prudent'), 'i_acknowledge_receiving_verbal'=>$this->input->post('i_acknowledge_receiving_verbal'), 'i_agree_that_i_shall_be_directly_responsible'=>$this->input->post('i_agree_that_i_shall_be_directly_responsible'), 'i_agree_to_pay_a_sum_of_2500'=>$this->input->post('i_agree_to_pay_a_sum_of_2500') ); $data['patient_agreement'] = json_encode($patient_agreement); # end of updation of patient_details table $update1 = $this->Referral_model->updateReferralTable($data, 'patient_details', $pid); # Patient details table designate info # patient_details_step2 table $data = array(); if($this->input->post('dg_fname')!="") { $data['designate_first_name'] = $this->input->post('dg_fname'); } if($this->input->post('dg_lname')!="") { $data['designate_last_name'] = $this->input->post('dg_lname'); } if($this->input->post('dg_telephone')!="") { $data['designate_telephone'] = $this->input->post('dg_telephone'); } if($this->input->post('dg_cell')!="") { $data['designate_cell'] = $this->input->post('dg_cell'); } if($this->input->post('dg_email')!="") { $data['designate_email'] = $this->input->post('dg_email'); } # end of updation of patient_details_step2 table $update1a = $this->Referral_model->updateReferralTable($data, 'patient_details_step2', $pid); # patient_insurance_info table $data = array(); # json format emergency contact address section $emgAddress = array( 'address'=>$this->input->post('address3'), 'Apartment'=>$this->input->post('AddrApartment3'), 'City'=>$this->input->post('addrCity3'), 'State'=>$this->input->post('addrState3'), 'Zipcode'=>$this->input->post('addrZipcode3'), 'County'=>$this->input->post('addrCounty3') ); $emgAddressJson = json_encode($emgAddress); # end of json format emergency contact address section if($this->input->post('pid')!="") { $data['main_id'] = $this->input->post('pid'); } if($this->input->post('advanceDirective')!="") { $data['AdvDirective'] = $this->input->post('advanceDirective'); } if($this->input->post('advanceDirectiveIfyes')!="") { $data['AdvDirectiveIfYes'] = $this->input->post('advanceDirectiveIfyes'); } if($this->input->post('advDateREcived')!="") { $data['AdvDirectiveDateRecived'] = $this->input->post('advDateREcived'); } if($this->input->post('advDNR')!="") { $data['advDnr'] = $this->input->post('advDNR'); } if($this->input->post('advDateEffective')!="") { $data['AdvDirectiveEffective'] = $this->input->post('advDateEffective'); } if($this->input->post('emgNamefname')!="") { $data['emgContactFirstName'] = $this->input->post('emgNamefname'); } if($this->input->post('emgNamelname')!="") { $data['emgContactLastName'] = $this->input->post('emgNamelname'); } if($this->input->post('emgRelationtoPt')!="") { $data['emgContactRelation'] = $this->input->post('emgRelationtoPt'); } if($this->input->post('emg_lang1')!="") { $data['emg_lang'] = $this->input->post('emg_lang1'); } if($this->input->post('emg_long1')!="") { $data['emg_long'] = $this->input->post('emg_long1'); } if($this->input->post('addrZipcode3')!="") { $data['emgContactAddress'] = $emgAddressJson; } if($this->input->post('emgTelephone')!="") { $data['emgContactTelephone'] = $this->input->post('emgTelephone'); } if($this->input->post('emgOtrNumber')!="") { $data['emgContactOteNo'] = $this->input->post('emgOtrNumber'); } if($this->input->post('emgEmail')!="") { $data['emgContactEmail'] = $this->input->post('emgEmail'); } if($this->input->post('emglivesWithPatient')!="") { $data['emgContactLiveswithPatient'] = $this->input->post('emglivesWithPatient'); } if($this->input->post('emgAccessTohome')!="") { $data['emgContactAccessToHome'] = $this->input->post('emgAccessTohome'); } if($this->input->post('insurance_type')!="") { $data['insurance_type'] = $this->input->post('insurance_type'); } if($this->input->post('insurance_plan')!="") { $data['insurance_plan'] = $this->input->post('insurance_plan'); } if($this->input->post('MedicaidId')!="") { $data['medicaid_id'] = $this->input->post('MedicaidId'); } if($this->input->post('medicaidAdult')!="") { $data['medicaid_adult'] = $this->input->post('medicaidAdult'); } if($this->input->post('MedicaidPediriatic')!="") { $data['medicaid_pedriatic'] = $this->input->post('MedicaidPediriatic'); } if($this->input->post('primarySeconday')!="") { $data['primaryOrSecondary'] = $this->input->post('primarySeconday'); } if($this->input->post('privatePolicyNumber')!="") { $data['Pvt_Ins_PlanId_Policy_no'] = $this->input->post('privatePolicyNumber'); } if($this->input->post('Private_claim_number')!="") { $data['claim_no'] = $this->input->post('Private_claim_number'); } $paymentModes = $this->input->post('paymentModes'); if($paymentModes=="Credit or Debit Card"){ $data['CreditCardInfo'] = $this->input->post('CreditCardInfo'); $data['ccNumber'] = $this->input->post('ccNumber'); $data['ccExpiration'] = $this->input->post('ccExpiration'); $data['ccCvv'] = $this->input->post('ccCvv'); $data['ccZipcode'] = $this->input->post('ccZipcode'); $data['bankAccount'] = ''; $data['bankName'] = ''; $data['bankNumber'] = ''; $data['RoutingNumber'] = ''; $data['Monthly_Invoice'] = ''; } if($paymentModes=="EFT"){ $data['bankAccount'] = $this->input->post('bankAccount'); $data['bankName'] = $this->input->post('bankName'); $data['bankNumber'] = $this->input->post('bankNumber'); $data['RoutingNumber'] = $this->input->post('RoutingNumber'); $data['CreditCardInfo'] = ''; $data['ccNumber'] = ''; $data['ccExpiration'] = ''; $data['ccCvv'] = ''; $data['ccZipcode'] = ''; $data['Monthly_Invoice'] = ''; } if($paymentModes=='Monthly Invoice'){ $data['Monthly_Invoice'] = $this->input->post('Monthly_Invoice'); $data['CreditCardInfo'] = ''; $data['ccNumber'] = ''; $data['ccExpiration'] = ''; $data['ccCvv'] = ''; $data['ccZipcode'] = ''; $data['bankAccount'] = ''; $data['bankName'] = ''; $data['bankNumber'] = ''; $data['RoutingNumber'] = ''; } // if($this->input->post('CreditCardInfo')!="") // { // $data['CreditCardInfo'] = $this->input->post('CreditCardInfo'); // } // if($this->input->post('ccNumber')!="") // { // $data['ccNumber'] = $this->input->post('ccNumber'); // } // if($this->input->post('ccExpiration')!="") // { // $data['ccExpiration'] = $this->input->post('ccExpiration'); // } // if($this->input->post('ccCvv')!="") // { // $data['ccCvv'] = $this->input->post('ccCvv'); // } // if($this->input->post('ccZipcode')!="") // { // $data['ccZipcode'] = $this->input->post('ccZipcode'); // } // if($this->input->post('bankAccount')!="") // { // $data['bankAccount'] = $this->input->post('bankAccount'); // } // if($this->input->post('bankName')!="") // { // $data['bankName'] = $this->input->post('bankName'); // } // if($this->input->post('bankNumber')!="") // { // $data['bankNumber'] = $this->input->post('bankNumber'); // } // if($this->input->post('RoutingNumber')!="") // { // $data['RoutingNumber'] = $this->input->post('RoutingNumber'); // } // if($this->input->post('Monthly_Invoice')!="") // { // $data['Monthly_Invoice'] = $this->input->post('Monthly_Invoice'); // } if($this->input->post('InsfaxNo')!="") { $data['InsfaxNo'] = $this->input->post('InsfaxNo'); } if($this->input->post('InsWebAdd')!="") { $data['InsWebAdd'] = $this->input->post('InsWebAdd'); } if($this->input->post('InsEin')!="") { $data['InsEin'] = $this->input->post('InsEin'); } if($this->input->post('InsContractStart')!="") { $data['InsContractStart'] = $this->input->post('InsContractStart'); } if($this->input->post('InsContractEnd')!="") { $data['InsContractEnd'] = $this->input->post('InsContractEnd'); } if($this->input->post('InsLocation')!="") { $data['InsLocation'] = $this->input->post('InsLocation'); } if($this->input->post('InsNotes')!="") { $data['InsNotes'] = $this->input->post('InsNotes'); } if($this->input->post('skilled_nursing_care')!="") { $data['skilled_nursing_care'] = $this->input->post('skilled_nursing_care'); } if($this->input->post('HCPCS_codes')!="") { $data['HCPCS_codes'] = $this->input->post('HCPCS_codes'); } # end of updation of patient_insurance_info table $update2 = $this->Referral_model->updateReferralTable($data, 'patient_insurance_info', $pid); # patient_md_order_step3 table $data = array(); if($this->input->post('pid')!="") { $data['main_id'] = $this->input->post('pid'); } if($this->input->post('correspondingRequirment')!="") { $data['correspondingRequirment'] = $this->input->post('correspondingRequirment'); } if($this->input->post('medication_name')!="") { $data['medication_name'] = $this->input->post('medication_name'); } if($this->input->post('medication_frequency')!="") { $data['medication_frequency'] = $this->input->post('medication_frequency'); } if($this->input->post('medication_route')!="") { $data['medication_route'] = $this->input->post('medication_route'); } if($this->input->post('lab_company')!="") { $data['lab_company'] = $this->input->post('lab_company'); } if($this->input->post('Type_lab_required')!="") { $data['Type_lab_required'] = $this->input->post('Type_lab_required'); } if($this->input->post('Intervals')!="") { $data['Intervals'] = $this->input->post('Intervals'); } if($this->input->post('Day')!="") { $data['Day'] = $this->input->post('Day'); } if($this->input->post('Time')!="") { $data['Time'] = $this->input->post('Time'); } if($this->input->post('patient_seen_by_MD')!="") { $data['patient_seen_by_MD'] = $this->input->post('patient_seen_by_MD'); } if($this->input->post('current_lab_work')!="") { $data['current_lab_work'] = $this->input->post('current_lab_work'); } if($this->input->post('lab_order')!="") { $data['lab_order'] = $this->input->post('lab_order'); } if($this->input->post('additional_lab_order')!="") { $data['additional_lab_order'] = $this->input->post('additional_lab_order'); } if($this->input->post('lab_frequency')!="") { $data['lab_frequency'] = $this->input->post('lab_frequency'); } if($this->input->post('other_lab_frequency')!="") { $data['other_lab_frequency'] = $this->input->post('other_lab_frequency'); } if($this->input->post('tube_type')!="") { $data['tube_type'] = $this->input->post('tube_type'); } if($this->input->post('formula')!="") { $data['formula'] = $this->input->post('formula'); } if($this->input->post('flush_with')!="") { $data['flush_with'] = $this->input->post('flush_with'); } if($this->input->post('flush_frequency')!="") { $data['flush_frequency'] = $this->input->post('flush_frequency'); } if($this->input->post('daily_intake_requirment')!="") { $data['daily_intake_requirment'] = $this->input->post('daily_intake_requirment'); } if($this->input->post('fluid_restriction')!="") { $data['fluid_restriction'] = $this->input->post('fluid_restriction'); } if($this->input->post('fluide_restric_amount')!="") { $data['fluide_restric_amount'] = $this->input->post('fluide_restric_amount'); } if($this->input->post('fluide_restric_frequency')!="") { $data['fluide_restric_frequency'] = $this->input->post('fluide_restric_frequency'); } # end of updation of patient_md_order_step3 table $update3 = $this->Referral_model->updateReferralTable($data, 'patient_md_order_step3', $pid); # patient_payment_info table $data = array(); if($this->input->post('pid')!="") { $data['main_id'] = $this->input->post('pid'); } if($this->input->post('payerType')!="") { $data['payerType'] = $this->input->post('payerType'); } if($this->input->post('paymentModes')!="") { $data['paymentModes'] = $this->input->post('paymentModes'); } if($this->input->post('RefertoVendorDocument')!="") { // $data['main_id'] = $this->input->post('RefertoVendorDocument'); $data['RefertoVendorDocument'] = $this->input->post('RefertoVendorDocument'); } # end of updation of patient_payment_info table $update4 = $this->Referral_model->updateReferralTable($data, 'patient_payment_info', $pid); if ($this->input->post('pid')!="") { if ($this->input->post('nameForm') != '' && $this->input->post('nameForm') == 'annual_in_home_performance_evaluation') { $annual_in_home_array = array(); $remove = ['tabPgs', 'fromType','reqFrom','nameForm']; $annual_in_home_array=array_diff_key($_POST, array_flip($remove)); if(!empty($annual_in_home_array)){ $annualInHomeJson = json_encode($annual_in_home_array); $data_annual['annual_in_home_performance'] = $annualInHomeJson; $update5 = $this->Referral_model->updateReferralTable($data_annual, 'patient_details_step2', $pid); } } } if($update1 || $update1a || $update2 || $update3 || $update4 || $update5){ $this->session->set_flashdata('ref_added', 'added'); } if($documentsupload=="yes"){ if($fileRet){ $this->session->set_flashdata('doc_update', 'Document Updated Successfully '); }else{ $this->session->set_flashdata('doc_error', 'Opps Error occurred! Document Not Updated'); } } /* | track which tab is filled */ # patient_details table $data = array(); if($currentFromNo!="") { $prevGenInfo = 0; // current form status if ($currentFromNo == '1' || $currentFromNo == 1) { if (!in_array($currentFromNo, $tabStat)) { array_push($tabStat, $currentFromNo); } else { $prevGenInfo = $tabStatPctg->form1; } // echo $pid; $genInfoPrg = $this->genInfoPectg($pid); $tabStatPctg->form1 = $genInfoPrg; $data['from_tab_status'] = json_encode($tabStat); $data['from_tab_status_pctg'] = json_encode($tabStatPctg); if($tabPtgs!="") { $tabProgress = $tabPtgs; $data['progress'] = (int)$pdata->progress + (int)$genInfoPrg - $prevGenInfo; } } else { if (!in_array($currentFromNo, $tabStat)) { array_push($tabStat, $currentFromNo); if($tabPtgs!="") { $tabProgress = $tabPtgs; $data['progress'] = (int)$pdata->progress + (int)$tabProgress; } $tabStatPctg->{'form'.$currentFromNo} = $tabProgress; } // echo '
'; print_r($tabStatPctg->{'form'.$currentFromNo}); die; $data['from_tab_status'] = json_encode($tabStat); $data['from_tab_status_pctg'] = json_encode($tabStatPctg); } } # end of updation of patient_details table $update1b = $this->Referral_model->updateReferralTable($data, 'patient_details', $pid); /* | redirection */ if($this->input->post('reqFrom')!=""){ $reqFrom = $this->input->post('reqFrom');} if(($this->input->post('fromType')=='addRef') && ($this->input->post('submit')=='mdOrders_info')) { redirect("referral/approval"); } else if($this->input->post('fromType')=='addRef') { if($reqFrom=="viewPage"){ redirect("patient/viewPatient?id={$pid}"); } redirect("referral/ReferralFrom/".base64_enc($pid)); } if ($this->input->post('fromType')=='activeRef') { redirect("referral/ReferralActivation/".base64_enc($pid)); } // echo ""; print_r($update2); die; # function's execution was ended here won't go further due use of die; // if ($this->form_validation->run() == FALSE) // { // } // else // { // if($_POST['submit'] == 'gen_info') { // var_dump($_POST); die(); $referance_source = $this->input->post('pt_refrance_type'); if($this->input->post('pt_refrance_type') == "Reffered by Patient") { $referance_source_value = $this->input->post('pt_refrance_value'); } elseif($this->input->post('pt_refrance_type') == "Reffered by Vendor") { $referance_source_value = $this->input->post('vend_refrance_value'); } else { $referance_source_value = ""; } $data = array( 'reference_information' => $referance_source, 'reference_id' => $referance_source_value, 'patient_id' => rand(10000,99999), 'first_name' => $this->input->post('fname'), 'level_service' => $this->input->post('level_service'), 'last_name' => $this->input->post('lname'), 'patient_email' => $this->input->post('email'), 'gender' => $this->input->post('gender'), 'primary_language' => $this->input->post('pnalguage'), 'dob' => $this->input->post('dob'), 'latitude' => $this->input->post('lang1'), 'longitude' => $this->input->post('long1'), 'add_house_Number_and_Street_Name' => $this->input->post('address1'), 'add_Apartment' => $this->input->post('AddrApartment1'), 'add_city' => $this->input->post('addrCity1'), 'add_state' => $this->input->post('addrState1'), 'add_zip_code' => $this->input->post('addrZipcode1'), 'add_county' => $this->input->post('addrCounty1'), 'telephone' => $this->input->post('telephone'), 'cellphone' => $this->input->post('cellphone'), 'referral_contact' => $this->input->post('referal_contact'), 'referral_type' => $this->input->post('referal_type'), 'referral_date' => $this->input->post('referal_recive_date'), ); if($this->input->post('form_mode') == 'Add') { $data['form_status'] = $this->input->post('form_status'); $data['progress'] = 20; $this->session->set_flashdata('ref_added', 'added'); } else { $this->session->set_flashdata('ref_updated', 'updated'); } if (isset($_GET["pid"]) && $_GET["pid"] != '') { $pid = $_GET["pid"]; $this->Referral_model->updatePatient($data,$pid); $this->session->set_userdata('editRef_stat', 'step1'); redirect("referral/editReferal?pid={$pid}"); } else { // pre($data);die(); $id = $this->Referral_model->insertPatient($data); // echo $this->db->last_query(); // die(); $this->Referral_model->mdOrdersInsert(array('patient_id' => $id)); $this->session->set_userdata('editRef_stat', 'step1'); redirect("referral/editReferal?pid={$id}"); } } // service info if(isset($_POST) && $_POST['submit'] == 'services') { $data = array( 'level_of_care' => $this->input->post('level_care'), 'level_service' => $this->input->post('level_service'), 'correspondingRequirment' => $this->input->post('correspondingRequirment'), 'new_order' => $this->input->post('new_order'), 'service_activity' => implode(",",$this->input->post('service_activity')), 'therapy_type' => implode(",",$this->input->post('therapy_type')), 'type_access' => implode(",",$this->input->post('type_access')), 'patient_seen_by_MD' => $this->input->post('patient_seen_by_MD'), 'current_lab_work' => $this->input->post('current_lab_work'), 'lab_order' => $this->input->post('lab_order'), 'additional_lab_order' => $this->input->post('additional_lab_order'), 'lab_frequency' => $this->input->post('lab_frequency'), 'other_lab_frequency' => $this->input->post('other_lab_frequency'), 'tube_type' => $this->input->post('tube_type'), 'formula' => $this->input->post('formula'), 'schedule' => $this->input->post('schedule'), 'flush_with' => $this->input->post('flush_with'), 'daily_intake_requirment' => $this->input->post('daily_intake_requirment'), 'flush_frequency' => $this->input->post('flush_frequency'), 'fluid_restriction' => $this->input->post('fluid_restriction'), 'fluide_restric_amount' => $this->input->post('fluide_restric_amount'), 'referal_source' => $this->input->post('referal_source'), 'fluide_restric_frequency' => $this->input->post('fluide_restric_frequency') ); if($this->input->post('form_mode') == 'Add') { $data['progress'] = 40; $data['form_status'] = $this->input->post('form_status'); $this->session->set_flashdata('ref_added', 'added'); } else { $this->session->set_flashdata('ref_updated', 'updated'); } $res = $this->Referral_model->updatePatient($data,$pid); $this->session->unset_userdata('editRef_stat'); redirect("referral/editReferal?pid={$pid}"); } // insurance info if (isset($_POST) && $_POST['submit'] == 'insInfo') { $data = array( 'patient_id' => $pid, 'paymentModes' => $this->input->post('paymentModes'), // 'CreditCardInfo' => $this->input->post('CreditCardInfo'), // 'ccNumber' => $this->input->post('ccNumber'), // 'ccExpiration' => $this->input->post('ccExpiration'), // 'ccCvv' => $this->input->post('ccCvv'), // 'ccZipcode' => $this->input->post('ccZipcode'), // 'bankAccount' => $this->input->post('bankAccount'), // 'bankName' => $this->input->post('bankName'), // 'bankNumber' => $this->input->post('bankNumber'), // 'RoutingNumber' => $this->input->post('insurance_type'), // 'Monthly_Invoice' => $this->input->post('Monthly_Invoice'), 'insurance_type' => $this->input->post('insurance_type'), 'insurance_plan' => $this->input->post('insurance_plan'), 'medicaid_id' => $this->input->post('MedicaidId'), 'medicaid_adult' => $this->input->post('medicaidAdult'), 'medicaid_pedriatic' => $this->input->post('MedicaidPediriatic'), 'primaryOrSecondary' => $this->input->post('primarySeconday'), 'Pvt_Ins_PlanId_Policy_no' => $this->input->post('privatePolicyNumber'), 'claim_no' => $this->input->post('Private_claim_number'), 'payerType' => $this->input->post('payerType'), // 'emgContactName' => $this->input->post('emgName'), // 'emgContactRelation' => $this->input->post('emgRelationtoPt'), // 'emgContactAddress' => $this->input->post('emgAddress'), // 'emgContactTelephone' => $this->input->post('emgTelephone'), // 'emgContactCellNo' => $this->input->post('emgCellNumber'), // 'emgContactOteNo' => $this->input->post('emgOtrNumber'), // 'emgContactEmail' => $this->input->post('emgEmail'), // 'emgContactLiveswithPatient' => $this->input->post('emglivesWithPatient'), // 'EmgPrepdEvacZone' => $this->input->post('emgEvacZone'), // 'EmgPrepdMobilityStat' => $this->input->post('emgMobilityStat'), // 'EmgPrepdLocation' => $this->input->post('emgEvaclocation'), // 'EmgPrepdEleDependency' => $this->input->post('emgEleDEpendency'), // 'ClinicalStartOfCare' => $this->input->post('startOfCare'), // 'ClinicalAllergies' => $this->input->post('clinfallergies'), // 'ClinicalAllergiesReaction' => $this->input->post('clinfAllergicREaction'), // 'ClinicalNotes' => $this->input->post('clinfNotes'), // 'AdvDirective' => $this->input->post('advanceDirective'), // 'AdvDirectiveIfYes' => $this->input->post('advanceDirectiveIfyes'), // 'AdvDirectiveDateRecived' => $this->input->post('advDateREcived'), // 'AdvDirectiveEffective' => $this->input->post('advDateEffective'), // 'PhysicanName' => $this->input->post('phymdName'), // 'PhysicanAddress' => $this->input->post('phymdAddress'), // 'PhysicanTelephone' => $this->input->post('phymdTelephone'), // 'PhysicanFax' => $this->input->post('phymdFAX'), // 'PhysicanEmail' => $this->input->post('phymdEmail'), // 'PhysicanAffiliation' => $this->input->post('phymdAffiliation'), // 'PhysicanNPI' => $this->input->post('phymdNPI'), // 'PhysicanLisence' => $this->input->post('phymdLisence'), // 'PhysicanNote' => $this->input->post('phymdnote'), // 'diagonosisICD' => $this->input->post('diagICD'), // 'diagonosisDescription' => implode(",",$this->input->post('diagDesc')), // 'diagonosisHistoricalDate' => $this->input->post('diagHistData'), // // 'diagonosisReferral' => $this->input->post('diagRefchkbocx'), // // 'diagonosisAssesment' => $this->input->post('diagAsschkbox'), // // 'diagonosisPrimary' => $this->input->post('diagPrimarychkbox'), // 'MedicationName' => $this->input->post('medicName'), // 'MedicationType' => $this->input->post('medicType'), // 'PatientPrefGender' => $this->input->post('prefGendofCaregiver'), // 'PatientPreNotes' => $this->input->post('petprefNotes') ); $paymentModes = $this->input->post('paymentModes'); if($paymentModes=="Credit or Debit Card"){ $data['CreditCardInfo'] = $this->input->post('CreditCardInfo'); $data['ccNumber'] = $this->input->post('ccNumber'); $data['ccExpiration'] = $this->input->post('ccExpiration'); $data['ccCvv'] = $this->input->post('ccCvv'); $data['ccZipcode'] = $this->input->post('ccZipcode'); $data['bankAccount'] = ''; $data['bankName'] = ''; $data['bankNumber'] = ''; $data['RoutingNumber'] = ''; $data['Monthly_Invoice'] = ''; } if($paymentModes=="EFT"){ $data['bankAccount'] = $this->input->post('bankAccount'); $data['bankName'] = $this->input->post('bankName'); $data['bankNumber'] = $this->input->post('bankNumber'); $data['RoutingNumber'] = $this->input->post('RoutingNumber'); $data['CreditCardInfo'] = ''; $data['ccNumber'] = ''; $data['ccExpiration'] = ''; $data['ccCvv'] = ''; $data['ccZipcode'] = ''; $data['Monthly_Invoice'] = ''; } if($paymentModes=="Monthly Invoice"){ $data['Monthly_Invoice'] = $this->input->post('Monthly_Invoice'); $data['CreditCardInfo'] = ''; $data['ccNumber'] = ''; $data['ccExpiration'] = ''; $data['ccCvv'] = ''; $data['ccZipcode'] = ''; $data['bankAccount'] = ''; $data['bankName'] = ''; $data['bankNumber'] = ''; $data['RoutingNumber'] = ''; } if ($pdata->form_status <= "2") { $pudata['form_status'] = 3; $pudata['progress'] = 70; $id = $this->Referral_model->updatePatient($pudata,$pid); $this->session->set_flashdata('ref_added', 'added'); } else { $this->session->set_flashdata('ref_updated', 'updated'); } $id = $this->Referral_model->insertPatientInsurance($data,$pid); $this->session->set_userdata('actPtn_stat', 'step4'); redirect("referral/editReferal?pid={$pid}"); } // patientAgreement if (isset($_POST) && $_POST['submit'] == 'patientAgreement') { $remarks = $this->input->post("pagreeDoc_remarks"); if(!empty($_FILES['pagreeDoc']['name'][0])) { $fileRet = $this->documentsSave2($_FILES,$pid,'pagreeDoc','PAGD',$remarks); } if($this->input->post('patient_agreement_Document_Verified')=='Verified') { $data = array( 'patient_id' => $pid, 'patient_auth_stat' => 1, 'approve_status' => 1 ); } if ($pdata->form_status <= "3") { $data['form_status'] = 4; $data['progress'] = 85; $this->session->set_flashdata('ref_added', 'added'); } else { $this->session->set_flashdata('ref_updated', 'updated'); } $this->Referral_model->updatePatient($data,$pid); redirect('referral/approval'); } if (isset($_POST) && $_POST['submit'] == 'mdOrders_info') { $remarks = $this->input->post("otherDoc_remarks"); if(!empty($_FILES['otherDoc']['name'][0])) { $fileRet = $this->documentsSave2($_FILES,$pid,'otherDoc','TRACH',$remarks); } $data = array( 'MdOrderReciveDate' => $this->input->post("MdOrderReciveDate"), 'MdOrderExpireDate' => date('Y-m-d', strtotime("+6 months", strtotime($this->input->post("MdOrderReciveDate")))), 'md_orders_notes' => $this->input->post("MdOrderNotes"), 'trach_excoriation' => $this->input->post("MDTrachExcoriation"), 'trach_excoriation_notes' => $this->input->post("MDTrachExcoriationNotes"), 'trach_drainage' => $this->input->post("MDTrachDrainage"), 'trach_drainage_notes' => $this->input->post("MDTrachDrainageNotes"), 'redness_trach_site' => $this->input->post("MDredNessAtTrachSite"), 'redness_trach_site_notes' => $this->input->post("MDredNessAtTrachSiteNotes"), 'trach_inner_cannula_changed' => $this->input->post("MDTrachInnerCannulaChanged"), 'trach_inner_cannula_changed_notes' => $this->input->post("MDTrachInnerCannulaChangedMdOrderNotes"), 'trach_suction' => $this->input->post("MDtrachSuction"), 'trach_suction_notes' => $this->input->post("MDTrachSuctionnotes"), 'trach_connector_size' => $this->input->post("MDtrachConnectorSize"), 'trach_connector_length' => $this->input->post("MDtrachConnectorLength"), 'trach_suction_type' => $this->input->post("MDtrachSuctionType"), 'trach_suction_catheter_kit' => $this->input->post("MDtrachSuctionCatherKit"), 'trach_suciton_catheter_kit_size' => $this->input->post("MDtrachCAthertarKitSize"), 'md_orders_comments' => $this->input->post("mdorderComments"), 'WoundDate' => $this->input->post("MDOrdersWounddate"), 'WoundType' => $this->input->post("MDOrdersWoundType"), 'woundSiteLocation' => $this->input->post("MDOrdersSiteLocation"), 'siteLocationNotes' => $this->input->post(""), 'WoundDescription' => $this->input->post("MDOrdersWoundDesc"), 'WoundMeasurement' => $this->input->post("MDOrdersWoundMeasurment"), 'WoundLenghts' => $this->input->post("MDOrdersWoundLength"), 'WoundWidth' => $this->input->post("MDOrdersWoundWidth"), 'WoundDiameter' => $this->input->post("MDOrdersWoundDiameter"), 'WoundUndermining' => $this->input->post("MDOrdersWoundUndermining"), 'WoundUnderminingClockPosition' => $this->input->post("MDOrdersWoundClockPosition"), 'WoundCleanseWith' => $this->input->post("mdOrdersWondsCleasnswith"), 'WoundApplications' => $this->input->post("mdOrdersWoundApplication"), 'AppliedOther' => $this->input->post("MDOrdersAppliedOther"), 'WoundCoveredWith' => $this->input->post("mdOrdersWoundCoverdWith"), 'CoveredwithOther' => $this->input->post("MDOrdersCoverOther"), 'WoundSecuredWith' => $this->input->post('mdOrdersWoundSecureWith'), 'PackedWoundBedWith' => $this->input->post('MDOrdersPackkedWoundsWithBed'), 'WoundStatus' => $this->input->post('mdOrdersWoundStatus'), 'WoundGranulating' => $this->input->post('MDOrdersWoundsGranulating'), 'ExcroticTissuePresent' => $this->input->post('MDOrdersExcroticTissuePresent'), 'WoundEschar' => $this->input->post("MDOrdersWoundEschar"), 'WoundExudate' => $this->input->post("MDOrdersWoundExudate"), 'WoundSlough' => $this->input->post("MDorderWoundSlough"), 'NecroticTissuePresent' => $this->input->post('MDOrdersNercroticTissuePresent'), 'NecroticTissueColor' => $this->input->post('MDorderNecroticTissueColor'), 'WoundDrainage' => $this->input->post("MDOrdersWoundDrainage"), 'WoundDrainageType' => $this->input->post("MDORDERWoundDrainageType"), 'WoundDrainageRate' => $this->input->post("MDOrdersWoundDrainageRate"), 'WoundDrainageAmount' => $this->input->post("MDORDERWoundDrainageAmount"), 'woundTunnelling' => $this->input->post("woundTunnelling"), 'woundTunnelingComment' => $this->input->post("woundTunnelingComment"), 'WoundBedAppearance' => $this->input->post("woundBedapperance"), // 'WoundBedComments' => $this->input->post(""), 'WoundRednessAtSite' => $this->input->post('MDOrdersWoundRednessAtSite'), 'WoundRedComments' => $this->input->post('MDOrdersWoundRednessAtSiteComment'), 'WoundOdor' => $this->input->post('MDOrdersWoundOdor'), 'WoundOdorComments' => $this->input->post("MDOrdersWoundOdorComment"), 'WoundSwelling' => $this->input->post('MDOrdersWoundSwelling'), 'WoundSwellingComments' => $this->input->post('MDOrdersWoundSwellingComment'), 'WoundPain' => $this->input->post('MDOrdersWoundPain'), 'WoundPainComments' => $this->input->post("MDOrdersWoundPainComment"), 'PatientIndependentInWoundCare' => $this->input->post('MDOrdersPatientIndependentInWoundCare'), 'PatientIsWillingToLearn' => $this->input->post('MDOrdersPatientIsWillingToLearn'), 'CaregiverIsWillingToLearn' => $this->input->post('MDOrdersCaregiverIsWillingToLearn'), 'CaregiverIsWillingToLearnComment' => $this->input->post('MDOrdersCaregiverIsWillingToLearnComment'), 'Caregiver' => $this->input->post('MdOrdersCaregiver'), ); $datap = array( 'primaryCarePhyMdInfo' => $this->input->post('primaryCarePhyMdInfo'), 'diagnosis' => $this->input->post('diagnosis'), 'new_order' => $this->input->post('new_order'), 'service_activity' => implode(",",$this->input->post('service_activity')), 'therapy_type' => implode(",",$this->input->post('therapy_type')), 'type_access' => implode(",",$this->input->post('type_access')), 'patient_seen_by_MD' => $this->input->post('patient_seen_by_MD'), 'current_lab_work' => $this->input->post('current_lab_work'), 'lab_order' => $this->input->post('lab_order'), 'additional_lab_order' => $this->input->post('additional_lab_order'), 'lab_frequency' => $this->input->post('lab_frequency'), 'other_lab_frequency' => $this->input->post('other_lab_frequency'), 'tube_type' => $this->input->post('tube_type'), 'formula' => $this->input->post('formula'), 'schedule' => $this->input->post('schedule'), 'flush_with' => $this->input->post('flush_with'), 'daily_intake_requirment' => $this->input->post('daily_intake_requirment'), 'flush_frequency' => $this->input->post('flush_frequency'), 'fluid_restriction' => $this->input->post('fluid_restriction'), 'fluide_restric_amount' => $this->input->post('fluide_restric_amount'), 'referal_source' => $this->input->post('referal_source'), 'fluide_restric_frequency' => $this->input->post('fluide_restric_frequency') ); if ($pdata->form_status <= "4") { $datap['form_status'] = 5; $datap['progress'] = 60; $this->Referral_model->updatePatient($datap,$pid); $this->session->set_flashdata('ref_added', 'added'); } else { $this->Referral_model->updatePatient($datap,$pid); $this->session->set_flashdata('ref_updated', 'updated'); } $this->Referral_model->mdOrdersUpdate($data,$pid); $this->session->set_userdata('editRef_stat', 'step2'); redirect("referral/editReferal?pid={$pid}"); //redirect("referral/approval"); } // } } public function ReferralActivation($pid=null) { if($pid==null) redirect('referral/approval'); $pid = base64_dec($pid); // if($this->input->get('pid')!=""){ $pid = $this->input->get('pid'); }; $data['insCompanyDetails'] = array(); if ($pid != '') { $data['pid'] = $pid; $allData = $this->Referral_model->getWherevalue($pid)[0]; $data['pdata'] = $allData; $pdocsTRACH = $this->Referral_model->getPatientDoc($pid,'TRACH'); $data['TRACHdocs'] = $pdocsTRACH; $pdocsPAGD = $this->Referral_model->getPatientDoc($pid,'PAGD'); $data['PAGDdocs'] = $pdocsPAGD; $pdocsINSD = $this->Referral_model->getPatientDoc($pid,'INSD'); $data['INSDdocs'] = $pdocsINSD; $insdata = $this->Referral_model->getWherevalueInsInfo($pid)[0]; $data['idata'] = $insdata; $data['serviceActivityTherapy'] = servicetherapy($allData->level_of_service); if($insdata->paymentModes =='Insurance Information') { $data['insCompanyDetails'] = $this->Referral_model->insCompanyDetails($insdata->insurance_plan); } } $data['skillNursingCare'] = $this->Referral_model->getSkillNursingCareList(); $data['HCPCSCodes'] = $this->Referral_model->getHCPCScodes(); $data['langs'] = $this->Referral_model->getLanguages(); $data['preferal'] = $this->Referral_model->getReferalSource(); $data['lvlService'] = $this->Referral_model->getLevelService(); $data['accessType'] = $this->Referral_model->getAccessType(); $data['tubes'] = $this->Referral_model->getTubeType(); $data['eleDep'] = $this->Referral_model->getEleDep(); $data['micd'] = $this->Referral_model->getICD(); $data['payerType'] = $this->Referral_model->getPayertype(); $data['vendorList'] = $this->Referral_model->getvendorLists(); $data['insuranceCompanyList'] = $this->Referral_model->insuranceCompanyList(); $data['patientList'] = $this->Referral_model->patientLists(); $data['relationList'] = $this->Referral_model->relationLists(); $data['rnId'] = $this->Referral_model->getValueFrom('master_cg_skills','name','RN')[0]->id; $data['lnpId'] = $this->Referral_model->getValueFrom('master_cg_skills','name','LNP')[0]->id; //Data for MD Order $patient=$this->Patient_model->getPatientByid($pid); $icd_data=json_decode($patient->icd_info); if($patient->primaryCarePhyMdNpi!=""){ $physician=$this->Physician_model->getPhysicianByNPI($patient->primaryCarePhyMdNpi); $data['physician']= $physician; } $md_order=$this->Md_order_model->getLatestOrderByPatientId($pid); $data['patient']=$patient; $data['icd_data']=$icd_data; $data['md_order']=$md_order; $data['labOption']=$this->Md_order_model->getTypesofLabsOption(); $data['medicationOption']=$this->Md_order_model->getMedicationOption(); $data['hide_demographics'] = true; $data['patient_agreement'] = json_decode($data['pdata']->patient_agreement); // echo '';print_r($data);die; $this->load->view('home/dashboard'); // just the header file $this->load->view('activatePatient',$data); $this->load->view('home/footer'); // just the header file } public function genInfoPectg($pid) { $total = 20; $mandateFields = array('reference_information','referral_date','first_name','last_name','gender','primary_language','marital_stat','dob','soc_sec_no','address','telephone','level_of_service'); $res = $this->Referral_model->getGeninfoPctg($pid); // echo ""; print_r($res); die; foreach ($mandateFields as $value) { if($res->$value == '') { // echo $value .':'. $res->$value .'
'; $total = $total - 1.66666666667; } } return ceil($total); } public function activateReferral() { if($this->input->get('pid')!='') { $pid = $this->input->get('pid'); if ($this->input->get('activate')=='true') { $resp = $this->Referral_model->activateReferral($pid); $patient = $this->Generate_bill_model->getPatient($pid); $physician = $this->Referral_model->getPhysician($patient->primaryCarePhyMdNpi); // echo ""; print_r($physician); die; if($patient->primaryCarePhyMdNpi) { $name=$physician->name; $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject ='Patient has been created'; $emaildata['emaildata'] = array( 'name' =>$name ); $to = $physician->email; $message= $this->load->view('email_template_management/patient_created',$emaildata,TRUE); send_email($from,$to,$subject,$message); } redirect("referral/approval"); } } } public function approval() { $pid =$_GET['id']; $data['pid']=$_GET['id']; if(isset($_GET['id'])){ if ($_GET['approve']=='true') { $resp = $this->Referral_model->approvePatient($pid); $this->session->unset_userdata('actPtn_stat'); redirect("referral/activatePatient?pid=$pid"); } $allData = $this->Referral_model->getWherevalue($pid)[0]; $data['datas'] = $allData; $allDataIns = $this->Referral_model->getWherevalueInsInfo($pid)[0]; $data['dataIns'] = $allDataIns; /*assessment*/ $data['asmData'] = $this->Referral_model->getWhereAssessment($pid)[0]; /*assessment end*/ $this->load->view('home/dashboard'); // just the header file $this->load->view('approval_view',$data); $this->load->view('home/footer'); }else{ $this->load->view('home/dashboard'); // just the header file $this->load->view('patient/loader'); $this->load->view('patient/loader2'); $this->load->view('pendin_approval_list',['dlGvdftsdr'=>intval($this->input->get('dlGvdftsdr'))]); $this->load->view('home/footer'); // just the header file } } public function activatePatientCriterial() { $msg = ""; $status = 0; $pid = $_POST['pid']; $pdata = $this->Referral_model->getWherevalue($pid)[0]; $tabStatPctg = json_decode($pdata->from_tab_status_pctg); // if ($pdata->reference_information == "Reffered by Patient") { $paymentInfo = $this->Referral_model->getWherevalueInsInfo($pid)[0]; if($paymentInfo->payerType == '') { $msg .= "Please update the Insurance Information details to activate
"; $status = 0; } else { if($paymentInfo->paymentModes == 'Insurance Information') { if($pdata->insurance_auth_stat == '1') { $status = 1; } else { $msg .= "Please update the Insurance Information details to activate
"; $status = 0; } } else { $status = 1; } } if($status == 1) { if((int)$tabStatPctg->form1 < 20) { $msg .= "Please fill all the mandatory fileds in general Information Tab
"; $status = 0; } else { $ttlPctg = (int)$tabStatPctg->form1+(int)$tabStatPctg->form2+(int)$tabStatPctg->form3+(int)$tabStatPctg->form4+(int)$tabStatPctg->form5+(int)$tabStatPctg->form6; if ($ttlPctg == 100) { $status = 1; } else { $msg .= "Please fill all the froms showing exclamation sign.
"; $status = 0; } } } $resp = array('msg' => $msg, 'status' => $status); echo json_encode($resp); } public function patientAgreementForm($value='',$pid=null) { // $pid = $_GET['pid']; $pid = base64_dec($pid); $pdata = $this->Referral_model->getWherevalue($pid)[0]; $data['pdata'] = $pdata; $this->load->view('patientAgreementForm',$data); } public function load_progress() { $id = $this->input->get('id'); $progress=$this->Referral_model->getProgress($id); echo $progress; } /* | new added on 28-09-2021~~ */ public function ChangePassword($id=null) { $id = base64_dec($id); // $id = $this->input->get('id'); $data['patient']=$this->Referral_model->getPatientById($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('change_password',$data); $this->load->view('home/footer'); } public 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 did not match!'); redirect('referral/ChangePassword/'.base64_enc($id)); } else { if($password=="") { $this->session->set_flashdata('feedback_error', 'Password can not be blanked!'); redirect('referral/ChangePassword/'.base64_enc($id)); } else { if ($this->Referral_model->update_email_check($email,$ionid)) { $this->session->set_flashdata('feedback_error', 'This Email Address Is Already Registered'); redirect('referral/ChangePassword/'.base64_enc($id)); } else { $password = $this->ion_auth_model->hash_password($password); $updatePassword=$this->Referral_model->updateIonUser($email,$password,$id,$ionid); if($updatePassword) { $this->session->set_flashdata('feedback_success', 'Password Updated Successfully'); redirect('referral/ChangePassword/'.base64_enc($id)); } else { $this->session->set_flashdata('feedback_error', 'Opps some error occurred, Password not updated. Try again!!'); redirect('referral/ChangePassword/'.base64_enc($id)); } } } } } /* | new added ending here */ public function documentsSave2($files,$id,$fileName,$doc_type,$doc_remarks) { $folder_name='uploads/PatientDocuments/PATIENT_'.str_pad($id, 6, "0", STR_PAD_LEFT).'/'; $uploadData['folder_name']=$folder_name; $uploadData['NAME']=$fileName; $uploadData['NEW_FILENAME_START']=$doc_type; $uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf'); $uploadData['CONFIG']['max_size']='20480000'; $output=multifileStore($files,$uploadData); $z=0; foreach ($output as $udata) { $data = array( 'patient_id' => $id, 'path' => $udata['PATH'], 'file_name' => $udata['NEW_FILE_NAME'], 'originalfilename' => $udata['ORIGINAL_FILE_NAME'], 'documents_type' => $doc_type, 'remarks' => $doc_remarks[$z] ); $docId=$this->Referral_model->addPatientDocuments($data); $z++; } if($docId){ return true; }else{ return false; } } public function documentDelete() { $fid = $_GET['fid']; // $redirect = $_GET['redirect']; $redirect_str = $_GET['redirect']; $redirect_arr = explode("/",$redirect_str); $redirect = $redirect_arr[0].'/'.$redirect_arr[1].'/'.base64_enc($redirect_arr[2]); // _die($redirect); $docdet=$this->Referral_model->getDocDetails($fid)[0]; $file_pointer = base_url().$docdet->path.$docdet->file_name; $docdet2=$this->Referral_model->delete_patient_doc($fid); if ($docdet2) { unlink($file_pointer); $this->session->set_flashdata('doc_deleted', 'doc_delete'); } else { $this->session->set_flashdata('doc_deleted_fails', 'doc_deleted_failsd'); } redirect($redirect); } public function documentsSave() { $id=$this->input->post('id'); $doc_type=$this->input->post('doc_type'); $Doc_remarks=$this->input->post('otherDoc_remarks'); $folder_name='uploads/PatientDocuments/PATIENT_'.str_pad($id, 6, "0", STR_PAD_LEFT).'/'; $uploadData['folder_name']=$folder_name; $uploadData['NAME']=$this->input->post('doc_type'); $uploadData['NEW_FILENAME_START']='TRACH_DOC'; $uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf'; $uploadData['CONFIG']['max_size']='20480000'; $output=fileStore($_FILES,$uploadData); $data = array( 'userid' => $id, 'path' => $output['PATH'], 'file_name' => $output['NEW_FILE_NAME'], 'originalfilename' => $output['ORIGINAL_FILE_NAME'], 'documents_type' => $doc_type, 'remarks' => $Doc_remarks ); $docId=$this->Referral_model->addPatientDocuments($data); echo $docId; } public function getPendingApprovalList() { $this->load->model('Referral_model'); $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; if ($limit == -1) { if (!empty($search)) { $data['name'] = $this->Referral_model->getNameBysearchPending($search); } else { $data['name'] = $this->Referral_model->name_listPending(); } } else { if (!empty($search)) { $data['name'] = $this->Referral_model->getNameByLimitBySearchPending($limit, $start, $search); } else { $data['name'] = $this->Referral_model->getNameByLimitPending($limit, $start); } } foreach ($data['name'] as $data) { static $slno = 1; $options3 = ''; $options4 = ''; $options5 = ''; if( $data->approve_status == 0 && $data->active_status == 0){ $options1 = ' ' . lang('Activate') .' '; // $options3 = ' ' . lang('Patient agreement form') .' '; $stsMsg = "Not Activate"; } elseif ($data->approve_status == 1 && $data->active_status == 0) { $options1 = ' ' . lang('Activate') .' '; $stsMsg = "Approved but not Activated"; } else{ $options1 = ' ' . lang('Edit Activation') .' '; $stsMsg = "Referral is activated"; } $options2 = ' ' . lang('Edit Referral') .' '; $options4 = ''; $options5 = ''; if($this->session->userdata('user_id')==1 && $this->ion_auth->in_group(array('admin')) && $this->input->post('dlGvdftsdr')==202){ $options6 = ''; }else{ $options6=''; } $info[] = array( $slno, 'REF'.$data->patient_id, $data->first_name." ".$data->last_name, $data->telephone, $stsMsg, $options1." ".$options2." ".$options3." ".$options4." ".$options5." ".$options6 ); $slno++; } $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => $this->db->get('patient_details')->num_rows(), "recordsFiltered" => $this->db->get('patient_details')->num_rows(), "data" => $info ); echo json_encode($output); } public function getList() { $this->load->model('Referral_model'); $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; if ($limit == -1) { if (!empty($search)) { $data['name'] = $this->Referral_model->getNameBysearch($search); } else { $data['name'] = $this->Referral_model->name_list(); } } else { if (!empty($search)) { $data['name'] = $this->Referral_model->getNameByLimitBySearch($limit, $start, $search); } else { $data['name'] = $this->Referral_model->getNameByLimit($limit, $start); } } foreach ($data['name'] as $data) { $intAssmStat = $this->Referral_model->getInitialAssessmentStatus($data->id); static $slno = 1; $statusChk = ''; if($data->status == "0"){ $statusChk = ''; }else{ $statusChk = 'checked'; } $options1 =''; $options3 = ' ' . lang('View') .''; $options5 = ' ' . lang('Schedule') .''; $options6 = ' ' . lang('Discharge') .'' ; $switch = ''; $info[] = array( $slno, $data->patient_id, $data->first_name." ".$data->last_name, $data->telephone, $switch, $options3." ".$options1." ".$options5." ".$options6 ); $slno++; } $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => $this->db->get('patient_details')->num_rows(), "recordsFiltered" => $this->db->get('patient_details')->num_rows(), "data" => $info ); echo json_encode($output); } function checkaddress() { // $response=map_address($_GET['address'].'+'.$_GET['zipcode']); $response=mapquest_address($_GET['address'],$_GET['zipcode']); echo json_encode($response); } public function getIcdList() { $icdCode = $this->input->get('code'); $data=get_ICD_Info($icdCode); // echo '';print_r($data); echo '';die(); // echo $data; // die(); for($i=0; $i'.$data[$i]['title'].''; } echo $options; } public function getNpiData() { $npicode = $this->input->get('code'); $response=npinumber_checking($npicode); // echo ' ';print_r($response); echo '';die(); // $response=npinumber_checking($_GET['npi']); if ($response->status_code == "404") { $data = $response; } else { $data=array( 'fname'=>$response->results[0]->basic->first_name, 'lname'=> $response->results[0]->basic->last_name, 'address'=>$response->results[0]->addresses[0]->address_1." ".$response->results[0]->addresses[0]->address_2, 'country'=>$response->results[0]->addresses[0]->country_name, 'country_code'=>$response->results[0]->addresses[0]->country_code, 'city'=>$response->results[0]->addresses[0]->city, 'phone'=>$response->results[0]->addresses[0]->telephone_number, 'zipcode'=>$response->results[0]->addresses[0]->postal_code, 'state'=>$response->results[0]->addresses[0]->state, 'result_count'=>$response->result_count, 'primary'=>$response->results[0]->taxonomies[0]->primary, 'license'=>$response->results[0]->taxonomies[0]->license ); } echo json_encode($data); } public function mapDist() { $address = 'google hq'; $zipcode ='94043'; // $resp = map_address($address); $resp=mapquest_address($address,$zipcode); var_dump($resp); } public function file_downloader() { $docType = $this->input->get('doctype'); // echo $docType; $userId = $this->input->get('userid'); // echo $userId;die; $response=$this->Referral_model->getFileBypatientIdFileType($docType,$userId); // echo"";print_r($response);die; $forPath = $response->path; $forFile_name = $response->file_name; $url = $forPath.$forFile_name; // echo $url;die; $rand = rand(9,99999999); $file_name=rand(9,9999999)."_".basename($url); if(force_download($file_name, file_get_contents($url))){ echo "File downloaded successfully"; }else{ echo "File downloading failed."; } } }