$result = $setup->createAdminUser($username, $password, $confirm_password);
    if ($result) {
        echo JsonResponse::success('Successfully created admin user');
        exit;
    } else {
        echo JsonResponse::error('Error creating admin user');
        exit;
    }
} elseif ($intent == 'addHospitalInfoAndUnits') {
    $hospital_name = $_REQUEST['name'];
    $hospital_address = $_REQUEST['address'];
    $values = $_REQUEST['values'];
    $hospital = new HospitalDetailsController();
    $result = $hospital->createHospitalDetails($hospital_name, $hospital_address);
    if ($result) {
        $units = new PharmacistController();
        $units_added = $units->addDrugUnits($values);
        if ($units_added) {
            echo JsonResponse::success('Successfully added hospital information and drug units');
            exit;
        } else {
            echo JsonResponse::error('Could not add drug units');
            exit;
        }
    } else {
        echo JsonResponse::error('Adding hospital information unsuccessful');
        exit;
    }
} elseif ($intent == 'addBillingItems') {
    $values = $_REQUEST['billItems'];
    $bills = new BillingController();
Beispiel #2
0
        $diagnosis = $_REQUEST[TreatmentTable::diagnosis];
        $treatment_id = $_REQUEST['treatment_id'];
        $prescription = $_REQUEST['prescription'];
        $encounter_id = isset($_REQUEST['encounter_id']) ? $_REQUEST['encounter_id'] : 0;
    } else {
        echo JsonResponse::error("things are not set");
        exit;
    }
    $admission_add = null;
    $newaddm = new TreatmentController();
    $admission_add = $newaddm->addTreatment2($doctorid, $patientid, $consultation, $symptoms, $diagnosis, $comments, $treatment_id);
    if ($admission_add) {
        foreach ($prescription as $somepre) {
            $status = ACTIVE;
            $mod = DOCTOR;
            $pre = new PharmacistController();
            $pre->AddPrescription($somepre, $treatment_id, $status, $mod, $encounter_id);
            if (!$pre) {
                exit;
            }
        }
    }
    if ($admission_add || $pre) {
        echo JsonResponse::success($admission_add);
        exit;
    } else {
        echo JsonResponse::error("Automatic Error creating treatment and prescription");
        exit;
    }
} elseif ($intent == 'getTreatmentHistory') {
    if (isset($_REQUEST['patient_id'])) {
Beispiel #3
0
    $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : "";
    $address = isset($_REQUEST['address']) ? $_REQUEST['address'] : "";
    $hospitalDetailsController = new HospitalDetailsController();
    if ($id) {
        $hospitalInfo = $hospitalDetailsController->updateHospitalDetails($id, $name, $address);
    } else {
        $hospitalInfo = $hospitalDetailsController->createHospitalDetails($name, $address);
    }
    if ($hospitalInfo) {
        CxSessionHandler::setItem(HOSPITAL_NAME, $name);
        // RESETS THE HOSPITAL NAME IN SESSION
        echo JsonResponse::success("Successfully updated  hospital details");
        exit;
    } else {
        echo JsonResponse::error("Could not update hospital details.");
        exit;
    }
} elseif ($intent == 'addDrugUnits') {
    $values = $_REQUEST['values'];
    $units = new PharmacistController();
    $result = $units->addDrugUnits($values);
    if ($result) {
        echo JsonResponse::success('Successfully added drug units.');
        exit;
    } else {
        echo JsonResponse::error('Adding of drug units unsuccessful.');
        exit;
    }
} else {
    echo JsonResponse::error("Invalid intent!");
}
Beispiel #4
0
<?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', 'UserModel', 'PharmacistModel'));
Crave::requireFiles(CONTROLLER, array('UserController', 'PharmacistController'));
$pharmacist = new PharmacistController();
$pharmacist_queue = $pharmacist->getPatientQueue();
$drugs = $pharmacist->getDrugs();
$units = $pharmacist->getUnits();
?>
<!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>
<!--Page header-->
        exit;
    } else {
        echo JsonResponse::accessDenied();
        exit;
    }
} elseif ($intent == 'addDrugUnits') {
    $values = $_REQUEST['values'];
    $units = new PharmacistController();
    $result = $units->addDrugUnits($values);
    if ($result) {
        echo JsonResponse::success('Successfully added drug units!');
        exit;
    } else {
        echo JsonResponse::error('Adding of drug units unsuccessful!');
        exit;
    }
} elseif ($intent == 'removeDrugUnit') {
    $unitRefId = $_REQUEST['id'];
    $units = new PharmacistController();
    $result = $units->removeDrugUnit($unitRefId);
    if ($result) {
        echo JsonResponse::success('Successfully removed drug unit!');
        exit;
    } else {
        echo JsonResponse::error('Removal of drug unit unsuccessful!');
        exit;
    }
} else {
    echo JsonResponse::error("Invalid intent");
    exit;
}