break; case 'getPatientVisits': $a = new Admin(); $a->displayPatientVisits($data['pid']); break; case 'getPatientsByPhysician': $a = new Admin(); $a->displayPhysiciansPatients($data['ename']); break; // ==================================================== // Treatment Module 2 // ==================================================== // Treatment Module 2 case 'newEDT': $t = new Treatment(); if ($t->newEDT($data)) { header('Location: index.php?treatment&success=t'); } else { printError("Failed to insert new EDT Record."); } break; case 'getEDT': $t = new Treatment(); $results = $t->getEDTRecords($data['pid'], (bool) $data['option']); if ($results) { $t->displayEDTRecords($results); } else { header('Location: index.php?treatment&success=tn'); } break; // ====================================================
function runAdmin() { global $results; $a = new Admin(); // New patient $data = array('pname' => 'TEST1', 'dob' => '01/01/1989', 'address' => '123 Fake St.', 'contact_phone' => '5197817372', 'contact_email' => '*****@*****.**', 'emerg_name' => 'Tori', 'emerg_phone' => '6138367372'); $data2 = array('pname' => 'TEST2', 'dob' => '01/01/1989', 'address' => '123 Fake St.', 'contact_phone' => '5197817372', 'contact_email' => '*****@*****.**', 'emerg_name' => 'Tori', 'emerg_phone' => '6138367372'); $results['admin_newPatient'] = $a->addPatient($data); $a->addPatient($data2); // Try to add a patient that already exists $attempt = array('pname' => 'TEST1'); $results['admin_newPatientNot'] = !$a->addPatient($attempt); $patients = $a->getAllPatients(); $emps = $a->getAllPhysicians(); $pid = array_search('TEST1', $patients); // Update patient // Prereq: Patient exists $newData = array('pid' => $pid, 'address' => '123 Updated St.', 'contact_phone' => '5197817372', 'contact_email' => '*****@*****.**'); $where = array('field' => 'pid', 'value' => $pid); $results['admin_updatePatient'] = $a->updatePatient($newData); // Check in patient // Prereq: Checked in patient $a->checkInPatient(array('pid' => array_search('TEST2', $patients), 'indate' => date('m/d/Y'), 'eidin' => key($emps))); $results['admin_datePatients'] = $a->getPatientsOnDate(date('m/d/Y')); // Get patient vists // Prereq: At least 1 EDT record for patient $t = new Treatment(); $edt = array('pid' => $pid, 'dateperf' => '11/30/2010', 'activitytype' => 'E', 'enames' => current($emps), 'description' => "Today I did things", 'duration' => '1', 'outcome' => 'Yay?', 'cost' => 100); $results['admin_patientVisits'] = $t->newEDT($edt) && $a->getPatientVisits($pid); // Get patients based on physician // Prereq: Checked in patient $results['admin_physicianReleasedAdmitted'] = $a->getPhysiciansPatients(key($emps)); // Check out a patient // Prereq: Checked in patient $results['admin_checkOutPatient'] = $a->checkOutPatient(array('pid' => array_search('TEST2', $patients), 'outdate' => date('m/d/Y'), 'eidout' => key($emps))); }