228 lines
8.3 KiB
PHP
228 lines
8.3 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['dob'] = trim($this->input->post('dob'));
|
|
$data['gender'] = trim($this->input->post('gender'));
|
|
|
|
$data["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
|
|
$data["action"] = MERMS_PROVIDERS_CREATEMEMBER;
|
|
$out = array();
|
|
$ret = $this->mermsemr_api($data, $out);
|
|
|
|
if ($ret == 0 && $out["member_id"] > 0) {
|
|
$data["account_message"] = "<span style='color:green; font-size:12px;'>New patient added </span>";
|
|
} else {
|
|
$data["account_message"] = "<span style='color:red; font-size:12px;'>Error adding new patient </span>";
|
|
}
|
|
}
|
|
|
|
$out = array();
|
|
$out = $this->getPatientList();
|
|
$data["patient_list"] = $out["patient_list"];
|
|
|
|
|
|
$this->renderProviderSecurePage('patient/newpatient', $data);
|
|
}
|
|
|
|
public function selectPatient() {
|
|
if ($this->uri->segment(3) === FALSE) {
|
|
$patient_id = 0;
|
|
} else {
|
|
$patient_id = $this->uri->segment(3);
|
|
}
|
|
|
|
// echo $patient_id;
|
|
$this->selectedPatientView($patient_id);
|
|
}
|
|
|
|
public function findpatient() {
|
|
$out = array();
|
|
$out = $this->getPatientList();
|
|
$data["patient_list"] = $out["patient_list"];
|
|
$this->renderProviderSecurePage('patient/findpatient', $data);
|
|
}
|
|
|
|
public function patientView() {
|
|
$data['patient_id'] = trim($this->input->post('patientID'));
|
|
$this->selectedPatientView($data['patient_id']);
|
|
}
|
|
|
|
private function selectedPatientView($patient_id) {
|
|
$data = [];
|
|
$data['patient_id'] = $patient_id;
|
|
$this->load->model('patient_model');
|
|
$out = $this->patient_model->LoadPatient($_SESSION['practice_id'], $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,m.gender,m.dob::date AS dob "
|
|
. " 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 selectPatienFetures() {
|
|
|
|
$patient_action = $data['patient_action'] = trim($this->input->get('patient_action'));
|
|
$data['patient_id'] = trim($this->input->get('patient_id'));
|
|
|
|
/*
|
|
create mode 100644 providerwww/application/views/provider/patient/patientActions/view_chart_action.php
|
|
create mode 100644 providerwww/application/views/provider/patient/patientActions/view_reminder_action.php
|
|
create mode 100644 providerwww/application/views/provider/patient/patientActions/view_tracking_action.php
|
|
*/
|
|
//SELECT description, start_date,end_date WHERE member_id =1 AND practice_id = 0 AND status = 1 ORDER BY added DESC
|
|
|
|
|
|
|
|
switch ($patient_action) {
|
|
case "REMINDERS":
|
|
//Reminder_model
|
|
$this->load->model('reminder_model');
|
|
$out = $this->reminder_model->getPatientReminderList($_SESSION['practice_id'], $data['patient_id']);
|
|
$data["patient_reminder_list"] = $out["patient_reminder_list"];
|
|
|
|
$this->load->view('provider/patient/patientActions/view_reminder_action', $data);
|
|
break;
|
|
case "TRACKING":
|
|
$this->load->view('provider/patient/patientActions/view_tracking_action');
|
|
break;
|
|
case "CHARTS":
|
|
$this->load->view('provider/patient/patientActions/view_chart_action');
|
|
break;
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
public function addPatientReminder() {
|
|
|
|
$data['reminder_text'] = trim($this->input->get('reminder_text'));
|
|
$data['start_date'] = trim($this->input->get('start_date'));
|
|
$data['end_date'] = trim($this->input->get('end_date'));
|
|
$data['reminder_type'] = trim($this->input->get('reminder_type'));
|
|
$data['patient_id'] = trim($this->input->get('patient_id'));
|
|
|
|
echo "Ameye";
|
|
|
|
|
|
}
|
|
/*
|
|
|
|
var reminder_text = document.reminderaddform.reminder_text.value;
|
|
var start_date = document.reminderaddform.start_date.value;
|
|
var end_date = document.reminderaddform.end_date.value;
|
|
var reminder_type = document.reminderaddform.reminder_type.value;
|
|
var patient_id = document.reminderaddform.patient_id.value;
|
|
// alert(patient_link_id);
|
|
|
|
if (reminder_text === '' || start_date === '' || end_date === '' || reminder_type === '') {
|
|
alert('All felids are required to add a reminder!');
|
|
return false;
|
|
}
|
|
|
|
// alert(job_description);
|
|
$('#link_result').html('Processing...');
|
|
$('#rem_link_submit').prop('disabled', true);
|
|
$.ajax({
|
|
url: "/patient/addPatientReminder?reminder_text=" + reminder_text + "&patient_id=" + patient_id +"&reminder_text=" + reminder_text +"&start_date=" + start_date +"&end_date=" + end_date + "&reminder_type="+reminder_type
|
|
}).done(function (data) {
|
|
$('#link_result').html(data);
|
|
document.linkform.patient_link_id.value = '';
|
|
$('#rem_link_submit').prop('disabled', false);
|
|
});
|
|
return false;
|
|
}
|
|
|
|
*/
|
|
public function linkpatient() {
|
|
// echo 'Ameye';
|
|
|
|
|
|
|
|
if ($_GET) {
|
|
$data['patient_link_id'] = trim($this->input->get('patient_link_id'));
|
|
$data['practice_id'] = $_SESSION['practice_id'];
|
|
$data['practice_user_id'] = $_SESSION['practice_id'];
|
|
|
|
$data["loc"] = $_SERVER["REMOTE_ADDR"];
|
|
$data["action"] = MERMS_PROVIDERS_LINKMEMBER;
|
|
$out = array();
|
|
$ret = $this->mermsemr_api($data, $out);
|
|
//$data["account_message"] = "This is the return " . $ret;
|
|
echo $out["message"];
|
|
} else {
|
|
echo 'Invalid call...';
|
|
}
|
|
}
|
|
|
|
}
|