56 lines
1.5 KiB
PHP
Executable File

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Test_model extends CI_model {
function __construct() {
parent::__construct();
$this->load->database();
}
function caregiver_list(){
$this->db->order_by('id', 'DESC');
$this->db->where('status', '1');
$this->db->where('verification_status', 'verified');
$query = $this->db->get('caregiver');
return $query->result();
}
function caregiver_data_where($id){
$this->db->where('id', $id);
$this->db->where('status', '1');
$query = $this->db->get('caregiver');
return $query->result();
}
function patient_list(){
$this->db->order_by('id', 'DESC');
$query = $this->db->get('patient_details');
return $query->result();
}
function mapCP($post){
// Delete Details from coaardinator mapCP
$this->db->where('caregiver_id', $post['Caregiver']);
$this->db->delete('caregiver_patient_mapping');
foreach ($post['patient_list'] as $value) {
$data = array(
'caregiver_id' => $post['Caregiver'],
'patient_id' => $value
);
$this->db->insert('caregiver_patient_mapping', $data);
}
}
function mapcaregiverPatientMatch($data){
$query = $this->db->get_where('caregiver_patient_mapping',$data);
$data = $query->result();
return $data;
}
}