Beispiel #1
0
        } else {
            echo JsonResponse::error("No test found for this patient");
            exit;
        }
    } else {
        echo JsonResponse::error("Please select a lab type");
        exit;
    }
} elseif ($intent == 'labRequest') {
    if (isset($_REQUEST['labType'])) {
        $type = $_REQUEST['labType'];
        $doctorId = intval(CxSessionHandler::getItem('userid'));
        $treatmentId = intval($_REQUEST['treatmentId']);
        $encounterId = isset($_REQUEST['encounterId']) ? $_REQUEST['encounterId'] : 0;
        $description = isset($_REQUEST['description']) ? $_REQUEST['description'] : "";
        $lab = new LaboratoryController();
        $result = $lab->requestLabTest($type, $doctorId, $treatmentId, $encounterId, $description);
        if ($result) {
            echo JsonResponse::success("Request successful");
            exit;
        } else {
            echo JsonResponse::error("Request unsuccessful. Try again!");
            exit;
        }
    } else {
        echo JsonResponse::error("Please select a lab type");
        exit;
    }
} else {
    JsonResponse::error("No intent set");
}