From 4fa09b12bc207ce036d917f37e14efb7e48bf528 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Sun, 7 Apr 2019 02:27:09 +0000 Subject: [PATCH] Backend Service --- .../application/controllers/Patient.php | 113 +++--- .../application/models/Patient_model.php | 25 +- .../provider/components/patient_listing.php | 44 +-- .../views/provider/patient/thispatient.php | 338 ++++++++++-------- .../provider/patient/thispatientChart.php | 273 ++++++++++++++ 5 files changed, 576 insertions(+), 217 deletions(-) create mode 100644 providerwww/application/views/provider/patient/thispatientChart.php diff --git a/providerwww/application/controllers/Patient.php b/providerwww/application/controllers/Patient.php index a1aad0f..9a6c269 100644 --- a/providerwww/application/controllers/Patient.php +++ b/providerwww/application/controllers/Patient.php @@ -11,65 +11,92 @@ class Patient extends Provider_Controller { public function addnew() { $data = array(); - $data["account_message"] = ""; - $data["firstname"] = $data["lastname"] = $data["email"] = $data["password"]= $data["street1"] = $data["street2"]= $data["city"] = $data["zipcode"]=""; - if ($_POST){ - $data['password'] = trim($this->input->post('password')); - $data['practice_id'] = $_SESSION['practice_id']; - $data['practice_user_id'] = $_SESSION['practice_id']; - $data['username'] = "NON-USER-".rand(1000000,99999999); - $data['password'] = "NON-USER-".rand(1000000,99999999); - $data['country'] = "NG"; - $data['firstname'] = trim($this->input->post('firstname')); - $data['lastname'] = trim($this->input->post('lastname')); - $data['email'] = trim($this->input->post('email')); - - $data['street1'] = trim($this->input->post('street1')); - $data['street2'] = trim($this->input->post('street2')); - $data['city'] = trim($this->input->post('city')); - $data['state'] = trim($this->input->post('state')); -$data["loc"] = $_SERVER["REMOTE_ADDR"]; + $data["account_message"] = ""; + $data["firstname"] = $data["lastname"] = $data["email"] = $data["password"] = $data["street1"] = $data["street2"] = $data["city"] = $data["zipcode"] = ""; + if ($_POST) { + $data['password'] = trim($this->input->post('password')); + $data['practice_id'] = $_SESSION['practice_id']; + $data['practice_user_id'] = $_SESSION['practice_id']; + $data['username'] = "NON-USER-" . rand(1000000, 99999999); + $data['password'] = "NON-USER-" . rand(1000000, 99999999); + $data['country'] = "NG"; + $data['firstname'] = trim($this->input->post('firstname')); + $data['lastname'] = trim($this->input->post('lastname')); + $data['email'] = trim($this->input->post('email')); - $data["action"] = MERMS_PROVIDERS_CREATEMEMBER; - $out = array(); - $ret = $this->mermsemr_api($data, $out); - $data["account_message"] = "This is the return ".$ret; + $data['street1'] = trim($this->input->post('street1')); + $data['street2'] = trim($this->input->post('street2')); + $data['city'] = trim($this->input->post('city')); + $data['state'] = trim($this->input->post('state')); + $data["loc"] = $_SERVER["REMOTE_ADDR"]; + + $data["action"] = MERMS_PROVIDERS_CREATEMEMBER; + $out = array(); + $ret = $this->mermsemr_api($data, $out); + $data["account_message"] = "This is the return " . $ret; echo "Posted"; - } + } $out = array(); - $out = $this->getPatientList(); - $data["patient_list"] = $out["patient_list"]; + $out = $this->getPatientList(); + $data["patient_list"] = $out["patient_list"]; $this->renderProviderSecurePage('patient/newpatient', $data); } - public function patientView(){ - echo $data['patient_id'] = trim($this->input->post('patientID')); - $this->load->model('patient_model'); - $out = $this->patient_model->LoadPatient(0, $data['patient_id']); - - print_r( $out ); - -$this->renderProviderSecurePage('patient/thispatient', $data); + public function patientView() { + echo $data['patient_id'] = trim($this->input->post('patientID')); + $this->load->model('patient_model'); + $out = $this->patient_model->LoadPatient(0, $data['patient_id']); - } - - private 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"; - $query = $this->db->query($mysql); + // print_r($out); + $data['firstname'] = $out["patient_return"][0]->firstname; + $data['lastname'] = $out["patient_return"][0]->lastname; + $data['email'] = $out["patient_return"][0]->email; + + $this->renderProviderSecurePage('patient/thispatient', $data); + } + + private 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"; + $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_list"] = $query->result(); + + + return $data; - } + } + public function report() { $data = array(); $this->renderProviderSecurePage('patient/patientreport', $data); } - public function chart(){ - echo "patientChart"; + + public function chart() { + // print_r($this->input->post()); + + if ($this->uri->segment(3) === FALSE) { + $patient_id = 0; + } else { + $patient_id = $this->uri->segment(3); + } + + if ($patient_id == 0) { + echo "go to find patient"; + } else { + + $this->load->model('patient_model'); + $out = $this->patient_model->LoadPatient(0, $patient_id); + + $data['firstname'] = $out["patient_return"][0]->firstname; + $data['lastname'] = $out["patient_return"][0]->lastname; + + $this->renderProviderSecurePage('patient/thispatientChart', $data); + } } + } diff --git a/providerwww/application/models/Patient_model.php b/providerwww/application/models/Patient_model.php index 223222b..f42a80c 100644 --- a/providerwww/application/models/Patient_model.php +++ b/providerwww/application/models/Patient_model.php @@ -3,27 +3,28 @@ class Patient_model extends CI_Model { function __construct() { - + } - public function getPatientList(){ + 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"; - $query = $this->db->query($mysql); + . " FROM patients p LEFT JOIN members m ON m.id=p.member_id ORDER BY p.added DESC"; + $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_list"] = $query->result(); return $data; - } - - 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 " - ." FROM patients p LEFT JOIN members m ON m.id=p.member_id WHERE p.id=".$patient_id; - $query = $this->db->query($mysql); + 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; + $query = $this->db->query($mysql); $num = $query->num_rows(); $data["patient_return"] = $query->result(); return $data; - } - + } + } + diff --git a/providerwww/application/views/provider/components/patient_listing.php b/providerwww/application/views/provider/components/patient_listing.php index 5b2e417..873d098 100644 --- a/providerwww/application/views/provider/components/patient_listing.php +++ b/providerwww/application/views/provider/components/patient_listing.php @@ -24,34 +24,34 @@ - + $icc = 0; + foreach ($patient_list as $prow) { + $icc++; + ?> + + + + firstname ?> lastname ?> + phone ?> + + Active + + + + + - - - firstname?> lastname?> - phone?> - - Active - - - - - - # - Name + Name Phone Chart Status diff --git a/providerwww/application/views/provider/patient/thispatient.php b/providerwww/application/views/provider/patient/thispatient.php index ba36def..0676db4 100644 --- a/providerwww/application/views/provider/patient/thispatient.php +++ b/providerwww/application/views/provider/patient/thispatient.php @@ -1,6 +1,7 @@ +