1258 lines
61 KiB
PHP
Executable File
1258 lines
61 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class patient extends MX_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->library('form_validation');
|
|
$this->load->model('Patient_model');
|
|
$this->load->model('referral/Referral_model');
|
|
$this->load->model('master_cg_service/Master_cg_service_model');
|
|
$this->load->model('master_caregiver_skills/Test_model', 'cg_skill');
|
|
$this->load->helper('dynamicFormViewer');
|
|
if (!$this->ion_auth->in_group('admin')) {
|
|
if(!$this->ion_auth->coordinator_permission('caregivers')){
|
|
redirect('home/permission');
|
|
}
|
|
|
|
}
|
|
$this->load->helper('common_helper');
|
|
}
|
|
|
|
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()
|
|
{
|
|
$view =$this->load->helper('dynamicFormViewer');
|
|
$pid =$_GET['id'];
|
|
$data['pid']=$_GET['id'];
|
|
$allData = $this->Referral_model->getWherevalue($pid)[0];
|
|
$data['datas'] = $allData;
|
|
|
|
$insdata = $this->Referral_model->getWherevalueInsInfo($pid)[0];
|
|
$data['idata'] = $insdata;
|
|
$data['serviceActivityTherapy'] = servicetherapy($allData->level_of_service);
|
|
$data['lvlService'] = $this->Referral_model->getLevelService();
|
|
$data['accessType'] = $this->Referral_model->getAccessType();
|
|
$data['patientList'] = $this->Referral_model->patientLists();
|
|
$data['relationList'] = $this->Referral_model->relationLists();
|
|
// pre($data['datas']);die();
|
|
|
|
$data['mdorders'] = $this->Referral_model->getMdOrdersByPatientId($pid);
|
|
|
|
$skl = $this->cg_skill->getWherevalue($data['datas']->level_of_service)[0];
|
|
$data['datas']->level_of_service_name=$skl->name;
|
|
|
|
if($data['datas']->service_type_required == 'Service')
|
|
{
|
|
// _die($data['datas']->service_ids);
|
|
$stn = $this->Referral_model->getServiceNameByID($data['datas']->service_ids);
|
|
$data['datas']->serviceTherapyName=$stn->name;
|
|
}
|
|
else{
|
|
$stn = $this->Referral_model->getTherapyNameByID($data['datas']->therapy_ids);
|
|
$data['datas']->serviceTherapyName=$stn->name;
|
|
}
|
|
$data['datas']->service_or_therapy_name = $stn;
|
|
$type_access_arr = explode(',', $data['datas']->type_access);
|
|
$taa = array();
|
|
foreach ($type_access_arr as $value)
|
|
{
|
|
$ta = $this->Referral_model->getAccessNameByID($value)->name;
|
|
$taa[] = $ta;
|
|
}
|
|
|
|
$data['datas']->type_access_names= implode(',', $taa);
|
|
|
|
$allDataIns = $this->Referral_model->getWherevalueInsInfo($pid)[0];
|
|
$data['dataIns'] = $allDataIns;
|
|
$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;
|
|
|
|
/*assessment*/
|
|
$data['asmData'] = $this->Referral_model->getWhereAssessment($pid);
|
|
/*assessment end*/
|
|
$data['datas']->serviceName=$this->Referral_model->getServiceName($data['datas']->service_ids);
|
|
|
|
$ta=explode(",",$data['datas']->type_access);
|
|
$data['datas']->type_of_accesss=implode(", ",$this->Referral_model->getTypeOfAccesses($ta));
|
|
|
|
|
|
#service for specific choosen Level of Service needed
|
|
$data['type_of_service_need']=$this->Referral_model->getServiceHeads($id="",$data['datas']->level_of_service);
|
|
#service for specific choosen Level of Service needed
|
|
|
|
// pre($data['type_of_service_need']);die();
|
|
$annual_in_home_performance=[];
|
|
if($data['datas']->annual_in_home_performance){
|
|
$annual_in_home_performance=$this->objectToArray(json_decode($data['datas']->annual_in_home_performance));
|
|
}
|
|
$data['newArray']=json_encode(array_merge($annual_in_home_performance));
|
|
$data['annual_in_home_performance'] = $annual_in_home_performance;
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('loader');
|
|
$this->load->view('patientView',$data);
|
|
$this->load->view('home/footer');
|
|
$this->load->view('home/dynamicViewScript',$data['newArray']);
|
|
}
|
|
|
|
public function statusChange()
|
|
{
|
|
$this->load->model('Patient_model');
|
|
$res = $this->Referral_model->status_change($_POST);
|
|
echo $res;
|
|
}
|
|
|
|
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("patient/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('pendin_approval_list');
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
}
|
|
|
|
public function activatePatient()
|
|
{
|
|
$pid = $_GET['pid'];
|
|
|
|
$data['langs'] = $this->Referral_model->getLanguages();
|
|
$data['preferal'] = $this->Referral_model->getReferalSource();
|
|
$data['lvlService'] = $this->Referral_model->getLevelService();
|
|
$data['serviceActivity'] = $this->Referral_model->getServiceActivity();
|
|
$data['eleDep'] = $this->Referral_model->getEleDep();
|
|
$data['therapyType'] = $this->Referral_model->getTherapyType();
|
|
$data['accessType'] = $this->Referral_model->getAccessType();
|
|
$data['tubes'] = $this->Referral_model->getTubeType();
|
|
$data['vendorList'] = $this->Referral_model->getvendorLists();
|
|
$data['payerType'] = $this->Referral_model->getPayertype();
|
|
$data['allergy'] = $this->Referral_model->getallergy();
|
|
$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;
|
|
|
|
$pdocs = $this->Referral_model->getPatientDoc($pid,'TRACH');
|
|
$data['TRACHdocs'] = $pdocs;
|
|
$pdocs = $this->Referral_model->getPatientDoc($pid,'PAGD');
|
|
$data['PAGDdocs'] = $pdocs;
|
|
$pdocs = $this->Referral_model->getPatientDoc($pid,'INSD');
|
|
$data['INSDdocs'] = $pdocs;
|
|
$data['type'] = $_GET['pid'];
|
|
$pdata = $this->Referral_model->getWherevalue($pid)[0];
|
|
$data['pdata'] = $pdata;
|
|
$insdata = $this->Referral_model->getWherevalueInsInfo($pid)[0];
|
|
$data['idata'] = $insdata;
|
|
$mdData = $this->Referral_model->getWhereMdOrders($pid)[0];
|
|
$data['mddata'] = $mdData;
|
|
|
|
if(isset($_GET['pid']))
|
|
{
|
|
if ($_GET['activate']=='true')
|
|
{
|
|
$resp = $this->Referral_model->activatePatient($pid);
|
|
redirect("patient/approval");
|
|
}
|
|
}
|
|
|
|
if (isset($_POST) && $_POST['submit'] == 'gen_info')
|
|
{
|
|
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
|
|
$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('<div class="error">', '</div>');
|
|
$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('<div class="error">', '</div>');
|
|
$this->form_validation->set_rules('paymentModes', 'Payment Type', 'required|xss_clean');
|
|
}
|
|
|
|
if (isset($_POST) && $_POST['submit'] == 'patientAgreement')
|
|
{
|
|
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
|
|
$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('<div class="error">', '</div>');
|
|
$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->Referral_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->Referral_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->Referral_model->updatePatient($pudata,$pid);
|
|
}
|
|
|
|
|
|
$id = $this->Referral_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->Referral_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->Referral_model->updatePatient($datap,$pid);
|
|
// echo "::::if from stat <= 4:::: :: TRUE";
|
|
// echo $this->db->last_query();
|
|
}
|
|
else
|
|
{
|
|
$this->Referral_model->updatePatient($datap,$pid);
|
|
$this->session->set_flashdata('ref_updated', 'updated');
|
|
// echo "::::if from stat <= 4:::: :: FAlse";
|
|
// echo $this->db->last_query();
|
|
}
|
|
|
|
$this->Referral_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->Referral_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->Referral_model->getWherevalue($pid)[0];
|
|
// if ($pdata->reference_information == "Reffered by Patient") {
|
|
$insInfo = $this->Referral_model->insuranceInfoCheck($pid);
|
|
|
|
if ($insInfo > 0) {
|
|
$status = 1;
|
|
}
|
|
else
|
|
{
|
|
$msg .= "Please update the Insurance Information details to activate<br>";
|
|
}
|
|
|
|
if ($pdata->patient_auth_stat == 'Insurance Information') {
|
|
if ($pdata->patient_auth_stat != '0') {
|
|
$status = 1;
|
|
}
|
|
else
|
|
{
|
|
$msg .= "Patient authorisation is pending<br>";
|
|
}
|
|
}
|
|
|
|
// }
|
|
// else{
|
|
// $status = 1;
|
|
// }
|
|
|
|
$resp = array('msg' => $msg, 'status' => $status);
|
|
|
|
echo json_encode($resp);
|
|
}
|
|
|
|
public function patientAgreementForm($value='')
|
|
{
|
|
$pid = $_GET['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;
|
|
}
|
|
|
|
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++;
|
|
}
|
|
}
|
|
|
|
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;
|
|
|
|
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->Referral_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->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 = '';
|
|
if( $data->approve_status == 0 && $data->active_status == 0){
|
|
$options1 = '<a class="badge badge-primary btn-sm badge_new_btn" href="'. base_url() .'patient/activatePatient?pid='. $data->id .'"> <i class="la la-edit"></i>' . lang('Approve') .' </a>';
|
|
$options3 = '<a class="badge badge-primary btn-sm badge_new_btn" target="_blank" href="'. base_url() .'patient/patientAgreementForm?pid='. $data->id .'"> <i class="la la-edit"></i>' . lang('Patient agreement form') .' </a>';
|
|
$stsMsg = "Not Approved";
|
|
}
|
|
elseif ($data->approve_status == 1 && $data->active_status == 0) {
|
|
$options1 = '<a class="badge badge-success inffo btn-sm btn_new" href="'. base_url() .'patient/activatePatient?pid='. $data->id .'"> <i class="la la-edit"></i>' . lang('Activate') .' </a>';
|
|
$stsMsg = "Approved but not Activated";
|
|
}
|
|
$options2 = '<a class="badge badge-success inffo btn-sm btn_new" href="'. base_url() .'patient/editReferal?pid='. $data->id .'"> <i class="la la-edit"></i>' . lang('Edit') .' </a>';
|
|
|
|
$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);
|
|
}
|
|
// function abc()
|
|
// {
|
|
// $data['name'] = $this->Referral_model->name_list();
|
|
// pre($data['name']);die();
|
|
// }
|
|
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->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);
|
|
}
|
|
}
|
|
$listCount = sizeof($data['name']);
|
|
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 = '<a class="badge badge-success inffo btn-sm btn_new" href="patient/viewPatient?id=' . $data->id .'"><i class="la la-eye"></i> ' . lang('View') .'</a>';
|
|
|
|
$options5 = '<a class="badge badge-success inffo btn-sm btn_new" href="PatientSchedule/Schedule?id=' . $data->id .'"><i class="fa fa-calendar" aria-hidden="true"></i> ' . lang('Schedule') .'</a>';
|
|
$options6 = '<a class="badge badge-success inffo btn-sm btn_new" href="patient_discharge/addDischarge/' . $data->id .'"><i class="fa fa-medkit" aria-hidden="true"></i> ' . lang('Discharge') .'</a>' ;
|
|
|
|
|
|
$switch = '<div class="material-switch ">
|
|
<input id="someSwitchOptionSuccess'.$slno.'" attrid="'.$data->id.'" class="switchValue" name="someSwitchOption001" value="'.$data->status.'" onclick="changeStatus(this)" type="checkbox" '.$statusChk.' />
|
|
|
|
<label for="someSwitchOptionSuccess'.$slno.'" class="label-success"></label>
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
$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_where('patient_details', array('active_status' => 1))->num_rows(),
|
|
// "recordsFiltered" => $this->db->get_where('patient_details', array('active_status' => 1))->num_rows(),
|
|
// "data" => $info
|
|
// );
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => $listCount,
|
|
"recordsFiltered" => $listCount,
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
}
|
|
|
|
echo json_encode($output);
|
|
}
|
|
|
|
function checkaddress(){
|
|
$response=address_info($_GET['address'],$_GET['zipcode']);
|
|
echo json_encode($response);
|
|
}
|
|
|
|
public function viewInitialAssessment($id)
|
|
{
|
|
// echo $id;exit;
|
|
$pid =$id;
|
|
$data['pid']=$id;
|
|
$this->load->model('Patient_model');
|
|
$allData = $this->Referral_model->getWherevalue($pid)[0];
|
|
$data['datas'] = $allData;
|
|
|
|
/*assessment*/
|
|
$data['asmData'] = $this->Referral_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');
|
|
}
|
|
public function objectToArray($obj){
|
|
foreach($obj as $key=>$val){
|
|
// echo $key.'>'.$val;
|
|
$arr[$key]=$val;
|
|
|
|
}
|
|
return $arr;
|
|
}
|
|
// scheduled visits
|
|
public function activePatients(){
|
|
try{
|
|
$request=(object)($this->input->get());
|
|
$filter=isset($request->flt)?trim($request->flt):'year';
|
|
$data['filter']=$filter;
|
|
$this->load->view('home/dashboard');
|
|
$this->load->view('active_patients',$data);
|
|
$this->load->view('home/footer');
|
|
}catch(Exception $e){
|
|
$getMsg="Patient - activePatients: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
public function getActivePatientsList(){
|
|
try{
|
|
$request=(object)($this->input->post());
|
|
$filter=isset($request->body['filter'])?trim($request->body['filter']):'year';
|
|
$periods=isset($request->body['periods'])?$request->body['periods']:[];
|
|
$period=isset($periods[0])?trim($periods[0]):'';
|
|
$data_list=[
|
|
'start'=>$request->start,
|
|
'limit'=>$request->length,
|
|
'search'=>(isset($request->search['value'])&&!empty($request->search['value']))?($request->search['value']):"",
|
|
'order_column'=>$request->order[0]['column'],
|
|
'order_type'=>$request->order[0]['dir'],
|
|
'filter'=>$filter
|
|
];
|
|
if($period!=''){
|
|
list($start_date,$end_date)=explode(" ~ ", $period);
|
|
$data_list['start_date']=$start_date;
|
|
$data_list['end_date']=$end_date;
|
|
}
|
|
$resData=$this->Patient_model->model_get_patients($data_list);
|
|
$info=[];
|
|
$i=1;
|
|
foreach($resData->data->patients as $data){
|
|
$info[]=[
|
|
$i,
|
|
$data['service_type'],
|
|
'<a href="'.base_url().'patient/viewPatient?id='.$data['id'].'">'.$data['name'].'</a>',
|
|
$data['email'],
|
|
$data['telephone'],
|
|
$data['main_city'].', '.$data['main_zipcode']
|
|
];
|
|
$i++;
|
|
}
|
|
$response=json_encode([
|
|
"draw"=>intval($request->draw),
|
|
"recordsTotal"=>$resData->data->total_count,
|
|
"recordsFiltered"=>$resData->data->count,
|
|
"data"=>$info,
|
|
"query"=>$resData->data->query
|
|
]);
|
|
echo $response;
|
|
}catch(Exception $e){
|
|
$getMsg="Patient - getActivePatientsList: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
public function scheduledVisits(){
|
|
$request=(object)($this->input->get());
|
|
$filter=isset($request->flt)?trim($request->flt):'week';
|
|
$data['filter']=$filter;
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('scheduled_visits',$data);
|
|
$this->load->view('home/master_assets');
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
public function getScheduledVisitsList(){
|
|
try{
|
|
$request=(object)($this->input->post());
|
|
$filter=isset($request->body['filter'])?trim($request->body['filter']):'year';
|
|
$periods=isset($request->body['periods'])?$request->body['periods']:[];
|
|
$period=isset($periods[0])?trim($periods[0]):'';
|
|
$data_list=[
|
|
'start'=>$request->start,
|
|
'limit'=>$request->length,
|
|
'search'=>(isset($request->search['value'])&&!empty($request->search['value']))?($request->search['value']):"",
|
|
'order_column'=>$request->order[0]['column'],
|
|
'order_type'=>$request->order[0]['dir'],
|
|
'filter'=>$filter
|
|
];
|
|
if($period!=''){
|
|
list($start_date,$end_date)=explode(" ~ ", $period);
|
|
$data_list['start_date']=$start_date;
|
|
$data_list['end_date']=$end_date;
|
|
}
|
|
$resData=$this->Patient_model->model_get_schedules($data_list);
|
|
|
|
$info=[];
|
|
$i=1;
|
|
foreach($resData->data->schedules as $data){
|
|
$data->cio_status='';
|
|
switch($data->approval_status){
|
|
case 'pending':
|
|
$data->approval_status='approval pending';
|
|
$aps_cls='badge-danger';
|
|
break;
|
|
case 'approved':
|
|
$aps_cls='badge-success';
|
|
break;
|
|
default:
|
|
$aps_cls='badge-secondary';
|
|
}
|
|
switch($data->visit_status){
|
|
case 'unconfirmed':
|
|
$vs_cls='badge-danger';
|
|
break;
|
|
case 'upcoming':
|
|
$vs_cls='badge-info';
|
|
break;
|
|
case 'ongoing':
|
|
$vs_cls='badge-success';
|
|
break;
|
|
case 'completed':
|
|
$vs_cls='badge-primary';
|
|
break;
|
|
case 'missed':
|
|
$vs_cls='badge-warning';
|
|
break;
|
|
case 'declined':
|
|
$vs_cls='badge-secondary';
|
|
break;
|
|
default:
|
|
$vs_cls='';
|
|
}
|
|
|
|
$status_html='<span class="badge '.$vs_cls.' text-capitalize mr-1">'.$data->visit_status.'</span>';
|
|
if($data->visit_status=='ongoing'){
|
|
if($data->clock_out_time==null){
|
|
$status_html.='<span class="badge badge-danger text-capitalize mr-1">No Clock Out</span>';
|
|
}if($data->acceptance_status!='Reported'){
|
|
$status_html.='<span class="badge badge-danger text-capitalize">Not Reported</span>';
|
|
}
|
|
}else if($data->visit_status=='completed'){
|
|
$status_html.='<span class="badge '.$aps_cls.' text-capitalize">'.$data->approval_status.'</span>';
|
|
}
|
|
|
|
$report_html='No Report';
|
|
if(in_array($data->visit_status,['ongoing','completed'])){
|
|
$report_html='<a class="btn btn-info btn-xs btn_width edit_btn" title="'.lang('Report').'" href="'.base_url().'assessment/view?id='.$data->patient_id.'&scheduleId='.$data->schedule_id.'"><i class="fa fa-eye"></i> '.lang('Report').'</a>';
|
|
}
|
|
|
|
$info[]=[
|
|
$i,
|
|
isset($data->schedule_start)?date('Y-m-d', strtotime($data->schedule_start)):'N/A',
|
|
'<a href="'.base_url().'patient/viewPatient?id='.$data->patient_id.'">'.$data->patient_name.'</a>',
|
|
$data->patient_main_city.' '.$data->patient_main_zipcode,
|
|
$data->service_type,
|
|
'<a href="'.base_url().'caregivers/addNewView/'.base64_enc($data->caregiver_id).'">'.$data->caregiver_name.'</a>',
|
|
// isset($data->clock_in_time)?$data->clock_in_time:'N/A',
|
|
// isset($data->clock_out_time)?$data->clock_out_time:'N/A',
|
|
'<span class="text-capitalize">'.$data->acceptance_status.'</span>',
|
|
$status_html,
|
|
$report_html
|
|
];
|
|
$i++;
|
|
}
|
|
$response=json_encode([
|
|
"draw"=>intval($request->draw),
|
|
"recordsTotal"=>$resData->data->total_count,
|
|
"recordsFiltered"=>$resData->data->count,
|
|
"data"=>$info,
|
|
"query"=>$resData->data->query
|
|
]);
|
|
echo $response;
|
|
}catch(Exception $e){
|
|
$getMsg="Patient - getScheduledVisitsList: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
public function get_scheduled_visits_list(){
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
$search = $this->input->post('search')['value'];
|
|
$filter = $requestData['body']['filter'];
|
|
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Patient_model->getScheduledVisitsBySearchListPage($limit, $start, $search,$orderColumn, $orderType, $filter);
|
|
} else {
|
|
$data['name'] = $this->Patient_model->getScheduledVisitsListPage($limit, $start, $orderColumn, $orderType, $filter);
|
|
}
|
|
$info=[];
|
|
foreach ($data['name'] as $data) {
|
|
static $slno = 1;
|
|
if ($data->address != '' || $data->address != null) {
|
|
$address_obj=json_decode($data->address);
|
|
if ($address_obj->City != '') {
|
|
$address=$address_obj->City;
|
|
}
|
|
}
|
|
$info[] = array(
|
|
$slno,
|
|
date('Y-m-d', strtotime($data->clock_in_time)),
|
|
$data->patient_name,
|
|
$address,
|
|
$data->service_type,
|
|
$data->caregiver_name,
|
|
$data->clock_in_time,
|
|
$data->clock_out_time
|
|
);
|
|
$slno++;
|
|
}
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => $this->Patient_model->getScheduledVisitsList($filter),
|
|
"recordsFiltered" => $this->Patient_model->getScheduledVisitsList($filter),
|
|
"data" => $info
|
|
);
|
|
echo json_encode($output);
|
|
}
|
|
|
|
public function openCases(){
|
|
try{
|
|
$this->load->view('home/dashboard');
|
|
$this->load->view('open_cases');
|
|
$this->load->view('home/footer');
|
|
}catch(Exception $e){
|
|
$getMsg="Patient - openCases: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
public function get_open_cases_list(){
|
|
try{
|
|
$request=(object)($this->input->post());
|
|
$data_list=[
|
|
'start'=>$request->start,
|
|
'limit'=>$request->length,
|
|
'search'=>(isset($request->search['value'])&&!empty($request->search['value']))?($request->search['value']):"",
|
|
'order_column'=>$request->order[0]['column'],
|
|
'order_type'=>$request->order[0]['dir'],
|
|
'filter'=>$request->body['filter']
|
|
];
|
|
$resData=$this->Patient_model->model_get_open_cases($data_list);
|
|
$info=[];
|
|
$i=1;
|
|
foreach($resData->data->open_cases as $data){
|
|
$info[]=[
|
|
$i,
|
|
$data['service_type'],
|
|
'<a href="'.base_url().'patient/viewPatient?id='.$data['id'].'">'.$data['name'].'</a>',
|
|
$data['email'],
|
|
$data['telephone'],
|
|
$data['main_city'].', '.$data['main_zipcode'],
|
|
];
|
|
$i++;
|
|
}
|
|
$response=json_encode([
|
|
"draw"=>intval($request->draw),
|
|
"recordsTotal"=>$resData->data->total_count,
|
|
"recordsFiltered"=>$resData->data->count,
|
|
"data"=>$info,
|
|
"query"=>$resData->data->query
|
|
]);
|
|
echo $response;
|
|
}catch(Exception $e){
|
|
$getMsg="Patient - get_open_cases_list: ".$e->getMessage();
|
|
echo $getMsg;
|
|
}
|
|
}
|
|
} |