forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppointmentRestController.php
More file actions
63 lines (51 loc) · 1.91 KB
/
AppointmentRestController.php
File metadata and controls
63 lines (51 loc) · 1.91 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* AppointmentRestController
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Matthew Vita <matthewvita48@gmail.com>
* @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/
namespace OpenEMR\RestControllers;
use OpenEMR\Services\AppointmentService;
use OpenEMR\RestControllers\RestControllerHelper;
class AppointmentRestController
{
private $appointmentService;
public function __construct()
{
$this->appointmentService = new AppointmentService();
}
public function getOne($eid)
{
$serviceResult = $this->appointmentService->getAppointment($eid);
return RestControllerHelper::responseHandler($serviceResult, null, 200);
}
public function getAll()
{
$serviceResult = $this->appointmentService->getAppointmentsForPatient(null);
return RestControllerHelper::responseHandler($serviceResult, null, 200);
}
public function getAllForPatient($pid)
{
$serviceResult = $this->appointmentService->getAppointmentsForPatient($pid);
return RestControllerHelper::responseHandler($serviceResult, null, 200);
}
public function post($pid, $data)
{
$validationResult = $this->appointmentService->validate($data);
$validationHandlerResult = RestControllerHelper::validationHandler($validationResult);
if (is_array($validationHandlerResult)) {
return $validationHandlerResult;
}
$serviceResult = $this->appointmentService->insert($pid, $data);
return RestControllerHelper::responseHandler(array("id" => $serviceResult), null, 200);
}
public function delete($eid)
{
$serviceResult = $this->appointmentService->delete($eid);
return RestControllerHelper::responseHandler($serviceResult, null, 200);
}
}