public function admitPatient($patient_id, $treatment_id, $admitted_by, $bed_id, $comments) { $feedback = array(); $admitted = AdmissionController::isAdmitted($patient_id); if ($admitted) { $feedback[P_STATUS] = STATUS_ERROR; $feedback[P_MESSAGE] = "Patient already admitted!"; return $feedback; } $occupied = WardController::isOccupied($bed_id); if ($occupied) { $feedback[P_STATUS] = STATUS_ERROR; $feedback[P_MESSAGE] = "Bed already occupied!"; return $feedback; } $admission_model = new AdmissionModel(); $admission_data = array(); $admission_data[AdmissionTable::patient_id] = $patient_id; $admission_data[AdmissionTable::treatment_id] = $treatment_id; $admission_data[AdmissionTable::admitted_by] = $admitted_by; $admission_data[AdmissionTable::comments] = $comments; $admission_data[AdmissionBedTable::bed_id] = $bed_id; $response = $admission_model->admitPatient($admission_data); if ($response) { $feedback[P_STATUS] = STATUS_OK; $feedback[P_MESSAGE] = "Patient admission successful!"; } else { $feedback[P_STATUS] = STATUS_ERROR; $feedback[P_MESSAGE] = "Unable to complete patient admission!"; } return $feedback; }
<?php /** * Created by PhpStorm. * User: olajuwon * Date: 2/16/2015 * Time: 1:10 PM */ require_once '../_core/global/_require.php'; Crave::requireAll(GLOBAL_VAR); Crave::requireAll(UTIL); Crave::requireFiles(MODEL, array('BaseModel', 'RoleModel', 'BedModel', 'WardModel', 'VitalsModel')); Crave::requireFiles(CONTROLLER, array('WardController', 'RoleController', 'VitalsController')); $ward = new WardController(); $wards = $ward->loadWards(); ?> <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>Admin Dashboard</title> <link href="../css/bootstrap/bootstrap.min.css" rel="stylesheet"> <link href='../css/libs/fullCalendar/fullcalendar.css' rel='stylesheet' /> <link href='../css/libs/fullCalendar/fullcalendar.print.css' rel='stylesheet' media='print' /> <link href="../css/master.css" rel="stylesheet"> </head> <body> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header">
$warden = new WardController(); $response = $warden->deleteBed($_POST[BedTable::bed_id]); if (is_array($response)) { echo JsonResponse::error($response[P_MESSAGE]); exit; } else { echo JsonResponse::message(STATUS_OK, "Bed successfully deleted!"); exit; } } else { echo JsonResponse::error("Incomplete request parameters!"); exit; } } elseif ($intent == 'deleteWard') { if (isset($_POST[WardRefTable::ward_ref_id])) { $warden = new WardController(); $response = $warden->deleteWard($_POST[WardRefTable::ward_ref_id]); if (is_array($response)) { echo JsonResponse::error($response[P_MESSAGE]); exit; } else { echo JsonResponse::message(STATUS_OK, "Ward deletion successful!"); exit; } } else { echo JsonResponse::error("Incomplete request parameters!"); exit; } } else { echo JsonResponse::error("Invalid intent!"); exit;