1023 lines
43 KiB
PHP
Executable File
1023 lines
43 KiB
PHP
Executable File
<?php
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
class PatientDashboard extends MX_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('referral/Referral_model');
|
|
$this->load->model('PatientDashboard_model');
|
|
$this->load->model('caregivers/Caregiver_model');
|
|
$this->load->model('home/Home_model');
|
|
$this->load->helper('generatepdf_helper');
|
|
$this->load->helper('docexpiredate_helper');
|
|
$this->load->helper('menu_helper');
|
|
$this->load->helper('map_helper');
|
|
if (!$this->ion_auth->in_group(array('Patient','admin'))) {
|
|
redirect(base_url().'home/permission');
|
|
}
|
|
}
|
|
public function index()
|
|
{
|
|
$id=$this->session->userdata('user_id');
|
|
$data['patient']=$this->Referral_model->getPatientByIonId($id);
|
|
$progress=$data['patient']->progress;
|
|
// if($progress < 80)
|
|
// {
|
|
// redirect(base_url()."patientDashboard/profile");
|
|
// }
|
|
$this->load->view('home/dashboard');
|
|
$this->load->view('dashboard',$data);
|
|
$this->load->view('home/footer');
|
|
}
|
|
public function profile()
|
|
{
|
|
$id=$this->session->userdata('user_id');
|
|
$data['patient']=$this->Referral_model->getPatientByIonId($id);
|
|
$pid=$data['patient']->id;
|
|
$progress=$data['patient']->progress;
|
|
if($progress < 80){
|
|
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;
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('profile',$data);
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
else{
|
|
redirect(base_url()."patientDashboard");
|
|
}
|
|
|
|
}
|
|
|
|
public function editProfile()
|
|
{
|
|
if($this->input->post('pid')!="")
|
|
{
|
|
$pid = $this->input->post('pid');
|
|
}
|
|
|
|
if ($pid == '')
|
|
{
|
|
$email = $this->input->post('email');
|
|
$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');
|
|
}
|
|
/*
|
|
| Registration to the patient_details table
|
|
| & to the other tables related to the patient
|
|
*/
|
|
$pid = $this->Referral_model->insertNewReferral($data);
|
|
|
|
/*
|
|
| Registration to the users table
|
|
*/
|
|
$username = $data['first_name'];
|
|
$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;
|
|
|
|
/*
|
|
| After Registration Send an activation Mail
|
|
| to the Patient Registered Email Id
|
|
*/
|
|
$fname=$this->input->post('fname');
|
|
$lname=$this->input->post('lname');
|
|
$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);
|
|
|
|
}
|
|
|
|
$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('email')!="")
|
|
{
|
|
$data['patient_email'] = $this->input->post('email');
|
|
if($pid==''){
|
|
$data['ion_user_id'] = $this->db->get_where('users', array('email' => $data['patient_email']))->row()->id;
|
|
}
|
|
}
|
|
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('type_access')!="")
|
|
{
|
|
$data['type_access'] = implode(",",$this->input->post('type_access'));
|
|
}
|
|
if($this->input->post('primaryCarePhyMdInfo')!="")
|
|
{
|
|
$data['primaryCarePhyMdNpi'] = $this->input->post('primaryCarePhyMdInfo');
|
|
}
|
|
# end of updation of patient_details table
|
|
// $data['ion_user_id'] = $this->db->get_where('users', array('email' => $data['patient_email']))->row()->id;
|
|
$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');
|
|
}
|
|
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');
|
|
}
|
|
# end of updation of patient_payment_info table
|
|
$update4 = $this->Referral_model->updateReferralTable($data, 'patient_payment_info', $pid);
|
|
|
|
|
|
if($update1 || $update1a || $update2 || $update3 || $update4){
|
|
$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 '<pre>'; 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('fromType')=='addRef') && ($this->input->post('submit')=='mdOrders_info'))
|
|
{
|
|
// redirect("referral/approval");
|
|
redirect(base_url()."patientDashboard");
|
|
}
|
|
else if($this->input->post('fromType')=='addRef')
|
|
{
|
|
// redirect("referral/ReferralFrom?pid={$pid}");
|
|
redirect(base_url()."patientDashboard/profile");
|
|
}
|
|
if ($this->input->post('fromType')=='activeRef')
|
|
{
|
|
// redirect("referral/ReferralActivation?pid={$pid}");
|
|
redirect(base_url()."patientDashboard");
|
|
}
|
|
|
|
}
|
|
|
|
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 "<pre>"; print_r($res); die;
|
|
foreach ($mandateFields as $value)
|
|
{
|
|
if($res->$value == '')
|
|
{
|
|
// echo $value .':'. $res->$value .'<br>';
|
|
$total = $total - 1.66666666667;
|
|
}
|
|
}
|
|
return ceil($total);
|
|
}#done
|
|
|
|
public function patientAgreementForm($value='')
|
|
{
|
|
$pid = $_GET['pid'];
|
|
$pdata = $this->Referral_model->getWherevalue($pid)[0];
|
|
$data['pdata'] = $pdata;
|
|
$this->load->view('patientAgreementForm',$data);
|
|
}#done
|
|
|
|
public function load_progress()
|
|
{
|
|
$id = $this->input->get('id');
|
|
$test_id = $this->patient_identity_id();
|
|
if($id==$test_id){
|
|
$progress=$this->Referral_model->getProgress($id);
|
|
}else{
|
|
redirect($this->uri->uri_string()."?id=".$test_id);
|
|
}
|
|
echo $progress;
|
|
}#done
|
|
|
|
/*
|
|
| new added on
|
|
*/
|
|
public function checkEmail()
|
|
{
|
|
$pid=$this->input->get("pid");
|
|
// $ion_user_id=$this->session->userdata('user_id');
|
|
$ion_user_id = $this->db->get_where('patient_details', array('id' => $pid))->row()->ion_user_id;
|
|
$email=$this->input->get('email');
|
|
$result=$this->PatientDashboard_model->checkEmail($ion_user_id,$email);
|
|
echo $result;
|
|
}
|
|
public function hms_check_patient_email_avl(){
|
|
try{
|
|
$pid=$this->input->get("pid");
|
|
$email=$this->input->get('email');
|
|
$result=$this->PatientDashboard_model->check_patient_email_avl($pid,$email);
|
|
echo $result;
|
|
}catch(Exception $e){
|
|
$getMsg="PatientDashboard - hms_check_patient_email_avl: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
public function checkTel()
|
|
{
|
|
$pid=$this->input->get("pid");
|
|
// $ion_user_id = $this->db->get_where('patient_details', array('id' => $pid))->row()->ion_user_id;
|
|
$tel=$this->input->get('tel');
|
|
$result=$this->PatientDashboard_model->checkTel($pid,$tel);
|
|
echo $result;
|
|
}
|
|
public function ChangePassword()
|
|
{
|
|
$id = $this->input->get('id');
|
|
$test_id = $this->patient_identity_id();
|
|
if($id==$test_id){
|
|
$data['patient']=$this->Referral_model->getPatientById($id);
|
|
}else{
|
|
redirect($this->uri->uri_string()."?id=".$test_id);
|
|
}
|
|
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('change_password',$data);
|
|
$this->load->view('home/footer');
|
|
}#done
|
|
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('patientDashboard/ChangePassword?id='.$id);
|
|
}
|
|
else
|
|
{
|
|
if($password=="")
|
|
{
|
|
$this->session->set_flashdata('feedback_error', 'Password can not be blanked!');
|
|
redirect('patientDashboard/ChangePassword?id='.$id);
|
|
}
|
|
else
|
|
{
|
|
if ($this->Referral_model->update_email_check($email,$ionid))
|
|
{
|
|
$this->session->set_flashdata('feedback_error', 'This Email Address Is Already Registered');
|
|
redirect('patientDashboard/ChangePassword?id='.$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('patientDashboard/ChangePassword?id='.$id);
|
|
}
|
|
else
|
|
{
|
|
$this->session->set_flashdata('feedback_error', 'Opps some error occurred, Password not updated. Try again!!');
|
|
redirect('patientDashboard/ChangePassword?id='.$id);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}#done
|
|
/*
|
|
| 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;
|
|
}
|
|
}#done
|
|
|
|
public function documentDelete()
|
|
{
|
|
$fid = $_GET['fid'];
|
|
$redirect = $_GET['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(base_url().$redirect);
|
|
}#done
|
|
|
|
function checkaddress()
|
|
{
|
|
// $response=map_address($_GET['address'].'+'.$_GET['zipcode']);
|
|
$response=mapquest_address($_GET['address'],$_GET['zipcode']);
|
|
echo json_encode($response);
|
|
}#done
|
|
|
|
public function getIcdList()
|
|
{
|
|
$icdCode = $this->input->get('code');
|
|
$data=get_ICD_Info($icdCode);
|
|
// echo '<pre>';print_r($data); echo '<pre>';die();
|
|
// echo $data;
|
|
// die();
|
|
for($i=0; $i<count($data); $i++)
|
|
{ // Loop through the data & construct the options
|
|
$options .= '<option value="'.$data[$i]['id'].'">'.$data[$i]['title'].'</option>';
|
|
}
|
|
echo $options;
|
|
}#done
|
|
|
|
public function getNpiData()
|
|
{
|
|
|
|
$npicode = $this->input->get('code');
|
|
$response=npinumber_checking($npicode);
|
|
// echo '<pre>';print_r($response); echo '<pre>';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);
|
|
}#done
|
|
|
|
// newly added
|
|
private function patient_identity_id()
|
|
{
|
|
$id=$this->session->userdata('user_id');
|
|
$data['patient']=$this->Referral_model->getPatientByIonId($id);
|
|
$pid=$data['patient']->id;
|
|
return $pid;
|
|
}
|
|
// newly added ending here
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|