diff --git a/providerwww/application/controllers/Patient.php b/providerwww/application/controllers/Patient.php index 069cc0a..d3328a3 100644 --- a/providerwww/application/controllers/Patient.php +++ b/providerwww/application/controllers/Patient.php @@ -45,6 +45,10 @@ class Patient extends Provider_Controller { $this->renderProviderSecurePage('patient/newpatient', $data); } + public function selectPatient(){ + + } + public function findpatient(){ $out = array(); $out = $this->getPatientList(); diff --git a/providerwww/application/controllers/Provider.php b/providerwww/application/controllers/Provider.php index cc64122..bbfb178 100644 --- a/providerwww/application/controllers/Provider.php +++ b/providerwww/application/controllers/Provider.php @@ -3,72 +3,70 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Provider extends Provider_Controller { + //var $patient_model; public function index() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; - $_SESSION['patient_count']=5; - - - - $this->load->model('encounter_model'); - $out = $this->encounter_model->getEncounterList(); - $data["encounter_list"] = $out["encounter_list"]; - - - $this->renderProviderSecurePage('dash', $data); + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; + $_SESSION['patient_count'] = 5; + $this->load->model('encounter_model'); + $out = $this->encounter_model->getEncounterList(); + $data["encounter_list"] = $out["encounter_list"]; + $this->renderProviderSecurePage('dash', $data); + // print_r($_SESSION); } - public function alerts() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; - $this->renderProviderSecurePage('dash', $data); + public function alerts() { + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; + $this->renderProviderSecurePage('dash', $data); } - public function todo() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; - $this->renderProviderSecurePage('dash', $data); + public function todo() { + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; + $this->renderProviderSecurePage('dash', $data); } - public function tasks() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; - $this->renderProviderSecurePage('dash', $data); + public function tasks() { + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; + $this->renderProviderSecurePage('dash', $data); } - public function calendar() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; - $this->renderProviderSecurePage('calendar', $data); + public function calendar() { + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; + $this->renderProviderSecurePage('calendar', $data); } - public function encounters() { - $data = array(); - $out = array(); - $this->load->model('patient_model'); - $out = $this->patient_model->getPatientList(); - $data["patient_list"] = $out["patient_list"]; + public function encounters() { + $data = array(); + $out = array(); + $this->load->model('patient_model'); + $out = $this->patient_model->getPatientList(); + $data["patient_list"] = $out["patient_list"]; - $this->load->model('encounter_model'); - $out = $this->encounter_model->getEncounterList(); - $data["encounter_list"] = $out["encounter_list"]; + $this->load->model('encounter_model'); + $out = $this->encounter_model->getEncounterList(); + $data["encounter_list"] = $out["encounter_list"]; - $this->renderProviderSecurePage('dash', $data); + $this->renderProviderSecurePage('dash', $data); } + } diff --git a/providerwww/application/core/MER_Controller.php b/providerwww/application/core/MER_Controller.php index 1872bf6..5de99ff 100644 --- a/providerwww/application/core/MER_Controller.php +++ b/providerwww/application/core/MER_Controller.php @@ -62,39 +62,35 @@ class MER_Controller extends CI_Controller { return htmlspecialchars($str); } - protected function loginUser($data, $out) { - + $data['action'] = MERMS_PROVIDERS_LOGIN; - // $data['mlog'] = $mlog; - // $data['member_id'] = $_SESSION['member_id']; + // $data['mlog'] = $mlog; + // $data['member_id'] = $_SESSION['member_id']; $this->load->model('backend_model'); $out = array(); $res = $this->backend_model->mermsemr_api($data, $out); - + $loginReturn = false; - - if ( $res==PHP_LOGIN_OK && isset($out["practice_id"]) && $out["practice_id"] > 0 ){ - - - $_SESSION['session_id'] =$out['sessionid']; // ""; - $_SESSION['username'] = $out['username']; // ""; - $_SESSION['practice_name'] = $out['practice_name']; - $_SESSION['practice_code'] = "IFE0001A"; - $_SESSION['user_firstname'] = $out['firstname']; - $_SESSION['user_lastname'] = $out['lastname']; - $_SESSION['user_email'] = $out['email']; - $_SESSION['user_id'] = $out['user_id']; - $_SESSION['practice_id'] = $out['practice_id']; - $_SESSION['user_provider'] = "1"; - $_SESSION['user_admin'] = "1"; + + if ($res == PHP_LOGIN_OK && isset($out["practice_id"]) && $out["practice_id"] > 0) { + $_SESSION['session_id'] = $out['sessionid']; // ""; + $_SESSION['username'] = $out['username']; // ""; + $_SESSION['practice_name'] = $out['practice_name']; + $_SESSION['practice_code'] = "IFE0001A"; + $_SESSION['user_firstname'] = $out['firstname']; + $_SESSION['user_lastname'] = $out['lastname']; + $_SESSION['user_email'] = $out['email']; + $_SESSION['user_id'] = $out['user_id']; + $_SESSION['practice_id'] = $out['practice_id']; + $_SESSION['user_provider'] = "1"; + $_SESSION['user_admin'] = "1"; $loginReturn = true; + } else { + $data['error_message'] = "Invalid Username or Password"; } - else { - $data['error_message']="Invalid Username or Password"; - } - - + + return $loginReturn; } @@ -155,7 +151,6 @@ class MER_Controller extends CI_Controller { return $str; - } protected function sql_escape_func($inp) { @@ -193,8 +188,6 @@ class MER_Controller extends CI_Controller { //$this->load->view('users/view_external_footer'); } - - protected function readFixedText($text_key) { $page_key = trim($text_key); @@ -247,19 +240,16 @@ class MER_Controller extends CI_Controller { return $query->result(); } - - protected function renderProviderSecurePage($page_name, $data) { - - // you dont have bussines here if you are not in session + + // you dont have bussines here if you are not in session if (!isset($_SESSION['session_id']) or ! isset($_SESSION['username']) or $_SESSION['username'] == '') { redirect(logout); } - + $this->load->view('template/provider_header', $data); $this->load->view('provider/' . $page_name, $data); $this->load->view('template/provider_footer', $data); } - } diff --git a/providerwww/application/models/Encounter_model.php b/providerwww/application/models/Encounter_model.php index 8bc3c86..66fdbc4 100644 --- a/providerwww/application/models/Encounter_model.php +++ b/providerwww/application/models/Encounter_model.php @@ -8,7 +8,7 @@ class Encounter_model extends CI_Model { public function getEncounterList() { - $mysql = "SELECT pe.primary_complain AS reason, pe.appt_date AS appt,m.firstname,m.lastname,'F' AS gender , '35' AS age, pe.id,pe.id AS encounter_id FROM patient_encounters pe LEFT JOIN members m ON m.id=pe.member_id"; + $mysql = "SELECT pe.member_id AS patient_id, pe.primary_complain AS reason, to_char(pe.appt_date, 'Day Mon DD HH12:MI') AS appt,m.firstname,m.lastname,'F' AS gender , '35' AS age, pe.id,pe.id AS encounter_id FROM patient_encounters pe LEFT JOIN members m ON m.id=pe.member_id"; $query = $this->db->query($mysql); $num = $query->num_rows(); $data["encounter_list"] = $query->result(); @@ -17,7 +17,7 @@ class Encounter_model extends CI_Model { public function LoadEncounter($practice_id, $patient_id) { - $mysql = "SELECT pe.primary_complain AS reason, pe.appt_date AS appt,m.firstname,m.lastname,'F' AS gender , '35' AS age, pe.id,pe.id AS encounter_id FROM patient_encounters pe LEFT JOIN members m ON m.id=pe.member_id"; + $mysql = "SELECT pe.member_id AS patient_id, pe.primary_complain AS reason, to_char(pe.appt_date, 'Day Mon DD HH12:MI') AS appt,m.firstname,m.lastname,'F' AS gender , '35' AS age, pe.id,pe.id AS encounter_id FROM patient_encounters pe LEFT JOIN members m ON m.id=pe.member_id"; $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_return"] = $query->result(); diff --git a/providerwww/application/models/Patient_model.php b/providerwww/application/models/Patient_model.php index f42a80c..b229190 100644 --- a/providerwww/application/models/Patient_model.php +++ b/providerwww/application/models/Patient_model.php @@ -8,8 +8,8 @@ class Patient_model extends CI_Model { public function getPatientList() { - $mysql = "SELECT p.practice_id,p.id AS patient_id,p.member_id,p.long_id,m.firstname,m.lastname,m.phone,p.added " - . " FROM patients p LEFT JOIN members m ON m.id=p.member_id ORDER BY p.added DESC"; + $mysql = "SELECT p.practice_id,p.id AS patient_id,p.member_id,p.long_id,m.firstname,m.lastname,m.phone,p.added::date " + . " FROM patients p LEFT JOIN members m ON m.id=p.member_id WHERE p.practice_id=" . $_SESSION['practice_id'] . " ORDER BY p.added DESC"; $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_list"] = $query->result(); @@ -18,8 +18,8 @@ class Patient_model extends CI_Model { public function LoadPatient($practice_id, $patient_id) { - $mysql = "SELECT p.practice_id,p.id AS patient_id,p.member_id,p.long_id,m.firstname,m.lastname,m.phone,p.added,m.email " - . " FROM patients p LEFT JOIN members m ON m.id=p.member_id WHERE p.id=" . $patient_id; + $mysql = "SELECT p.practice_id,p.id AS patient_id,p.member_id,p.long_id,m.firstname,m.lastname,m.phone,p.added::date,m.email " + . " FROM patients p LEFT JOIN members m ON m.id=p.member_id WHERE p.id=" . $patient_id . " AND p.practice_id=" . $_SESSION['practice_id']; $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_return"] = $query->result(); @@ -27,4 +27,3 @@ class Patient_model extends CI_Model { } } - diff --git a/providerwww/application/views/provider/components/encounter_listing.php b/providerwww/application/views/provider/components/encounter_listing.php index 7c58e11..7a9679d 100644 --- a/providerwww/application/views/provider/components/encounter_listing.php +++ b/providerwww/application/views/provider/components/encounter_listing.php @@ -14,11 +14,11 @@ $icc = 0;