forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 13
/
PrescriptionRestController.php
50 lines (41 loc) · 1.46 KB
/
PrescriptionRestController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* PrescriptionRestController
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Yash Bothra <yashrajbothra786gmail.com>
* @copyright Copyright (c) 2020 Yash Bothra <yashrajbothra786gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/
namespace OpenEMR\RestControllers;
use OpenEMR\Services\PrescriptionService;
use OpenEMR\RestControllers\RestControllerHelper;
class PrescriptionRestController
{
private $prescriptionService;
public function __construct()
{
$this->prescriptionService = new PrescriptionService();
}
/**
* Fetches a single prescription resource by id.
* @param $uuid- The prescription uuid identifier in string format.
*/
public function getOne($uuid)
{
$processingResult = $this->prescriptionService->getOne($uuid);
if (!$processingResult->hasErrors() && count($processingResult->getData()) == 0) {
return RestControllerHelper::handleProcessingResult($processingResult, 404);
}
return RestControllerHelper::handleProcessingResult($processingResult, 200);
}
/**
* Returns prescription resources which match an optional search criteria.
*/
public function getAll($search = array())
{
$processingResult = $this->prescriptionService->getAll($search);
return RestControllerHelper::handleProcessingResult($processingResult, 200, true);
}
}