196 lines
5.2 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 name_list(){
$this->db->order_by('id', 'DESC');
$query = $this->db->get('patient_caregiver_mapping');
return $query->result();
}
function coordinator_list()
{
$this->db->order_by('id', 'DESC');
$query = $this->db->get('coordinator');
return $query->result();
}
function coordinator_data_where($id){
$this->db->where('id', $id);
$query = $this->db->get('coordinator');
return $query->result();
}
function caregiver_list(){
$this->db->order_by('id', 'DESC');
$query = $this->db->get('caregiver');
return $query->result();
}
function caregiver_data_where($id){
$this->db->where('id', $id);
$query = $this->db->get('caregiver');
return $query->result();
}
function service_list(){
$this->db->order_by('id', 'DESC');
$query = $this->db->get('master_service_activity');
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_service_mapping');
foreach ($post['service_list'] as $value) {
$data = array(
'caregiver_id' => $post['Caregiver'],
'service_id' => $value
);
$this->db->insert('caregiver_service_mapping', $data);
}
}
function mapcaregiverServiceMatch($data){
$query = $this->db->get_where('caregiver_service_mapping',$data);
$data = $query->result();
return $data;
}
function mapPatientExist($data){
$query = $this->db->get_where('caregiver_service_mapping',$data);
$data = $query->result();
return $data;
}
// function save_name($post) {
// $slot_name = $post['slot_name'];
// $data = array(
// 'name' => $slot_name,
// );
// $this->db->insert('patient_caregiver_mapping', $data);
// }
// function delete_name($id)
// {
// $this->db->where('id', $id);
// $this->db->delete('patient_caregiver_mapping');
// }
// function edit_name($post,$id){
// $data = array(
// 'name' => $post['slotEditname'],
// );
// $this->db->where('id', $id);
// $this->db->update('patient_caregiver_mapping', $data);
// }
// function duplicate_entry($post)
// {
// $val = $post['val'];
// if (isset($post['currId'])) {
// $currId = $post['currId'];
// $query1 = $this->db->get_where('patient_caregiver_mapping', array('id' => $currId));
// $exceptVal = $query1->result()[0]->name;
// // SELECT * FROM `master_access_assessment` WHERE name='12Hours' AND name!='vatibra'
// $this->db->where('name', $val);
// $this->db->where('name !=', $exceptVal);
// $query = $this->db->get('patient_caregiver_mapping');
// }
// else{
// $query = $this->db->get_where('patient_caregiver_mapping', array('name' => $val));
// }
// if($query->num_rows() > 0)
// {
// return 'exist';
// }
// else{
// return 'notexist';
// }
// }
// function status_change($post){
// $id = $post['id'];
// $stat = $post['val'];
// $this->db->set('status', $stat);
// $this->db->where('id', $id);
// $this->db->update('patient_caregiver_mapping');
// if($stat == '1')
// {
// return 'Status set active';
// }
// else{
// return 'Status set deactive';
// }
// }
// function getWherevalue($id){
// $this->db->where('id', $id);
// $query = $this->db->get('patient_caregiver_mapping');
// return $query->result();
// }
// function getNameBysearch($search) {
// $this->db->order_by('id', 'desc');
// $this->db->like('id', $search);
// $this->db->or_like('name', $search);
// $this->db->or_like('status', $search);
// $query = $this->db->get('patient_caregiver_mapping');
// return $query->result();
// }
// function getNameByLimit($limit, $start) {
// $this->db->order_by('id', 'desc');
// $this->db->limit($limit, $start);
// $query = $this->db->get('patient_caregiver_mapping');
// return $query->result();
// }
// function getNameByLimitBySearch($limit, $start, $search) {
// $this->db->like('id', $search);
// $this->db->order_by('id', 'desc');
// $this->db->or_like('name', $search);
// $this->db->or_like('status', $search);
// $this->db->limit($limit, $start);
// $query = $this->db->get('patient_caregiver_mapping');
// return $query->result();
// }
}