/** * getter for patients array * @return integer|Patients[string][integer] */ public static function getPatients() { $person1 = new Patients(); $person1->setPerson(1, "John", 67, "Male"); $person2 = new Patients(); $person2->setPerson(2, "Mary", 75, "Female"); $patientArray = array(1 => array('ID' => 1, 'Patient' => $person1), 2 => array('ID' => 2, 'Patient' => $person2)); return $patientArray; }
public function save_patient($data_array, $patient_number, $date_created, $facility_code) { $o = new Patients(); $o->fromArray($data_array); $o->save(); $sql = "select id from patient_details where patient_number='{$patient_number}' and date_created='{$date_created}' limit 0,1"; $query = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAll($sql); foreach ($query as $key => $value) { $id = $value['id']; $system_patient_number = $facility_code . 'P' . $id; $sql_u = "update patient_details set system_patient_number='{$system_patient_number}' where id='{$id}'"; $q = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($sql_u); } return TRUE; }
public function patients() { $p_data = Patients::get_patient_data(); $data['patient_data'] = $p_data; $data['sidebar'] = "facility/facility_dispensing/sidebar_dispensing"; $view = 'shared_files/template/template'; // $data['report_view'] $this->load->view($view, $data); }
<?php require_once CODE_ROOT . '/classes/patients.php'; $patients = new Patients(); if (empty($request_uri[2])) { $request_uri[2] = ''; } if (empty($request_uri[3])) { $request_uri[3] = 0; } switch ($request_uri[2]) { case '': $patients->edit(0); $patients->_list(); break; case 'add': $patients->edit(0); if ($patients->result['success'] === true) { header('Location: /patients/?filter=' . $patients->result['fio'] . ' ' . $patients->result['age']); die; } break; case 'edit': $urlData['id'] = (int) $request_uri[3]; $patients->edit((int) $request_uri[3]); if (IS_AJAX === true && filter_input(INPUT_POST, 'action', FILTER_VALIDATE_INT) === 1) { $result = array('success' => $patients->result['success'], 'messages' => $patients->result['message']); echo json_encode($result); die; } break;
public function patient_history_ajax() { $patient_id = $this->input->post('patient_id'); $patient_details = Patients::get_patient_history($patient_id); // echo "<pre>";print_r($patient_details); /*$p_dets = array(); foreach ($patient_details as $key => $value) { $id = $value['id']; $firstname = $value['firstname']; $lastname = $value['lastname']; $date_of_birth = $value['date_of_birth']; $date_of_birth_string = date('F, m Y', strtotime($date_of_birth)); $gender = $value['gender']; $name = $firstname.' '.$lastname; $gender = ($gender=='1') ? 'Male' : 'Female'; $name_and_number = $name .' | '.$patient_number; $p_dets[] = array($patient_number,$name,$gender,$date_of_birth_string,$name_and_number,$id); } echo json_encode($p_dets[0]);*/ $result_table = ""; $result_table .= ' <table class="table table-bordered row-fluid datatable"> <thead> <th>Patient Name</th> <th>Commodity Name</th> <th>Units Dispensed</th> <th>Date Dispensed</th> </thead> <tbody>'; if (count($patient_details) > 0) { foreach ($patient_details as $data) { $result_table .= '<tr> <td>' . $data['firstname'] . ' ' . $data['lastname'] . '</td> <td>' . $data['commodity_name'] . '</td> <td>' . $data['units_dispensed'] . '</td> <td>' . date('Y-M-d', strtotime($data['date_created'])) . '</td> </tr>'; } } else { $result_table .= '<tr><td colspan="4"><b>There is no history on this patient</b></td></tr>'; } $result_table .= '</tbody></table>'; echo $result_table; }
public function saveImage($id) { //import the class for image manipulation from the extension folder Yii::import('application.extensions.upload.Upload'); $ss = array('name' => $_FILES['UserDetails']['name']['photo'], 'type' => $_FILES['UserDetails']['type']['photo'], 'tmp_name' => $_FILES['UserDetails']['tmp_name']['photo'], 'error' => $_FILES['UserDetails']['error']['photo'], 'size' => $_FILES['UserDetails']['size']['photo']); //Receive file/image data from the post request $Upload = new Upload(isset($ss) ? $ss : null); $Upload->jpeg_quality = 100; $Upload->no_script = false; $Upload->image_resize = true; $Upload->image_x = 300; $Upload->image_y = 250; $Upload->image_ratio = true; //some vars $rand = rand(1000, 9000); $newName = $rand; $image_path = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/users/' . $id . '/'; $image_thumb_path = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/users/3/thumbs/'; $destPath = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/users/3/thumbs/'; //Verify if was uloaded if ($Upload->uploaded) { $Upload->file_new_name_body = $id; $Upload->process($image_path); //if was processed if ($Upload->processed) { $destName = $Upload->file_dst_name; $this->photo = $id; $this->photo_thumb = 'thumb_' . $id; $this->save(); // create the thumb unset($Upload); $Upload = new Upload($image_path . $destName); $Upload->file_new_name_body = 'thumb_' . $id; $Upload->no_script = false; $Upload->image_resize = true; $Upload->image_x = 34; $Upload->image_y = 34; $Upload->image_ratio = true; $Upload->process($image_path); Patients::model()->sqThm($image_path . 'thumb_' . $id . '.jpg', $image_path . 'thumb_' . $id . '.jpg'); } else { echo $Upload->error; } } else { echo "Select an image to upload"; } }
public function patient_history_ajax() { $patient_id = $this->input->post('patient_id'); $patient_details = Patients::get_patient_history($patient_id); $result_table = ""; $total = 0; $result_table .= ' <table class="table table-bordered row-fluid datatable" id="ajax_history_table"> <thead> <th>Patient Name</th> <th>Commodity Name</th> <th>Units Dispensed</th> <th>Date Dispensed</th> </thead> <tbody>'; if (count($patient_details) > 0) { foreach ($patient_details as $data) { $total += intval($data['units_dispensed']); $result_table .= '<tr> <td>' . $data['firstname'] . ' ' . $data['lastname'] . '</td> <td>' . $data['commodity_name'] . '</td> <td>' . $data['units_dispensed'] . '</td> <td>' . date('Y-M-d', strtotime($data['date_created'])) . '</td> </tr>'; } } else { $result_table .= '<tr><td><b>There is no history on this patient</b></td><td></td><td></td><td></td></tr>'; } $result_table .= '<tr><td>--</td><td><b>Total:</b></td><td><b>' . $total . '</b></td><td></td></tr>'; $result_table .= '</tbody></table>'; echo $result_table; }
<?php require_once 'patientsIllnessesClass.php'; $patientIllnessRelation1 = new patientsIllnesses(); $patientIllnessRelation1->setIllnessId(1); $patientIllnessRelation1->setPatientId(1); $patientIllnessRelation2 = new patientsIllnesses(); $patientIllnessRelation2->setIllnessId(1); $patientIllnessRelation2->setPatientId(2); $patientIllnessRelation3 = new patientsIllnesses(); $patientIllnessRelation3->setIllnessId(2); $patientIllnessRelation3->setPatientId(2); $relationArray = array(1 => $patientIllnessRelation1, 2 => $patientIllnessRelation2, 3 => $patientIllnessRelation3); require_once 'patientsClass.php'; require_once 'illnessesClass.php'; $wantedPatients = Patients::getPatients(); $wantedPatient1 = $wantedPatients[$patientIllnessRelation2->getPatientId()]; $wantedPatientName1 = $wantedPatient1['Patient']->getPersonName(); $wantedIllnesses = Illnesses::getIllnesses(); $wantedIllness1 = $wantedIllnesses[$patientIllnessRelation2->getIllnessId()]; $wantedIllnessName1 = $wantedIllness1['Illness']->getIllnessName(); //echo $wantedPatientName1, $wantedIllnessName1; echo '<br/>'; echo '<pre>wantedPatiens<br/>'; /*echo var_dump($patientIllnessRelation1); */ echo var_dump($wantedPatients); /*echo '<pre/>'; */ /*foreach ($wantedPatients as $PatientId => $value ){ foreach($wantedIllnesses as $IllnessId => $value2){