forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcedureRestController.php
51 lines (42 loc) · 1.48 KB
/
ProcedureRestController.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
51
<?php
/**
* ProcedureRestController
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Matthew Vita <[email protected]>
* @author Yash Bothra <yashrajbothra786gmail.com>
* @copyright Copyright (c) 2018 Matthew Vita <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/
namespace OpenEMR\RestControllers;
use OpenEMR\Services\ProcedureService;
use OpenEMR\RestControllers\RestControllerHelper;
class ProcedureRestController
{
private $procedureService;
public function __construct()
{
$this->procedureService = new ProcedureService();
}
/**
* Fetches a single procedure resource by id.
* @param $uuid- The procedure uuid identifier in string format.
*/
public function getOne($uuid)
{
$processingResult = $this->procedureService->getOne($uuid);
if (!$processingResult->hasErrors() && count($processingResult->getData()) == 0) {
return RestControllerHelper::handleProcessingResult($processingResult, 404);
}
return RestControllerHelper::handleProcessingResult($processingResult, 200);
}
/**
* Returns procedure resources which match an optional search criteria.
*/
public function getAll($search = array())
{
$processingResult = $this->procedureService->getAll($search);
return RestControllerHelper::handleProcessingResult($processingResult, 200, true);
}
}