load->database(); } function insertUser($data) { $this->db->insert('physician', $data); } function getPhysician() { $query = $this->db->get('physician'); return $query->result(); } function getPhysicianBysearch($search) { $this->db->order_by('id', 'desc'); $this->db->like('id', $search); $this->db->or_like('name', $search); $this->db->or_like('phone', $search); $this->db->or_like('address', $search); $this->db->or_like('email', $search); $query = $this->db->get('physician'); return $query->result(); } function getPhysicianByLimit($limit, $start) { $this->db->order_by('id', 'desc'); $this->db->limit($limit, $start); $query = $this->db->get('physician'); return $query->result(); } function getPhysicianByLimitBySearch($limit, $start, $search) { $this->db->group_start(); $this->db->like('id', $search); $this->db->or_like('name', $search); $this->db->or_like('phone', $search); $this->db->or_like('address', $search); $this->db->or_like('email', $search); $this->db->group_end(); $this->db->order_by('id', 'desc'); $this->db->limit($limit, $start); $query = $this->db->get('physician'); return $query->result(); } function getPhysicianById($id) { $this->db->where('id', $id); $query = $this->db->get('physician'); return $query->row(); } function getPhysicianByNPI($npi){ $this->db->where('npi', $npi); $query = $this->db->get('physician'); return $query->row(); } function updatePhysician($id, $data) { //echo '
'; print_r($data); echo '
'; exit; $this->db->where('id', $id); $this->db->update('physician', $data); //echo $this->db->get_compiled_select(); die; } function delete($id) { $this->db->where('id', $id); $this->db->delete('physician'); } function updateIonUser($username, $email, $password, $ion_user_id) { $uptade_ion_user = array( 'username' => $username, 'email' => $email, 'password' => $password ); //echo '
'; print_r($uptade_ion_user); echo '
';die; $this->db->where('id', $ion_user_id); $this->db->update('users', $uptade_ion_user); } function getPhysicianByIonId($id) { $this->db->where('ion_user_id', $id); $query = $this->db->get('physician')->row(); //echo '
'; print_r($query); echo '
'; exit; return $query; } function getPatientList($id) { $this->db->where('primaryCarePhyMdNpi', $id); $query = $this->db->get('patient_details'); return $query->result(); } function getNameBysearch($search,$orderColumn, $orderType) { if($orderColumn==0) $this->db->order_by('id', $orderType); else if($orderColumn==1) $this->db->order_by('primaryCarePhyMdNpi', $orderType); else if($orderColumn==2) $this->db->order_by('first_name', $orderType); $this->db->where('primaryCarePhyMdNpi', $id); $this->db->like('id', $search); $this->db->or_like('first_name', $search); $query = $this->db->get('patient_details'); return $query->result(); } function getNameByLimit($limit, $start, $orderColumn, $orderType,$id) { //echo '
'; print_r($orderType); echo '
';die; if($orderColumn==0) $this->db->order_by('id', $orderType); else if($orderColumn==1) $this->db->order_by('primaryCarePhyMdNpi', $orderType); else if($orderColumn==2) $this->db->order_by('first_name', $orderType); $this->db->where('primaryCarePhyMdNpi', $id); $this->db->limit($limit, $start); $query = $this->db->get('patient_details'); return $query->result(); } function getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType,$id) { //echo $id;die; $this->db->like('id', $search); $this->db->order_by('id', 'desc'); $this->db->or_like('primaryCarePhyMdNpi', $search); $this->db->or_like('first_name', $search); $this->db->where('primaryCarePhyMdNpi', $id); $this->db->limit($limit, $start); $query = $this->db->get('patient_details'); return $query->result(); } function getPendingOrderListByLimit($limit, $start, $orderColumn, $orderType,$phyId) { // if($orderColumn==0) // $this->db->order_by('id', $orderType); // else if($orderColumn==1) // $this->db->order_by('primaryCarePhyMdNpi', $orderType); // else if($orderColumn==2) // $this->db->order_by('first_name', $orderType); $this->db->select('patient_md_order.*'); $this->db->select("CONCAT_WS(' ', patient_details.first_name, patient_details.last_name) AS patient_name"); $this->db->from("patient_md_order"); $this->db->where("patient_md_order.physician_id",$phyId); $this->db->where("patient_md_order.order_status!=","Submitted"); $this->db->join("patient_details", "patient_details.id=patient_md_order.patient_id"); $this->db->order_by('id', 'DESC'); $this->db->limit($limit, $start); $query = $this->db->get()->result(); //echo $this->db->last_query();die; return $query; } function getApprovedOrderListByLimit($limit, $start, $orderColumn, $orderType,$phyId) { $this->db->select('patient_md_order.*'); $this->db->select("CONCAT_WS(' ', patient_details.first_name, patient_details.last_name) AS patient_name"); $this->db->from("patient_md_order"); $this->db->where("patient_md_order.physician_id",$phyId); $this->db->where("patient_md_order.order_status","Submitted"); $this->db->join("patient_details", "patient_details.id=patient_md_order.patient_id"); $this->db->order_by('id', 'DESC'); $this->db->limit($limit, $start); $query = $this->db->get()->result(); return $query; } function checkEmail($email,$ion_user_id){ if($ion_user_id>0) { $result=$this->db->get_where('users', array('id' => $ion_user_id))->row(); // echo $this->db->last_query(); $ion_email=$result->email; if($email==$ion_email){ return true; }else{ $result=$this->db->get_where('users', array('email' => $email))->row(); if($result){ return false; }else{ return true; } } }else{ $result=$this->db->get_where('users', array('email' => $email))->row(); // echo $this->db->last_query(); if(count($result) > 0){ return false; }else{ return true; } } } function checkNPIexist($npi_no,$phyid){ if($phyid>0){ $result=$this->db->get_where('physician', array('id' => $phyid))->row(); // echo $this->db->last_query(); $npiNo=$result->npi; if($npi_no==$npiNo){ return true; }else{ $result=$this->db->get_where('physician', array('npi' => $npi_no))->row(); if($result){ return false; }else{ return true; } } }else{ $result=$this->db->get_where('physician', array('npi' => $npi_no))->row(); if($result){ return false; }else{ return true; } } } }