load->model('finance/finance_model'); $this->load->model('appointment/appointment_model'); $this->load->model('notice/notice_model'); $this->load->model('home_model'); $this->load->model('caregivers/Caregiver_model'); //$this->load->helper(menu); } public function index() { $data=array(); $data=menu_array(); // pre($data); // die; // echo '
'; print_r($this->ion_auth); echo '';die; // die; // $user_id=$this->session->userdata('user_id'); // $data=$this->home_model->get_menu($user_id); if ($this->ion_auth->in_group(array('Caregiver'))) { redirect('/CaregiversDashboard'); } else if ($this->ion_auth->in_group(array('Physician'))) { redirect('/physicianDashboard'); } else if($this->ion_auth->in_group(array('Patient'))) { redirect('/patientDashboard'); // die("1"); } $this->load->view('dashboard',$data); // just the header file $this->load->view('home', $data); $this->load->view('footer', $data); } public function permission() { $this->load->view('permission'); } public function getCaregiverInfo(){ $_GET['caregiver_id']; $caregiver=$this->home_model->getCargiverInfo($_GET['caregiver_id']); $data['modalCaregiver']=$this->home_model->getCargiverInfo($_GET['caregiver_id']); //echo '
';print_r($caregiver);echo ''; die; $this->load->view('home/common_modal_caregiver',$data); } public function getSchedule(){ // _die($_GET); $sed=$this->home_model->getSchedule($_GET['patientId'],$_GET['caregiverId'],$_GET['start'],$_GET['end']); // $sed=$this->home_model->getSchedule($_GET['patientId'],394,$_GET['start'],$_GET['end']); //$this->load->view('home/common_calendar',$data); //print_r($scheduleData); // pre($sed);die; echo json_encode($sed,true); } public function getIcdList() { $icdCode = $this->input->get('code'); $data=get_ICD_Info($icdCode); //echo '
';print_r($url_arr); echo '';die();
for($i=0; $i'.$title.'';
}
echo $options;
}
#admin dashboard
public function hmsDashboardDynamicInfo(){
try{
$user_id=$this->session->userdata('user_id');
$request=(object)($this->input->get('params'));
$info_type=isset($request->info_type)?trim($request->info_type):'';
if($info_type=='open_cases'){
$this->load->model('patient/Patient_model');
$openCases=$this->Patient_model->model_get_open_cases([]);
$quickData=(object)[
'new'=>isset($openCases->data->total_count)?intval($openCases->data->total_count):0,
'old'=>0,
'rate'=>0,
'growth'=>'none',
];
$openCases->data=$quickData;
$response=$openCases;
}else if($info_type=='available_caregivers'){
$this->load->model('caregivers/Caregiver_model');
$availableCaregivers=$this->Caregiver_model->model_get_available_caregivers([]);
$quickData=(object)[
'new'=>isset($availableCaregivers->data->total_count)?intval($availableCaregivers->data->total_count):0,
'old'=>0,
'rate'=>0,
'growth'=>'none',
];
$availableCaregivers->data=$quickData;
$response=$availableCaregivers;
}else if($info_type=='total_patients'){
$this->load->model('patient/Patient_model');
$filter=isset($request->filter)?trim($request->filter):'year';
$periods=isset($request->periods)?$request->periods:[];
foreach($periods as $period){
list($start_date,$end_date)=explode(" ~ ", $period);
$patients=$this->Patient_model->model_get_patients([
'filter'=>$filter,
'start_date'=>$start_date,
'end_date'=>$end_date
]);
$patients_count[]=isset($patients->data->total_count)?intval($patients->data->total_count):0;
}
$quickData=calc_rate_prcntg(end($patients_count),prev($patients_count));
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$quickData
];
}else if($info_type=='scheduled_visits'){
$this->load->model('patient/Patient_model');
$filter=isset($request->filter)?trim($request->filter):'year';
$periods=isset($request->periods)?$request->periods:[];
foreach($periods as $period){
list($start_date,$end_date)=explode(" ~ ", $period);
$schedules=$this->Patient_model->model_get_schedules([
'filter'=>$filter,
'start_date'=>$start_date,
'end_date'=>$end_date
]);
$schedules_count[]=isset($schedules->data->total_count)?intval($schedules->data->total_count):0;
}
$quickData=calc_rate_prcntg(end($schedules_count),prev($schedules_count));
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$quickData
];
}else if($info_type=='revenues'){
$this->load->model('bills/Bills_model');
$filter=isset($request->filter)?trim($request->filter):'week';
$periods=isset($request->periods)?$request->periods:[];
$revenuesData=$this->Bills_model->model_calc_revenue($periods);
$quickData=calc_rate_prcntg(end($revenuesData['weekly_revenues']),prev($revenuesData['weekly_revenues']));
$quickData->total_revenues=$revenuesData['total_revenues'];
$quickData->weekly_revenues=$revenuesData['weekly_revenues'];
$quickData->weekly_services=$revenuesData['weekly_services'];
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$quickData
];
}else if($info_type=='vendors_overview'){
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$request
];
}else if($info_type=='daily_scheduled'){
$startDate=isset($request->start_date)?trim($request->start_date):'0000-00-00';
$endDate=isset($request->end_date)?trim($request->end_date):'0000-00-00';
$resData=$this->home_model->getDailyBasisSchedule([
'limit'=>100,
'start_date'=>$startDate,
'end_date'=>$endDate
]);
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$resData->data->schedules
];
}else if($info_type=='financial_overview'){
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$request
];
}else if($info_type=='monthly_activity'){
$this->load->model('patient/Patient_model');
$filter=isset($request->filter)?trim($request->filter):'month';
$periods=isset($request->periods)?$request->periods:[];
$period=isset($periods[0])?trim($periods[0]):'';
if($period!=''){
list($start_date,$end_date)=explode(" ~ ", $period);
$patientsNew=$this->Patient_model->model_get_patients([
'filter'=>$filter,
'start_date'=>$start_date,
'end_date'=>$end_date
]);
$patients_count['month']=isset($patientsNew->data->total_count)?intval($patientsNew->data->total_count):0;
}
$patients=$this->Patient_model->model_get_patients([]);
$patients_count['all']=isset($patients->data->total_count)?intval($patients->data->total_count):0;
$totalCompleteVisit=$this->home_model->getTotalSchedule('month');
$totalScheduleRequest=$this->home_model->getTotalScheduleRequest();
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>[
'total_patients'=>isset($patients_count['all'])?intval($patients_count['all']):0,
'new_patients'=>isset($patients_count['month'])?intval($patients_count['month']):0,
'total_caregivers'=>$this->home_model->getAllCaregiversData('all'),
'new_caregivers'=>$this->home_model->getAllCaregiversData('month'),
'missed_visits'=>($totalScheduleRequest - $totalCompleteVisit),
'total_completed_visits'=>$totalCompleteVisit
]
];
}else if($info_type=='total_patients_click'){
$this->load->model('patient/Patient_model');
$filter=isset($request->filter)?trim($request->filter):'year';
$periods=isset($request->periods)?$request->periods:[];
foreach($periods as $period){
list($start_date,$end_date)=explode(" ~ ", $period);
$patients=$this->Patient_model->model_get_patients([
'filter'=>$filter,
'start_date'=>$start_date,
'end_date'=>$end_date
]);
$patients_count[]=isset($patients->data->total_count)?intval($patients->data->total_count):0;
}
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$patients_count
];
}else if($info_type=='scheduled_visits_click'){
$this->load->model('patient/Patient_model');
$filter=isset($request->filter)?trim($request->filter):'year';
$periods=isset($request->periods)?$request->periods:[];
foreach($periods as $period){
list($start_date,$end_date)=explode(" ~ ", $period);
$schedules=$this->Patient_model->model_get_schedules([
'filter'=>$filter,
'start_date'=>$start_date,
'end_date'=>$end_date
]);
$schedules_count[]=isset($schedules->data->total_count)?intval($schedules->data->total_count):0;
}
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$schedules_count
];
}else if($info_type=='revenues_click'){
$this->load->model('bills/Bills_model');
$periods=isset($request->periods)?$request->periods:[];
$chartData=$this->Bills_model->model_calc_revenue($periods);
$response=[
'status'=>200,
'msg'=>'fetched successfully',
'data'=>$chartData
];
}else{
$response=json_encode([
'status'=>400,
'msg'=>'invalid info type'
]);
}
echo json_encode($response);
}catch(Exception $e){
$getMsg="Home - hmsDashboardDynamicInfo: ".$e->getMessage();
echo $getMsg;
}
}
public function hmsVendorsOverviewList(){
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->params['filter']
];
$data_list['require']="data";
$patientsData=$this->home_model->hms_get_adb_vendors_overview($data_list);
$data_list['require']="count";
$patientsCount=$this->home_model->hms_get_adb_vendors_overview($data_list);
$info=[];
$i=1;
foreach($patientsData as $data){
$address = '';
if ($data['address'] != '' || $data['address'] != null) {
$address_obj=json_decode($data['address']);
if ($address_obj->City != '') {
$address=$address_obj->City;
}
}
$vendor_view = '' . $data['vedor_name'] . '';
$patient_view = '' . $data['first_name']." ".$data['last_name'] . '';
$info[] = [
$i,
$vendor_view,
$patient_view,
$data['service_type'],
$address,
$data['live_status']
];
$i++;
}
$response=json_encode([
"draw"=>intval($request->draw),
"recordsTotal"=>$patientsCount,
"recordsFiltered"=>$patientsCount,
"data"=>$info
]);
echo $response;
}catch(Exception $e){
$getMsg="Home - hmsVendorsOverviewList: ".$e->getMessage();
echo $getMsg;
}
}
public function hmsFinancialOverviewList(){
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->params['filter']
];
$data_list['require']="data";
$financialData=$this->home_model->hms_get_adb_financial_overview($data_list);
$data_list['require']="count";
$financialCount=$this->home_model->hms_get_adb_financial_overview($data_list);
$info=[];
$i=1;
foreach($financialData as $data){
$vendor_view='' . $data['vedor_name'] . '';
$patient_view='' . $data['patient_name']. '';
$info[]=[
$i,
$data['live_status'],
$vendor_view,
$patient_view,
$data['service_type'],
$data['main_city']
];
$i++;
}
$response=json_encode([
"draw"=>intval($request->draw),
"recordsTotal"=>$financialCount,
"recordsFiltered"=>$financialCount,
"data"=>$info
]);
echo $response;
}catch(Exception $e){
$getMsg="Home - hmsFinancialOverviewList: ".$e->getMessage();
echo $getMsg;
}
}
#admin dashboard
}
/* End of file home.php */
/* Location: ./application/controllers/home.php */