149 lines
4.7 KiB
PHP
Executable File
149 lines
4.7 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class CaregiverDashboard_model extends CI_model {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
function updateAcceptance($data,$id)
|
|
{
|
|
// echo '<pre>'; print_r($id); echo '</pre>';
|
|
// echo '<pre>'; print_r($data); echo '</pre>';die;
|
|
$this->db->where('id', $id);
|
|
$query=$this->db->update('caregiver_schedule',$data);
|
|
return $this->db->affected_rows();
|
|
}
|
|
function getCaregiverPreviousSchedule($caregiver_id){
|
|
$now=date("Y-m-d 00:00:00");
|
|
$this->db->select('a.id as scheduleId,a.patient_id as patient_row_id,a.*,b.*');
|
|
$this->db->from('caregiver_schedule a');
|
|
$this->db->join('patient_details b', 'b.id = a.patient_id', 'left');
|
|
$this->db->where('a.start<',$now);
|
|
$this->db->where('a.caregiver_id',$caregiver_id);
|
|
$this->db->order_by('a.start','ASC');
|
|
$query = $this->db->get()->result();
|
|
return $query;
|
|
}
|
|
function getCaregiverUpcommingSchedule($caregiver_id){
|
|
$now=date("Y-m-d 00:00:00");
|
|
$this->db->select('a.id as scheduleId,a.patient_id as patient_row_id,a.*,b.*');
|
|
$this->db->from('caregiver_schedule a');
|
|
$this->db->join('patient_details b', 'b.id = a.patient_id', 'left');
|
|
$this->db->where('a.start>',$now);
|
|
$this->db->where('a.caregiver_id',$caregiver_id);
|
|
$this->db->order_by('a.start','ASC');
|
|
$query = $this->db->get()->result();
|
|
return $query;
|
|
}
|
|
function getPatientByCaregiverId($caregiver_id){
|
|
// echo $caregiver_id;
|
|
$sql="Select distinct(a.patient_id),b.first_name,b.last_name,b.level_of_care,b.patient_id as patientID,b.cellphone
|
|
from caregiver_schedule a
|
|
left join patient_details b on a.patient_id=b.id
|
|
where a.caregiver_id=".$caregiver_id."
|
|
and a.acceptance_status='Accepted'
|
|
and a.status='1'";
|
|
// order by a.id DESC";
|
|
$result=$this->db->query($sql)->result();
|
|
return $result;
|
|
//echo '<pre>'; print_r($result); echo '</pre>';die;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
| for caregiver Document Signature
|
|
*/
|
|
function saveDislosureSignature($data)
|
|
{
|
|
return $this->db->insert('caregiver_document_signature', $data);
|
|
}
|
|
function getSignatureInfo($caregiverId)
|
|
{
|
|
$this->db->where('caregiver_id',$caregiverId);
|
|
$result=$this->db->get('caregiver_document_signature')->result();
|
|
return $result;
|
|
}
|
|
function getCgDetails($id)
|
|
{
|
|
$this->db->where('id',$id);
|
|
$result=$this->db->get('caregiver')->row();
|
|
return $result;
|
|
}
|
|
/*
|
|
| Ending caregiver Document Signature
|
|
*/
|
|
|
|
|
|
/*
|
|
| for caregiver clock in out
|
|
*/
|
|
function getClockInOutInfo($sch_id)
|
|
{
|
|
$this->db->where('schedule_id',$sch_id);
|
|
$result=$this->db->get('caregiver_patient_clock_in_out')->row();
|
|
return $result;
|
|
}
|
|
function getWebsiteData(){
|
|
return $this->db->get('website_settings')->row();
|
|
}
|
|
/*
|
|
| End caregiver clock in out
|
|
*/
|
|
|
|
|
|
function getAllSignatureDetails($id)
|
|
{
|
|
$this->db->where('caregiver_id',$id);
|
|
$result=$this->db->get('caregiver_document_signature')->result();
|
|
return $result;
|
|
}
|
|
|
|
|
|
function getScheduleDetailsByScheduleId($id)
|
|
{
|
|
$this->db->where('id',$id);
|
|
$result=$this->db->get('caregiver_schedule')->row();
|
|
return $result;
|
|
}
|
|
|
|
function getClockInOutDetailsByScheduleId($id)
|
|
{
|
|
$this->db->where('schedule_id',$id);
|
|
$result=$this->db->get('caregiver_patient_clock_in_out')->row();
|
|
return $result;
|
|
}
|
|
|
|
function getDocumentSignatureByCgId($id)
|
|
{
|
|
$this->db->where('caregiver_id',$id);
|
|
$result=$this->db->get('caregiver_document_signature')->result();
|
|
return $result;
|
|
}
|
|
function getAuthReleaseSignature($id)
|
|
{
|
|
$this->db->where('caregiver_id',$id);
|
|
$this->db->where('document_details',"AuthRelease");
|
|
$result=$this->db->get('caregiver_document_signature')->row();
|
|
return $result;
|
|
}
|
|
|
|
function getFileByUserIdFileType($docType,$userId){
|
|
$this->db->select('path,file_name');
|
|
$this->db->where('userid', $userId);
|
|
$this->db->where('documents_type', $docType);
|
|
$this->db->where('user_type', 'Caregiver');
|
|
$this->db->order_by('id', 'desc');
|
|
$this->db->where('status', 1);
|
|
$query = $this->db->get('users_documents');
|
|
// print_r($query);die;
|
|
// echo $this->db->last_query();die;
|
|
return $query->row();
|
|
}
|
|
}
|