load->library('form_validation'); $this->load->model('Patient_model'); if (!$this->ion_auth->in_group('admin')) { redirect('home/permission'); } } public function index() { $this->load->view('home/dashboard'); // just the header file $this->load->view('patient'); $this->load->view('home/master_assets'); $this->load->view('home/footer'); // just the header file } public function viewPatient() { $pid =$_GET['id']; $data['pid']=$_GET['id']; $allData = $this->Patient_model->getWherevalue($pid)[0]; $data['datas'] = $allData; $allDataIns = $this->Patient_model->getWherevalueInsInfo($pid)[0]; $data['dataIns'] = $allDataIns; /*assessment*/ $data['asmData'] = $this->Patient_model->getWhereAssessment($pid); /*assessment end*/ $this->load->view('home/dashboard'); // just the header file $this->load->view('patientView',$data); $this->load->view('home/footer'); } public function statusChange(){ $this->load->model('Patient_model'); $res = $this->Patient_model->status_change($_POST); echo $res; } public function editReferal() { $pid =$_GET['pid']; $allData = $this->Patient_model->getWherevalue($pid)[0]; $data['pdata'] = $allData; $mdData = $this->Patient_model->getWhereMdOrders($pid)[0]; $data['mddata'] = $mdData; $insdata = $this->Patient_model->getWherevalueInsInfo($pid)[0]; $data['idata'] = $insdata; $pdocs = $this->Patient_model->getPatientDoc($pid,'TRACH'); $data['TRACHdocs'] = $pdocs; $pdocs = $this->Patient_model->getPatientDoc($pid,'PAGD'); $data['PAGDdocs'] = $pdocs; $data['langs'] = $this->Patient_model->getLanguages(); $data['preferal'] = $this->Patient_model->getReferalSource(); $data['lvlService'] = $this->Patient_model->getLevelService(); $data['serviceActivity'] = $this->Patient_model->getServiceActivity(); $data['therapyType'] = $this->Patient_model->getTherapyType(); $data['accessType'] = $this->Patient_model->getAccessType(); $data['tubes'] = $this->Patient_model->getTubeType(); $data['eleDep'] = $this->Patient_model->getEleDep(); $data['micd'] = $this->Patient_model->getICD(); $data['payerType'] = $this->Patient_model->getPayertype(); $data['vendorList'] = $this->Patient_model->getvendorLists(); $data['patientList'] = $this->Patient_model->patientLists(); $data['rnId'] = $this->Patient_model->getValueFrom('master_cg_skills','name','RN')[0]->id; $data['lnpId'] = $this->Patient_model->getValueFrom('master_cg_skills','name','LNP')[0]->id; if (isset($_POST) && $_POST['submit'] == 'gen_info') { $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('fname', 'First Name', 'trim|required|max_length[100]|xss_clean'); $this->form_validation->set_rules('lname', 'Last Name', 'trim|required|max_length[100]|xss_clean'); $this->form_validation->set_rules('gender', 'Gender', 'trim|required|xss_clean'); $this->form_validation->set_rules('pnalguage', 'Primary language', 'trim|required|max_length[50]|xss_clean'); $this->form_validation->set_rules('dob', 'Date of Birth', 'trim|required|max_length[50]|xss_clean'); } if (isset($_POST) && $_POST['submit'] == 'mdOrders_info') { $this->form_validation->set_rules('MdOrderNotes', 'MdOrderNotes', 'xss_clean'); // $this->form_validation->set_rules('level_service', 'Level of service', 'required'); } if (isset($_POST) && $_POST['submit'] == 'services') { // $this->form_validation->set_rules('referal_source', 'Referal Source', 'required|xss_clean'); $this->form_validation->set_rules('level_service', 'Level of service', 'required'); } if (isset($_POST) && $_POST['submit'] == 'insInfo') { $this->form_validation->set_rules('paymentModes', 'payment modes', 'required'); } if (isset($_POST) && $_POST['submit'] == 'patientAgreement') { $this->form_validation->set_rules('patient_agreement_Document_Verified', 'patient agreement Document Verified', 'required'); } if ($this->form_validation->run() == FALSE) { $this->load->view('home/dashboard'); // just the header file $this->load->view('edit_referral',$data); $this->load->view('home/footer'); // just the header file } else { // echo "
";
            // print_r($_REQUEST);
            // print_r($_FILES); 
            
            if($_POST['submit'] == 'gen_info')
            {                
                $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'),
                                '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'),
                                'telephone' => $this->input->post('telephone'),
                                'cellphone' => $this->input->post('cellphone'),
                                'designate_first_name' => $this->input->post('dg_fname'),
                                'designate_last_name' => $this->input->post('dg_lname'),
                                'designate_telephone' => $this->input->post('dg_telephone'),
                                'designate_cell' => $this->input->post('dg_cell'),
                                '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->Patient_model->updatePatient($data,$pid);
                    $this->session->set_userdata('editRef_stat', 'step1');                    
                    redirect("patient/editReferal?pid={$pid}");
                }
                else
                {
                    $id = $this->Patient_model->insertPatient($data);
                    $this->Patient_model->mdOrdersInsert(array('patient_id' => $id));
                    $this->session->set_userdata('editRef_stat', 'step1');
                    
                    redirect("patient/editReferal?pid={$id}");
                }   
            }            

            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')                    
                );

                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->Patient_model->updatePatient($data,$pid);
                $this->session->unset_userdata('editRef_stat');
                redirect("patient/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'),
                    // 'emgContactAccessToHome' => $this->input->post('emgAccessTohome'),
                    // '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')
                );

                
                if ($pdata->form_status <= "2") 
                {
                    $pudata['form_status'] = 3;
                    $pudata['progress'] = 70;
                    $id = $this->Patient_model->updatePatient($pudata,$pid);
                    $this->session->set_flashdata('ref_added', 'added');
                }
                else
                {
                    $this->session->set_flashdata('ref_updated', 'updated');
                }
                
                
                $id = $this->Patient_model->insertPatientInsurance($data,$pid);
                $this->session->set_userdata('actPtn_stat', 'step4');
                redirect("patient/editReferal?pid={$pid}");
            }
            // insurance info

            // patient 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->Patient_model->updatePatient($data,$pid);
                redirect('patient/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->Patient_model->updatePatient($datap,$pid);
                    $this->session->set_flashdata('ref_added', 'added');
                }
                else
                {
                    $this->Patient_model->updatePatient($datap,$pid);
                    $this->session->set_flashdata('ref_updated', 'updated');
                }

                

                $this->Patient_model->mdOrdersUpdate($data,$pid);
                $this->session->set_userdata('editRef_stat', 'step2');
                redirect("patient/editReferal?pid={$pid}");
            }
                // patient patientAgreement
            }

    }

    public function approval()
    {
        $pid =$_GET['id'];
        $data['pid']=$_GET['id'];
        
        if(isset($_GET['id'])){
            if ($_GET['approve']=='true') {
                $resp = $this->Patient_model->approvePatient($pid);
                $this->session->unset_userdata('actPtn_stat');    
                redirect("patient/activatePatient?pid=$pid");
            }
                
            $allData = $this->Patient_model->getWherevalue($pid)[0];
            $data['datas'] = $allData;
            $allDataIns = $this->Patient_model->getWherevalueInsInfo($pid)[0];
            $data['dataIns'] = $allDataIns;
            
            /*assessment*/
            $data['asmData'] = $this->Patient_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('pendin_approval_list');
            $this->load->view('home/footer'); // just the header file
        }       
    }

    public function activatePatient()
    {
            $pid = $_GET['pid'];   

            $data['langs'] = $this->Patient_model->getLanguages();
            $data['preferal'] = $this->Patient_model->getReferalSource();
            $data['lvlService'] = $this->Patient_model->getLevelService();  
            $data['serviceActivity'] = $this->Patient_model->getServiceActivity(); 
            $data['eleDep'] = $this->Patient_model->getEleDep();
            $data['therapyType'] = $this->Patient_model->getTherapyType(); 
            $data['accessType'] = $this->Patient_model->getAccessType();
            $data['tubes'] = $this->Patient_model->getTubeType();
            $data['vendorList'] = $this->Patient_model->getvendorLists();
            $data['payerType'] = $this->Patient_model->getPayertype();
            $data['allergy'] = $this->Patient_model->getallergy();
            $data['rnId'] = $this->Patient_model->getValueFrom('master_cg_skills','name','RN')[0]->id;
            $data['lnpId'] = $this->Patient_model->getValueFrom('master_cg_skills','name','LNP')[0]->id;

            $pdocs = $this->Patient_model->getPatientDoc($pid,'TRACH');
            $data['TRACHdocs'] = $pdocs;
            $pdocs = $this->Patient_model->getPatientDoc($pid,'PAGD');
            $data['PAGDdocs'] = $pdocs;
            $pdocs = $this->Patient_model->getPatientDoc($pid,'INSD');
            $data['INSDdocs'] = $pdocs;
            $data['type'] = $_GET['pid'];
            $pdata = $this->Patient_model->getWherevalue($pid)[0];
            $data['pdata'] = $pdata;
            $insdata = $this->Patient_model->getWherevalueInsInfo($pid)[0];
            $data['idata'] = $insdata;
            $mdData = $this->Patient_model->getWhereMdOrders($pid)[0];
            $data['mddata'] = $mdData;

            if(isset($_GET['pid']))
            {
                if ($_GET['activate']=='true') 
                {
                    $resp = $this->Patient_model->activatePatient($pid);    
                    redirect("patient/approval");
                }
            }

            if (isset($_POST) && $_POST['submit'] == 'gen_info')
            {
                $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('fname', 'First Name', 'trim|required|max_length[100]|xss_clean'); $this->form_validation->set_rules('lname', 'Last Name', 'trim|required|max_length[100]|xss_clean'); $this->form_validation->set_rules('email', 'Email', 'trim|required|max_length[50]|xss_clean'); $this->form_validation->set_rules('gender', 'Gender', 'trim|required|xss_clean'); $this->form_validation->set_rules('pnalguage', 'Primary language', 'trim|required|max_length[50]|xss_clean'); $this->form_validation->set_rules('dob', 'Date of Birth', 'trim|required|max_length[50]|xss_clean'); $this->form_validation->set_rules('socsec', 'Soc sec ', 'required'); $this->form_validation->set_rules('merital_stat', 'Merital Status', 'required'); $this->form_validation->set_rules('cellphone', 'CellPhone', 'required'); $this->form_validation->set_rules('address', 'Address', 'required'); } if (isset($_POST) && $_POST['submit'] == 'mdOrders_info') { $this->form_validation->set_rules('MdOrderNotes', 'MdOrderNotes', 'xss_clean'); // $this->form_validation->set_rules('level_service', 'Level of service', 'required'); } if (isset($_POST) && $_POST['submit'] == 'services') { $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('level_service', 'Level of Service', 'required|xss_clean'); } if (isset($_POST) && $_POST['submit'] == 'insInfo') { $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('paymentModes', 'Payment Type', 'required|xss_clean'); } if (isset($_POST) && $_POST['submit'] == 'patientAgreement') { $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('patient_agreement_Document_Verified', 'patient agreement Document Verified', 'required'); } if (isset($_POST) && $_POST['submit'] == 'insAgreement') { $this->form_validation->set_error_delimiters('
', '
'); $this->form_validation->set_rules('ins_agreement_doc_Verified', 'Insurance Authorization', 'required|xss_clean'); } if ($this->form_validation->run() == FALSE) { $this->load->view('home/dashboard'); // just the header file $this->load->view('activatePatient',$data); $this->load->view('home/footer'); // just the header file } else { /**genral**/ if (isset($_POST) && $_POST['submit'] == 'gen_info') { $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 = ""; } // Validating Name Field $fname = $this->input->post('fname'); // Validating Email Field $lname = $this->input->post('lname'); $email = $this->input->post('email'); $Gender = $this->input->post('gender'); $pnalguage = $this->input->post('pnalguage'); $dob = $this->input->post('dob'); $socsec = $this->input->post('socsec'); $merital_stat = $this->input->post('merital_stat'); $telephone = $this->input->post('telephone'); $height = $this->input->post('height'); $weight = $this->input->post('weight'); $cellphone = $this->input->post('cellphone'); $address = $this->input->post('address'); $lati_cdnt = $this->input->post('lang1'); $longi_cdnt = $this->input->post('long1'); $AddrApartment = $this->input->post('AddrApartment'); $addrCity = $this->input->post('addrCity'); $addrState = $this->input->post('addrState'); $addrZipcode = $this->input->post('addrZipcode'); $addrCounty = $this->input->post('addrCounty'); $alt_address = $this->input->post('alt_address'); $altApartment = $this->input->post("altApartment"); $AltCity = $this->input->post("AltCity"); $altState = $this->input->post("altState"); $altZipcode = $this->input->post("altZipcode"); $altCounty = $this->input->post("altCounty"); $direction = $this->input->post('direction'); $otr_number = $this->input->post('otr_number'); $data = array( 'reference_information' => $referance_source, 'reference_id' => $referance_source_value, 'referral_contact' => $this->input->post('referal_contact'), 'referral_type' => $this->input->post('referal_type'), 'referral_date' => $this->input->post('referal_recive_date'), 'first_name' => $fname, 'last_name' => $lname, 'patient_email' => $email, 'gender' => $Gender, 'primary_language' => $pnalguage, 'dob' => $dob, 'soc_sec_no' => $socsec, 'marital_stat' => $merital_stat, 'height' => $height, 'weight' => $weight, 'telephone' => $telephone, 'cellphone' => $cellphone, 'other_no' => $otr_number, 'address' => $address, 'add_house_Number_and_Street_Name' => $address, 'add_Apartment' => $AddrApartment, 'add_city' => $addrCity, 'add_state' => $addrState, 'add_zip_code' => $addrZipcode, 'add_county' => $addrCounty, 'alt_billing_address' => $alt_address, 'alt_house_Number_and_Street_Name' => $alt_address, 'alt_Apartment' => $altApartment, 'alt_city' => $AltCity, 'alt_state' => $altState, 'alt_zip_code' => $altZipcode, 'alt_county' => $altCounty, 'latitude' => $lati_cdnt, 'longitude' => $longi_cdnt, 'direction' => $direction, 'designate_first_name' => $this->input->post('dg_fname'), 'designate_last_name' => $this->input->post('dg_lname'), 'designate_telephone' => $this->input->post('dg_telephone'), 'designate_cell' => $this->input->post('dg_cell'), ); $pid = $_GET['pid']; $id = $this->Patient_model->updatePatient($data,$pid); $this->session->set_userdata('actPtn_stat', 'step1'); $this->session->set_flashdata('ref_updated', 'updated'); redirect("patient/activatePatient?pid={$pid}"); } /**genral**/ /**services**/ if (isset($_POST) && $_POST['submit'] == 'services') { $data = array( 'level_of_care' => $this->input->post('level_care'), 'level_service' => $this->input->post('level_service'), '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 <= "1") { $data['form_status'] = 2; $data['progress'] = 40; } $id = $this->Patient_model->updatePatient($data,$pid); $this->session->set_userdata('actPtn_stat', 'step3'); $this->session->set_flashdata('ref_updated', 'updated'); redirect("patient/activatePatient?pid={$pid}"); } /**services**/ /**payer info**/ if (isset($_POST) && $_POST['submit'] == 'insInfo') { $pid = $_GET['pid']; $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'), // 'emgContactAccessToHome' => $this->input->post('emgAccessTohome'), // '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'), ); if ($pdata->form_status <= "2") { $pudata['form_status'] = 3; $pudata['progress'] = 70; $id = $this->Patient_model->updatePatient($pudata,$pid); } $id = $this->Patient_model->insertPatientInsurance($data,$pid); $this->session->set_userdata('actPtn_stat', 'step4'); $this->session->set_flashdata('ref_updated', 'updated'); redirect("patient/activatePatient?pid={$pid}"); } /**payer info**/ /** 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') { $dataPa = array( 'patient_id' => $pid, 'patient_auth_stat' => 1, 'approve_status' => 1 ); } if ($pdata->form_status <= "3") { $dataPa['form_status'] = 4; $dataPa['progress'] = 85; } $this->Patient_model->updatePatient($dataPa,$pid); $this->session->set_flashdata('ref_updated', 'updated'); redirect("patient/activatePatient?pid={$pid}"); } /** patientAgreement **/ /**md order**/ 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'] = 90; $id = $this->Patient_model->updatePatient($datap,$pid); // echo "::::if from stat <= 4:::: :: TRUE"; // echo $this->db->last_query(); } else { $this->Patient_model->updatePatient($datap,$pid); $this->session->set_flashdata('ref_updated', 'updated'); // echo "::::if from stat <= 4:::: :: FAlse"; // echo $this->db->last_query(); } $this->Patient_model->mdOrdersUpdate($data,$pid); // echo ":::: if MD ORDER UPDATE :::: :: FAlse"; echo $this->db->last_query(); $this->session->set_userdata('actPtn_stat', 'step2'); $this->session->set_flashdata('ref_updated', 'updated'); // die(); redirect("patient/activatePatient?pid={$pid}"); } /**md order**/ /** insAgreement **/ if (isset($_POST) && $_POST['submit'] == 'insAgreement') { $remarks = $this->input->post("insDoc_remarks"); if(!empty($_FILES['insDoc']['name'][0])) { $fileRet = $this->documentsSave2($_FILES,$pid,'insDoc','INSD',$remarks); } if($this->input->post('ins_agreement_doc_Verified')=='Verified') { $data = array( 'patient_id' => $pid, 'insurance_auth_stat' => 1, ); } if ($pdata->form_status <= "5") { $data['form_status'] = 6; $data['progress'] = 100; } $this->Patient_model->updatePatient($data,$pid); $this->session->set_flashdata('ref_updated', 'updated'); redirect("patient/activatePatient?pid={$pid}"); } /* insAgreement */ } /*from rules pass else block end*/ } public function activatePatientCriterial() { $msg = ""; $status = 0; $pid = $_POST['pid']; $pdata = $this->Patient_model->getWherevalue($pid)[0]; // if ($pdata->reference_information == "Reffered by Patient") { $insInfo = $this->Patient_model->insuranceInfoCheck($pid); if ($insInfo > 0) { $status = 1; } else { $msg .= "Please update the Insurance Information details to activate
"; } if ($pdata->patient_auth_stat == 'Insurance Information') { if ($pdata->patient_auth_stat != '0') { $status = 1; } else { $msg .= "Patient authorisation is pending
"; } } // } // else{ // $status = 1; // } $resp = array('msg' => $msg, 'status' => $status); echo json_encode($resp); } public function patientAgreementForm($value='') { $pid = $_GET['pid']; $pdata = $this->Patient_model->getWherevalue($pid)[0]; $data['pdata'] = $pdata; $this->load->view('patientAgreementForm',$data); } public function load_progress() { $id = $this->input->get('id'); $progress=$this->Patient_model->getProgress($id); echo $progress; } 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->Patient_model->addPatientDocuments($data); $z++; } } public function documentDelete() { $fid = $_GET['fid']; $redirect = $_GET['redirect']; $docdet=$this->Patient_model->getDocDetails($fid)[0]; $file_pointer = base_url().$docdet->path.$docdet->file_name; if (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->Patient_model->addPatientDocuments($data); echo $docId; } public function getPendingApprovalList() { $this->load->model('Patient_model'); $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; if ($limit == -1) { if (!empty($search)) { $data['name'] = $this->Patient_model->getNameBysearchPending($search); } else { $data['name'] = $this->Patient_model->name_listPending(); } } else { if (!empty($search)) { $data['name'] = $this->Patient_model->getNameByLimitBySearchPending($limit, $start, $search); } else { $data['name'] = $this->Patient_model->getNameByLimitPending($limit, $start); } } foreach ($data['name'] as $data) { static $slno = 1; $options3 = ''; if( $data->approve_status == 0 && $data->active_status == 0){ $options1 = ' ' . lang('Approve') .' '; $options3 = ' ' . lang('Patient agreement form') .' '; $stsMsg = "Not Approved"; } elseif ($data->approve_status == 1 && $data->active_status == 0) { $options1 = ' ' . lang('Activate') .' '; $stsMsg = "Approved but not Activated"; } $options2 = ' ' . lang('Edit') .' '; $info[] = array( $slno, 'REF'.$data->patient_id, $data->first_name." ".$data->last_name, $data->telephone, $stsMsg, $options1." ".$options2." ".$options3 ); $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('Patient_model'); $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; if ($limit == -1) { if (!empty($search)) { $data['name'] = $this->Patient_model->getNameBysearch($search); } else { $data['name'] = $this->Patient_model->name_list(); } } else { if (!empty($search)) { $data['name'] = $this->Patient_model->getNameByLimitBySearch($limit, $start, $search); } else { $data['name'] = $this->Patient_model->getNameByLimit($limit, $start); } } foreach ($data['name'] as $data) { $intAssmStat = $this->Patient_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=address_info($_GET['address'],$_GET['zipcode']); echo json_encode($response); } public function viewInitialAssessment($id) { $pid =$id; $data['pid']=$id; $this->load->model('Patient_model'); $allData = $this->Patient_model->getWherevalue($pid)[0]; $data['datas'] = $allData; /*assessment*/ $data['asmData'] = $this->Patient_model->getWhereAssessment($pid)[0]; /*assessment end*/ $this->load->view('home/dashboard'); // just the header file $this->load->view('patientInitialAssessmentView',$data); $this->load->view('home/footer'); } }