103 lines
3.6 KiB
PHP
103 lines
3.6 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Patient extends Provider_Controller {
|
|
|
|
public function index() {
|
|
$data = array();
|
|
$this->renderProviderSecurePage('patient/patientreport', $data);
|
|
}
|
|
|
|
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["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"];
|
|
|
|
|
|
$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);
|
|
$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() {
|
|
// 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);
|
|
}
|
|
}
|
|
|
|
}
|