Openemr fhir search (#4349)
[openemr.git] / src / RestControllers / PrescriptionRestController.php
blob08a93c2c8bf3160ec6115397641f2c4773bda8dd
1 <?php
3 /**
4 * PrescriptionRestController
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Yash Bothra <yashrajbothra786gmail.com>
9 * @copyright Copyright (c) 2020 Yash Bothra <yashrajbothra786gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 namespace OpenEMR\RestControllers;
15 use OpenEMR\Services\PrescriptionService;
16 use OpenEMR\RestControllers\RestControllerHelper;
18 class PrescriptionRestController
20 private $prescriptionService;
22 public function __construct()
24 $this->prescriptionService = new PrescriptionService();
27 /**
28 * Fetches a single prescription resource by id.
29 * @param $uuid- The prescription uuid identifier in string format.
31 public function getOne($uuid)
33 $processingResult = $this->prescriptionService->getOne($uuid);
35 if (!$processingResult->hasErrors() && count($processingResult->getData()) == 0) {
36 return RestControllerHelper::handleProcessingResult($processingResult, 404);
39 return RestControllerHelper::handleProcessingResult($processingResult, 200);
42 /**
43 * Returns prescription resources which match an optional search criteria.
45 public function getAll($search = array())
47 $processingResult = $this->prescriptionService->getAll($search);
48 return RestControllerHelper::handleProcessingResult($processingResult, 200, true);