$admission_add = $newaddm->getLabHistory($patientId, $labTestType); } if ($admission_add) { echo JsonResponse::success($admission_add); exit; } else { // print_r($_REQUEST); echo JsonResponse::error("Error getting lab history"); exit; } } elseif ($intent == 'labHistory') { if (isset($_REQUEST['labType'])) { $type = $_REQUEST['labType']; $patientId = intval($_REQUEST['patientId']); $lab = new LaboratoryController(); $result = $lab->getLabHistory($type, $patientId); if ($result) { echo JsonResponse::success($result); exit; } 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'));