132 lines
5.0 KiB
PHP
Executable File
132 lines
5.0 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class PatientSchedule extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->model('Patient_schedule_model');
|
|
if (!$this->ion_auth->in_group('admin')) {
|
|
if(!$this->ion_auth->coordinator_permission('caregivers')){
|
|
redirect('home/permission');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
public function index() {
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('PatientSchedule');
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
public function Schedule(){
|
|
$patientId=$_GET['id'];
|
|
|
|
$data['patient']=$this->Patient_schedule_model->getPatientDetails($patientId);
|
|
$data['caregivers']=$this->Patient_schedule_model->getCaregiverList($patientId,$data['patient']);
|
|
$data['modalPatient']=$this->Patient_schedule_model->patientDetailsForModal($patientId);
|
|
// pre($data);die();
|
|
// echo '<pre>';print_r($data['caregivers']);echo '</pre>';die;
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('CaregiverSchedule',$data);
|
|
$this->load->view('home/common_modal_patient',$data);
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
public function saveSchedule(){
|
|
// print_r($_POST);die;
|
|
$caregiver_id = $_POST['caregiver_id'];
|
|
$success=$this->Patient_schedule_model->saveSchedule($_POST);
|
|
if($success>0){
|
|
|
|
// ------------Send Push Notification --------------
|
|
$getFcmToken = $this->Patient_schedule_model->getFcmToken($caregiver_id);
|
|
$fcm_token = $getFcmToken->fcm_token;
|
|
$post_title='Notification From Admin';
|
|
$post_message='Admin set your patient schedule';
|
|
$type='caregiver';
|
|
sendNotification($fcm_token,$post_title,$post_message,$type);
|
|
// ------------Send Push Notification ---------------
|
|
$this->session->set_flashdata('feedback_success', 'Schedule Added.');
|
|
}
|
|
redirect('PatientSchedule/Schedule?id='.$_POST['patient_id']);
|
|
}
|
|
public function getEventDetails(){
|
|
$patientId = $this->input->get('patientId');
|
|
$caregiverId = $this->input->get('caregiverId');
|
|
$start = $this->input->get('start');
|
|
$end = $this->input->get('end');
|
|
//print_r($id);
|
|
$caregiverSchedule=$this->Patient_schedule_model->getEventSchedule($patientId,$caregiverId,$start,$end);
|
|
|
|
echo json_encode($caregiverSchedule,true);
|
|
}
|
|
public function getEventDetailsById(){
|
|
//print_r($_GET);
|
|
$ScheduleDtl=$this->Patient_schedule_model->getEventDetailsById($_GET);
|
|
echo json_encode($ScheduleDtl);
|
|
}
|
|
public function getList()
|
|
{
|
|
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Patient_schedule_model->getNameByLimitBySearch($limit, $start, $search);
|
|
} else {
|
|
$data['name'] = $this->Patient_schedule_model->getNameByLimit($limit, $start);
|
|
}
|
|
|
|
foreach ($data['name'] as $data) {
|
|
static $slno = 1;
|
|
$options1 = '<a class="btn btn-primary" href="PatientSchedule/Schedule?id='. $data->id .'"> <i class="la la-edit"></i>' . lang('Get Schedule') .' </a>';
|
|
|
|
$info[] = array(
|
|
$slno,
|
|
$data->patient_id,
|
|
$data->first_name." ".$data->last_name,
|
|
$data->cellphone,
|
|
$options3." ".$options1." ".$options4." ".$options2
|
|
);
|
|
$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 PreviousSchedule(){
|
|
//print_r($_GET);
|
|
$result=$this->Patient_schedule_model->PreviousSchedule($_GET);
|
|
echo $result;
|
|
}
|
|
public function CheckSchedule(){
|
|
echo $result=$this->Patient_schedule_model->CheckSchedule($_GET);
|
|
//echo '<pre>';print_r($result); echo '</pre>';die;
|
|
}
|
|
public function getCaregiverName(){
|
|
echo $result=$this->Patient_schedule_model->getCaregiverName($_GET);
|
|
}
|
|
public function getCaregiverPreviousSchedule(){
|
|
$caregiver_id=$this->input->get('caregiverId');
|
|
echo $result=$this->Patient_schedule_model->getCaregiverPreviousSchedule($caregiver_id);
|
|
}
|
|
public function getCaregiverUpcomingSchedule(){
|
|
$caregiver_id=$this->input->get('caregiverId');
|
|
echo $result=$this->Patient_schedule_model->getCaregiverUpcomingSchedule($caregiver_id);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|