improved prior 8.2 fix
[openemr.git] / _rest_routes.inc.php
blob8e00af52f6d85dda409c66b52f504bf4475aca59
1 <?php
3 /**
4 * Routes
5 * (All REST routes)
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Matthew Vita <matthewvita48@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @author Yash Raj Bothra <yashrajbothra786@gmail.com>
13 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
14 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
15 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 /**
21 * @OA\Info(title="OpenEMR API", version="6.1.0")
22 * @OA\Server(url="/apis/default/")
23 * @OA\SecurityScheme(
24 * securityScheme="openemr_auth",
25 * type="oauth2",
26 * @OA\Flow(
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
31 * scopes={
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "api:fhir": "FHIR R4 API",
35 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
36 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
37 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
38 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
39 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
40 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
41 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
42 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
43 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
44 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
45 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
46 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
47 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
48 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
49 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
50 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
51 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
52 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
53 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
54 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
55 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
56 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
57 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
58 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
59 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
60 * "system/Device.read": "Read all device resources in the system (api:fhir)",
61 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
62 * "system/Document.read": "Read all document resources in the system (api:fhir)",
63 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
64 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
65 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
66 * "system/Group.read": "Read all group resources in the system (api:fhir)",
67 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
68 * "system/Location.read": "Read all location resources in the system (api:fhir)",
69 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
70 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
71 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
72 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
73 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
74 * "system/Person.read": "Read all person resources in the system (api:fhir)",
75 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
76 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
77 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
78 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
79 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
80 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
81 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
82 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
83 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
84 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
85 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
86 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
87 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
88 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
89 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
90 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
91 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
92 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
93 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
94 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
95 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
96 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
97 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
98 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
99 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
100 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
101 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
102 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
103 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
104 * "api:oemr": "Standard OpenEMR API",
105 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
106 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
107 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
108 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
109 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
110 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
111 * "user/document.read": "Read documents the user has access to (api:oemr)",
112 * "user/document.write": "Write documents the user has access to (api:oemr)",
113 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
114 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
115 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
116 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
117 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
118 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
119 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
120 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
121 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
122 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
123 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
124 * "user/list.read": "Read lists the user has access to (api:oemr)",
125 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
126 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
127 * "user/medication.read": "Read medications the user has access to (api:oemr)",
128 * "user/medication.write": "Write medications the user has access to (api:oemr)",
129 * "user/message.write": "Read messages the user has access to (api:oemr)",
130 * "user/patient.read": "Read patients the user has access to (api:oemr)",
131 * "user/patient.write": "Write patients the user has access to (api:oemr)",
132 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
133 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
134 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
135 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
136 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
137 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
138 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
139 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
140 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
141 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
142 * "api:port": "Standard Patient Portal OpenEMR API",
143 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
144 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
148 * @OA\Tag(
149 * name="fhir",
150 * description="FHIR R4 API"
152 * @OA\Tag(
153 * name="standard",
154 * description="Standard OpenEMR API"
156 * @OA\Tag(
157 * name="standard-patient",
158 * description="Standard Patient Portal OpenEMR API"
160 * @OA\Response(
161 * response="standard",
162 * description="Standard Response",
163 * @OA\MediaType(
164 * mediaType="application/json",
165 * @OA\Schema(
166 * @OA\Property(
167 * property="validationErrors",
168 * description="Validation errors.",
169 * type="array",
170 * @OA\Items(
171 * type="object",
172 * ),
173 * ),
174 * @OA\Property(
175 * property="internalErrors",
176 * description="Internal errors.",
177 * type="array",
178 * @OA\Items(
179 * type="object",
180 * ),
181 * ),
182 * @OA\Property(
183 * property="data",
184 * description="Returned data.",
185 * type="array",
186 * @OA\Items(
187 * type="object",
188 * ),
189 * ),
190 * example={
191 * "validationErrors": {},
192 * "error_description": {},
193 * "data": {}
198 * @OA\Response(
199 * response="badrequest",
200 * description="Bad Request",
201 * @OA\MediaType(
202 * mediaType="application/json",
203 * @OA\Schema(
204 * @OA\Property(
205 * property="validationErrors",
206 * description="Validation errors.",
207 * type="object"
208 * ),
209 * example={
210 * "validationErrors":
212 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
218 * @OA\Response(
219 * response="unauthorized",
220 * description="Unauthorized",
221 * @OA\MediaType(
222 * mediaType="application/json",
223 * @OA\Schema(
224 * @OA\Property(
225 * property="error",
226 * description="The error.",
227 * type="string"
228 * ),
229 * @OA\Property(
230 * property="error_description",
231 * description="The description of the error.",
232 * type="string"
233 * ),
234 * @OA\Property(
235 * property="hint",
236 * description="More specific information on the error.",
237 * type="string"
238 * ),
239 * @OA\Property(
240 * property="message",
241 * description="Message regarding the error.",
242 * type="string"
243 * ),
244 * example={
245 * "error": "access_denied",
246 * "error_description": "The resource owner or authorization server denied the request.",
247 * "hint": "Missing ""Authorization"" header",
248 * "message": "The resource owner or authorization server denied the request."
253 * @OA\Response(
254 * response="uuidnotfound",
255 * description="Not Found",
256 * @OA\MediaType(
257 * mediaType="application/json",
258 * @OA\Schema(
259 * @OA\Property(
260 * property="empty",
261 * description="empty",
262 * type="object"
263 * ),
264 * example={}
270 // Lets keep our controller classes with the routes.
272 use OpenEMR\Common\Acl\AccessDeniedException;
273 use OpenEMR\Common\Http\HttpRestRequest;
274 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
275 use OpenEMR\RestControllers\FacilityRestController;
276 use OpenEMR\RestControllers\VersionRestController;
277 use OpenEMR\RestControllers\ProductRegistrationRestController;
278 use OpenEMR\RestControllers\PatientRestController;
279 use OpenEMR\RestControllers\EncounterRestController;
280 use OpenEMR\RestControllers\PractitionerRestController;
281 use OpenEMR\RestControllers\ListRestController;
282 use OpenEMR\RestControllers\InsuranceCompanyRestController;
283 use OpenEMR\RestControllers\AppointmentRestController;
284 use OpenEMR\RestControllers\ConditionRestController;
285 use OpenEMR\RestControllers\ONoteRestController;
286 use OpenEMR\RestControllers\DocumentRestController;
287 use OpenEMR\RestControllers\DrugRestController;
288 use OpenEMR\RestControllers\ImmunizationRestController;
289 use OpenEMR\RestControllers\InsuranceRestController;
290 use OpenEMR\RestControllers\MessageRestController;
291 use OpenEMR\RestControllers\PrescriptionRestController;
292 use OpenEMR\RestControllers\ProcedureRestController;
294 // Note some Http clients may not send auth as json so a function
295 // is implemented to determine and parse encoding on auth route's.
297 // Note that the api route is only for users role
298 // (there is a mechanism in place to ensure only user role can access the api route)
299 RestConfig::$ROUTE_MAP = array(
301 * @OA\Get(
302 * path="/api/facility",
303 * description="Returns a single facility.",
304 * tags={"standard"},
305 * @OA\Parameter(
306 * name="name",
307 * in="query",
308 * description="The name for the facility.",
309 * required=false,
310 * @OA\Schema(
311 * type="string"
313 * ),
314 * @OA\Parameter(
315 * name="facility_npi",
316 * in="query",
317 * description="The facility_npi for the facility.",
318 * required=false,
319 * @OA\Schema(
320 * type="string"
322 * ),
323 * @OA\Parameter(
324 * name="phone",
325 * in="query",
326 * description="The phone for the facility.",
327 * required=false,
328 * @OA\Schema(
329 * type="string"
331 * ),
332 * @OA\Parameter(
333 * name="fax",
334 * in="query",
335 * description="The fax for the facility.",
336 * required=false,
337 * @OA\Schema(
338 * type="string"
340 * ),
341 * @OA\Parameter(
342 * name="street",
343 * in="query",
344 * description="The street for the facility.",
345 * required=false,
346 * @OA\Schema(
347 * type="string"
349 * ),
350 * @OA\Parameter(
351 * name="city",
352 * in="query",
353 * description="The city for the facility.",
354 * required=false,
355 * @OA\Schema(
356 * type="string"
358 * ),
359 * @OA\Parameter(
360 * name="state",
361 * in="query",
362 * description="The state for the facility.",
363 * required=false,
364 * @OA\Schema(
365 * type="string"
367 * ),
368 * @OA\Parameter(
369 * name="postal_code",
370 * in="query",
371 * description="The postal_code for the facility.",
372 * required=false,
373 * @OA\Schema(
374 * type="string"
376 * ),
377 * @OA\Parameter(
378 * name="country_code",
379 * in="query",
380 * description="The country_code for the facility.",
381 * required=false,
382 * @OA\Schema(
383 * type="string"
385 * ),
386 * @OA\Parameter(
387 * name="federal_ein",
388 * in="query",
389 * description="The federal_ein for the facility.",
390 * required=false,
391 * @OA\Schema(
392 * type="string"
394 * ),
395 * @OA\Parameter(
396 * name="website",
397 * in="query",
398 * description="The website for the facility.",
399 * required=false,
400 * @OA\Schema(
401 * type="string"
403 * ),
404 * @OA\Parameter(
405 * name="email",
406 * in="query",
407 * description="The email for the facility.",
408 * required=false,
409 * @OA\Schema(
410 * type="string"
412 * ),
413 * @OA\Parameter(
414 * name="domain_identifier",
415 * in="query",
416 * description="The domain_identifier for the facility.",
417 * required=false,
418 * @OA\Schema(
419 * type="string"
421 * ),
422 * @OA\Parameter(
423 * name="facility_taxonomy",
424 * in="query",
425 * description="The facility_taxonomy for the facility.",
426 * required=false,
427 * @OA\Schema(
428 * type="string"
430 * ),
431 * @OA\Parameter(
432 * name="facility_code",
433 * in="query",
434 * description="The facility_code for the facility.",
435 * required=false,
436 * @OA\Schema(
437 * type="string"
439 * ),
440 * @OA\Parameter(
441 * name="billing_location",
442 * in="query",
443 * description="The billing_location setting for the facility.",
444 * required=false,
445 * @OA\Schema(
446 * type="string"
448 * ),
449 * @OA\Parameter(
450 * name="accepts_assignment",
451 * in="query",
452 * description="The accepts_assignment setting for the facility.",
453 * required=false,
454 * @OA\Schema(
455 * type="string"
457 * ),
458 * @OA\Parameter(
459 * name="oid",
460 * in="query",
461 * description="The oid for the facility.",
462 * required=false,
463 * @OA\Schema(
464 * type="string"
466 * ),
467 * @OA\Parameter(
468 * name="service_location",
469 * in="query",
470 * description="The service_location setting for the facility.",
471 * required=false,
472 * @OA\Schema(
473 * type="string"
475 * ),
476 * @OA\Response(
477 * response="200",
478 * ref="#/components/responses/standard"
479 * ),
480 * @OA\Response(
481 * response="400",
482 * ref="#/components/responses/badrequest"
483 * ),
484 * @OA\Response(
485 * response="401",
486 * ref="#/components/responses/unauthorized"
487 * ),
488 * security={{"openemr_auth":{}}}
491 "GET /api/facility" => function () {
492 RestConfig::authorization_check("admin", "users");
493 $return = (new FacilityRestController())->getAll($_GET);
494 RestConfig::apiLog($return);
495 return $return;
499 * @OA\Get(
500 * path="/api/facility/{fuuid}",
501 * description="Returns a single facility.",
502 * tags={"standard"},
503 * @OA\Parameter(
504 * name="fuuid",
505 * in="path",
506 * description="The uuid for the facility.",
507 * required=true,
508 * @OA\Schema(
509 * type="string"
511 * ),
512 * @OA\Response(
513 * response="200",
514 * ref="#/components/responses/standard"
515 * ),
516 * @OA\Response(
517 * response="400",
518 * ref="#/components/responses/badrequest"
519 * ),
520 * @OA\Response(
521 * response="401",
522 * ref="#/components/responses/unauthorized"
523 * ),
524 * security={{"openemr_auth":{}}}
527 "GET /api/facility/:fuuid" => function ($fuuid) {
528 RestConfig::authorization_check("admin", "users");
529 $return = (new FacilityRestController())->getOne($fuuid);
530 RestConfig::apiLog($return);
531 return $return;
535 * @OA\Post(
536 * path="/api/facility",
537 * description="Creates a facility in the system",
538 * tags={"standard"},
539 * @OA\RequestBody(
540 * required=true,
541 * @OA\MediaType(
542 * mediaType="application/json",
543 * @OA\Schema(
544 * @OA\Property(
545 * property="name",
546 * description="The name for the facility.",
547 * type="string"
548 * ),
549 * @OA\Property(
550 * property="facility_npi",
551 * description="The facility_npi for the facility.",
552 * type="string"
553 * ),
554 * @OA\Property(
555 * property="phone",
556 * description="The phone for the facility.",
557 * type="string"
558 * ),
559 * @OA\Property(
560 * property="fax",
561 * description="The fax for the facility.",
562 * type="string"
563 * ),
564 * @OA\Property(
565 * property="street",
566 * description="The street for the facility.",
567 * type="string"
568 * ),
569 * @OA\Property(
570 * property="city",
571 * description="The city for the facility.",
572 * type="string"
573 * ),
574 * @OA\Property(
575 * property="state",
576 * description="The state for the facility.",
577 * type="string"
578 * ),
579 * @OA\Property(
580 * property="postal_code",
581 * description="The postal_code for the facility.",
582 * type="string"
583 * ),
584 * @OA\Property(
585 * property="country_code",
586 * description="The country_code for the facility.",
587 * type="string"
588 * ),
589 * @OA\Property(
590 * property="federal_ein",
591 * description="The federal_ein for the facility.",
592 * type="string"
593 * ),
594 * @OA\Property(
595 * property="website",
596 * description="The website for the facility.",
597 * type="string"
598 * ),
599 * @OA\Property(
600 * property="email",
601 * description="The email for the facility.",
602 * type="string"
603 * ),
604 * @OA\Property(
605 * property="domain_identifier",
606 * description="The domain_identifier for the facility.",
607 * type="string"
608 * ),
609 * @OA\Property(
610 * property="facility_taxonomy",
611 * description="The facility_taxonomy for the facility.",
612 * type="string"
613 * ),
614 * @OA\Property(
615 * property="facility_code",
616 * description="The facility_code for the facility.",
617 * type="string"
618 * ),
619 * @OA\Property(
620 * property="billing_location",
621 * description="The billing_location setting for the facility.",
622 * type="string"
623 * ),
624 * @OA\Property(
625 * property="accepts_assignment",
626 * description="The accepts_assignment setting for the facility.",
627 * type="string"
628 * ),
629 * @OA\Property(
630 * property="oid",
631 * description="The oid for the facility.",
632 * type="string"
633 * ),
634 * @OA\Property(
635 * property="service_location",
636 * description="The service_location setting for the facility.",
637 * type="string"
638 * ),
639 * required={"name", "facility_npi"},
640 * example={
641 * "name": "Aquaria",
642 * "facility_npi": "123456789123",
643 * "phone": "808-606-3030",
644 * "fax": "808-606-3031",
645 * "street": "1337 Bit Shifter Ln",
646 * "city": "San Lorenzo",
647 * "state": "ZZ",
648 * "postal_code": "54321",
649 * "country_code": "US",
650 * "federal_ein": "4343434",
651 * "website": "https://example.com",
652 * "email": "foo@bar.com",
653 * "domain_identifier": "",
654 * "facility_taxonomy": "",
655 * "facility_code": "",
656 * "billing_location": "1",
657 * "accepts_assignment": "1",
658 * "oid": "",
659 * "service_location": "1"
663 * ),
664 * @OA\Response(
665 * response="200",
666 * ref="#/components/responses/standard"
667 * ),
668 * @OA\Response(
669 * response="400",
670 * ref="#/components/responses/badrequest"
671 * ),
672 * @OA\Response(
673 * response="401",
674 * ref="#/components/responses/unauthorized"
675 * ),
676 * security={{"openemr_auth":{}}}
679 "POST /api/facility" => function () {
680 RestConfig::authorization_check("admin", "super");
681 $data = (array) (json_decode(file_get_contents("php://input")));
682 $return = (new FacilityRestController())->post($data);
683 RestConfig::apiLog($return, $data);
684 return $return;
688 * @OA\Put(
689 * path="/api/facility/{fuuid}",
690 * description="Updates a facility in the system",
691 * tags={"standard"},
692 * @OA\Parameter(
693 * name="fuuid",
694 * in="path",
695 * description="The uuid for the facility.",
696 * required=true,
697 * @OA\Schema(
698 * type="string"
700 * ),
701 * @OA\RequestBody(
702 * required=true,
703 * @OA\MediaType(
704 * mediaType="application/json",
705 * @OA\Schema(
706 * @OA\Property(
707 * property="name",
708 * description="The name for the facility.",
709 * type="string"
710 * ),
711 * @OA\Property(
712 * property="facility_npi",
713 * description="The facility_npi for the facility.",
714 * type="string"
715 * ),
716 * @OA\Property(
717 * property="phone",
718 * description="The phone for the facility.",
719 * type="string"
720 * ),
721 * @OA\Property(
722 * property="fax",
723 * description="The fax for the facility.",
724 * type="string"
725 * ),
726 * @OA\Property(
727 * property="street",
728 * description="The street for the facility.",
729 * type="string"
730 * ),
731 * @OA\Property(
732 * property="city",
733 * description="The city for the facility.",
734 * type="string"
735 * ),
736 * @OA\Property(
737 * property="state",
738 * description="The state for the facility.",
739 * type="string"
740 * ),
741 * @OA\Property(
742 * property="postal_code",
743 * description="The postal_code for the facility.",
744 * type="string"
745 * ),
746 * @OA\Property(
747 * property="country_code",
748 * description="The country_code for the facility.",
749 * type="string"
750 * ),
751 * @OA\Property(
752 * property="federal_ein",
753 * description="The federal_ein for the facility.",
754 * type="string"
755 * ),
756 * @OA\Property(
757 * property="website",
758 * description="The website for the facility.",
759 * type="string"
760 * ),
761 * @OA\Property(
762 * property="email",
763 * description="The email for the facility.",
764 * type="string"
765 * ),
766 * @OA\Property(
767 * property="domain_identifier",
768 * description="The domain_identifier for the facility.",
769 * type="string"
770 * ),
771 * @OA\Property(
772 * property="facility_taxonomy",
773 * description="The facility_taxonomy for the facility.",
774 * type="string"
775 * ),
776 * @OA\Property(
777 * property="facility_code",
778 * description="The facility_code for the facility.",
779 * type="string"
780 * ),
781 * @OA\Property(
782 * property="billing_location",
783 * description="The billing_location setting for the facility.",
784 * type="string"
785 * ),
786 * @OA\Property(
787 * property="accepts_assignment",
788 * description="The accepts_assignment setting for the facility.",
789 * type="string"
790 * ),
791 * @OA\Property(
792 * property="oid",
793 * description="The oid for the facility.",
794 * type="string"
795 * ),
796 * @OA\Property(
797 * property="service_location",
798 * description="The service_location setting for the facility.",
799 * type="string"
800 * ),
801 * example={
802 * "name": "Aquaria",
803 * "facility_npi": "123456789123",
804 * "phone": "808-606-3030",
805 * "fax": "808-606-3031",
806 * "street": "1337 Bit Shifter Ln",
807 * "city": "San Lorenzo",
808 * "state": "ZZ",
809 * "postal_code": "54321",
810 * "country_code": "US",
811 * "federal_ein": "4343434",
812 * "website": "https://example.com",
813 * "email": "foo@bar.com",
814 * "domain_identifier": "",
815 * "facility_taxonomy": "",
816 * "facility_code": "",
817 * "billing_location": "1",
818 * "accepts_assignment": "1",
819 * "oid": "",
820 * "service_location": "1"
824 * ),
825 * @OA\Response(
826 * response="200",
827 * ref="#/components/responses/standard"
828 * ),
829 * @OA\Response(
830 * response="400",
831 * ref="#/components/responses/badrequest"
832 * ),
833 * @OA\Response(
834 * response="401",
835 * ref="#/components/responses/unauthorized"
836 * ),
837 * security={{"openemr_auth":{}}}
840 "PUT /api/facility/:fuuid" => function ($fuuid) {
841 RestConfig::authorization_check("admin", "super");
842 $data = (array) (json_decode(file_get_contents("php://input")));
843 $return = (new FacilityRestController())->patch($fuuid, $data);
844 RestConfig::apiLog($return, $data);
845 return $return;
849 * @OA\Get(
850 * path="/api/patient",
851 * description="Retrieves a list of patients",
852 * tags={"standard"},
853 * @OA\Parameter(
854 * name="fname",
855 * in="query",
856 * description="The first name for the patient.",
857 * required=false,
858 * @OA\Schema(
859 * type="string"
861 * ),
862 * @OA\Parameter(
863 * name="lname",
864 * in="query",
865 * description="The last name for the patient.",
866 * required=false,
867 * @OA\Schema(
868 * type="string"
870 * ),
871 * @OA\Parameter(
872 * name="ss",
873 * in="query",
874 * description="The social security number for the patient.",
875 * required=false,
876 * @OA\Schema(
877 * type="string"
879 * ),
880 * @OA\Parameter(
881 * name="street",
882 * in="query",
883 * description="The street for the patient.",
884 * required=false,
885 * @OA\Schema(
886 * type="string"
888 * ),
889 * @OA\Parameter(
890 * name="postal_code",
891 * in="query",
892 * description="The postal code for the patient.",
893 * required=false,
894 * @OA\Schema(
895 * type="string"
897 * ),
898 * @OA\Parameter(
899 * name="city",
900 * in="query",
901 * description="The city for the patient.",
902 * required=false,
903 * @OA\Schema(
904 * type="string"
906 * ),
907 * @OA\Parameter(
908 * name="state",
909 * in="query",
910 * description="The state for the patient.",
911 * required=false,
912 * @OA\Schema(
913 * type="string"
915 * ),
916 * @OA\Parameter(
917 * name="phone_home",
918 * in="query",
919 * description="The home phone for the patient.",
920 * required=false,
921 * @OA\Schema(
922 * type="string"
924 * ),
925 * @OA\Parameter(
926 * name="phone_biz",
927 * in="query",
928 * description="The business phone for the patient.",
929 * required=false,
930 * @OA\Schema(
931 * type="string"
933 * ),
934 * @OA\Parameter(
935 * name="phone_cell",
936 * in="query",
937 * description="The cell phone for the patient.",
938 * required=false,
939 * @OA\Schema(
940 * type="string"
942 * ),
943 * @OA\Parameter(
944 * name="postal_contact",
945 * in="query",
946 * description="The postal_contact for the patient.",
947 * required=false,
948 * @OA\Schema(
949 * type="string"
951 * ),
952 * @OA\Parameter(
953 * name="sex",
954 * in="query",
955 * description="The gender for the patient.",
956 * required=false,
957 * @OA\Schema(
958 * type="string"
960 * ),
961 * @OA\Parameter(
962 * name="country_code",
963 * in="query",
964 * description="The country code for the patient.",
965 * required=false,
966 * @OA\Schema(
967 * type="string"
969 * ),
970 * @OA\Parameter(
971 * name="email",
972 * in="query",
973 * description="The email for the patient.",
974 * required=false,
975 * @OA\Schema(
976 * type="string"
978 * ),
979 * @OA\Parameter(
980 * name="DOB",
981 * in="query",
982 * description="The DOB for the patient.",
983 * required=false,
984 * @OA\Schema(
985 * type="string"
987 * ),
988 * @OA\Response(
989 * response="200",
990 * ref="#/components/responses/standard"
991 * ),
992 * @OA\Response(
993 * response="400",
994 * ref="#/components/responses/badrequest"
995 * ),
996 * @OA\Response(
997 * response="401",
998 * ref="#/components/responses/unauthorized"
999 * ),
1000 * security={{"openemr_auth":{}}}
1003 "GET /api/patient" => function () {
1004 RestConfig::authorization_check("patients", "demo");
1005 $return = (new PatientRestController())->getAll($_GET);
1006 RestConfig::apiLog($return);
1007 return $return;
1011 * Schema for the patient request
1013 * @OA\Schema(
1014 * schema="api_patient_request",
1015 * @OA\Property(
1016 * property="title",
1017 * description="The title of patient.",
1018 * type="string"
1019 * ),
1020 * @OA\Property(
1021 * property="fname",
1022 * description="The fname of patient.",
1023 * type="string"
1024 * ),
1025 * @OA\Property(
1026 * property="mname",
1027 * description="The mname of patient.",
1028 * type="string"
1029 * ),
1030 * @OA\Property(
1031 * property="lname",
1032 * description="The lname of patient.",
1033 * type="string"
1034 * ),
1035 * @OA\Property(
1036 * property="street",
1037 * description="The street address of patient.",
1038 * type="string"
1039 * ),
1040 * @OA\Property(
1041 * property="postal_code",
1042 * description="The postal code of patient.",
1043 * type="string"
1044 * ),
1045 * @OA\Property(
1046 * property="city",
1047 * description="The city of patient.",
1048 * type="string"
1049 * ),
1050 * @OA\Property(
1051 * property="state",
1052 * description="The state of patient.",
1053 * type="string"
1054 * ),
1055 * @OA\Property(
1056 * property="country_code",
1057 * description="The country code of patient.",
1058 * type="string"
1059 * ),
1060 * @OA\Property(
1061 * property="phone_contact",
1062 * description="The phone contact of patient.",
1063 * type="string"
1064 * ),
1065 * @OA\Property(
1066 * property="DOB",
1067 * description="The DOB of patient.",
1068 * type="string"
1069 * ),
1070 * @OA\Property(
1071 * property="sex",
1072 * description="The lname of patient.",
1073 * type="string"
1074 * ),
1075 * @OA\Property(
1076 * property="race",
1077 * description="The race of patient.",
1078 * type="string"
1079 * ),
1080 * @OA\Property(
1081 * property="ethnicity",
1082 * description="The ethnicity of patient.",
1083 * type="string"
1084 * ),
1085 * required={"fname", "lname", "DOB", "sex"},
1086 * example={
1087 * "title": "Mr",
1088 * "fname": "Foo",
1089 * "mname": "",
1090 * "lname": "Bar",
1091 * "street": "456 Tree Lane",
1092 * "postal_code": "08642",
1093 * "city": "FooTown",
1094 * "state": "FL",
1095 * "country_code": "US",
1096 * "phone_contact": "123-456-7890",
1097 * "DOB": "1992-02-02",
1098 * "sex": "Male",
1099 * "race": "",
1100 * "ethnicity": ""
1105 * @OA\Post(
1106 * path="/api/patient",
1107 * description="Creates a new patient",
1108 * tags={"standard"},
1109 * @OA\RequestBody(
1110 * required=true,
1111 * @OA\MediaType(
1112 * mediaType="application/json",
1113 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1115 * ),
1116 * @OA\Response(
1117 * response="200",
1118 * description="Standard response",
1119 * @OA\MediaType(
1120 * mediaType="application/json",
1121 * @OA\Schema(
1122 * @OA\Property(
1123 * property="validationErrors",
1124 * description="Validation errors.",
1125 * type="array",
1126 * @OA\Items(
1127 * type="object",
1128 * ),
1129 * ),
1130 * @OA\Property(
1131 * property="internalErrors",
1132 * description="Internal errors.",
1133 * type="array",
1134 * @OA\Items(
1135 * type="object",
1136 * ),
1137 * ),
1138 * @OA\Property(
1139 * property="data",
1140 * description="Returned data.",
1141 * type="array",
1142 * @OA\Items(
1143 * @OA\Property(
1144 * property="pid",
1145 * description="patient pid",
1146 * type="integer",
1148 * ),
1149 * ),
1150 * example={
1151 * "validationErrors": {},
1152 * "error_description": {},
1153 * "data": {
1154 * "pid": 1
1159 * ),
1160 * @OA\Response(
1161 * response="401",
1162 * ref="#/components/responses/unauthorized"
1163 * ),
1164 * security={{"openemr_auth":{}}}
1167 "POST /api/patient" => function () {
1168 RestConfig::authorization_check("patients", "demo");
1169 $data = (array) (json_decode(file_get_contents("php://input")));
1170 $return = (new PatientRestController())->post($data);
1171 RestConfig::apiLog($return, $data);
1172 return $return;
1176 * Schema for the patient response
1178 * @OA\Schema(
1179 * schema="api_patient_response",
1180 * @OA\Property(
1181 * property="validationErrors",
1182 * description="Validation errors.",
1183 * type="array",
1184 * @OA\Items(
1185 * type="object",
1186 * ),
1187 * ),
1188 * @OA\Property(
1189 * property="internalErrors",
1190 * description="Internal errors.",
1191 * type="array",
1192 * @OA\Items(
1193 * type="object",
1194 * ),
1195 * ),
1196 * @OA\Property(
1197 * property="data",
1198 * description="Returned data.",
1199 * type="array",
1200 * @OA\Items(
1201 * @OA\Property(
1202 * property="id",
1203 * description="patient id",
1204 * type="string",
1205 * ),
1206 * @OA\Property(
1207 * property="pid",
1208 * description="patient pid",
1209 * type="string",
1210 * ),
1211 * @OA\Property(
1212 * property="pubpid",
1213 * description="patient public id",
1214 * type="string",
1215 * ),
1216 * @OA\Property(
1217 * property="title",
1218 * description="patient title",
1219 * type="string",
1220 * ),
1221 * @OA\Property(
1222 * property="fname",
1223 * description="patient first name",
1224 * type="string",
1225 * ),
1226 * @OA\Property(
1227 * property="mname",
1228 * description="patient middle name",
1229 * type="string",
1230 * ),
1231 * @OA\Property(
1232 * property="lname",
1233 * description="patient last name",
1234 * type="string",
1235 * ),
1236 * @OA\Property(
1237 * property="ss",
1238 * description="patient social security number",
1239 * type="string",
1240 * ),
1241 * @OA\Property(
1242 * property="street",
1243 * description="patient street address",
1244 * type="string",
1245 * ),
1246 * @OA\Property(
1247 * property="postal_code",
1248 * description="patient postal code",
1249 * type="string",
1250 * ),
1251 * @OA\Property(
1252 * property="city",
1253 * description="patient city",
1254 * type="string",
1255 * ),
1256 * @OA\Property(
1257 * property="state",
1258 * description="patient state",
1259 * type="string",
1260 * ),
1261 * @OA\Property(
1262 * property="county",
1263 * description="patient county",
1264 * type="string",
1265 * ),
1266 * @OA\Property(
1267 * property="country_code",
1268 * description="patient country code",
1269 * type="string",
1270 * ),
1271 * @OA\Property(
1272 * property="drivers_license",
1273 * description="patient drivers license id",
1274 * type="string",
1275 * ),
1276 * @OA\Property(
1277 * property="contact_relationship",
1278 * description="patient contact relationship",
1279 * type="string",
1280 * ),
1281 * @OA\Property(
1282 * property="phone_contact",
1283 * description="patient phone contact",
1284 * type="string",
1285 * ),
1286 * @OA\Property(
1287 * property="phone_home",
1288 * description="patient home phone",
1289 * type="string",
1290 * ),
1291 * @OA\Property(
1292 * property="phone_biz",
1293 * description="patient work phone",
1294 * type="string",
1295 * ),
1296 * @OA\Property(
1297 * property="phone_cell",
1298 * description="patient mobile phone",
1299 * type="string",
1300 * ),
1301 * @OA\Property(
1302 * property="email",
1303 * description="patient email",
1304 * type="string",
1305 * ),
1306 * @OA\Property(
1307 * property="DOB",
1308 * description="patient DOB",
1309 * type="string",
1310 * ),
1311 * @OA\Property(
1312 * property="sex",
1313 * description="patient sex (gender)",
1314 * type="string",
1315 * ),
1316 * @OA\Property(
1317 * property="race",
1318 * description="patient race",
1319 * type="string",
1320 * ),
1321 * @OA\Property(
1322 * property="ethnicity",
1323 * description="patient ethnicity",
1324 * type="string",
1325 * ),
1326 * @OA\Property(
1327 * property="status",
1328 * description="patient status",
1329 * type="string",
1330 * ),
1331 * ),
1332 * ),
1333 * example={
1334 * "validationErrors": {},
1335 * "error_description": {},
1336 * "data": {
1337 * "id": "193",
1338 * "pid": "1",
1339 * "pubpid": "",
1340 * "title": "Mr",
1341 * "fname": "Baz",
1342 * "mname": "",
1343 * "lname": "Bop",
1344 * "ss": "",
1345 * "street": "456 Tree Lane",
1346 * "postal_code": "08642",
1347 * "city": "FooTown",
1348 * "state": "FL",
1349 * "county": "",
1350 * "country_code": "US",
1351 * "drivers_license": "",
1352 * "contact_relationship": "",
1353 * "phone_contact": "123-456-7890",
1354 * "phone_home": "",
1355 * "phone_biz": "",
1356 * "phone_cell": "",
1357 * "email": "",
1358 * "DOB": "1992-02-03",
1359 * "sex": "Male",
1360 * "race": "",
1361 * "ethnicity": "",
1362 * "status": ""
1368 * @OA\Put(
1369 * path="/api/patient/{puuid}",
1370 * description="Updates a patient",
1371 * tags={"standard"},
1372 * @OA\Parameter(
1373 * name="puuid",
1374 * in="path",
1375 * description="The uuid for the patient.",
1376 * required=true,
1377 * @OA\Schema(
1378 * type="string"
1380 * ),
1381 * @OA\RequestBody(
1382 * required=true,
1383 * @OA\MediaType(
1384 * mediaType="application/json",
1385 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1387 * ),
1388 * @OA\Response(
1389 * response="200",
1390 * description="Standard response",
1391 * @OA\MediaType(
1392 * mediaType="application/json",
1393 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1395 * ),
1396 * @OA\Response(
1397 * response="401",
1398 * ref="#/components/responses/unauthorized"
1399 * ),
1400 * security={{"openemr_auth":{}}}
1403 "PUT /api/patient/:puuid" => function ($puuid) {
1404 RestConfig::authorization_check("patients", "demo");
1405 $data = (array) (json_decode(file_get_contents("php://input")));
1406 $return = (new PatientRestController())->put($puuid, $data);
1407 RestConfig::apiLog($return, $data);
1408 return $return;
1412 * @OA\Get(
1413 * path="/api/patient/{puuid}",
1414 * description="Retrieves a single patient by their uuid",
1415 * tags={"standard"},
1416 * @OA\Parameter(
1417 * name="puuid",
1418 * in="path",
1419 * description="The uuid for the patient.",
1420 * required=true,
1421 * @OA\Schema(
1422 * type="string"
1424 * ),
1425 * @OA\Response(
1426 * response="200",
1427 * description="Standard response",
1428 * @OA\MediaType(
1429 * mediaType="application/json",
1430 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1432 * ),
1433 * @OA\Response(
1434 * response="401",
1435 * ref="#/components/responses/unauthorized"
1436 * ),
1437 * security={{"openemr_auth":{}}}
1440 "GET /api/patient/:puuid" => function ($puuid) {
1441 RestConfig::authorization_check("patients", "demo");
1442 $return = (new PatientRestController())->getOne($puuid);
1443 RestConfig::apiLog($return);
1444 return $return;
1448 * @OA\Get(
1449 * path="/api/patient/{puuid}/encounter",
1450 * description="Retrieves a list of encounters for a single patient",
1451 * tags={"standard"},
1452 * @OA\Parameter(
1453 * name="puuid",
1454 * in="path",
1455 * description="The uuid for the patient.",
1456 * required=true,
1457 * @OA\Schema(
1458 * type="string"
1460 * ),
1461 * @OA\Response(
1462 * response="200",
1463 * ref="#/components/responses/standard"
1464 * ),
1465 * @OA\Response(
1466 * response="400",
1467 * ref="#/components/responses/badrequest"
1468 * ),
1469 * @OA\Response(
1470 * response="401",
1471 * ref="#/components/responses/unauthorized"
1472 * ),
1473 * security={{"openemr_auth":{}}}
1476 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1477 RestConfig::authorization_check("encounters", "auth_a");
1478 $return = (new EncounterRestController())->getAll($puuid);
1479 RestConfig::apiLog($return);
1480 return $return;
1484 * Schema for the encounter request
1486 * @OA\Schema(
1487 * schema="api_encounter_request",
1488 * @OA\Property(
1489 * property="date",
1490 * description="The date of encounter.",
1491 * type="string"
1492 * ),
1493 * @OA\Property(
1494 * property="onset_date",
1495 * description="The onset date of encounter.",
1496 * type="string"
1497 * ),
1498 * @OA\Property(
1499 * property="reason",
1500 * description="The reason of encounter.",
1501 * type="string"
1502 * ),
1503 * @OA\Property(
1504 * property="facility",
1505 * description="The facility of encounter.",
1506 * type="string"
1507 * ),
1508 * @OA\Property(
1509 * property="pc_catid",
1510 * description="The pc_catid of encounter.",
1511 * type="string"
1512 * ),
1513 * @OA\Property(
1514 * property="facility_id",
1515 * description="The facility id of encounter.",
1516 * type="string"
1517 * ),
1518 * @OA\Property(
1519 * property="billing_facility",
1520 * description="The billing facility id of encounter.",
1521 * type="string"
1522 * ),
1523 * @OA\Property(
1524 * property="sensitivity",
1525 * description="The sensitivity of encounter.",
1526 * type="string"
1527 * ),
1528 * @OA\Property(
1529 * property="referral_source",
1530 * description="The referral source of encounter.",
1531 * type="string"
1532 * ),
1533 * @OA\Property(
1534 * property="pos_code",
1535 * description="The pos_code of encounter.",
1536 * type="string"
1537 * ),
1538 * @OA\Property(
1539 * property="external_id",
1540 * description="The external id of encounter.",
1541 * type="string"
1542 * ),
1543 * @OA\Property(
1544 * property="provider_id",
1545 * description="The provider id of encounter.",
1546 * type="string"
1547 * ),
1548 * @OA\Property(
1549 * property="class_code",
1550 * description="The class_code of encounter.",
1551 * type="string"
1552 * ),
1553 * required={"pc_catid", "class_code"},
1554 * example={
1555 * "date":"2020-11-10",
1556 * "onset_date": "",
1557 * "reason": "Pregnancy Test",
1558 * "facility": "Owerri General Hospital",
1559 * "pc_catid": "5",
1560 * "facility_id": "3",
1561 * "billing_facility": "3",
1562 * "sensitivity": "normal",
1563 * "referral_source": "",
1564 * "pos_code": "0",
1565 * "external_id": "",
1566 * "provider_id": "1",
1567 * "class_code" : "AMB"
1572 * @OA\Post(
1573 * path="/api/patient/{puuid}/encounter",
1574 * description="Creates a new encounter",
1575 * tags={"standard"},
1576 * @OA\Parameter(
1577 * name="puuid",
1578 * in="path",
1579 * description="The uuid for the patient.",
1580 * required=true,
1581 * @OA\Schema(
1582 * type="string"
1584 * ),
1585 * @OA\RequestBody(
1586 * required=true,
1587 * @OA\MediaType(
1588 * mediaType="application/json",
1589 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1591 * ),
1592 * @OA\Response(
1593 * response="200",
1594 * description="Standard response",
1595 * @OA\MediaType(
1596 * mediaType="application/json",
1597 * @OA\Schema(
1598 * @OA\Property(
1599 * property="validationErrors",
1600 * description="Validation errors.",
1601 * type="array",
1602 * @OA\Items(
1603 * type="object",
1604 * ),
1605 * ),
1606 * @OA\Property(
1607 * property="internalErrors",
1608 * description="Internal errors.",
1609 * type="array",
1610 * @OA\Items(
1611 * type="object",
1612 * ),
1613 * ),
1614 * @OA\Property(
1615 * property="data",
1616 * description="Returned data.",
1617 * type="array",
1618 * @OA\Items(
1619 * @OA\Property(
1620 * property="encounter",
1621 * description="encounter id",
1622 * type="integer",
1623 * ),
1624 * @OA\Property(
1625 * property="uuid",
1626 * description="encounter uuid",
1627 * type="string",
1629 * ),
1630 * ),
1631 * example={
1632 * "validationErrors": {},
1633 * "error_description": {},
1634 * "data": {
1635 * "encounter": 1,
1636 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1641 * ),
1642 * @OA\Response(
1643 * response="401",
1644 * ref="#/components/responses/unauthorized"
1645 * ),
1646 * security={{"openemr_auth":{}}}
1649 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1650 RestConfig::authorization_check("encounters", "auth_a");
1651 $data = (array) (json_decode(file_get_contents("php://input")));
1652 $return = (new EncounterRestController())->post($puuid, $data);
1653 RestConfig::apiLog($return, $data);
1654 return $return;
1658 * Schema for the encounter response
1660 * @OA\Schema(
1661 * schema="api_encounter_response",
1662 * @OA\Property(
1663 * property="validationErrors",
1664 * description="Validation errors.",
1665 * type="array",
1666 * @OA\Items(
1667 * type="object",
1668 * ),
1669 * ),
1670 * @OA\Property(
1671 * property="internalErrors",
1672 * description="Internal errors.",
1673 * type="array",
1674 * @OA\Items(
1675 * type="object",
1676 * ),
1677 * ),
1678 * @OA\Property(
1679 * property="data",
1680 * description="Returned data.",
1681 * type="array",
1682 * @OA\Items(
1683 * @OA\Property(
1684 * property="id",
1685 * description="encounter id",
1686 * type="string",
1687 * ),
1688 * @OA\Property(
1689 * property="uuid",
1690 * description="encounter uuid",
1691 * type="string",
1692 * ),
1693 * @OA\Property(
1694 * property="date",
1695 * description="encounter date",
1696 * type="string",
1697 * ),
1698 * @OA\Property(
1699 * property="reason",
1700 * description="encounter reason",
1701 * type="string",
1702 * ),
1703 * @OA\Property(
1704 * property="facility",
1705 * description="encounter facility name",
1706 * type="string",
1707 * ),
1708 * @OA\Property(
1709 * property="facility_id",
1710 * description="encounter facility id name",
1711 * type="string",
1712 * ),
1713 * @OA\Property(
1714 * property="pid",
1715 * description="encounter for patient pid",
1716 * type="string",
1717 * ),
1718 * @OA\Property(
1719 * property="onset_date",
1720 * description="encounter onset date",
1721 * type="string",
1722 * ),
1723 * @OA\Property(
1724 * property="sensitivity",
1725 * description="encounter sensitivity",
1726 * type="string",
1727 * ),
1728 * @OA\Property(
1729 * property="billing_note",
1730 * description="encounter billing note",
1731 * type="string",
1732 * ),
1733 * @OA\Property(
1734 * property="pc_catid",
1735 * description="encounter pc_catid",
1736 * type="string",
1737 * ),
1738 * @OA\Property(
1739 * property="last_level_billed",
1740 * description="encounter last_level_billed",
1741 * type="string",
1742 * ),
1743 * @OA\Property(
1744 * property="last_level_closed",
1745 * description="encounter last_level_closed",
1746 * type="string",
1747 * ),
1748 * @OA\Property(
1749 * property="last_stmt_date",
1750 * description="encounter last_stmt_date",
1751 * type="string",
1752 * ),
1753 * @OA\Property(
1754 * property="stmt_count",
1755 * description="encounter stmt_count",
1756 * type="string",
1757 * ),
1758 * @OA\Property(
1759 * property="provider_id",
1760 * description="provider id",
1761 * type="string",
1762 * ),
1763 * @OA\Property(
1764 * property="supervisor_id",
1765 * description="encounter supervisor id",
1766 * type="string",
1767 * ),
1768 * @OA\Property(
1769 * property="invoice_refno",
1770 * description="encounter invoice_refno",
1771 * type="string",
1772 * ),
1773 * @OA\Property(
1774 * property="referral_source",
1775 * description="encounter referral source",
1776 * type="string",
1777 * ),
1778 * @OA\Property(
1779 * property="billing_facility",
1780 * description="encounter billing facility id",
1781 * type="string",
1782 * ),
1783 * @OA\Property(
1784 * property="external_id",
1785 * description="encounter external id",
1786 * type="string",
1787 * ),
1788 * @OA\Property(
1789 * property="pos_code",
1790 * description="encounter pos_code",
1791 * type="string",
1792 * ),
1793 * @OA\Property(
1794 * property="class_code",
1795 * description="encounter class_code",
1796 * type="string",
1797 * ),
1798 * @OA\Property(
1799 * property="class_title",
1800 * description="encounter class_title",
1801 * type="string",
1802 * ),
1803 * @OA\Property(
1804 * property="pc_catname",
1805 * description="encounter pc_catname",
1806 * type="string",
1807 * ),
1808 * @OA\Property(
1809 * property="billing_facility_name",
1810 * description="encounter billing facility name",
1811 * type="string",
1812 * ),
1813 * ),
1814 * ),
1815 * example={
1816 * "validationErrors": {},
1817 * "error_description": {},
1818 * "data": {
1819 * "id": "1",
1820 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1821 * "date": "2019-09-14 00:00:00",
1822 * "reason": "Pregnancy Test",
1823 * "facility": "Owerri General Hospital",
1824 * "facility_id": "3",
1825 * "pid": "1",
1826 * "onset_date": "2019-04-20 00:00:00",
1827 * "sensitivity": "normal",
1828 * "billing_note": null,
1829 * "pc_catid": "5",
1830 * "last_level_billed": "0",
1831 * "last_level_closed": "0",
1832 * "last_stmt_date": null,
1833 * "stmt_count": "0",
1834 * "provider_id": "1",
1835 * "supervisor_id": "0",
1836 * "invoice_refno": "",
1837 * "referral_source": "",
1838 * "billing_facility": "3",
1839 * "external_id": "",
1840 * "pos_code": "0",
1841 * "class_code": "AMB",
1842 * "class_title": "ambulatory",
1843 * "pc_catname": "Office Visit",
1844 * "billing_facility_name": "Owerri General Hospital"
1850 * @OA\Put(
1851 * path="/api/patient/{puuid}/encounter/{euuid}",
1852 * description="Modify a encounter",
1853 * tags={"standard"},
1854 * @OA\Parameter(
1855 * name="puuid",
1856 * in="path",
1857 * description="The uuid for the patient.",
1858 * required=true,
1859 * @OA\Schema(
1860 * type="string"
1862 * ),
1863 * @OA\Parameter(
1864 * name="euuid",
1865 * in="path",
1866 * description="The uuid for the encounter.",
1867 * required=true,
1868 * @OA\Schema(
1869 * type="string"
1871 * ),
1872 * @OA\RequestBody(
1873 * required=true,
1874 * @OA\MediaType(
1875 * mediaType="application/json",
1876 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1878 * ),
1879 * @OA\Response(
1880 * response="200",
1881 * description="Standard response",
1882 * @OA\MediaType(
1883 * mediaType="application/json",
1884 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1886 * ),
1887 * @OA\Response(
1888 * response="401",
1889 * ref="#/components/responses/unauthorized"
1890 * ),
1891 * security={{"openemr_auth":{}}}
1894 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1895 RestConfig::authorization_check("encounters", "auth_a");
1896 $data = (array) (json_decode(file_get_contents("php://input")));
1897 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1898 RestConfig::apiLog($return, $data);
1899 return $return;
1903 * @OA\Get(
1904 * path="/api/patient/{puuid}/encounter/{euuid}",
1905 * description="Retrieves a single encounter for a patient",
1906 * tags={"standard"},
1907 * @OA\Parameter(
1908 * name="puuid",
1909 * in="path",
1910 * description="The uuid for the patient.",
1911 * required=true,
1912 * @OA\Schema(
1913 * type="string"
1915 * ),
1916 * @OA\Parameter(
1917 * name="euuid",
1918 * in="path",
1919 * description="The uuid for the encounter.",
1920 * required=true,
1921 * @OA\Schema(
1922 * type="string"
1924 * ),
1925 * @OA\Response(
1926 * response="200",
1927 * description="Standard response",
1928 * @OA\MediaType(
1929 * mediaType="application/json",
1930 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1932 * ),
1933 * @OA\Response(
1934 * response="401",
1935 * ref="#/components/responses/unauthorized"
1936 * ),
1937 * security={{"openemr_auth":{}}}
1940 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1941 RestConfig::authorization_check("encounters", "auth_a");
1942 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1943 RestConfig::apiLog($return);
1944 return $return;
1948 * @OA\Get(
1949 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1950 * description="Retrieves soap notes from an encounter for a patient",
1951 * tags={"standard"},
1952 * @OA\Parameter(
1953 * name="pid",
1954 * in="path",
1955 * description="The pid for the patient.",
1956 * required=true,
1957 * @OA\Schema(
1958 * type="string"
1960 * ),
1961 * @OA\Parameter(
1962 * name="eid",
1963 * in="path",
1964 * description="The id for the encounter.",
1965 * required=true,
1966 * @OA\Schema(
1967 * type="string"
1969 * ),
1970 * @OA\Response(
1971 * response="200",
1972 * ref="#/components/responses/standard"
1973 * ),
1974 * @OA\Response(
1975 * response="400",
1976 * ref="#/components/responses/badrequest"
1977 * ),
1978 * @OA\Response(
1979 * response="401",
1980 * ref="#/components/responses/unauthorized"
1981 * ),
1982 * security={{"openemr_auth":{}}}
1985 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1986 RestConfig::authorization_check("encounters", "notes");
1987 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1988 RestConfig::apiLog($return);
1989 return $return;
1993 * Schema for the vital request
1995 * @OA\Schema(
1996 * schema="api_vital_request",
1997 * @OA\Property(
1998 * property="bps",
1999 * description="The bps of vitals.",
2000 * type="string"
2001 * ),
2002 * @OA\Property(
2003 * property="bpd",
2004 * description="The bpd of vitals.",
2005 * type="string"
2006 * ),
2007 * @OA\Property(
2008 * property="weight",
2009 * description="The weight of vitals. (unit is lb)",
2010 * type="string"
2011 * ),
2012 * @OA\Property(
2013 * property="height",
2014 * description="The height of vitals. (unit is inches)",
2015 * type="string"
2016 * ),
2017 * @OA\Property(
2018 * property="temperature",
2019 * description="The temperature of temperature. (unit is F)",
2020 * type="string"
2021 * ),
2022 * @OA\Property(
2023 * property="temp_method",
2024 * description="The temp_method of vitals.",
2025 * type="string"
2026 * ),
2027 * @OA\Property(
2028 * property="pulse",
2029 * description="The pulse of vitals.",
2030 * type="string"
2031 * ),
2032 * @OA\Property(
2033 * property="respiration",
2034 * description="The respiration of vitals.",
2035 * type="string"
2036 * ),
2037 * @OA\Property(
2038 * property="note",
2039 * description="The note (ie. comments) of vitals.",
2040 * type="string"
2041 * ),
2042 * @OA\Property(
2043 * property="waist_circ",
2044 * description="The waist circumference of vitals. (unit is inches)",
2045 * type="string"
2046 * ),
2047 * @OA\Property(
2048 * property="head_circ",
2049 * description="The head circumference of vitals. (unit is inches)",
2050 * type="string"
2051 * ),
2052 * @OA\Property(
2053 * property="oxygen_saturation",
2054 * description="The oxygen_saturation of vitals.",
2055 * type="string"
2056 * ),
2057 * example={
2058 * "bps": "130",
2059 * "bpd": "80",
2060 * "weight": "220",
2061 * "height": "70",
2062 * "temperature": "98",
2063 * "temp_method": "Oral",
2064 * "pulse": "60",
2065 * "respiration": "20",
2066 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2067 * "waist_circ": "37",
2068 * "head_circ": "22.2",
2069 * "oxygen_saturation": "96"
2074 * @OA\Post(
2075 * path="/api/patient/{pid}/encounter/{eid}/vital",
2076 * description="Submits a new vitals form",
2077 * tags={"standard"},
2078 * @OA\Parameter(
2079 * name="pid",
2080 * in="path",
2081 * description="The id for the patient.",
2082 * required=true,
2083 * @OA\Schema(
2084 * type="string"
2086 * ),
2087 * @OA\Parameter(
2088 * name="eid",
2089 * in="path",
2090 * description="The id for the encounter.",
2091 * required=true,
2092 * @OA\Schema(
2093 * type="string"
2095 * ),
2096 * @OA\RequestBody(
2097 * required=true,
2098 * @OA\MediaType(
2099 * mediaType="application/json",
2100 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2102 * ),
2103 * @OA\Response(
2104 * response="200",
2105 * ref="#/components/responses/standard"
2106 * ),
2107 * @OA\Response(
2108 * response="400",
2109 * ref="#/components/responses/badrequest"
2110 * ),
2111 * @OA\Response(
2112 * response="401",
2113 * ref="#/components/responses/unauthorized"
2114 * ),
2115 * security={{"openemr_auth":{}}}
2118 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2119 RestConfig::authorization_check("encounters", "notes");
2120 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2121 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2122 RestConfig::apiLog($return, $data);
2123 return $return;
2127 * @OA\Put(
2128 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2129 * description="Edit a vitals form",
2130 * tags={"standard"},
2131 * @OA\Parameter(
2132 * name="pid",
2133 * in="path",
2134 * description="The id for the patient.",
2135 * required=true,
2136 * @OA\Schema(
2137 * type="string"
2139 * ),
2140 * @OA\Parameter(
2141 * name="eid",
2142 * in="path",
2143 * description="The id for the encounter.",
2144 * required=true,
2145 * @OA\Schema(
2146 * type="string"
2148 * ),
2149 * @OA\Parameter(
2150 * name="vid",
2151 * in="path",
2152 * description="The id for the vitalss form.",
2153 * required=true,
2154 * @OA\Schema(
2155 * type="string"
2157 * ),
2158 * @OA\RequestBody(
2159 * required=true,
2160 * @OA\MediaType(
2161 * mediaType="application/json",
2162 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2164 * ),
2165 * @OA\Response(
2166 * response="200",
2167 * ref="#/components/responses/standard"
2168 * ),
2169 * @OA\Response(
2170 * response="400",
2171 * ref="#/components/responses/badrequest"
2172 * ),
2173 * @OA\Response(
2174 * response="401",
2175 * ref="#/components/responses/unauthorized"
2176 * ),
2177 * security={{"openemr_auth":{}}}
2180 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2181 RestConfig::authorization_check("encounters", "notes");
2182 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2183 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2184 RestConfig::apiLog($return, $data);
2185 return $return;
2189 * @OA\Get(
2190 * path="/api/patient/{pid}/encounter/{eid}/vital",
2191 * description="Retrieves all vitals from an encounter for a patient",
2192 * tags={"standard"},
2193 * @OA\Parameter(
2194 * name="pid",
2195 * in="path",
2196 * description="The pid for the patient.",
2197 * required=true,
2198 * @OA\Schema(
2199 * type="string"
2201 * ),
2202 * @OA\Parameter(
2203 * name="eid",
2204 * in="path",
2205 * description="The id for the encounter.",
2206 * required=true,
2207 * @OA\Schema(
2208 * type="string"
2210 * ),
2211 * @OA\Response(
2212 * response="200",
2213 * ref="#/components/responses/standard"
2214 * ),
2215 * @OA\Response(
2216 * response="400",
2217 * ref="#/components/responses/badrequest"
2218 * ),
2219 * @OA\Response(
2220 * response="401",
2221 * ref="#/components/responses/unauthorized"
2222 * ),
2223 * security={{"openemr_auth":{}}}
2226 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2227 RestConfig::authorization_check("encounters", "notes");
2228 $return = (new EncounterRestController())->getVitals($pid, $eid);
2229 RestConfig::apiLog($return);
2230 return $return;
2234 * @OA\Get(
2235 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2236 * description="Retrieves a vitals form from an encounter for a patient",
2237 * tags={"standard"},
2238 * @OA\Parameter(
2239 * name="pid",
2240 * in="path",
2241 * description="The pid for the patient.",
2242 * required=true,
2243 * @OA\Schema(
2244 * type="string"
2246 * ),
2247 * @OA\Parameter(
2248 * name="eid",
2249 * in="path",
2250 * description="The id for the encounter.",
2251 * required=true,
2252 * @OA\Schema(
2253 * type="string"
2255 * ),
2256 * @OA\Parameter(
2257 * name="vid",
2258 * in="path",
2259 * description="The id for the vitals form.",
2260 * required=true,
2261 * @OA\Schema(
2262 * type="string"
2264 * ),
2265 * @OA\Response(
2266 * response="200",
2267 * ref="#/components/responses/standard"
2268 * ),
2269 * @OA\Response(
2270 * response="400",
2271 * ref="#/components/responses/badrequest"
2272 * ),
2273 * @OA\Response(
2274 * response="401",
2275 * ref="#/components/responses/unauthorized"
2276 * ),
2277 * security={{"openemr_auth":{}}}
2280 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2281 RestConfig::authorization_check("encounters", "notes");
2282 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2283 RestConfig::apiLog($return);
2284 return $return;
2288 * @OA\Get(
2289 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2290 * description="Retrieves a soap note from an encounter for a patient",
2291 * tags={"standard"},
2292 * @OA\Parameter(
2293 * name="pid",
2294 * in="path",
2295 * description="The pid for the patient.",
2296 * required=true,
2297 * @OA\Schema(
2298 * type="string"
2300 * ),
2301 * @OA\Parameter(
2302 * name="eid",
2303 * in="path",
2304 * description="The id for the encounter.",
2305 * required=true,
2306 * @OA\Schema(
2307 * type="string"
2309 * ),
2310 * @OA\Parameter(
2311 * name="sid",
2312 * in="path",
2313 * description="The id for the soap note.",
2314 * required=true,
2315 * @OA\Schema(
2316 * type="string"
2318 * ),
2319 * @OA\Response(
2320 * response="200",
2321 * ref="#/components/responses/standard"
2322 * ),
2323 * @OA\Response(
2324 * response="400",
2325 * ref="#/components/responses/badrequest"
2326 * ),
2327 * @OA\Response(
2328 * response="401",
2329 * ref="#/components/responses/unauthorized"
2330 * ),
2331 * security={{"openemr_auth":{}}}
2334 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2335 RestConfig::authorization_check("encounters", "notes");
2336 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2337 RestConfig::apiLog($return);
2338 return $return;
2342 * Schema for the soap_note request
2344 * @OA\Schema(
2345 * schema="api_soap_note_request",
2346 * @OA\Property(
2347 * property="subjective",
2348 * description="The subjective of soap note.",
2349 * type="string"
2350 * ),
2351 * @OA\Property(
2352 * property="objective",
2353 * description="The objective of soap note.",
2354 * type="string"
2355 * ),
2356 * @OA\Property(
2357 * property="assessment",
2358 * description="The assessment of soap note.",
2359 * type="string"
2360 * ),
2361 * @OA\Property(
2362 * property="plan",
2363 * description="The plan of soap note.",
2364 * type="string"
2365 * ),
2366 * example={
2367 * "subjective": "The patient with mechanical fall and cut finger.",
2368 * "objective": "The patient with finger laceration on exam.",
2369 * "assessment": "The patient with finger laceration requiring sutures.",
2370 * "plan": "Sutured finger laceration."
2375 * @OA\Post(
2376 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2377 * description="Submits a new soap note",
2378 * tags={"standard"},
2379 * @OA\Parameter(
2380 * name="pid",
2381 * in="path",
2382 * description="The id for the patient.",
2383 * required=true,
2384 * @OA\Schema(
2385 * type="string"
2387 * ),
2388 * @OA\Parameter(
2389 * name="eid",
2390 * in="path",
2391 * description="The id for the encounter.",
2392 * required=true,
2393 * @OA\Schema(
2394 * type="string"
2396 * ),
2397 * @OA\RequestBody(
2398 * required=true,
2399 * @OA\MediaType(
2400 * mediaType="application/json",
2401 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2403 * ),
2404 * @OA\Response(
2405 * response="200",
2406 * ref="#/components/responses/standard"
2407 * ),
2408 * @OA\Response(
2409 * response="400",
2410 * ref="#/components/responses/badrequest"
2411 * ),
2412 * @OA\Response(
2413 * response="401",
2414 * ref="#/components/responses/unauthorized"
2415 * ),
2416 * security={{"openemr_auth":{}}}
2419 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2420 RestConfig::authorization_check("encounters", "notes");
2421 $data = (array) (json_decode(file_get_contents("php://input")));
2422 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2423 RestConfig::apiLog($return, $data);
2424 return $return;
2428 * @OA\Put(
2429 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2430 * description="Edit a soap note",
2431 * tags={"standard"},
2432 * @OA\Parameter(
2433 * name="pid",
2434 * in="path",
2435 * description="The id for the patient.",
2436 * required=true,
2437 * @OA\Schema(
2438 * type="string"
2440 * ),
2441 * @OA\Parameter(
2442 * name="eid",
2443 * in="path",
2444 * description="The id for the encounter.",
2445 * required=true,
2446 * @OA\Schema(
2447 * type="string"
2449 * ),
2450 * @OA\Parameter(
2451 * name="sid",
2452 * in="path",
2453 * description="The id for the soap noted.",
2454 * required=true,
2455 * @OA\Schema(
2456 * type="string"
2458 * ),
2459 * @OA\RequestBody(
2460 * required=true,
2461 * @OA\MediaType(
2462 * mediaType="application/json",
2463 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2465 * ),
2466 * @OA\Response(
2467 * response="200",
2468 * ref="#/components/responses/standard"
2469 * ),
2470 * @OA\Response(
2471 * response="400",
2472 * ref="#/components/responses/badrequest"
2473 * ),
2474 * @OA\Response(
2475 * response="401",
2476 * ref="#/components/responses/unauthorized"
2477 * ),
2478 * security={{"openemr_auth":{}}}
2481 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2482 RestConfig::authorization_check("encounters", "notes");
2483 $data = (array) (json_decode(file_get_contents("php://input")));
2484 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2485 RestConfig::apiLog($return, $data);
2486 return $return;
2491 * @OA\Get(
2492 * path="/api/practitioner",
2493 * description="Retrieves a list of practitioners",
2494 * tags={"standard"},
2495 * @OA\Parameter(
2496 * name="title",
2497 * in="query",
2498 * description="The title for the practitioner.",
2499 * required=false,
2500 * @OA\Schema(
2501 * type="string"
2503 * ),
2504 * @OA\Parameter(
2505 * name="fname",
2506 * in="query",
2507 * description="The first name for the practitioner.",
2508 * required=false,
2509 * @OA\Schema(
2510 * type="string"
2512 * ),
2513 * @OA\Parameter(
2514 * name="lname",
2515 * in="query",
2516 * description="The last name for the practitioner.",
2517 * required=false,
2518 * @OA\Schema(
2519 * type="string"
2521 * ),
2522 * @OA\Parameter(
2523 * name="mname",
2524 * in="query",
2525 * description="The middle name for the practitioner.",
2526 * required=false,
2527 * @OA\Schema(
2528 * type="string"
2530 * ),
2531 * @OA\Parameter(
2532 * name="federaltaxid",
2533 * in="query",
2534 * description="The federal tax id for the practitioner.",
2535 * required=false,
2536 * @OA\Schema(
2537 * type="string"
2539 * ),
2540 * @OA\Parameter(
2541 * name="federaldrugid",
2542 * in="query",
2543 * description="The federal drug id for the practitioner.",
2544 * required=false,
2545 * @OA\Schema(
2546 * type="string"
2548 * ),
2549 * @OA\Parameter(
2550 * name="upin",
2551 * in="query",
2552 * description="The upin for the practitioner.",
2553 * required=false,
2554 * @OA\Schema(
2555 * type="string"
2557 * ),
2558 * @OA\Parameter(
2559 * name="facility_id",
2560 * in="query",
2561 * description="The facility id for the practitioner.",
2562 * required=false,
2563 * @OA\Schema(
2564 * type="string"
2566 * ),
2567 * @OA\Parameter(
2568 * name="facility",
2569 * in="query",
2570 * description="The facility for the practitioner.",
2571 * required=false,
2572 * @OA\Schema(
2573 * type="string"
2575 * ),
2576 * @OA\Parameter(
2577 * name="npi",
2578 * in="query",
2579 * description="The npi for the practitioner.",
2580 * required=false,
2581 * @OA\Schema(
2582 * type="string"
2584 * ),
2585 * @OA\Parameter(
2586 * name="email",
2587 * in="query",
2588 * description="The email for the practitioner.",
2589 * required=false,
2590 * @OA\Schema(
2591 * type="string"
2593 * ),
2594 * @OA\Parameter(
2595 * name="specialty",
2596 * in="query",
2597 * description="The specialty for the practitioner.",
2598 * required=false,
2599 * @OA\Schema(
2600 * type="string"
2602 * ),
2603 * @OA\Parameter(
2604 * name="billname",
2605 * in="query",
2606 * description="The billname for the practitioner.",
2607 * required=false,
2608 * @OA\Schema(
2609 * type="string"
2611 * ),
2612 * @OA\Parameter(
2613 * name="url",
2614 * in="query",
2615 * description="The url for the practitioner.",
2616 * required=false,
2617 * @OA\Schema(
2618 * type="string"
2620 * ),
2621 * @OA\Parameter(
2622 * name="assistant",
2623 * in="query",
2624 * description="The assistant for the practitioner.",
2625 * required=false,
2626 * @OA\Schema(
2627 * type="string"
2629 * ),
2630 * @OA\Parameter(
2631 * name="organization",
2632 * in="query",
2633 * description="The organization for the practitioner.",
2634 * required=false,
2635 * @OA\Schema(
2636 * type="string"
2638 * ),
2639 * @OA\Parameter(
2640 * name="valedictory",
2641 * in="query",
2642 * description="The valedictory for the practitioner.",
2643 * required=false,
2644 * @OA\Schema(
2645 * type="string"
2647 * ),
2648 * @OA\Parameter(
2649 * name="street",
2650 * in="query",
2651 * description="The street for the practitioner.",
2652 * required=false,
2653 * @OA\Schema(
2654 * type="string"
2656 * ),
2657 * @OA\Parameter(
2658 * name="streetb",
2659 * in="query",
2660 * description="The street (line 2) for the practitioner.",
2661 * required=false,
2662 * @OA\Schema(
2663 * type="string"
2665 * ),
2666 * @OA\Parameter(
2667 * name="city",
2668 * in="query",
2669 * description="The city for the practitioner.",
2670 * required=false,
2671 * @OA\Schema(
2672 * type="string"
2674 * ),
2675 * @OA\Parameter(
2676 * name="state",
2677 * in="query",
2678 * description="The state for the practitioner.",
2679 * required=false,
2680 * @OA\Schema(
2681 * type="string"
2683 * ),
2684 * @OA\Parameter(
2685 * name="zip",
2686 * in="query",
2687 * description="The zip for the practitioner.",
2688 * required=false,
2689 * @OA\Schema(
2690 * type="string"
2692 * ),
2693 * @OA\Parameter(
2694 * name="phone",
2695 * in="query",
2696 * description="The phone for the practitioner.",
2697 * required=false,
2698 * @OA\Schema(
2699 * type="string"
2701 * ),
2702 * @OA\Parameter(
2703 * name="fax",
2704 * in="query",
2705 * description="The fax for the practitioner.",
2706 * required=false,
2707 * @OA\Schema(
2708 * type="string"
2710 * ),
2711 * @OA\Parameter(
2712 * name="phonew1",
2713 * in="query",
2714 * description="The phonew1 for the practitioner.",
2715 * required=false,
2716 * @OA\Schema(
2717 * type="string"
2719 * ),
2720 * @OA\Parameter(
2721 * name="phonecell",
2722 * in="query",
2723 * description="The phonecell for the practitioner.",
2724 * required=false,
2725 * @OA\Schema(
2726 * type="string"
2728 * ),
2729 * @OA\Parameter(
2730 * name="notes",
2731 * in="query",
2732 * description="The notes for the practitioner.",
2733 * required=false,
2734 * @OA\Schema(
2735 * type="string"
2737 * ),
2738 * @OA\Parameter(
2739 * name="state_license_number2",
2740 * in="query",
2741 * description="The state license number for the practitioner.",
2742 * required=false,
2743 * @OA\Schema(
2744 * type="string"
2746 * ),
2747 * @OA\Parameter(
2748 * name="username",
2749 * in="query",
2750 * description="The username for the practitioner.",
2751 * required=false,
2752 * @OA\Schema(
2753 * type="string"
2755 * ),
2756 * @OA\Response(
2757 * response="200",
2758 * ref="#/components/responses/standard"
2759 * ),
2760 * @OA\Response(
2761 * response="400",
2762 * ref="#/components/responses/badrequest"
2763 * ),
2764 * @OA\Response(
2765 * response="401",
2766 * ref="#/components/responses/unauthorized"
2767 * ),
2768 * security={{"openemr_auth":{}}}
2771 "GET /api/practitioner" => function () {
2772 RestConfig::authorization_check("admin", "users");
2773 $return = (new PractitionerRestController())->getAll($_GET);
2774 RestConfig::apiLog($return);
2775 return $return;
2779 * @OA\Get(
2780 * path="/api/practitioner/{pruuid}",
2781 * description="Retrieves a single practitioner by their uuid",
2782 * tags={"standard"},
2783 * @OA\Parameter(
2784 * name="pruuid",
2785 * in="path",
2786 * description="The uuid for the practitioner.",
2787 * required=true,
2788 * @OA\Schema(
2789 * type="string"
2791 * ),
2792 * @OA\Response(
2793 * response="200",
2794 * ref="#/components/responses/standard"
2795 * ),
2796 * @OA\Response(
2797 * response="400",
2798 * ref="#/components/responses/badrequest"
2799 * ),
2800 * @OA\Response(
2801 * response="401",
2802 * ref="#/components/responses/unauthorized"
2803 * ),
2804 * security={{"openemr_auth":{}}}
2807 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2808 RestConfig::authorization_check("admin", "users");
2809 $return = (new PractitionerRestController())->getOne($pruuid);
2810 RestConfig::apiLog($return);
2811 return $return;
2815 * @OA\Post(
2816 * path="/api/practitioner",
2817 * description="Submits a new practitioner",
2818 * tags={"standard"},
2819 * @OA\RequestBody(
2820 * required=true,
2821 * @OA\MediaType(
2822 * mediaType="application/json",
2823 * @OA\Schema(
2824 * @OA\Property(
2825 * property="title",
2826 * description="The title for the practitioner.",
2827 * type="string"
2828 * ),
2829 * @OA\Property(
2830 * property="fname",
2831 * description="The first name for the practitioner.",
2832 * type="string"
2833 * ),
2834 * @OA\Property(
2835 * property="mname",
2836 * description="The middle name for the practitioner.",
2837 * type="string"
2838 * ),
2839 * @OA\Property(
2840 * property="lname",
2841 * description="The last name for the practitioner.",
2842 * type="string"
2843 * ),
2844 * @OA\Property(
2845 * property="federaltaxid",
2846 * description="The federal tax id for the practitioner.",
2847 * type="string"
2848 * ),
2849 * @OA\Property(
2850 * property="federaldrugid",
2851 * description="The federal drug id for the practitioner.",
2852 * type="string"
2853 * ),
2854 * @OA\Property(
2855 * property="upin",
2856 * description="The upin for the practitioner.",
2857 * type="string"
2858 * ),
2859 * @OA\Property(
2860 * property="facility_id",
2861 * description="The facility_id for the practitioner.",
2862 * type="string"
2863 * ),
2864 * @OA\Property(
2865 * property="facility",
2866 * description="The facility name for the practitioner.",
2867 * type="string"
2868 * ),
2869 * @OA\Property(
2870 * property="npi",
2871 * description="The npi for the practitioner.",
2872 * type="string"
2873 * ),
2874 * @OA\Property(
2875 * property="email",
2876 * description="The email for the practitioner.",
2877 * type="string"
2878 * ),
2879 * @OA\Property(
2880 * property="specialty",
2881 * description="The specialty for the practitioner.",
2882 * type="string"
2883 * ),
2884 * @OA\Property(
2885 * property="billname",
2886 * description="The billname for the practitioner.",
2887 * type="string"
2888 * ),
2889 * @OA\Property(
2890 * property="url",
2891 * description="The url for the practitioner.",
2892 * type="string"
2893 * ),
2894 * @OA\Property(
2895 * property="assistant",
2896 * description="The assistant for the practitioner.",
2897 * type="string"
2898 * ),
2899 * @OA\Property(
2900 * property="valedictory",
2901 * description="The valedictory for the practitioner.",
2902 * type="string"
2903 * ),
2904 * @OA\Property(
2905 * property="street",
2906 * description="The street address for the practitioner.",
2907 * type="string"
2908 * ),
2909 * @OA\Property(
2910 * property="streetb",
2911 * description="The streetb address for the practitioner.",
2912 * type="string"
2913 * ),
2914 * @OA\Property(
2915 * property="city",
2916 * description="The city for the practitioner.",
2917 * type="string"
2918 * ),
2919 * @OA\Property(
2920 * property="state",
2921 * description="The state for the practitioner.",
2922 * type="string"
2923 * ),
2924 * @OA\Property(
2925 * property="zip",
2926 * description="The zip for the practitioner.",
2927 * type="string"
2928 * ),
2929 * @OA\Property(
2930 * property="phone",
2931 * description="The phone for the practitioner.",
2932 * type="string"
2933 * ),
2934 * @OA\Property(
2935 * property="fax",
2936 * description="The fax for the practitioner.",
2937 * type="string"
2938 * ),
2939 * @OA\Property(
2940 * property="phonew1",
2941 * description="The phonew1 for the practitioner.",
2942 * type="string"
2943 * ),
2944 * @OA\Property(
2945 * property="phonecell",
2946 * description="The phonecell for the practitioner.",
2947 * type="string"
2948 * ),
2949 * @OA\Property(
2950 * property="notes",
2951 * description="The notes for the practitioner.",
2952 * type="string"
2953 * ),
2954 * @OA\Property(
2955 * property="state_license_number",
2956 * description="The state license number for the practitioner.",
2957 * type="string"
2958 * ),
2959 * @OA\Property(
2960 * property="username",
2961 * description="The username for the practitioner.",
2962 * type="string"
2963 * ),
2964 * required={"fname", "lname", "npi"},
2965 * example={
2966 * "title": "Mrs.",
2967 * "fname": "Eduardo",
2968 * "mname": "Kathy",
2969 * "lname": "Perez",
2970 * "federaltaxid": "",
2971 * "federaldrugid": "",
2972 * "upin": "",
2973 * "facility_id": "3",
2974 * "facility": "Your Clinic Name Here",
2975 * "npi": "12345678901",
2976 * "email": "info@pennfirm.com",
2977 * "specialty": "",
2978 * "billname": null,
2979 * "url": null,
2980 * "assistant": null,
2981 * "organization": null,
2982 * "valedictory": null,
2983 * "street": "789 Third Avenue",
2984 * "streetb": "123 Cannaut Street",
2985 * "city": "San Diego",
2986 * "state": "CA",
2987 * "zip": "90210",
2988 * "phone": "(619) 555-9827",
2989 * "fax": null,
2990 * "phonew1": "(619) 555-7822",
2991 * "phonecell": "(619) 555-7821",
2992 * "notes": null,
2993 * "state_license_number": "123456",
2994 * "username": "eduardoperez"
2998 * ),
2999 * @OA\Response(
3000 * response="200",
3001 * description="Standard response",
3002 * @OA\MediaType(
3003 * mediaType="application/json",
3004 * @OA\Schema(
3005 * @OA\Property(
3006 * property="validationErrors",
3007 * description="Validation errors.",
3008 * type="array",
3009 * @OA\Items(
3010 * type="object",
3011 * ),
3012 * ),
3013 * @OA\Property(
3014 * property="internalErrors",
3015 * description="Internal errors.",
3016 * type="array",
3017 * @OA\Items(
3018 * type="object",
3019 * ),
3020 * ),
3021 * @OA\Property(
3022 * property="data",
3023 * description="Returned data.",
3024 * type="array",
3025 * @OA\Items(
3026 * @OA\Property(
3027 * property="id",
3028 * description="practitioner id",
3029 * type="integer",
3030 * ),
3031 * @OA\Property(
3032 * property="uuid",
3033 * description="practitioner uuid",
3034 * type="string",
3035 * ),
3036 * ),
3037 * ),
3038 * example={
3039 * "validationErrors": {},
3040 * "error_description": {},
3041 * "data": {
3042 * "id": 7,
3043 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3048 * ),
3049 * @OA\Response(
3050 * response="401",
3051 * ref="#/components/responses/unauthorized"
3052 * ),
3053 * security={{"openemr_auth":{}}}
3056 "POST /api/practitioner" => function () {
3057 RestConfig::authorization_check("admin", "users");
3058 $data = (array) (json_decode(file_get_contents("php://input")));
3059 $return = (new PractitionerRestController())->post($data);
3060 RestConfig::apiLog($return, $data);
3061 return $return;
3065 * @OA\Put(
3066 * path="/api/practitioner/{pruuid}",
3067 * description="Edit a practitioner",
3068 * tags={"standard"},
3069 * @OA\Parameter(
3070 * name="pruuid",
3071 * in="path",
3072 * description="The uuid for the practitioner.",
3073 * required=true,
3074 * @OA\Schema(
3075 * type="string"
3077 * ),
3078 * @OA\RequestBody(
3079 * required=true,
3080 * @OA\MediaType(
3081 * mediaType="application/json",
3082 * @OA\Schema(
3083 * @OA\Property(
3084 * property="title",
3085 * description="The title for the practitioner.",
3086 * type="string"
3087 * ),
3088 * @OA\Property(
3089 * property="fname",
3090 * description="The first name for the practitioner.",
3091 * type="string"
3092 * ),
3093 * @OA\Property(
3094 * property="mname",
3095 * description="The middle name for the practitioner.",
3096 * type="string"
3097 * ),
3098 * @OA\Property(
3099 * property="lname",
3100 * description="The last name for the practitioner.",
3101 * type="string"
3102 * ),
3103 * @OA\Property(
3104 * property="federaltaxid",
3105 * description="The federal tax id for the practitioner.",
3106 * type="string"
3107 * ),
3108 * @OA\Property(
3109 * property="federaldrugid",
3110 * description="The federal drug id for the practitioner.",
3111 * type="string"
3112 * ),
3113 * @OA\Property(
3114 * property="upin",
3115 * description="The upin for the practitioner.",
3116 * type="string"
3117 * ),
3118 * @OA\Property(
3119 * property="facility_id",
3120 * description="The facility_id for the practitioner.",
3121 * type="string"
3122 * ),
3123 * @OA\Property(
3124 * property="facility",
3125 * description="The facility name for the practitioner.",
3126 * type="string"
3127 * ),
3128 * @OA\Property(
3129 * property="npi",
3130 * description="The npi for the practitioner.",
3131 * type="string"
3132 * ),
3133 * @OA\Property(
3134 * property="email",
3135 * description="The email for the practitioner.",
3136 * type="string"
3137 * ),
3138 * @OA\Property(
3139 * property="specialty",
3140 * description="The specialty for the practitioner.",
3141 * type="string"
3142 * ),
3143 * @OA\Property(
3144 * property="billname",
3145 * description="The billname for the practitioner.",
3146 * type="string"
3147 * ),
3148 * @OA\Property(
3149 * property="url",
3150 * description="The url for the practitioner.",
3151 * type="string"
3152 * ),
3153 * @OA\Property(
3154 * property="assistant",
3155 * description="The assistant for the practitioner.",
3156 * type="string"
3157 * ),
3158 * @OA\Property(
3159 * property="valedictory",
3160 * description="The valedictory for the practitioner.",
3161 * type="string"
3162 * ),
3163 * @OA\Property(
3164 * property="street",
3165 * description="The street address for the practitioner.",
3166 * type="string"
3167 * ),
3168 * @OA\Property(
3169 * property="streetb",
3170 * description="The streetb address for the practitioner.",
3171 * type="string"
3172 * ),
3173 * @OA\Property(
3174 * property="city",
3175 * description="The city for the practitioner.",
3176 * type="string"
3177 * ),
3178 * @OA\Property(
3179 * property="state",
3180 * description="The state for the practitioner.",
3181 * type="string"
3182 * ),
3183 * @OA\Property(
3184 * property="zip",
3185 * description="The zip for the practitioner.",
3186 * type="string"
3187 * ),
3188 * @OA\Property(
3189 * property="phone",
3190 * description="The phone for the practitioner.",
3191 * type="string"
3192 * ),
3193 * @OA\Property(
3194 * property="fax",
3195 * description="The fax for the practitioner.",
3196 * type="string"
3197 * ),
3198 * @OA\Property(
3199 * property="phonew1",
3200 * description="The phonew1 for the practitioner.",
3201 * type="string"
3202 * ),
3203 * @OA\Property(
3204 * property="phonecell",
3205 * description="The phonecell for the practitioner.",
3206 * type="string"
3207 * ),
3208 * @OA\Property(
3209 * property="notes",
3210 * description="The notes for the practitioner.",
3211 * type="string"
3212 * ),
3213 * @OA\Property(
3214 * property="state_license_number",
3215 * description="The state license number for the practitioner.",
3216 * type="string"
3217 * ),
3218 * @OA\Property(
3219 * property="username",
3220 * description="The username for the practitioner.",
3221 * type="string"
3222 * ),
3223 * example={
3224 * "title": "Mr",
3225 * "fname": "Baz",
3226 * "mname": "",
3227 * "lname": "Bop",
3228 * "street": "456 Tree Lane",
3229 * "zip": "08642",
3230 * "city": "FooTown",
3231 * "state": "FL",
3232 * "phone": "123-456-7890"
3236 * ),
3237 * @OA\Response(
3238 * response="200",
3239 * description="Standard response",
3240 * @OA\MediaType(
3241 * mediaType="application/json",
3242 * @OA\Schema(
3243 * @OA\Property(
3244 * property="validationErrors",
3245 * description="Validation errors.",
3246 * type="array",
3247 * @OA\Items(
3248 * type="object",
3249 * ),
3250 * ),
3251 * @OA\Property(
3252 * property="internalErrors",
3253 * description="Internal errors.",
3254 * type="array",
3255 * @OA\Items(
3256 * type="object",
3257 * ),
3258 * ),
3259 * @OA\Property(
3260 * property="data",
3261 * description="Returned data.",
3262 * type="array",
3263 * @OA\Items(
3264 * @OA\Property(
3265 * property="id",
3266 * description="practitioner id",
3267 * type="string",
3268 * ),
3269 * @OA\Property(
3270 * property="uuid",
3271 * description="practitioner uuid",
3272 * type="string",
3273 * ),
3274 * @OA\Property(
3275 * property="title",
3276 * description="practitioner title",
3277 * type="string",
3278 * ),
3279 * @OA\Property(
3280 * property="fname",
3281 * description="practitioner fname",
3282 * type="string",
3283 * ),
3284 * @OA\Property(
3285 * property="lname",
3286 * description="practitioner lname",
3287 * type="string",
3288 * ),
3289 * @OA\Property(
3290 * property="mname",
3291 * description="practitioner mname",
3292 * type="string",
3293 * ),
3294 * @OA\Property(
3295 * property="federaltaxid",
3296 * description="practitioner federaltaxid",
3297 * type="string",
3298 * ),
3299 * @OA\Property(
3300 * property="federaldrugid",
3301 * description="practitioner federaldrugid",
3302 * type="string",
3303 * ),
3304 * @OA\Property(
3305 * property="upin",
3306 * description="practitioner upin",
3307 * type="string",
3308 * ),
3309 * @OA\Property(
3310 * property="facility_id",
3311 * description="practitioner facility_id",
3312 * type="string",
3313 * ),
3314 * @OA\Property(
3315 * property="facility",
3316 * description="practitioner facility",
3317 * type="string",
3318 * ),
3319 * @OA\Property(
3320 * property="npi",
3321 * description="practitioner npi",
3322 * type="string",
3323 * ),
3324 * @OA\Property(
3325 * property="email",
3326 * description="practitioner email",
3327 * type="string",
3328 * ),
3329 * @OA\Property(
3330 * property="active",
3331 * description="practitioner active setting",
3332 * type="string",
3333 * ),
3334 * @OA\Property(
3335 * property="specialty",
3336 * description="practitioner specialty",
3337 * type="string",
3338 * ),
3339 * @OA\Property(
3340 * property="billname",
3341 * description="practitioner billname",
3342 * type="string",
3343 * ),
3344 * @OA\Property(
3345 * property="url",
3346 * description="practitioner url",
3347 * type="string",
3348 * ),
3349 * @OA\Property(
3350 * property="assistant",
3351 * description="practitioner assistant",
3352 * type="string",
3353 * ),
3354 * @OA\Property(
3355 * property="organization",
3356 * description="practitioner organization",
3357 * type="string",
3358 * ),
3359 * @OA\Property(
3360 * property="valedictory",
3361 * description="practitioner valedictory",
3362 * type="string",
3363 * ),
3364 * @OA\Property(
3365 * property="street",
3366 * description="practitioner street",
3367 * type="string",
3368 * ),
3369 * @OA\Property(
3370 * property="streetb",
3371 * description="practitioner streetb",
3372 * type="string",
3373 * ),
3374 * @OA\Property(
3375 * property="city",
3376 * description="practitioner city",
3377 * type="string",
3378 * ),
3379 * @OA\Property(
3380 * property="state",
3381 * description="practitioner state",
3382 * type="string",
3383 * ),
3384 * @OA\Property(
3385 * property="zip",
3386 * description="practitioner zip",
3387 * type="string",
3388 * ),
3389 * @OA\Property(
3390 * property="phone",
3391 * description="practitioner phone",
3392 * type="string",
3393 * ),
3394 * @OA\Property(
3395 * property="fax",
3396 * description="fax",
3397 * type="string",
3398 * ),
3399 * @OA\Property(
3400 * property="phonew1",
3401 * description="practitioner phonew1",
3402 * type="string",
3403 * ),
3404 * @OA\Property(
3405 * property="phonecell",
3406 * description="practitioner phonecell",
3407 * type="string",
3408 * ),
3409 * @OA\Property(
3410 * property="notes",
3411 * description="practitioner notes",
3412 * type="string",
3413 * ),
3414 * @OA\Property(
3415 * property="state_license_number",
3416 * description="practitioner state license number",
3417 * type="string",
3418 * ),
3419 * @OA\Property(
3420 * property="abook_title",
3421 * description="practitioner abook title",
3422 * type="string",
3423 * ),
3424 * @OA\Property(
3425 * property="physician_title",
3426 * description="practitioner physician title",
3427 * type="string",
3428 * ),
3429 * @OA\Property(
3430 * property="physician_code",
3431 * description="practitioner physician code",
3432 * type="string",
3434 * ),
3435 * ),
3436 * example={
3437 * "validationErrors": {},
3438 * "error_description": {},
3439 * "data": {
3440 * "id": 7,
3441 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3442 * "title": "Mr",
3443 * "fname": "Baz",
3444 * "lname": "Bop",
3445 * "mname": "",
3446 * "federaltaxid": "",
3447 * "federaldrugid": "",
3448 * "upin": "",
3449 * "facility_id": "3",
3450 * "facility": "Your Clinic Name Here",
3451 * "npi": "0123456789",
3452 * "email": "info@pennfirm.com",
3453 * "active": "1",
3454 * "specialty": "",
3455 * "billname": "",
3456 * "url": "",
3457 * "assistant": "",
3458 * "organization": "",
3459 * "valedictory": "",
3460 * "street": "456 Tree Lane",
3461 * "streetb": "123 Cannaut Street",
3462 * "city": "FooTown",
3463 * "state": "FL",
3464 * "zip": "08642",
3465 * "phone": "123-456-7890",
3466 * "fax": "",
3467 * "phonew1": "(619) 555-7822",
3468 * "phonecell": "(619) 555-7821",
3469 * "notes": "",
3470 * "state_license_number": "123456",
3471 * "abook_title": null,
3472 * "physician_title": null,
3473 * "physician_code": null
3478 * ),
3479 * @OA\Response(
3480 * response="401",
3481 * ref="#/components/responses/unauthorized"
3482 * ),
3483 * security={{"openemr_auth":{}}}
3486 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3487 RestConfig::authorization_check("admin", "users");
3488 $data = (array) (json_decode(file_get_contents("php://input")));
3489 $return = (new PractitionerRestController())->patch($pruuid, $data);
3490 RestConfig::apiLog($return, $data);
3491 return $return;
3495 * @OA\Get(
3496 * path="/api/medical_problem",
3497 * description="Retrieves a list of medical problems",
3498 * tags={"standard"},
3499 * @OA\Parameter(
3500 * name="puuid",
3501 * in="query",
3502 * description="The uuid for the patient.",
3503 * required=false,
3504 * @OA\Schema(
3505 * type="string"
3507 * ),
3508 * @OA\Parameter(
3509 * name="condition_uuid",
3510 * in="query",
3511 * description="The uuid for the medical problem.",
3512 * required=false,
3513 * @OA\Schema(
3514 * type="string"
3516 * ),
3517 * @OA\Parameter(
3518 * name="title",
3519 * in="query",
3520 * description="The title for the medical problem.",
3521 * required=false,
3522 * @OA\Schema(
3523 * type="string"
3525 * ),
3526 * @OA\Parameter(
3527 * name="begdate",
3528 * in="query",
3529 * description="The start date for the medical problem.",
3530 * required=false,
3531 * @OA\Schema(
3532 * type="string"
3534 * ),
3535 * @OA\Parameter(
3536 * name="enddate",
3537 * in="query",
3538 * description="The end date for the medical problem.",
3539 * required=false,
3540 * @OA\Schema(
3541 * type="string"
3543 * ),
3544 * @OA\Parameter(
3545 * name="diagnosis",
3546 * in="query",
3547 * description="The diagnosis for the medical problem.",
3548 * required=false,
3549 * @OA\Schema(
3550 * type="string"
3552 * ),
3553 * @OA\Response(
3554 * response="200",
3555 * ref="#/components/responses/standard"
3556 * ),
3557 * @OA\Response(
3558 * response="400",
3559 * ref="#/components/responses/badrequest"
3560 * ),
3561 * @OA\Response(
3562 * response="401",
3563 * ref="#/components/responses/unauthorized"
3564 * ),
3565 * security={{"openemr_auth":{}}}
3568 "GET /api/medical_problem" => function () {
3569 RestConfig::authorization_check("encounters", "notes");
3570 $return = (new ConditionRestController())->getAll();
3571 RestConfig::apiLog($return);
3572 return $return;
3576 * @OA\Get(
3577 * path="/api/medical_problem/{muuid}",
3578 * description="Retrieves a single medical problem by their uuid",
3579 * tags={"standard"},
3580 * @OA\Parameter(
3581 * name="muuid",
3582 * in="path",
3583 * description="The uuid for the medical problem.",
3584 * required=true,
3585 * @OA\Schema(
3586 * type="string"
3588 * ),
3589 * @OA\Response(
3590 * response="200",
3591 * ref="#/components/responses/standard"
3592 * ),
3593 * @OA\Response(
3594 * response="400",
3595 * ref="#/components/responses/badrequest"
3596 * ),
3597 * @OA\Response(
3598 * response="401",
3599 * ref="#/components/responses/unauthorized"
3600 * ),
3601 * security={{"openemr_auth":{}}}
3604 "GET /api/medical_problem/:muuid" => function ($muuid) {
3605 RestConfig::authorization_check("encounters", "notes");
3606 $return = (new ConditionRestController())->getOne($muuid);
3607 RestConfig::apiLog($return);
3608 return $return;
3612 * @OA\Get(
3613 * path="/api/patient/{puuid}/medical_problem",
3614 * description="Retrieves all medical problems for a patient",
3615 * tags={"standard"},
3616 * @OA\Parameter(
3617 * name="puuid",
3618 * in="path",
3619 * description="The uuid for the patient.",
3620 * required=true,
3621 * @OA\Schema(
3622 * type="string"
3624 * ),
3625 * @OA\Response(
3626 * response="200",
3627 * ref="#/components/responses/standard"
3628 * ),
3629 * @OA\Response(
3630 * response="400",
3631 * ref="#/components/responses/badrequest"
3632 * ),
3633 * @OA\Response(
3634 * response="401",
3635 * ref="#/components/responses/unauthorized"
3636 * ),
3637 * security={{"openemr_auth":{}}}
3640 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3641 RestConfig::authorization_check("encounters", "notes");
3642 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3643 RestConfig::apiLog($return);
3644 return $return;
3648 * @OA\Get(
3649 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3650 * description="Retrieves a medical problem for a patient",
3651 * tags={"standard"},
3652 * @OA\Parameter(
3653 * name="puuid",
3654 * in="path",
3655 * description="The uuid for the patient.",
3656 * required=true,
3657 * @OA\Schema(
3658 * type="string"
3660 * ),
3661 * @OA\Parameter(
3662 * name="muuid",
3663 * in="path",
3664 * description="The uuid for the medical problem.",
3665 * required=true,
3666 * @OA\Schema(
3667 * type="string"
3669 * ),
3670 * @OA\Response(
3671 * response="200",
3672 * ref="#/components/responses/standard"
3673 * ),
3674 * @OA\Response(
3675 * response="400",
3676 * ref="#/components/responses/badrequest"
3677 * ),
3678 * @OA\Response(
3679 * response="401",
3680 * ref="#/components/responses/unauthorized"
3681 * ),
3682 * security={{"openemr_auth":{}}}
3685 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3686 RestConfig::authorization_check("patients", "med");
3687 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3688 RestConfig::apiLog($return);
3689 return $return;
3693 * Schema for the medical_problem request
3695 * @OA\Schema(
3696 * schema="api_medical_problem_request",
3697 * @OA\Property(
3698 * property="title",
3699 * description="The title of medical problem.",
3700 * type="string"
3701 * ),
3702 * @OA\Property(
3703 * property="begdate",
3704 * description="The beginning date of medical problem.",
3705 * type="string"
3706 * ),
3707 * @OA\Property(
3708 * property="enddate",
3709 * description="The end date of medical problem.",
3710 * type="string"
3711 * ),
3712 * @OA\Property(
3713 * property="diagnosis",
3714 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3715 * type="string"
3716 * ),
3717 * required={"title", "begdate"},
3718 * example={
3719 * "title": "Dermatochalasis",
3720 * "begdate": "2010-10-13",
3721 * "enddate": null,
3722 * "diagnosis": "ICD10:H02.839"
3727 * @OA\Post(
3728 * path="/api/patient/{puuid}/medical_problem",
3729 * description="Submits a new medical problem",
3730 * tags={"standard"},
3731 * @OA\Parameter(
3732 * name="puuid",
3733 * in="path",
3734 * description="The uuid for the patient.",
3735 * required=true,
3736 * @OA\Schema(
3737 * type="string"
3739 * ),
3740 * @OA\RequestBody(
3741 * required=true,
3742 * @OA\MediaType(
3743 * mediaType="application/json",
3744 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3746 * ),
3747 * @OA\Response(
3748 * response="200",
3749 * ref="#/components/responses/standard"
3750 * ),
3751 * @OA\Response(
3752 * response="400",
3753 * ref="#/components/responses/badrequest"
3754 * ),
3755 * @OA\Response(
3756 * response="401",
3757 * ref="#/components/responses/unauthorized"
3758 * ),
3759 * security={{"openemr_auth":{}}}
3762 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3763 RestConfig::authorization_check("patients", "med");
3764 $data = (array) (json_decode(file_get_contents("php://input")));
3765 $return = (new ConditionRestController())->post($puuid, $data);
3766 RestConfig::apiLog($return, $data);
3767 return $return;
3771 * @OA\Put(
3772 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3773 * description="Edit a medical problem",
3774 * tags={"standard"},
3775 * @OA\Parameter(
3776 * name="puuid",
3777 * in="path",
3778 * description="The uuid for the patient.",
3779 * required=true,
3780 * @OA\Schema(
3781 * type="string"
3783 * ),
3784 * @OA\Parameter(
3785 * name="muuid",
3786 * in="path",
3787 * description="The uuid for the medical problem.",
3788 * required=true,
3789 * @OA\Schema(
3790 * type="string"
3792 * ),
3793 * @OA\RequestBody(
3794 * required=true,
3795 * @OA\MediaType(
3796 * mediaType="application/json",
3797 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3799 * ),
3800 * @OA\Response(
3801 * response="200",
3802 * ref="#/components/responses/standard"
3803 * ),
3804 * @OA\Response(
3805 * response="400",
3806 * ref="#/components/responses/badrequest"
3807 * ),
3808 * @OA\Response(
3809 * response="401",
3810 * ref="#/components/responses/unauthorized"
3811 * ),
3812 * security={{"openemr_auth":{}}}
3815 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3816 RestConfig::authorization_check("patients", "med");
3817 $data = (array) (json_decode(file_get_contents("php://input")));
3818 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3819 RestConfig::apiLog($return, $data);
3820 return $return;
3824 * @OA\Delete(
3825 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3826 * description="Delete a medical problem",
3827 * tags={"standard"},
3828 * @OA\Parameter(
3829 * name="puuid",
3830 * in="path",
3831 * description="The uuid for the patient.",
3832 * required=true,
3833 * @OA\Schema(
3834 * type="string"
3836 * ),
3837 * @OA\Parameter(
3838 * name="muuid",
3839 * in="path",
3840 * description="The uuid for the medical problem.",
3841 * required=true,
3842 * @OA\Schema(
3843 * type="string"
3845 * ),
3846 * @OA\Response(
3847 * response="200",
3848 * ref="#/components/responses/standard"
3849 * ),
3850 * @OA\Response(
3851 * response="400",
3852 * ref="#/components/responses/badrequest"
3853 * ),
3854 * @OA\Response(
3855 * response="401",
3856 * ref="#/components/responses/unauthorized"
3857 * ),
3858 * security={{"openemr_auth":{}}}
3861 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3862 RestConfig::authorization_check("patients", "med");
3863 $return = (new ConditionRestController())->delete($puuid, $muuid);
3864 RestConfig::apiLog($return);
3865 return $return;
3869 * @OA\Get(
3870 * path="/api/allergy",
3871 * description="Retrieves a list of allergies",
3872 * tags={"standard"},
3873 * @OA\Parameter(
3874 * name="lists.pid",
3875 * in="query",
3876 * description="The uuid for the patient.",
3877 * required=false,
3878 * @OA\Schema(
3879 * type="string"
3881 * ),
3882 * @OA\Parameter(
3883 * name="lists.id",
3884 * in="query",
3885 * description="The uuid for the allergy.",
3886 * required=false,
3887 * @OA\Schema(
3888 * type="string"
3890 * ),
3891 * @OA\Parameter(
3892 * name="title",
3893 * in="query",
3894 * description="The title for the allergy.",
3895 * required=false,
3896 * @OA\Schema(
3897 * type="string"
3899 * ),
3900 * @OA\Parameter(
3901 * name="begdate",
3902 * in="query",
3903 * description="The start date for the allergy.",
3904 * required=false,
3905 * @OA\Schema(
3906 * type="string"
3908 * ),
3909 * @OA\Parameter(
3910 * name="enddate",
3911 * in="query",
3912 * description="The end date for the allergy.",
3913 * required=false,
3914 * @OA\Schema(
3915 * type="string"
3917 * ),
3918 * @OA\Parameter(
3919 * name="diagnosis",
3920 * in="query",
3921 * description="The diagnosis for the allergy.",
3922 * required=false,
3923 * @OA\Schema(
3924 * type="string"
3926 * ),
3927 * @OA\Response(
3928 * response="200",
3929 * ref="#/components/responses/standard"
3930 * ),
3931 * @OA\Response(
3932 * response="400",
3933 * ref="#/components/responses/badrequest"
3934 * ),
3935 * @OA\Response(
3936 * response="401",
3937 * ref="#/components/responses/unauthorized"
3938 * ),
3939 * security={{"openemr_auth":{}}}
3942 "GET /api/allergy" => function () {
3943 RestConfig::authorization_check("patients", "med");
3944 $return = (new AllergyIntoleranceRestController())->getAll();
3945 RestConfig::apiLog($return);
3946 return $return;
3950 * @OA\Get(
3951 * path="/api/allergy/{auuid}",
3952 * description="Retrieves a single allergy by their uuid",
3953 * tags={"standard"},
3954 * @OA\Parameter(
3955 * name="auuid",
3956 * in="path",
3957 * description="The uuid for the allergy.",
3958 * required=true,
3959 * @OA\Schema(
3960 * type="string"
3962 * ),
3963 * @OA\Response(
3964 * response="200",
3965 * ref="#/components/responses/standard"
3966 * ),
3967 * @OA\Response(
3968 * response="400",
3969 * ref="#/components/responses/badrequest"
3970 * ),
3971 * @OA\Response(
3972 * response="401",
3973 * ref="#/components/responses/unauthorized"
3974 * ),
3975 * security={{"openemr_auth":{}}}
3978 "GET /api/allergy/:auuid" => function ($auuid) {
3979 RestConfig::authorization_check("patients", "med");
3980 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3981 RestConfig::apiLog($return);
3982 return $return;
3986 * @OA\Get(
3987 * path="/api/patient/{puuid}/allergy",
3988 * description="Retrieves all allergies for a patient",
3989 * tags={"standard"},
3990 * @OA\Parameter(
3991 * name="puuid",
3992 * in="path",
3993 * description="The uuid for the patient.",
3994 * required=true,
3995 * @OA\Schema(
3996 * type="string"
3998 * ),
3999 * @OA\Response(
4000 * response="200",
4001 * ref="#/components/responses/standard"
4002 * ),
4003 * @OA\Response(
4004 * response="400",
4005 * ref="#/components/responses/badrequest"
4006 * ),
4007 * @OA\Response(
4008 * response="401",
4009 * ref="#/components/responses/unauthorized"
4010 * ),
4011 * security={{"openemr_auth":{}}}
4014 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4015 RestConfig::authorization_check("patients", "med");
4016 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4017 RestConfig::apiLog($return);
4018 return $return;
4022 * @OA\Get(
4023 * path="/api/patient/{puuid}/allergy/{auuid}",
4024 * description="Retrieves a allergy for a patient",
4025 * tags={"standard"},
4026 * @OA\Parameter(
4027 * name="puuid",
4028 * in="path",
4029 * description="The uuid for the patient.",
4030 * required=true,
4031 * @OA\Schema(
4032 * type="string"
4034 * ),
4035 * @OA\Parameter(
4036 * name="auuid",
4037 * in="path",
4038 * description="The uuid for the allergy.",
4039 * required=true,
4040 * @OA\Schema(
4041 * type="string"
4043 * ),
4044 * @OA\Response(
4045 * response="200",
4046 * ref="#/components/responses/standard"
4047 * ),
4048 * @OA\Response(
4049 * response="400",
4050 * ref="#/components/responses/badrequest"
4051 * ),
4052 * @OA\Response(
4053 * response="401",
4054 * ref="#/components/responses/unauthorized"
4055 * ),
4056 * security={{"openemr_auth":{}}}
4059 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4060 RestConfig::authorization_check("patients", "med");
4061 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4062 RestConfig::apiLog($return);
4063 return $return;
4067 * Schema for the allergy request
4069 * @OA\Schema(
4070 * schema="api_allergy_request",
4071 * @OA\Property(
4072 * property="title",
4073 * description="The title of allergy.",
4074 * type="string"
4075 * ),
4076 * @OA\Property(
4077 * property="begdate",
4078 * description="The beginning date of allergy.",
4079 * type="string"
4080 * ),
4081 * @OA\Property(
4082 * property="enddate",
4083 * description="The end date of allergy.",
4084 * type="string"
4085 * ),
4086 * @OA\Property(
4087 * property="diagnosis",
4088 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4089 * type="string"
4090 * ),
4091 * required={"title", "begdate"},
4092 * example={
4093 * "title": "Iodine",
4094 * "begdate": "2010-10-13",
4095 * "enddate": null
4100 * @OA\Post(
4101 * path="/api/patient/{puuid}/allergy",
4102 * description="Submits a new allergy",
4103 * tags={"standard"},
4104 * @OA\Parameter(
4105 * name="puuid",
4106 * in="path",
4107 * description="The uuid for the patient.",
4108 * required=true,
4109 * @OA\Schema(
4110 * type="string"
4112 * ),
4113 * @OA\RequestBody(
4114 * required=true,
4115 * @OA\MediaType(
4116 * mediaType="application/json",
4117 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4119 * ),
4120 * @OA\Response(
4121 * response="200",
4122 * ref="#/components/responses/standard"
4123 * ),
4124 * @OA\Response(
4125 * response="400",
4126 * ref="#/components/responses/badrequest"
4127 * ),
4128 * @OA\Response(
4129 * response="401",
4130 * ref="#/components/responses/unauthorized"
4131 * ),
4132 * security={{"openemr_auth":{}}}
4135 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4136 RestConfig::authorization_check("patients", "med");
4137 $data = (array) (json_decode(file_get_contents("php://input")));
4138 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4139 RestConfig::apiLog($return, $data);
4140 return $return;
4144 * @OA\Put(
4145 * path="/api/patient/{puuid}/allergy/{auuid}",
4146 * description="Edit a allergy",
4147 * tags={"standard"},
4148 * @OA\Parameter(
4149 * name="puuid",
4150 * in="path",
4151 * description="The uuid for the patient.",
4152 * required=true,
4153 * @OA\Schema(
4154 * type="string"
4156 * ),
4157 * @OA\Parameter(
4158 * name="auuid",
4159 * in="path",
4160 * description="The uuid for the allergy.",
4161 * required=true,
4162 * @OA\Schema(
4163 * type="string"
4165 * ),
4166 * @OA\RequestBody(
4167 * required=true,
4168 * @OA\MediaType(
4169 * mediaType="application/json",
4170 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4172 * ),
4173 * @OA\Response(
4174 * response="200",
4175 * ref="#/components/responses/standard"
4176 * ),
4177 * @OA\Response(
4178 * response="400",
4179 * ref="#/components/responses/badrequest"
4180 * ),
4181 * @OA\Response(
4182 * response="401",
4183 * ref="#/components/responses/unauthorized"
4184 * ),
4185 * security={{"openemr_auth":{}}}
4188 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4189 RestConfig::authorization_check("patients", "med");
4190 $data = (array) (json_decode(file_get_contents("php://input")));
4191 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4192 RestConfig::apiLog($return, $data);
4193 return $return;
4197 * @OA\Delete(
4198 * path="/api/patient/{puuid}/allergy/{auuid}",
4199 * description="Delete a medical problem",
4200 * tags={"standard"},
4201 * @OA\Parameter(
4202 * name="puuid",
4203 * in="path",
4204 * description="The uuid for the patient.",
4205 * required=true,
4206 * @OA\Schema(
4207 * type="string"
4209 * ),
4210 * @OA\Parameter(
4211 * name="auuid",
4212 * in="path",
4213 * description="The uuid for the allergy.",
4214 * required=true,
4215 * @OA\Schema(
4216 * type="string"
4218 * ),
4219 * @OA\Response(
4220 * response="200",
4221 * ref="#/components/responses/standard"
4222 * ),
4223 * @OA\Response(
4224 * response="400",
4225 * ref="#/components/responses/badrequest"
4226 * ),
4227 * @OA\Response(
4228 * response="401",
4229 * ref="#/components/responses/unauthorized"
4230 * ),
4231 * security={{"openemr_auth":{}}}
4234 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4235 RestConfig::authorization_check("patients", "med");
4236 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4237 RestConfig::apiLog($return);
4238 return $return;
4242 * @OA\Get(
4243 * path="/api/patient/{pid}/medication",
4244 * description="Retrieves all medications for a patient",
4245 * tags={"standard"},
4246 * @OA\Parameter(
4247 * name="pid",
4248 * in="path",
4249 * description="The pid for the patient.",
4250 * required=true,
4251 * @OA\Schema(
4252 * type="string"
4254 * ),
4255 * @OA\Response(
4256 * response="200",
4257 * ref="#/components/responses/standard"
4258 * ),
4259 * @OA\Response(
4260 * response="400",
4261 * ref="#/components/responses/badrequest"
4262 * ),
4263 * @OA\Response(
4264 * response="401",
4265 * ref="#/components/responses/unauthorized"
4266 * ),
4267 * security={{"openemr_auth":{}}}
4270 "GET /api/patient/:pid/medication" => function ($pid) {
4271 RestConfig::authorization_check("patients", "med");
4272 $return = (new ListRestController())->getAll($pid, "medication");
4273 RestConfig::apiLog($return);
4274 return $return;
4278 * Schema for the medication request
4280 * @OA\Schema(
4281 * schema="api_medication_request",
4282 * @OA\Property(
4283 * property="title",
4284 * description="The title of medication.",
4285 * type="string"
4286 * ),
4287 * @OA\Property(
4288 * property="begdate",
4289 * description="The beginning date of medication.",
4290 * type="string"
4291 * ),
4292 * @OA\Property(
4293 * property="enddate",
4294 * description="The end date of medication.",
4295 * type="string"
4296 * ),
4297 * @OA\Property(
4298 * property="diagnosis",
4299 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4300 * type="string"
4301 * ),
4302 * required={"title", "begdate"},
4303 * example={
4304 * "title": "Norvasc",
4305 * "begdate": "2013-04-13",
4306 * "enddate": null
4311 * @OA\Post(
4312 * path="/api/patient/{pid}/medication",
4313 * description="Submits a new medication",
4314 * tags={"standard"},
4315 * @OA\Parameter(
4316 * name="pid",
4317 * in="path",
4318 * description="The pid for the patient.",
4319 * required=true,
4320 * @OA\Schema(
4321 * type="string"
4323 * ),
4324 * @OA\RequestBody(
4325 * required=true,
4326 * @OA\MediaType(
4327 * mediaType="application/json",
4328 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4330 * ),
4331 * @OA\Response(
4332 * response="200",
4333 * ref="#/components/responses/standard"
4334 * ),
4335 * @OA\Response(
4336 * response="400",
4337 * ref="#/components/responses/badrequest"
4338 * ),
4339 * @OA\Response(
4340 * response="401",
4341 * ref="#/components/responses/unauthorized"
4342 * ),
4343 * security={{"openemr_auth":{}}}
4346 "POST /api/patient/:pid/medication" => function ($pid) {
4347 RestConfig::authorization_check("patients", "med");
4348 $data = (array) (json_decode(file_get_contents("php://input")));
4349 $return = (new ListRestController())->post($pid, "medication", $data);
4350 RestConfig::apiLog($return, $data);
4351 return $return;
4355 * @OA\Put(
4356 * path="/api/patient/{pid}/medication/{mid}",
4357 * description="Edit a medication",
4358 * tags={"standard"},
4359 * @OA\Parameter(
4360 * name="pid",
4361 * in="path",
4362 * description="The pid for the patient.",
4363 * required=true,
4364 * @OA\Schema(
4365 * type="string"
4367 * ),
4368 * @OA\Parameter(
4369 * name="mid",
4370 * in="path",
4371 * description="The id for the medication.",
4372 * required=true,
4373 * @OA\Schema(
4374 * type="string"
4376 * ),
4377 * @OA\RequestBody(
4378 * required=true,
4379 * @OA\MediaType(
4380 * mediaType="application/json",
4381 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4383 * ),
4384 * @OA\Response(
4385 * response="200",
4386 * ref="#/components/responses/standard"
4387 * ),
4388 * @OA\Response(
4389 * response="400",
4390 * ref="#/components/responses/badrequest"
4391 * ),
4392 * @OA\Response(
4393 * response="401",
4394 * ref="#/components/responses/unauthorized"
4395 * ),
4396 * security={{"openemr_auth":{}}}
4399 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4400 RestConfig::authorization_check("patients", "med");
4401 $data = (array) (json_decode(file_get_contents("php://input")));
4402 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4403 RestConfig::apiLog($return, $data);
4404 return $return;
4408 * @OA\Get(
4409 * path="/api/patient/{pid}/medication/{mid}",
4410 * description="Retrieves a medication for a patient",
4411 * tags={"standard"},
4412 * @OA\Parameter(
4413 * name="pid",
4414 * in="path",
4415 * description="The id for the patient.",
4416 * required=true,
4417 * @OA\Schema(
4418 * type="string"
4420 * ),
4421 * @OA\Parameter(
4422 * name="mid",
4423 * in="path",
4424 * description="The id for the medication.",
4425 * required=true,
4426 * @OA\Schema(
4427 * type="string"
4429 * ),
4430 * @OA\Response(
4431 * response="200",
4432 * ref="#/components/responses/standard"
4433 * ),
4434 * @OA\Response(
4435 * response="400",
4436 * ref="#/components/responses/badrequest"
4437 * ),
4438 * @OA\Response(
4439 * response="401",
4440 * ref="#/components/responses/unauthorized"
4441 * ),
4442 * security={{"openemr_auth":{}}}
4445 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4446 RestConfig::authorization_check("patients", "med");
4447 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4448 RestConfig::apiLog($return);
4449 return $return;
4453 * @OA\Delete(
4454 * path="/api/patient/{pid}/medication/{mid}",
4455 * description="Delete a medication",
4456 * tags={"standard"},
4457 * @OA\Parameter(
4458 * name="pid",
4459 * in="path",
4460 * description="The id for the patient.",
4461 * required=true,
4462 * @OA\Schema(
4463 * type="string"
4465 * ),
4466 * @OA\Parameter(
4467 * name="mid",
4468 * in="path",
4469 * description="The id for the medication.",
4470 * required=true,
4471 * @OA\Schema(
4472 * type="string"
4474 * ),
4475 * @OA\Response(
4476 * response="200",
4477 * ref="#/components/responses/standard"
4478 * ),
4479 * @OA\Response(
4480 * response="400",
4481 * ref="#/components/responses/badrequest"
4482 * ),
4483 * @OA\Response(
4484 * response="401",
4485 * ref="#/components/responses/unauthorized"
4486 * ),
4487 * security={{"openemr_auth":{}}}
4490 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4491 RestConfig::authorization_check("patients", "med");
4492 $return = (new ListRestController())->delete($pid, $mid, "medication");
4493 RestConfig::apiLog($return);
4494 return $return;
4498 * @OA\Get(
4499 * path="/api/patient/{pid}/surgery",
4500 * description="Retrieves all surgeries for a patient",
4501 * tags={"standard"},
4502 * @OA\Parameter(
4503 * name="pid",
4504 * in="path",
4505 * description="The pid for the patient.",
4506 * required=true,
4507 * @OA\Schema(
4508 * type="string"
4510 * ),
4511 * @OA\Response(
4512 * response="200",
4513 * ref="#/components/responses/standard"
4514 * ),
4515 * @OA\Response(
4516 * response="400",
4517 * ref="#/components/responses/badrequest"
4518 * ),
4519 * @OA\Response(
4520 * response="401",
4521 * ref="#/components/responses/unauthorized"
4522 * ),
4523 * security={{"openemr_auth":{}}}
4526 "GET /api/patient/:pid/surgery" => function ($pid) {
4527 RestConfig::authorization_check("patients", "med");
4528 $return = (new ListRestController())->getAll($pid, "surgery");
4529 RestConfig::apiLog($return);
4530 return $return;
4534 * @OA\Get(
4535 * path="/api/patient/{pid}/surgery/{sid}",
4536 * description="Retrieves a surgery for a patient",
4537 * tags={"standard"},
4538 * @OA\Parameter(
4539 * name="pid",
4540 * in="path",
4541 * description="The id for the patient.",
4542 * required=true,
4543 * @OA\Schema(
4544 * type="string"
4546 * ),
4547 * @OA\Parameter(
4548 * name="sid",
4549 * in="path",
4550 * description="The id for the surgery.",
4551 * required=true,
4552 * @OA\Schema(
4553 * type="string"
4555 * ),
4556 * @OA\Response(
4557 * response="200",
4558 * ref="#/components/responses/standard"
4559 * ),
4560 * @OA\Response(
4561 * response="400",
4562 * ref="#/components/responses/badrequest"
4563 * ),
4564 * @OA\Response(
4565 * response="401",
4566 * ref="#/components/responses/unauthorized"
4567 * ),
4568 * security={{"openemr_auth":{}}}
4571 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4572 RestConfig::authorization_check("patients", "med");
4573 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4574 RestConfig::apiLog($return);
4575 return $return;
4579 * @OA\Delete(
4580 * path="/api/patient/{pid}/surgery/{sid}",
4581 * description="Delete a surgery",
4582 * tags={"standard"},
4583 * @OA\Parameter(
4584 * name="pid",
4585 * in="path",
4586 * description="The id for the patient.",
4587 * required=true,
4588 * @OA\Schema(
4589 * type="string"
4591 * ),
4592 * @OA\Parameter(
4593 * name="sid",
4594 * in="path",
4595 * description="The id for the surgery.",
4596 * required=true,
4597 * @OA\Schema(
4598 * type="string"
4600 * ),
4601 * @OA\Response(
4602 * response="200",
4603 * ref="#/components/responses/standard"
4604 * ),
4605 * @OA\Response(
4606 * response="400",
4607 * ref="#/components/responses/badrequest"
4608 * ),
4609 * @OA\Response(
4610 * response="401",
4611 * ref="#/components/responses/unauthorized"
4612 * ),
4613 * security={{"openemr_auth":{}}}
4616 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4617 RestConfig::authorization_check("patients", "med");
4618 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4619 RestConfig::apiLog($return);
4620 return $return;
4624 * Schema for the surgery request
4626 * @OA\Schema(
4627 * schema="api_surgery_request",
4628 * @OA\Property(
4629 * property="title",
4630 * description="The title of surgery.",
4631 * type="string"
4632 * ),
4633 * @OA\Property(
4634 * property="begdate",
4635 * description="The beginning date of surgery.",
4636 * type="string"
4637 * ),
4638 * @OA\Property(
4639 * property="enddate",
4640 * description="The end date of surgery.",
4641 * type="string"
4642 * ),
4643 * @OA\Property(
4644 * property="diagnosis",
4645 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4646 * type="string"
4647 * ),
4648 * required={"title", "begdate"},
4649 * example={
4650 * "title": "Blepharoplasty",
4651 * "begdate": "2013-10-14",
4652 * "enddate": null,
4653 * "diagnosis": "CPT4:15823-50"
4658 * @OA\Post(
4659 * path="/api/patient/{pid}/surgery",
4660 * description="Submits a new surgery",
4661 * tags={"standard"},
4662 * @OA\Parameter(
4663 * name="pid",
4664 * in="path",
4665 * description="The pid for the patient.",
4666 * required=true,
4667 * @OA\Schema(
4668 * type="string"
4670 * ),
4671 * @OA\RequestBody(
4672 * required=true,
4673 * @OA\MediaType(
4674 * mediaType="application/json",
4675 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4677 * ),
4678 * @OA\Response(
4679 * response="200",
4680 * ref="#/components/responses/standard"
4681 * ),
4682 * @OA\Response(
4683 * response="400",
4684 * ref="#/components/responses/badrequest"
4685 * ),
4686 * @OA\Response(
4687 * response="401",
4688 * ref="#/components/responses/unauthorized"
4689 * ),
4690 * security={{"openemr_auth":{}}}
4693 "POST /api/patient/:pid/surgery" => function ($pid) {
4694 RestConfig::authorization_check("patients", "med");
4695 $data = (array) (json_decode(file_get_contents("php://input")));
4696 $return = (new ListRestController())->post($pid, "surgery", $data);
4697 RestConfig::apiLog($return, $data);
4698 return $return;
4702 * @OA\Put(
4703 * path="/api/patient/{pid}/surgery/{sid}",
4704 * description="Edit a surgery",
4705 * tags={"standard"},
4706 * @OA\Parameter(
4707 * name="pid",
4708 * in="path",
4709 * description="The pid for the patient.",
4710 * required=true,
4711 * @OA\Schema(
4712 * type="string"
4714 * ),
4715 * @OA\Parameter(
4716 * name="sid",
4717 * in="path",
4718 * description="The id for the surgery.",
4719 * required=true,
4720 * @OA\Schema(
4721 * type="string"
4723 * ),
4724 * @OA\RequestBody(
4725 * required=true,
4726 * @OA\MediaType(
4727 * mediaType="application/json",
4728 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4730 * ),
4731 * @OA\Response(
4732 * response="200",
4733 * ref="#/components/responses/standard"
4734 * ),
4735 * @OA\Response(
4736 * response="400",
4737 * ref="#/components/responses/badrequest"
4738 * ),
4739 * @OA\Response(
4740 * response="401",
4741 * ref="#/components/responses/unauthorized"
4742 * ),
4743 * security={{"openemr_auth":{}}}
4746 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4747 RestConfig::authorization_check("patients", "med");
4748 $data = (array) (json_decode(file_get_contents("php://input")));
4749 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4750 RestConfig::apiLog($return, $data);
4751 return $return;
4755 * @OA\Get(
4756 * path="/api/patient/{pid}/dental_issue",
4757 * description="Retrieves all dental issues for a patient",
4758 * tags={"standard"},
4759 * @OA\Parameter(
4760 * name="pid",
4761 * in="path",
4762 * description="The pid for the patient.",
4763 * required=true,
4764 * @OA\Schema(
4765 * type="string"
4767 * ),
4768 * @OA\Response(
4769 * response="200",
4770 * ref="#/components/responses/standard"
4771 * ),
4772 * @OA\Response(
4773 * response="400",
4774 * ref="#/components/responses/badrequest"
4775 * ),
4776 * @OA\Response(
4777 * response="401",
4778 * ref="#/components/responses/unauthorized"
4779 * ),
4780 * security={{"openemr_auth":{}}}
4783 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4784 RestConfig::authorization_check("patients", "med");
4785 $return = (new ListRestController())->getAll($pid, "dental");
4786 RestConfig::apiLog($return);
4787 return $return;
4791 * @OA\Get(
4792 * path="/api/patient/{pid}/dental_issue/{did}",
4793 * description="Retrieves a dental issue for a patient",
4794 * tags={"standard"},
4795 * @OA\Parameter(
4796 * name="pid",
4797 * in="path",
4798 * description="The id for the patient.",
4799 * required=true,
4800 * @OA\Schema(
4801 * type="string"
4803 * ),
4804 * @OA\Parameter(
4805 * name="did",
4806 * in="path",
4807 * description="The id for the dental issue.",
4808 * required=true,
4809 * @OA\Schema(
4810 * type="string"
4812 * ),
4813 * @OA\Response(
4814 * response="200",
4815 * ref="#/components/responses/standard"
4816 * ),
4817 * @OA\Response(
4818 * response="400",
4819 * ref="#/components/responses/badrequest"
4820 * ),
4821 * @OA\Response(
4822 * response="401",
4823 * ref="#/components/responses/unauthorized"
4824 * ),
4825 * security={{"openemr_auth":{}}}
4828 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4829 RestConfig::authorization_check("patients", "med");
4830 $return = (new ListRestController())->getOne($pid, "dental", $did);
4831 RestConfig::apiLog($return);
4832 return $return;
4836 * @OA\Delete(
4837 * path="/api/patient/{pid}/dental_issue/{did}",
4838 * description="Delete a dental issue",
4839 * tags={"standard"},
4840 * @OA\Parameter(
4841 * name="pid",
4842 * in="path",
4843 * description="The id for the patient.",
4844 * required=true,
4845 * @OA\Schema(
4846 * type="string"
4848 * ),
4849 * @OA\Parameter(
4850 * name="did",
4851 * in="path",
4852 * description="The id for the dental issue.",
4853 * required=true,
4854 * @OA\Schema(
4855 * type="string"
4857 * ),
4858 * @OA\Response(
4859 * response="200",
4860 * ref="#/components/responses/standard"
4861 * ),
4862 * @OA\Response(
4863 * response="400",
4864 * ref="#/components/responses/badrequest"
4865 * ),
4866 * @OA\Response(
4867 * response="401",
4868 * ref="#/components/responses/unauthorized"
4869 * ),
4870 * security={{"openemr_auth":{}}}
4873 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4874 RestConfig::authorization_check("patients", "med");
4875 $return = (new ListRestController())->delete($pid, $did, "dental");
4876 RestConfig::apiLog($return);
4877 return $return;
4881 * Schema for the dental_issue request
4883 * @OA\Schema(
4884 * schema="api_dental_issue_request",
4885 * @OA\Property(
4886 * property="title",
4887 * description="The title of dental issue.",
4888 * type="string"
4889 * ),
4890 * @OA\Property(
4891 * property="begdate",
4892 * description="The beginning date of dental issue.",
4893 * type="string"
4894 * ),
4895 * @OA\Property(
4896 * property="enddate",
4897 * description="The end date of dental issue.",
4898 * type="string"
4899 * ),
4900 * @OA\Property(
4901 * property="diagnosis",
4902 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4903 * type="string"
4904 * ),
4905 * required={"title", "begdate"},
4906 * example={
4907 * "title": "Halitosis",
4908 * "begdate": "2015-03-17",
4909 * "enddate": null,
4914 * @OA\Post(
4915 * path="/api/patient/{pid}/dental_issue",
4916 * description="Submits a new dental issue",
4917 * tags={"standard"},
4918 * @OA\Parameter(
4919 * name="pid",
4920 * in="path",
4921 * description="The pid for the patient.",
4922 * required=true,
4923 * @OA\Schema(
4924 * type="string"
4926 * ),
4927 * @OA\RequestBody(
4928 * required=true,
4929 * @OA\MediaType(
4930 * mediaType="application/json",
4931 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4933 * ),
4934 * @OA\Response(
4935 * response="200",
4936 * ref="#/components/responses/standard"
4937 * ),
4938 * @OA\Response(
4939 * response="400",
4940 * ref="#/components/responses/badrequest"
4941 * ),
4942 * @OA\Response(
4943 * response="401",
4944 * ref="#/components/responses/unauthorized"
4945 * ),
4946 * security={{"openemr_auth":{}}}
4949 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4950 RestConfig::authorization_check("patients", "med");
4951 $data = (array) (json_decode(file_get_contents("php://input")));
4952 $return = (new ListRestController())->post($pid, "dental", $data);
4953 RestConfig::apiLog($return, $data);
4954 return $return;
4958 * @OA\Put(
4959 * path="/api/patient/{pid}/dental_issue/{did}",
4960 * description="Edit a dental issue",
4961 * tags={"standard"},
4962 * @OA\Parameter(
4963 * name="pid",
4964 * in="path",
4965 * description="The pid for the patient.",
4966 * required=true,
4967 * @OA\Schema(
4968 * type="string"
4970 * ),
4971 * @OA\Parameter(
4972 * name="did",
4973 * in="path",
4974 * description="The id for the dental issue.",
4975 * required=true,
4976 * @OA\Schema(
4977 * type="string"
4979 * ),
4980 * @OA\RequestBody(
4981 * required=true,
4982 * @OA\MediaType(
4983 * mediaType="application/json",
4984 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4986 * ),
4987 * @OA\Response(
4988 * response="200",
4989 * ref="#/components/responses/standard"
4990 * ),
4991 * @OA\Response(
4992 * response="400",
4993 * ref="#/components/responses/badrequest"
4994 * ),
4995 * @OA\Response(
4996 * response="401",
4997 * ref="#/components/responses/unauthorized"
4998 * ),
4999 * security={{"openemr_auth":{}}}
5002 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5003 RestConfig::authorization_check("patients", "med");
5004 $data = (array) (json_decode(file_get_contents("php://input")));
5005 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5006 RestConfig::apiLog($return, $data);
5007 return $return;
5011 * @OA\Get(
5012 * path="/api/patient/{pid}/appointment",
5013 * description="Retrieves all appointments for a patient",
5014 * tags={"standard"},
5015 * @OA\Parameter(
5016 * name="pid",
5017 * in="path",
5018 * description="The pid for the patient.",
5019 * required=true,
5020 * @OA\Schema(
5021 * type="string"
5023 * ),
5024 * @OA\Response(
5025 * response="200",
5026 * ref="#/components/responses/standard"
5027 * ),
5028 * @OA\Response(
5029 * response="400",
5030 * ref="#/components/responses/badrequest"
5031 * ),
5032 * @OA\Response(
5033 * response="401",
5034 * ref="#/components/responses/unauthorized"
5035 * ),
5036 * security={{"openemr_auth":{}}}
5039 "GET /api/patient/:pid/appointment" => function ($pid) {
5040 RestConfig::authorization_check("patients", "appt");
5041 $return = (new AppointmentRestController())->getAllForPatient($pid);
5042 RestConfig::apiLog($return);
5043 return $return;
5047 * @OA\Post(
5048 * path="/api/patient/{pid}/appointment",
5049 * description="Submits a new appointment",
5050 * tags={"standard"},
5051 * @OA\Parameter(
5052 * name="pid",
5053 * in="path",
5054 * description="The id for the patient.",
5055 * required=true,
5056 * @OA\Schema(
5057 * type="string"
5059 * ),
5060 * @OA\RequestBody(
5061 * required=true,
5062 * @OA\MediaType(
5063 * mediaType="application/json",
5064 * @OA\Schema(
5065 * @OA\Property(
5066 * property="pc_catid",
5067 * description="The category of the appointment.",
5068 * type="string"
5069 * ),
5070 * @OA\Property(
5071 * property="pc_title",
5072 * description="The title of the appointment.",
5073 * type="string"
5074 * ),
5075 * @OA\Property(
5076 * property="pc_duration",
5077 * description="The duration of the appointment.",
5078 * type="string"
5079 * ),
5080 * @OA\Property(
5081 * property="pc_hometext",
5082 * description="Comments for the appointment.",
5083 * type="string"
5084 * ),
5085 * @OA\Property(
5086 * property="pc_apptstatus",
5087 * description="use an option from resource=/api/list/apptstat",
5088 * type="string"
5089 * ),
5090 * @OA\Property(
5091 * property="pc_eventDate",
5092 * description="The date of the appointment.",
5093 * type="string"
5094 * ),
5095 * @OA\Property(
5096 * property="pc_startTime",
5097 * description="The time of the appointment.",
5098 * type="string"
5099 * ),
5100 * @OA\Property(
5101 * property="pc_facility",
5102 * description="The facility id of the appointment.",
5103 * type="string"
5104 * ),
5105 * @OA\Property(
5106 * property="pc_billing_location",
5107 * description="The billinag location id of the appointment.",
5108 * type="string"
5109 * ),
5110 * @OA\Property(
5111 * property="pc_aid",
5112 * description="The provider id for the appointment.",
5113 * type="string"
5114 * ),
5115 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5116 * example={
5117 * "pc_catid": "5",
5118 * "pc_title": "Office Visit",
5119 * "pc_duration": "900",
5120 * "pc_hometext": "Test",
5121 * "pc_apptstatus": "-",
5122 * "pc_eventDate": "2018-10-19",
5123 * "pc_startTime": "09:00",
5124 * "pc_facility": "9",
5125 * "pc_billing_location": "10",
5126 * "pc_aid": "1"
5130 * ),
5131 * @OA\Response(
5132 * response="200",
5133 * ref="#/components/responses/standard"
5134 * ),
5135 * @OA\Response(
5136 * response="400",
5137 * ref="#/components/responses/badrequest"
5138 * ),
5139 * @OA\Response(
5140 * response="401",
5141 * ref="#/components/responses/unauthorized"
5142 * ),
5143 * security={{"openemr_auth":{}}}
5146 "POST /api/patient/:pid/appointment" => function ($pid) {
5147 RestConfig::authorization_check("patients", "appt");
5148 $data = (array) (json_decode(file_get_contents("php://input")));
5149 $return = (new AppointmentRestController())->post($pid, $data);
5150 RestConfig::apiLog($return, $data);
5151 return $return;
5155 * @OA\Get(
5156 * path="/api/appointment",
5157 * description="Retrieves all appointments",
5158 * tags={"standard"},
5159 * @OA\Response(
5160 * response="200",
5161 * ref="#/components/responses/standard"
5162 * ),
5163 * @OA\Response(
5164 * response="400",
5165 * ref="#/components/responses/badrequest"
5166 * ),
5167 * @OA\Response(
5168 * response="401",
5169 * ref="#/components/responses/unauthorized"
5170 * ),
5171 * security={{"openemr_auth":{}}}
5174 "GET /api/appointment" => function () {
5175 RestConfig::authorization_check("patients", "appt");
5176 $return = (new AppointmentRestController())->getAll();
5177 RestConfig::apiLog($return);
5178 return $return;
5182 * @OA\Get(
5183 * path="/api/appointment/{eid}",
5184 * description="Retrieves an appointment",
5185 * tags={"standard"},
5186 * @OA\Parameter(
5187 * name="eid",
5188 * in="path",
5189 * description="The eid for the appointment.",
5190 * required=true,
5191 * @OA\Schema(
5192 * type="string"
5194 * ),
5195 * @OA\Response(
5196 * response="200",
5197 * ref="#/components/responses/standard"
5198 * ),
5199 * @OA\Response(
5200 * response="400",
5201 * ref="#/components/responses/badrequest"
5202 * ),
5203 * @OA\Response(
5204 * response="401",
5205 * ref="#/components/responses/unauthorized"
5206 * ),
5207 * security={{"openemr_auth":{}}}
5210 "GET /api/appointment/:eid" => function ($eid) {
5211 RestConfig::authorization_check("patients", "appt");
5212 $return = (new AppointmentRestController())->getOne($eid);
5213 RestConfig::apiLog($return);
5214 return $return;
5218 * @OA\Delete(
5219 * path="/api/patient/{pid}/appointment/{eid}",
5220 * description="Delete a appointment",
5221 * tags={"standard"},
5222 * @OA\Parameter(
5223 * name="pid",
5224 * in="path",
5225 * description="The id for the patient.",
5226 * required=true,
5227 * @OA\Schema(
5228 * type="string"
5230 * ),
5231 * @OA\Parameter(
5232 * name="eid",
5233 * in="path",
5234 * description="The eid for the appointment.",
5235 * required=true,
5236 * @OA\Schema(
5237 * type="string"
5239 * ),
5240 * @OA\Response(
5241 * response="200",
5242 * ref="#/components/responses/standard"
5243 * ),
5244 * @OA\Response(
5245 * response="400",
5246 * ref="#/components/responses/badrequest"
5247 * ),
5248 * @OA\Response(
5249 * response="401",
5250 * ref="#/components/responses/unauthorized"
5251 * ),
5252 * security={{"openemr_auth":{}}}
5255 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5256 RestConfig::authorization_check("patients", "appt");
5257 $return = (new AppointmentRestController())->delete($eid);
5258 RestConfig::apiLog($return);
5259 return $return;
5263 * @OA\Get(
5264 * path="/api/patient/{pid}/appointment/{eid}",
5265 * description="Retrieves a appointment for a patient",
5266 * tags={"standard"},
5267 * @OA\Parameter(
5268 * name="pid",
5269 * in="path",
5270 * description="The id for the patient.",
5271 * required=true,
5272 * @OA\Schema(
5273 * type="string"
5275 * ),
5276 * @OA\Parameter(
5277 * name="eid",
5278 * in="path",
5279 * description="The eid for the appointment.",
5280 * required=true,
5281 * @OA\Schema(
5282 * type="string"
5284 * ),
5285 * @OA\Response(
5286 * response="200",
5287 * ref="#/components/responses/standard"
5288 * ),
5289 * @OA\Response(
5290 * response="400",
5291 * ref="#/components/responses/badrequest"
5292 * ),
5293 * @OA\Response(
5294 * response="401",
5295 * ref="#/components/responses/unauthorized"
5296 * ),
5297 * security={{"openemr_auth":{}}}
5300 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5301 RestConfig::authorization_check("patients", "appt");
5302 $return = (new AppointmentRestController())->getOne($eid);
5303 RestConfig::apiLog($return);
5304 return $return;
5308 * @OA\Get(
5309 * path="/api/list/{list_name}",
5310 * description="Retrieves a list",
5311 * tags={"standard"},
5312 * @OA\Parameter(
5313 * name="list_name",
5314 * in="path",
5315 * description="The list_id of the list.",
5316 * required=true,
5317 * @OA\Schema(
5318 * type="string"
5320 * ),
5321 * @OA\Response(
5322 * response="200",
5323 * ref="#/components/responses/standard"
5324 * ),
5325 * @OA\Response(
5326 * response="400",
5327 * ref="#/components/responses/badrequest"
5328 * ),
5329 * @OA\Response(
5330 * response="401",
5331 * ref="#/components/responses/unauthorized"
5332 * ),
5333 * security={{"openemr_auth":{}}}
5336 "GET /api/list/:list_name" => function ($list_name) {
5337 RestConfig::authorization_check("lists", "default");
5338 $return = (new ListRestController())->getOptions($list_name);
5339 RestConfig::apiLog($return);
5340 return $return;
5344 * @OA\Get(
5345 * path="/api/version",
5346 * description="Retrieves the OpenEMR version information",
5347 * tags={"standard"},
5348 * @OA\Response(
5349 * response="200",
5350 * ref="#/components/responses/standard"
5351 * ),
5352 * @OA\Response(
5353 * response="400",
5354 * ref="#/components/responses/badrequest"
5355 * ),
5356 * @OA\Response(
5357 * response="401",
5358 * ref="#/components/responses/unauthorized"
5359 * ),
5360 * security={{"openemr_auth":{}}}
5363 "GET /api/version" => function () {
5364 $return = (new VersionRestController())->getOne();
5365 RestConfig::apiLog($return);
5366 return $return;
5370 * @OA\Get(
5371 * path="/api/product",
5372 * description="Retrieves the OpenEMR product registration information",
5373 * tags={"standard"},
5374 * @OA\Response(
5375 * response="200",
5376 * ref="#/components/responses/standard"
5377 * ),
5378 * @OA\Response(
5379 * response="400",
5380 * ref="#/components/responses/badrequest"
5381 * ),
5382 * @OA\Response(
5383 * response="401",
5384 * ref="#/components/responses/unauthorized"
5385 * ),
5386 * security={{"openemr_auth":{}}}
5389 "GET /api/product" => function () {
5390 $return = (new ProductRegistrationRestController())->getOne();
5391 RestConfig::apiLog($return);
5392 return $return;
5396 * @OA\Get(
5397 * path="/api/insurance_company",
5398 * description="Retrieves all insurance companies",
5399 * tags={"standard"},
5400 * @OA\Response(
5401 * response="200",
5402 * ref="#/components/responses/standard"
5403 * ),
5404 * @OA\Response(
5405 * response="400",
5406 * ref="#/components/responses/badrequest"
5407 * ),
5408 * @OA\Response(
5409 * response="401",
5410 * ref="#/components/responses/unauthorized"
5411 * ),
5412 * security={{"openemr_auth":{}}}
5415 "GET /api/insurance_company" => function () {
5416 $return = (new InsuranceCompanyRestController())->getAll();
5417 RestConfig::apiLog($return);
5418 return $return;
5422 * @OA\Get(
5423 * path="/api/insurance_company/{iid}",
5424 * description="Retrieves insurance company",
5425 * tags={"standard"},
5426 * @OA\Parameter(
5427 * name="iid",
5428 * in="path",
5429 * description="The id of the insurance company.",
5430 * required=true,
5431 * @OA\Schema(
5432 * type="string"
5434 * ),
5435 * @OA\Response(
5436 * response="200",
5437 * ref="#/components/responses/standard"
5438 * ),
5439 * @OA\Response(
5440 * response="400",
5441 * ref="#/components/responses/badrequest"
5442 * ),
5443 * @OA\Response(
5444 * response="401",
5445 * ref="#/components/responses/unauthorized"
5446 * ),
5447 * security={{"openemr_auth":{}}}
5450 "GET /api/insurance_company/:iid" => function ($iid) {
5451 $return = (new InsuranceCompanyRestController())->getOne($iid);
5452 RestConfig::apiLog($return);
5453 return $return;
5457 * @OA\Get(
5458 * path="/api/insurance_type",
5459 * description="Retrieves all insurance types",
5460 * tags={"standard"},
5461 * @OA\Response(
5462 * response="200",
5463 * ref="#/components/responses/standard"
5464 * ),
5465 * @OA\Response(
5466 * response="400",
5467 * ref="#/components/responses/badrequest"
5468 * ),
5469 * @OA\Response(
5470 * response="401",
5471 * ref="#/components/responses/unauthorized"
5472 * ),
5473 * security={{"openemr_auth":{}}}
5476 "GET /api/insurance_type" => function () {
5477 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5478 RestConfig::apiLog($return);
5479 return $return;
5483 * Schema for the insurance_company request
5485 * @OA\Schema(
5486 * schema="api_insurance_company_request",
5487 * @OA\Property(
5488 * property="name",
5489 * description="The name of insurance company.",
5490 * type="string"
5491 * ),
5492 * @OA\Property(
5493 * property="attn",
5494 * description="The attn of insurance company.",
5495 * type="string"
5496 * ),
5497 * @OA\Property(
5498 * property="cms_id",
5499 * description="The cms id of insurance company.",
5500 * type="string"
5501 * ),
5502 * @OA\Property(
5503 * property="ins_type_code",
5504 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5505 * type="string"
5506 * ),
5507 * @OA\Property(
5508 * property="x12_receiver_id",
5509 * description="The x12 receiver id of insurance company.",
5510 * type="string"
5511 * ),
5512 * @OA\Property(
5513 * property="x12_default_partner_id",
5514 * description="The x12 default partner id of insurance company.",
5515 * type="string"
5516 * ),
5517 * @OA\Property(
5518 * property="alt_cms_id",
5519 * description="The alternate cms id of insurance company.",
5520 * type="string"
5521 * ),
5522 * @OA\Property(
5523 * property="line1",
5524 * description="The line1 address of insurance company.",
5525 * type="string"
5526 * ),
5527 * @OA\Property(
5528 * property="line2",
5529 * description="The line2 address of insurance company.",
5530 * type="string"
5531 * ),
5532 * @OA\Property(
5533 * property="city",
5534 * description="The city of insurance company.",
5535 * type="string"
5536 * ),
5537 * @OA\Property(
5538 * property="state",
5539 * description="The state of insurance company.",
5540 * type="string"
5541 * ),
5542 * @OA\Property(
5543 * property="zip",
5544 * description="The zip of insurance company.",
5545 * type="string"
5546 * ),
5547 * @OA\Property(
5548 * property="country",
5549 * description="The country of insurance company.",
5550 * type="string"
5551 * ),
5552 * required={"name"},
5553 * example={
5554 * "name": "Cool Insurance Company",
5555 * "attn": null,
5556 * "cms_id": null,
5557 * "ins_type_code": "2",
5558 * "x12_receiver_id": null,
5559 * "x12_default_partner_id": null,
5560 * "alt_cms_id": "",
5561 * "line1": "123 Cool Lane",
5562 * "line2": "Suite 123",
5563 * "city": "Cooltown",
5564 * "state": "CA",
5565 * "zip": "12245",
5566 * "country": "USA"
5571 * @OA\Post(
5572 * path="/api/insurance_company",
5573 * description="Submits a new insurance company",
5574 * tags={"standard"},
5575 * @OA\RequestBody(
5576 * required=true,
5577 * @OA\MediaType(
5578 * mediaType="application/json",
5579 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5581 * ),
5582 * @OA\Response(
5583 * response="200",
5584 * ref="#/components/responses/standard"
5585 * ),
5586 * @OA\Response(
5587 * response="400",
5588 * ref="#/components/responses/badrequest"
5589 * ),
5590 * @OA\Response(
5591 * response="401",
5592 * ref="#/components/responses/unauthorized"
5593 * ),
5594 * security={{"openemr_auth":{}}}
5597 "POST /api/insurance_company" => function () {
5598 $data = (array) (json_decode(file_get_contents("php://input")));
5599 $return = (new InsuranceCompanyRestController())->post($data);
5600 RestConfig::apiLog($return, $data);
5601 return $return;
5605 * @OA\Put(
5606 * path="/api/insurance_company/{iid}",
5607 * description="Edit a insurance company",
5608 * tags={"standard"},
5609 * @OA\Parameter(
5610 * name="iid",
5611 * in="path",
5612 * description="The id for the insurance company.",
5613 * required=true,
5614 * @OA\Schema(
5615 * type="string"
5617 * ),
5618 * @OA\RequestBody(
5619 * required=true,
5620 * @OA\MediaType(
5621 * mediaType="application/json",
5622 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5624 * ),
5625 * @OA\Response(
5626 * response="200",
5627 * ref="#/components/responses/standard"
5628 * ),
5629 * @OA\Response(
5630 * response="400",
5631 * ref="#/components/responses/badrequest"
5632 * ),
5633 * @OA\Response(
5634 * response="401",
5635 * ref="#/components/responses/unauthorized"
5636 * ),
5637 * security={{"openemr_auth":{}}}
5640 "PUT /api/insurance_company/:iid" => function ($iid) {
5641 $data = (array) (json_decode(file_get_contents("php://input")));
5642 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5643 RestConfig::apiLog($return, $data);
5644 return $return;
5648 * @OA\Post(
5649 * path="/api/patient/{pid}/document",
5650 * description="Submits a new patient document",
5651 * tags={"standard"},
5652 * @OA\Parameter(
5653 * name="pid",
5654 * in="path",
5655 * description="The pid for the patient.",
5656 * required=true,
5657 * @OA\Schema(
5658 * type="string"
5660 * ),
5661 * @OA\Parameter(
5662 * name="path",
5663 * in="query",
5664 * description="The category of the document.",
5665 * required=true,
5666 * @OA\Schema(
5667 * type="string"
5669 * ),
5670 * @OA\RequestBody(
5671 * required=true,
5672 * @OA\MediaType(
5673 * mediaType="multipart/form-data",
5674 * @OA\Schema(
5675 * @OA\Property(
5676 * property="document",
5677 * description="document",
5678 * type="string",
5679 * format="binary"
5680 * ),
5681 * ),
5682 * ),
5683 * ),
5684 * @OA\Response(
5685 * response="200",
5686 * ref="#/components/responses/standard"
5687 * ),
5688 * @OA\Response(
5689 * response="400",
5690 * ref="#/components/responses/badrequest"
5691 * ),
5692 * @OA\Response(
5693 * response="401",
5694 * ref="#/components/responses/unauthorized"
5695 * ),
5696 * security={{"openemr_auth":{}}}
5699 "POST /api/patient/:pid/document" => function ($pid) {
5700 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5701 RestConfig::apiLog($return);
5702 return $return;
5706 * @OA\Get(
5707 * path="/api/patient/{pid}/document",
5708 * description="Retrieves all file information of documents from a category for a patient",
5709 * tags={"standard"},
5710 * @OA\Parameter(
5711 * name="pid",
5712 * in="path",
5713 * description="The pid for the patient.",
5714 * required=true,
5715 * @OA\Schema(
5716 * type="string"
5718 * ),
5719 * @OA\Parameter(
5720 * name="path",
5721 * in="query",
5722 * description="The category of the documents.",
5723 * required=true,
5724 * @OA\Schema(
5725 * type="string"
5727 * ),
5728 * @OA\Response(
5729 * response="200",
5730 * ref="#/components/responses/standard"
5731 * ),
5732 * @OA\Response(
5733 * response="400",
5734 * ref="#/components/responses/badrequest"
5735 * ),
5736 * @OA\Response(
5737 * response="401",
5738 * ref="#/components/responses/unauthorized"
5739 * ),
5740 * security={{"openemr_auth":{}}}
5743 "GET /api/patient/:pid/document" => function ($pid) {
5744 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5745 RestConfig::apiLog($return);
5746 return $return;
5750 * @OA\Get(
5751 * path="/api/patient/{pid}/document/{did}",
5752 * description="Retrieves a document for a patient",
5753 * tags={"standard"},
5754 * @OA\Parameter(
5755 * name="pid",
5756 * in="path",
5757 * description="The pid for the patient.",
5758 * required=true,
5759 * @OA\Schema(
5760 * type="string"
5762 * ),
5763 * @OA\Parameter(
5764 * name="did",
5765 * in="path",
5766 * description="The id for the patient document.",
5767 * required=true,
5768 * @OA\Schema(
5769 * type="string"
5771 * ),
5772 * @OA\Response(
5773 * response="200",
5774 * ref="#/components/responses/standard"
5775 * ),
5776 * @OA\Response(
5777 * response="400",
5778 * ref="#/components/responses/badrequest"
5779 * ),
5780 * @OA\Response(
5781 * response="401",
5782 * ref="#/components/responses/unauthorized"
5783 * ),
5784 * security={{"openemr_auth":{}}}
5787 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5788 $return = (new DocumentRestController())->downloadFile($pid, $did);
5789 RestConfig::apiLog($return);
5790 return $return;
5794 * @OA\Get(
5795 * path="/api/patient/{pid}/insurance",
5796 * description="Retrieves all insurances for a patient",
5797 * tags={"standard"},
5798 * @OA\Parameter(
5799 * name="pid",
5800 * in="path",
5801 * description="The pid for the patient.",
5802 * required=true,
5803 * @OA\Schema(
5804 * type="string"
5806 * ),
5807 * @OA\Response(
5808 * response="200",
5809 * ref="#/components/responses/standard"
5810 * ),
5811 * @OA\Response(
5812 * response="400",
5813 * ref="#/components/responses/badrequest"
5814 * ),
5815 * @OA\Response(
5816 * response="401",
5817 * ref="#/components/responses/unauthorized"
5818 * ),
5819 * security={{"openemr_auth":{}}}
5822 "GET /api/patient/:pid/insurance" => function ($pid) {
5823 $return = (new InsuranceRestController())->getAll($pid);
5824 RestConfig::apiLog($return);
5825 return $return;
5829 * @OA\Get(
5830 * path="/api/patient/{pid}/insurance/{type}",
5831 * description="Retrieves a insurance (by type) for a patient",
5832 * tags={"standard"},
5833 * @OA\Parameter(
5834 * name="pid",
5835 * in="path",
5836 * description="The pid for the patient.",
5837 * required=true,
5838 * @OA\Schema(
5839 * type="string"
5841 * ),
5842 * @OA\Parameter(
5843 * name="type",
5844 * in="path",
5845 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5846 * required=true,
5847 * @OA\Schema(
5848 * type="string"
5850 * ),
5851 * @OA\Response(
5852 * response="200",
5853 * ref="#/components/responses/standard"
5854 * ),
5855 * @OA\Response(
5856 * response="400",
5857 * ref="#/components/responses/badrequest"
5858 * ),
5859 * @OA\Response(
5860 * response="401",
5861 * ref="#/components/responses/unauthorized"
5862 * ),
5863 * security={{"openemr_auth":{}}}
5866 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5867 $return = (new InsuranceRestController())->getOne($pid, $type);
5868 RestConfig::apiLog($return);
5869 return $return;
5873 * Schema for the insurance request
5875 * @OA\Schema(
5876 * schema="api_insurance_request",
5877 * @OA\Property(
5878 * property="provider",
5879 * description="The insurance company id.",
5880 * type="string"
5881 * ),
5882 * @OA\Property(
5883 * property="plan_name",
5884 * description="The plan name of insurance.",
5885 * type="string"
5886 * ),
5887 * @OA\Property(
5888 * property="policy_number",
5889 * description="The policy number of insurance.",
5890 * type="string"
5891 * ),
5892 * @OA\Property(
5893 * property="group_number",
5894 * description="The group number of insurance.",
5895 * type="string"
5896 * ),
5897 * @OA\Property(
5898 * property="subscriber_lname",
5899 * description="The subscriber last name of insurance.",
5900 * type="string"
5901 * ),
5902 * @OA\Property(
5903 * property="subscriber_mname",
5904 * description="The subscriber middle name of insurance.",
5905 * type="string"
5906 * ),
5907 * @OA\Property(
5908 * property="subscriber_fname",
5909 * description="The subscriber first name of insurance.",
5910 * type="string"
5911 * ),
5912 * @OA\Property(
5913 * property="subscriber_relationship",
5914 * description="The subscriber relationship of insurance.",
5915 * type="string"
5916 * ),
5917 * @OA\Property(
5918 * property="subscriber_ss",
5919 * description="The subscriber ss number of insurance.",
5920 * type="string"
5921 * ),
5922 * @OA\Property(
5923 * property="subscriber_DOB",
5924 * description="The subscriber DOB of insurance.",
5925 * type="string"
5926 * ),
5927 * @OA\Property(
5928 * property="subscriber_street",
5929 * description="The subscriber street address of insurance.",
5930 * type="string"
5931 * ),
5932 * @OA\Property(
5933 * property="subscriber_postal_code",
5934 * description="The subscriber postal code of insurance.",
5935 * type="string"
5936 * ),
5937 * @OA\Property(
5938 * property="subscriber_city",
5939 * description="The subscriber city of insurance.",
5940 * type="string"
5941 * ),
5942 * @OA\Property(
5943 * property="subscriber_state",
5944 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5945 * type="string"
5946 * ),
5947 * @OA\Property(
5948 * property="subscriber_country",
5949 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5950 * type="string"
5951 * ),
5952 * @OA\Property(
5953 * property="subscriber_phone",
5954 * description="The subscriber phone of insurance.",
5955 * type="string"
5956 * ),
5957 * @OA\Property(
5958 * property="subscriber_employer",
5959 * description="The subscriber employer of insurance.",
5960 * type="string"
5961 * ),
5962 * @OA\Property(
5963 * property="subscriber_employer_street",
5964 * description="The subscriber employer street of insurance.",
5965 * type="string"
5966 * ),
5967 * @OA\Property(
5968 * property="subscriber_employer_postal_code",
5969 * description="The subscriber employer postal code of insurance.",
5970 * type="string"
5971 * ),
5972 * @OA\Property(
5973 * property="subscriber_employer_state",
5974 * description="The subscriber employer state of insurance.",
5975 * type="string"
5976 * ),
5977 * @OA\Property(
5978 * property="subscriber_employer_country",
5979 * description="The subscriber employer country of insurance.",
5980 * type="string"
5981 * ),
5982 * @OA\Property(
5983 * property="subscriber_employer_city",
5984 * description="The subscriber employer city of insurance.",
5985 * type="string"
5986 * ),
5987 * @OA\Property(
5988 * property="copay",
5989 * description="The copay of insurance.",
5990 * type="string"
5991 * ),
5992 * @OA\Property(
5993 * property="date",
5994 * description="The date of insurance.",
5995 * type="string"
5996 * ),
5997 * @OA\Property(
5998 * property="subscriber_sex",
5999 * description="The subscriber sex of insurance.",
6000 * type="string"
6001 * ),
6002 * @OA\Property(
6003 * property="accept_assignment",
6004 * description="The accept_assignment of insurance.",
6005 * type="string"
6006 * ),
6007 * @OA\Property(
6008 * property="policy_type",
6009 * description="The policy_type of insurance.",
6010 * type="string"
6011 * ),
6012 * required={"provider", "plan_name", "policy_number", "group_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_country", "subscriber_phone", "subscriber_sex", "accept_assignment", "policy_type"},
6013 * example={
6014 * "provider": "33",
6015 * "plan_name": "Some Plan",
6016 * "policy_number": "12345",
6017 * "group_number": "252412",
6018 * "subscriber_lname": "Tester",
6019 * "subscriber_mname": "Xi",
6020 * "subscriber_fname": "Foo",
6021 * "subscriber_relationship": "other",
6022 * "subscriber_ss": "234231234",
6023 * "subscriber_DOB": "2018-10-03",
6024 * "subscriber_street": "183 Cool St",
6025 * "subscriber_postal_code": "23418",
6026 * "subscriber_city": "Cooltown",
6027 * "subscriber_state": "AZ",
6028 * "subscriber_country": "USA",
6029 * "subscriber_phone": "234-598-2123",
6030 * "subscriber_employer": "Some Employer",
6031 * "subscriber_employer_street": "123 Heather Lane",
6032 * "subscriber_employer_postal_code": "23415",
6033 * "subscriber_employer_state": "AZ",
6034 * "subscriber_employer_country": "USA",
6035 * "subscriber_employer_city": "Cooltown",
6036 * "copay": "35",
6037 * "date": "2018-10-15",
6038 * "subscriber_sex": "Female",
6039 * "accept_assignment": "TRUE",
6040 * "policy_type": "a"
6045 * @OA\Post(
6046 * path="/api/patient/{pid}/insurance/{type}",
6047 * description="Submits a new patient insurance (with type)",
6048 * tags={"standard"},
6049 * @OA\Parameter(
6050 * name="pid",
6051 * in="path",
6052 * description="The pid for the patient.",
6053 * required=true,
6054 * @OA\Schema(
6055 * type="string"
6057 * ),
6058 * @OA\Parameter(
6059 * name="type",
6060 * in="path",
6061 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6062 * required=true,
6063 * @OA\Schema(
6064 * type="string"
6066 * ),
6067 * @OA\RequestBody(
6068 * required=true,
6069 * @OA\MediaType(
6070 * mediaType="application/json",
6071 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6073 * ),
6074 * @OA\Response(
6075 * response="200",
6076 * ref="#/components/responses/standard"
6077 * ),
6078 * @OA\Response(
6079 * response="400",
6080 * ref="#/components/responses/badrequest"
6081 * ),
6082 * @OA\Response(
6083 * response="401",
6084 * ref="#/components/responses/unauthorized"
6085 * ),
6086 * security={{"openemr_auth":{}}}
6089 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6090 $data = (array) (json_decode(file_get_contents("php://input")));
6091 $return = (new InsuranceRestController())->post($pid, $type, $data);
6092 RestConfig::apiLog($return, $data);
6093 return $return;
6097 * @OA\Put(
6098 * path="/api/patient/{pid}/insurance/{type}",
6099 * description="Edit a patient insurance (by type)",
6100 * tags={"standard"},
6101 * @OA\Parameter(
6102 * name="pid",
6103 * in="path",
6104 * description="The pid for the patient.",
6105 * required=true,
6106 * @OA\Schema(
6107 * type="string"
6109 * ),
6110 * @OA\Parameter(
6111 * name="type",
6112 * in="path",
6113 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6114 * required=true,
6115 * @OA\Schema(
6116 * type="string"
6118 * ),
6119 * @OA\RequestBody(
6120 * required=true,
6121 * @OA\MediaType(
6122 * mediaType="application/json",
6123 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6125 * ),
6126 * @OA\Response(
6127 * response="200",
6128 * ref="#/components/responses/standard"
6129 * ),
6130 * @OA\Response(
6131 * response="400",
6132 * ref="#/components/responses/badrequest"
6133 * ),
6134 * @OA\Response(
6135 * response="401",
6136 * ref="#/components/responses/unauthorized"
6137 * ),
6138 * security={{"openemr_auth":{}}}
6141 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6142 $data = (array) (json_decode(file_get_contents("php://input")));
6143 $return = (new InsuranceRestController())->put($pid, $type, $data);
6144 RestConfig::apiLog($return, $data);
6145 return $return;
6149 * Schema for the message request
6151 * @OA\Schema(
6152 * schema="api_message_request",
6153 * @OA\Property(
6154 * property="body",
6155 * description="The body of message.",
6156 * type="string"
6157 * ),
6158 * @OA\Property(
6159 * property="groupname",
6160 * description="The group name (usually is 'Default').",
6161 * type="string"
6162 * ),
6163 * @OA\Property(
6164 * property="from",
6165 * description="The sender of the message.",
6166 * type="string"
6167 * ),
6168 * @OA\Property(
6169 * property="to",
6170 * description="The recipient of the message.",
6171 * type="string"
6172 * ),
6173 * @OA\Property(
6174 * property="title",
6175 * description="use an option from resource=/api/list/note_type",
6176 * type="string"
6177 * ),
6178 * @OA\Property(
6179 * property="message_status",
6180 * description="use an option from resource=/api/list/message_status",
6181 * type="string"
6182 * ),
6183 * required={"body", "groupname", "from", "to", "title", "message_status"},
6184 * example={
6185 * "body": "Test 456",
6186 * "groupname": "Default",
6187 * "from": "Matthew",
6188 * "to": "admin",
6189 * "title": "Other",
6190 * "message_status": "New"
6195 * @OA\Post(
6196 * path="/api/patient/{pid}/message",
6197 * description="Submits a pnote message",
6198 * tags={"standard"},
6199 * @OA\Parameter(
6200 * name="pid",
6201 * in="path",
6202 * description="The id for the patient.",
6203 * required=true,
6204 * @OA\Schema(
6205 * type="string"
6207 * ),
6208 * @OA\RequestBody(
6209 * required=true,
6210 * @OA\MediaType(
6211 * mediaType="application/json",
6212 * @OA\Schema(ref="#/components/schemas/api_message_request")
6214 * ),
6215 * @OA\Response(
6216 * response="200",
6217 * ref="#/components/responses/standard"
6218 * ),
6219 * @OA\Response(
6220 * response="400",
6221 * ref="#/components/responses/badrequest"
6222 * ),
6223 * @OA\Response(
6224 * response="401",
6225 * ref="#/components/responses/unauthorized"
6226 * ),
6227 * security={{"openemr_auth":{}}}
6230 "POST /api/patient/:pid/message" => function ($pid) {
6231 RestConfig::authorization_check("patients", "notes");
6232 $data = (array) (json_decode(file_get_contents("php://input")));
6233 $return = (new MessageRestController())->post($pid, $data);
6234 RestConfig::apiLog($return, $data);
6235 return $return;
6240 * @OA\Put(
6241 * path="/api/patient/{pid}/message/{mid}",
6242 * description="Edit a pnote message",
6243 * tags={"standard"},
6244 * @OA\Parameter(
6245 * name="pid",
6246 * in="path",
6247 * description="The id for the patient.",
6248 * required=true,
6249 * @OA\Schema(
6250 * type="string"
6252 * ),
6253 * @OA\Parameter(
6254 * name="mid",
6255 * in="path",
6256 * description="The id for the pnote message.",
6257 * required=true,
6258 * @OA\Schema(
6259 * type="string"
6261 * ),
6262 * @OA\RequestBody(
6263 * required=true,
6264 * @OA\MediaType(
6265 * mediaType="application/json",
6266 * @OA\Schema(ref="#/components/schemas/api_message_request")
6268 * ),
6269 * @OA\Response(
6270 * response="200",
6271 * ref="#/components/responses/standard"
6272 * ),
6273 * @OA\Response(
6274 * response="400",
6275 * ref="#/components/responses/badrequest"
6276 * ),
6277 * @OA\Response(
6278 * response="401",
6279 * ref="#/components/responses/unauthorized"
6280 * ),
6281 * security={{"openemr_auth":{}}}
6284 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6285 RestConfig::authorization_check("patients", "notes");
6286 $data = (array) (json_decode(file_get_contents("php://input")));
6287 $return = (new MessageRestController())->put($pid, $mid, $data);
6288 RestConfig::apiLog($return, $data);
6289 return $return;
6293 * @OA\Delete(
6294 * path="/api/patient/{pid}/message/{mid}",
6295 * description="Delete a pnote message",
6296 * tags={"standard"},
6297 * @OA\Parameter(
6298 * name="pid",
6299 * in="path",
6300 * description="The id for the patient.",
6301 * required=true,
6302 * @OA\Schema(
6303 * type="string"
6305 * ),
6306 * @OA\Parameter(
6307 * name="eid",
6308 * in="path",
6309 * description="The id for the pnote message.",
6310 * required=true,
6311 * @OA\Schema(
6312 * type="string"
6314 * ),
6315 * @OA\Response(
6316 * response="200",
6317 * ref="#/components/responses/standard"
6318 * ),
6319 * @OA\Response(
6320 * response="400",
6321 * ref="#/components/responses/badrequest"
6322 * ),
6323 * @OA\Response(
6324 * response="401",
6325 * ref="#/components/responses/unauthorized"
6326 * ),
6327 * security={{"openemr_auth":{}}}
6330 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6331 RestConfig::authorization_check("patients", "notes");
6332 $return = (new MessageRestController())->delete($pid, $mid);
6333 RestConfig::apiLog($return);
6334 return $return;
6338 * @OA\Get(
6339 * path="/api/immunization",
6340 * description="Retrieves a list of immunizations",
6341 * tags={"standard"},
6342 * @OA\Parameter(
6343 * name="patient_id",
6344 * in="query",
6345 * description="The pid for the patient.",
6346 * required=false,
6347 * @OA\Schema(
6348 * type="string"
6350 * ),
6351 * @OA\Parameter(
6352 * name="id",
6353 * in="query",
6354 * description="The id for the immunization.",
6355 * required=false,
6356 * @OA\Schema(
6357 * type="string"
6359 * ),
6360 * @OA\Parameter(
6361 * name="uuid",
6362 * in="query",
6363 * description="The uuid for the immunization.",
6364 * required=false,
6365 * @OA\Schema(
6366 * type="string"
6368 * ),
6369 * @OA\Parameter(
6370 * name="administered_date",
6371 * in="query",
6372 * description="The administered date for the immunization.",
6373 * required=false,
6374 * @OA\Schema(
6375 * type="string"
6377 * ),
6378 * @OA\Parameter(
6379 * name="immunization_id",
6380 * in="query",
6381 * description="The immunization list_id for the immunization.",
6382 * required=false,
6383 * @OA\Schema(
6384 * type="string"
6386 * ),
6387 * @OA\Parameter(
6388 * name="cvx_code",
6389 * in="query",
6390 * description="The cvx code for the immunization.",
6391 * required=false,
6392 * @OA\Schema(
6393 * type="string"
6395 * ),
6396 * @OA\Parameter(
6397 * name="manufacturer",
6398 * in="query",
6399 * description="The manufacturer for the immunization.",
6400 * required=false,
6401 * @OA\Schema(
6402 * type="string"
6404 * ),
6405 * @OA\Parameter(
6406 * name="lot_number",
6407 * in="query",
6408 * description="The lot number for the immunization.",
6409 * required=false,
6410 * @OA\Schema(
6411 * type="string"
6413 * ),
6414 * @OA\Parameter(
6415 * name="administered_by_id",
6416 * in="query",
6417 * description="The administered by id for the immunization.",
6418 * required=false,
6419 * @OA\Schema(
6420 * type="string"
6422 * ),
6423 * @OA\Parameter(
6424 * name="administered_by",
6425 * in="query",
6426 * description="The administered by for the immunization.",
6427 * required=false,
6428 * @OA\Schema(
6429 * type="string"
6431 * ),
6432 * @OA\Parameter(
6433 * name="education_date",
6434 * in="query",
6435 * description="The education date for the immunization.",
6436 * required=false,
6437 * @OA\Schema(
6438 * type="string"
6440 * ),
6441 * @OA\Parameter(
6442 * name="vis_date",
6443 * in="query",
6444 * description="The vis date for the immunization.",
6445 * required=false,
6446 * @OA\Schema(
6447 * type="string"
6449 * ),
6450 * @OA\Parameter(
6451 * name="note",
6452 * in="query",
6453 * description="The note for the immunization.",
6454 * required=false,
6455 * @OA\Schema(
6456 * type="string"
6458 * ),
6459 * @OA\Parameter(
6460 * name="create_date",
6461 * in="query",
6462 * description="The create date for the immunization.",
6463 * required=false,
6464 * @OA\Schema(
6465 * type="string"
6467 * ),
6468 * @OA\Parameter(
6469 * name="update_date",
6470 * in="query",
6471 * description="The update date for the immunization.",
6472 * required=false,
6473 * @OA\Schema(
6474 * type="string"
6476 * ),
6477 * @OA\Parameter(
6478 * name="created_by",
6479 * in="query",
6480 * description="The created_by for the immunization.",
6481 * required=false,
6482 * @OA\Schema(
6483 * type="string"
6485 * ),
6486 * @OA\Parameter(
6487 * name="updated_by",
6488 * in="query",
6489 * description="The updated_by for the immunization.",
6490 * required=false,
6491 * @OA\Schema(
6492 * type="string"
6494 * ),
6495 * @OA\Parameter(
6496 * name="amount_administered",
6497 * in="query",
6498 * description="The amount administered for the immunization.",
6499 * required=false,
6500 * @OA\Schema(
6501 * type="string"
6503 * ),
6504 * @OA\Parameter(
6505 * name="amount_administered_unit",
6506 * in="query",
6507 * description="The amount administered unit for the immunization.",
6508 * required=false,
6509 * @OA\Schema(
6510 * type="string"
6512 * ),
6513 * @OA\Parameter(
6514 * name="expiration_date",
6515 * in="query",
6516 * description="The expiration date for the immunization.",
6517 * required=false,
6518 * @OA\Schema(
6519 * type="string"
6521 * ),
6522 * @OA\Parameter(
6523 * name="route",
6524 * in="query",
6525 * description="The route for the immunization.",
6526 * required=false,
6527 * @OA\Schema(
6528 * type="string"
6530 * ),
6531 * @OA\Parameter(
6532 * name="administration_site",
6533 * in="query",
6534 * description="The administration site for the immunization.",
6535 * required=false,
6536 * @OA\Schema(
6537 * type="string"
6539 * ),
6540 * @OA\Parameter(
6541 * name="added_erroneously",
6542 * in="query",
6543 * description="The added_erroneously for the immunization.",
6544 * required=false,
6545 * @OA\Schema(
6546 * type="string"
6548 * ),
6549 * @OA\Parameter(
6550 * name="external_id",
6551 * in="query",
6552 * description="The external_id for the immunization.",
6553 * required=false,
6554 * @OA\Schema(
6555 * type="string"
6557 * ),
6558 * @OA\Parameter(
6559 * name="completion_status",
6560 * in="query",
6561 * description="The completion status for the immunization.",
6562 * required=false,
6563 * @OA\Schema(
6564 * type="string"
6566 * ),
6567 * @OA\Parameter(
6568 * name="information_source",
6569 * in="query",
6570 * description="The information source for the immunization.",
6571 * required=false,
6572 * @OA\Schema(
6573 * type="string"
6575 * ),
6576 * @OA\Parameter(
6577 * name="refusal_reason",
6578 * in="query",
6579 * description="The refusal reason for the immunization.",
6580 * required=false,
6581 * @OA\Schema(
6582 * type="string"
6584 * ),
6585 * @OA\Parameter(
6586 * name="ordering_provider",
6587 * in="query",
6588 * description="The ordering provider for the immunization.",
6589 * required=false,
6590 * @OA\Schema(
6591 * type="string"
6593 * ),
6594 * @OA\Response(
6595 * response="200",
6596 * ref="#/components/responses/standard"
6597 * ),
6598 * @OA\Response(
6599 * response="400",
6600 * ref="#/components/responses/badrequest"
6601 * ),
6602 * @OA\Response(
6603 * response="401",
6604 * ref="#/components/responses/unauthorized"
6605 * ),
6606 * security={{"openemr_auth":{}}}
6609 "GET /api/immunization" => function () {
6610 RestConfig::authorization_check("patients", "med");
6611 $return = (new ImmunizationRestController())->getAll($_GET);
6612 RestConfig::apiLog($return);
6613 return $return;
6617 * @OA\Get(
6618 * path="/api/immunization/{uuid}",
6619 * description="Retrieves a immunization",
6620 * tags={"standard"},
6621 * @OA\Parameter(
6622 * name="uuid",
6623 * in="path",
6624 * description="The uuid for the immunization.",
6625 * required=true,
6626 * @OA\Schema(
6627 * type="string"
6629 * ),
6630 * @OA\Response(
6631 * response="200",
6632 * ref="#/components/responses/standard"
6633 * ),
6634 * @OA\Response(
6635 * response="400",
6636 * ref="#/components/responses/badrequest"
6637 * ),
6638 * @OA\Response(
6639 * response="401",
6640 * ref="#/components/responses/unauthorized"
6641 * ),
6642 * security={{"openemr_auth":{}}}
6645 "GET /api/immunization/:uuid" => function ($uuid) {
6646 RestConfig::authorization_check("patients", "med");
6647 $return = (new ImmunizationRestController())->getOne($uuid);
6648 RestConfig::apiLog($return);
6649 return $return;
6653 * @OA\Get(
6654 * path="/api/procedure",
6655 * description="Retrieves a list of all procedures",
6656 * tags={"standard"},
6657 * @OA\Response(
6658 * response="200",
6659 * ref="#/components/responses/standard"
6660 * ),
6661 * @OA\Response(
6662 * response="400",
6663 * ref="#/components/responses/badrequest"
6664 * ),
6665 * @OA\Response(
6666 * response="401",
6667 * ref="#/components/responses/unauthorized"
6668 * ),
6669 * security={{"openemr_auth":{}}}
6672 "GET /api/procedure" => function () {
6673 RestConfig::authorization_check("patients", "med");
6674 $return = (new ProcedureRestController())->getAll();
6675 RestConfig::apiLog($return);
6676 return $return;
6680 * @OA\Get(
6681 * path="/api/procedure/{uuid}",
6682 * description="Retrieves a procedure",
6683 * tags={"standard"},
6684 * @OA\Parameter(
6685 * name="uuid",
6686 * in="path",
6687 * description="The uuid for the procedure.",
6688 * required=true,
6689 * @OA\Schema(
6690 * type="string"
6692 * ),
6693 * @OA\Response(
6694 * response="200",
6695 * ref="#/components/responses/standard"
6696 * ),
6697 * @OA\Response(
6698 * response="400",
6699 * ref="#/components/responses/badrequest"
6700 * ),
6701 * @OA\Response(
6702 * response="401",
6703 * ref="#/components/responses/unauthorized"
6704 * ),
6705 * security={{"openemr_auth":{}}}
6708 "GET /api/procedure/:uuid" => function ($uuid) {
6709 RestConfig::authorization_check("patients", "med");
6710 $return = (new ProcedureRestController())->getOne($uuid);
6711 RestConfig::apiLog($return);
6712 return $return;
6716 * @OA\Get(
6717 * path="/api/drug",
6718 * description="Retrieves a list of all drugs",
6719 * tags={"standard"},
6720 * @OA\Response(
6721 * response="200",
6722 * ref="#/components/responses/standard"
6723 * ),
6724 * @OA\Response(
6725 * response="400",
6726 * ref="#/components/responses/badrequest"
6727 * ),
6728 * @OA\Response(
6729 * response="401",
6730 * ref="#/components/responses/unauthorized"
6731 * ),
6732 * security={{"openemr_auth":{}}}
6735 "GET /api/drug" => function () {
6736 RestConfig::authorization_check("patients", "med");
6737 $return = (new DrugRestController())->getAll();
6738 RestConfig::apiLog($return);
6739 return $return;
6743 * @OA\Get(
6744 * path="/api/drug/{uuid}",
6745 * description="Retrieves a drug",
6746 * tags={"standard"},
6747 * @OA\Parameter(
6748 * name="uuid",
6749 * in="path",
6750 * description="The uuid for the drug.",
6751 * required=true,
6752 * @OA\Schema(
6753 * type="string"
6755 * ),
6756 * @OA\Response(
6757 * response="200",
6758 * ref="#/components/responses/standard"
6759 * ),
6760 * @OA\Response(
6761 * response="400",
6762 * ref="#/components/responses/badrequest"
6763 * ),
6764 * @OA\Response(
6765 * response="401",
6766 * ref="#/components/responses/unauthorized"
6767 * ),
6768 * security={{"openemr_auth":{}}}
6771 "GET /api/drug/:uuid" => function ($uuid) {
6772 RestConfig::authorization_check("patients", "med");
6773 $return = (new DrugRestController())->getOne($uuid);
6774 RestConfig::apiLog($return);
6775 return $return;
6779 * @OA\Get(
6780 * path="/api/prescription",
6781 * description="Retrieves a list of all prescriptions",
6782 * tags={"standard"},
6783 * @OA\Response(
6784 * response="200",
6785 * ref="#/components/responses/standard"
6786 * ),
6787 * @OA\Response(
6788 * response="400",
6789 * ref="#/components/responses/badrequest"
6790 * ),
6791 * @OA\Response(
6792 * response="401",
6793 * ref="#/components/responses/unauthorized"
6794 * ),
6795 * security={{"openemr_auth":{}}}
6798 "GET /api/prescription" => function () {
6799 RestConfig::authorization_check("patients", "med");
6800 $return = (new PrescriptionRestController())->getAll();
6801 RestConfig::apiLog($return);
6802 return $return;
6806 * @OA\Get(
6807 * path="/api/prescription/{uuid}",
6808 * description="Retrieves a prescription",
6809 * tags={"standard"},
6810 * @OA\Parameter(
6811 * name="uuid",
6812 * in="path",
6813 * description="The uuid for the prescription.",
6814 * required=true,
6815 * @OA\Schema(
6816 * type="string"
6818 * ),
6819 * @OA\Response(
6820 * response="200",
6821 * ref="#/components/responses/standard"
6822 * ),
6823 * @OA\Response(
6824 * response="400",
6825 * ref="#/components/responses/badrequest"
6826 * ),
6827 * @OA\Response(
6828 * response="401",
6829 * ref="#/components/responses/unauthorized"
6830 * ),
6831 * security={{"openemr_auth":{}}}
6834 "GET /api/prescription/:uuid" => function ($uuid) {
6835 RestConfig::authorization_check("patients", "med");
6836 $return = (new PrescriptionRestController())->getOne($uuid);
6837 RestConfig::apiLog($return);
6838 return $return;
6842 use OpenEMR\Common\Http\StatusCode;
6843 use OpenEMR\Common\Http\Psr17Factory;
6844 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
6845 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
6846 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
6847 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
6848 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
6849 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
6850 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
6851 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
6852 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
6853 use OpenEMR\RestControllers\FHIR\FhirExportRestController;
6854 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
6855 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
6856 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
6857 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
6858 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
6859 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
6860 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
6861 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
6862 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
6863 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
6864 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
6865 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
6866 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
6867 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
6868 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
6870 // Note that the fhir route includes both user role and patient role
6871 // (there is a mechanism in place to ensure patient role is binded
6872 // to only see the data of the one patient)
6873 RestConfig::$FHIR_ROUTE_MAP = array(
6875 * @OA\Get(
6876 * path="/fhir/AllergyIntolerance",
6877 * description="Returns a list of AllergyIntolerance resources.",
6878 * tags={"fhir"},
6879 * @OA\Parameter(
6880 * name="_id",
6881 * in="query",
6882 * description="The uuid for the AllergyIntolerance resource.",
6883 * required=false,
6884 * @OA\Schema(
6885 * type="string"
6887 * ),
6888 * @OA\Parameter(
6889 * name="patient",
6890 * in="query",
6891 * description="The uuid for the patient.",
6892 * required=false,
6893 * @OA\Schema(
6894 * type="string"
6896 * ),
6897 * @OA\Response(
6898 * response="200",
6899 * description="Standard Response",
6900 * @OA\MediaType(
6901 * mediaType="application/json",
6902 * @OA\Schema(
6903 * @OA\Property(
6904 * property="json object",
6905 * description="FHIR Json object.",
6906 * type="object"
6907 * ),
6908 * example={
6909 * "meta": {
6910 * "lastUpdated": "2021-09-14T09:13:51"
6911 * },
6912 * "resourceType": "Bundle",
6913 * "type": "collection",
6914 * "total": 0,
6915 * "link": {
6917 * "relation": "self",
6918 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
6924 * ),
6925 * @OA\Response(
6926 * response="400",
6927 * ref="#/components/responses/badrequest"
6928 * ),
6929 * @OA\Response(
6930 * response="401",
6931 * ref="#/components/responses/unauthorized"
6932 * ),
6933 * security={{"openemr_auth":{}}}
6936 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
6937 $getParams = $request->getQueryParams();
6938 if ($request->isPatientRequest()) {
6939 // only allow access to data of binded patient
6940 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
6941 } else {
6942 RestConfig::authorization_check("patients", "med");
6943 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
6945 RestConfig::apiLog($return);
6946 return $return;
6950 * @OA\Get(
6951 * path="/fhir/AllergyIntolerance/{uuid}",
6952 * description="Returns a single AllergyIntolerance resource.",
6953 * tags={"fhir"},
6954 * @OA\Parameter(
6955 * name="uuid",
6956 * in="path",
6957 * description="The uuid for the AllergyIntolerance resource.",
6958 * required=true,
6959 * @OA\Schema(
6960 * type="string"
6962 * ),
6963 * @OA\Response(
6964 * response="200",
6965 * description="Standard Response",
6966 * @OA\MediaType(
6967 * mediaType="application/json",
6968 * @OA\Schema(
6969 * @OA\Property(
6970 * property="json object",
6971 * description="FHIR Json object.",
6972 * type="object"
6973 * ),
6974 * example={
6975 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
6976 * "meta": {
6977 * "versionId": "1",
6978 * "lastUpdated": "2021-09-16T00:27:32+00:00"
6979 * },
6980 * "resourceType": "AllergyIntolerance",
6981 * "text": {
6982 * "status": "additional",
6983 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
6984 * },
6985 * "clinicalStatus": {
6986 * "coding": {
6988 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
6989 * "code": "active",
6990 * "display": "Active"
6993 * },
6994 * "verificationStatus": {
6995 * "coding": {
6997 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
6998 * "code": "confirmed",
6999 * "display": "Confirmed"
7002 * },
7003 * "category": {
7004 * "medication"
7005 * },
7006 * "criticality": "low",
7007 * "code": {
7008 * "coding": {
7010 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7011 * "code": "unknown",
7012 * "display": "Unknown"
7015 * },
7016 * "patient": {
7017 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7018 * },
7019 * "reaction": {
7021 * "manifestation": {
7023 * "coding": {
7025 * "system": "http://snomed.info/sct",
7026 * "code": "422587007",
7027 * "display": "Nausea"
7029 * },
7030 * "text": "Nausea"
7038 * ),
7039 * @OA\Response(
7040 * response="400",
7041 * ref="#/components/responses/badrequest"
7042 * ),
7043 * @OA\Response(
7044 * response="401",
7045 * ref="#/components/responses/unauthorized"
7046 * ),
7047 * @OA\Response(
7048 * response="404",
7049 * ref="#/components/responses/uuidnotfound"
7050 * ),
7051 * security={{"openemr_auth":{}}}
7054 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7055 if ($request->isPatientRequest()) {
7056 // only allow access to data of binded patient
7057 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7058 } else {
7059 RestConfig::authorization_check("patients", "med");
7060 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7062 RestConfig::apiLog($return);
7063 return $return;
7067 * @OA\Get(
7068 * path="/fhir/CarePlan",
7069 * description="Returns a list of CarePlan resources.",
7070 * tags={"fhir"},
7071 * @OA\Parameter(
7072 * name="_id",
7073 * in="query",
7074 * description="The uuid for the CarePlan resource.",
7075 * required=false,
7076 * @OA\Schema(
7077 * type="string"
7079 * ),
7080 * @OA\Parameter(
7081 * name="patient",
7082 * in="query",
7083 * description="The uuid for the patient.",
7084 * required=false,
7085 * @OA\Schema(
7086 * type="string"
7088 * ),
7089 * @OA\Parameter(
7090 * name="category",
7091 * in="query",
7092 * description="The category of the CarePlan resource.",
7093 * required=false,
7094 * @OA\Schema(
7095 * type="string"
7097 * ),
7098 * @OA\Response(
7099 * response="200",
7100 * description="Standard Response",
7101 * @OA\MediaType(
7102 * mediaType="application/json",
7103 * @OA\Schema(
7104 * @OA\Property(
7105 * property="json object",
7106 * description="FHIR Json object.",
7107 * type="object"
7108 * ),
7109 * example={
7110 * "meta": {
7111 * "lastUpdated": "2021-09-14T09:13:51"
7112 * },
7113 * "resourceType": "Bundle",
7114 * "type": "collection",
7115 * "total": 0,
7116 * "link": {
7118 * "relation": "self",
7119 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7125 * ),
7126 * @OA\Response(
7127 * response="400",
7128 * ref="#/components/responses/badrequest"
7129 * ),
7130 * @OA\Response(
7131 * response="401",
7132 * ref="#/components/responses/unauthorized"
7133 * ),
7134 * security={{"openemr_auth":{}}}
7137 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7138 $getParams = $request->getQueryParams();
7139 if ($request->isPatientRequest()) {
7140 // only allow access to data of binded patient
7141 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7142 } else {
7143 RestConfig::authorization_check("patients", "med");
7144 $return = (new FhirCarePlanRestController())->getAll($getParams);
7146 RestConfig::apiLog($return);
7147 return $return;
7151 * @OA\Get(
7152 * path="/fhir/CarePlan/{uuid}",
7153 * description="Returns a single CarePlan resource.",
7154 * tags={"fhir"},
7155 * @OA\Parameter(
7156 * name="uuid",
7157 * in="path",
7158 * description="The uuid for the CarePlan resource.",
7159 * required=true,
7160 * @OA\Schema(
7161 * type="string"
7163 * ),
7164 * @OA\Response(
7165 * response="200",
7166 * description="Standard Response",
7167 * @OA\MediaType(
7168 * mediaType="application/json",
7169 * @OA\Schema(
7170 * @OA\Property(
7171 * property="json object",
7172 * description="FHIR Json object.",
7173 * type="object"
7174 * ),
7175 * example={
7176 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7177 * "meta": {
7178 * "versionId": "1",
7179 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7180 * },
7181 * "resourceType": "CarePlan",
7182 * "text": {
7183 * "status": "generated",
7184 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7185 * },
7186 * "status": "active",
7187 * "intent": "plan",
7188 * "category": {
7190 * "coding": {
7192 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7193 * "code": "assess-plan"
7197 * },
7198 * "description": "Treat flu.",
7199 * "subject": {
7200 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7201 * "type": "Patient"
7206 * ),
7207 * @OA\Response(
7208 * response="400",
7209 * ref="#/components/responses/badrequest"
7210 * ),
7211 * @OA\Response(
7212 * response="401",
7213 * ref="#/components/responses/unauthorized"
7214 * ),
7215 * @OA\Response(
7216 * response="404",
7217 * ref="#/components/responses/uuidnotfound"
7218 * ),
7219 * security={{"openemr_auth":{}}}
7222 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7223 if ($request->isPatientRequest()) {
7224 // only allow access to data of binded patient
7225 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7226 } else {
7227 RestConfig::authorization_check("patients", "med");
7228 $return = (new FhirCarePlanRestController())->getOne($uuid);
7230 RestConfig::apiLog($return);
7231 return $return;
7235 * @OA\Get(
7236 * path="/fhir/CareTeam",
7237 * description="Returns a list of CareTeam resources.",
7238 * tags={"fhir"},
7239 * @OA\Parameter(
7240 * name="_id",
7241 * in="query",
7242 * description="The uuid for the CareTeam resource.",
7243 * required=false,
7244 * @OA\Schema(
7245 * type="string"
7247 * ),
7248 * @OA\Parameter(
7249 * name="patient",
7250 * in="query",
7251 * description="The uuid for the patient.",
7252 * required=false,
7253 * @OA\Schema(
7254 * type="string"
7256 * ),
7257 * @OA\Parameter(
7258 * name="status",
7259 * in="query",
7260 * description="The status of the CarePlan resource.",
7261 * required=false,
7262 * @OA\Schema(
7263 * type="string"
7265 * ),
7266 * @OA\Response(
7267 * response="200",
7268 * description="Standard Response",
7269 * @OA\MediaType(
7270 * mediaType="application/json",
7271 * @OA\Schema(
7272 * @OA\Property(
7273 * property="json object",
7274 * description="FHIR Json object.",
7275 * type="object"
7276 * ),
7277 * example={
7278 * "meta": {
7279 * "lastUpdated": "2021-09-14T09:13:51"
7280 * },
7281 * "resourceType": "Bundle",
7282 * "type": "collection",
7283 * "total": 0,
7284 * "link": {
7286 * "relation": "self",
7287 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7293 * ),
7294 * @OA\Response(
7295 * response="400",
7296 * ref="#/components/responses/badrequest"
7297 * ),
7298 * @OA\Response(
7299 * response="401",
7300 * ref="#/components/responses/unauthorized"
7301 * ),
7302 * security={{"openemr_auth":{}}}
7305 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
7306 $getParams = $request->getQueryParams();
7307 if ($request->isPatientRequest()) {
7308 // only allow access to data of binded patient
7309 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7310 } else {
7311 RestConfig::authorization_check("patients", "med");
7312 $return = (new FhirCareTeamRestController())->getAll($getParams);
7314 RestConfig::apiLog($return);
7315 return $return;
7319 * @OA\Get(
7320 * path="/fhir/CareTeam/{uuid}",
7321 * description="Returns a single CareTeam resource.",
7322 * tags={"fhir"},
7323 * @OA\Parameter(
7324 * name="uuid",
7325 * in="path",
7326 * description="The uuid for the CareTeam resource.",
7327 * required=true,
7328 * @OA\Schema(
7329 * type="string"
7331 * ),
7332 * @OA\Response(
7333 * response="200",
7334 * description="Standard Response",
7335 * @OA\MediaType(
7336 * mediaType="application/json",
7337 * @OA\Schema(
7338 * @OA\Property(
7339 * property="json object",
7340 * description="FHIR Json object.",
7341 * type="object"
7342 * ),
7343 * example={
7344 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7345 * "meta": {
7346 * "versionId": "1",
7347 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7348 * },
7349 * "resourceType": "CareTeam",
7350 * "status": "active",
7351 * "subject": {
7352 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7353 * "type": "Patient"
7354 * },
7355 * "participant": {
7357 * "role": {
7359 * "coding": {
7361 * "system": "http://nucc.org/provider-taxonomy",
7362 * "code": "102L00000X",
7363 * "display": "Psychoanalyst"
7367 * },
7368 * "member": {
7369 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7370 * "type": "Practitioner"
7371 * },
7372 * "onBehalfOf": {
7373 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7374 * "type": "Organization"
7376 * },
7378 * "role": {
7380 * "coding": {
7382 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7383 * "code": "unknown",
7384 * "display": "Unknown"
7388 * },
7389 * "member": {
7390 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7391 * "type": "Organization"
7398 * ),
7399 * @OA\Response(
7400 * response="400",
7401 * ref="#/components/responses/badrequest"
7402 * ),
7403 * @OA\Response(
7404 * response="401",
7405 * ref="#/components/responses/unauthorized"
7406 * ),
7407 * @OA\Response(
7408 * response="404",
7409 * ref="#/components/responses/uuidnotfound"
7410 * ),
7411 * security={{"openemr_auth":{}}}
7414 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
7415 if ($request->isPatientRequest()) {
7416 // only allow access to data of binded patient
7417 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7418 } else {
7419 RestConfig::authorization_check("patients", "med");
7420 $return = (new FhirCareTeamRestController())->getOne($uuid);
7422 RestConfig::apiLog($return);
7423 return $return;
7427 * @OA\Get(
7428 * path="/fhir/Condition",
7429 * description="Returns a list of Condition resources.",
7430 * tags={"fhir"},
7431 * @OA\Parameter(
7432 * name="_id",
7433 * in="query",
7434 * description="The uuid for the Condition resource.",
7435 * required=false,
7436 * @OA\Schema(
7437 * type="string"
7439 * ),
7440 * @OA\Parameter(
7441 * name="patient",
7442 * in="query",
7443 * description="The uuid for the patient.",
7444 * required=false,
7445 * @OA\Schema(
7446 * type="string"
7448 * ),
7449 * @OA\Response(
7450 * response="200",
7451 * description="Standard Response",
7452 * @OA\MediaType(
7453 * mediaType="application/json",
7454 * @OA\Schema(
7455 * @OA\Property(
7456 * property="json object",
7457 * description="FHIR Json object.",
7458 * type="object"
7459 * ),
7460 * example={
7461 * "meta": {
7462 * "lastUpdated": "2021-09-14T09:13:51"
7463 * },
7464 * "resourceType": "Bundle",
7465 * "type": "collection",
7466 * "total": 0,
7467 * "link": {
7469 * "relation": "self",
7470 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7476 * ),
7477 * @OA\Response(
7478 * response="400",
7479 * ref="#/components/responses/badrequest"
7480 * ),
7481 * @OA\Response(
7482 * response="401",
7483 * ref="#/components/responses/unauthorized"
7484 * ),
7485 * security={{"openemr_auth":{}}}
7488 "GET /fhir/Condition" => function (HttpRestRequest $request) {
7489 $getParams = $request->getQueryParams();
7490 if ($request->isPatientRequest()) {
7491 // only allow access to data of binded patient
7492 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7493 } else {
7494 RestConfig::authorization_check("patients", "med");
7495 $return = (new FhirConditionRestController())->getAll($getParams);
7497 RestConfig::apiLog($return);
7498 return $return;
7502 * @OA\Get(
7503 * path="/fhir/Condition/{uuid}",
7504 * description="Returns a single Condition resource.",
7505 * tags={"fhir"},
7506 * @OA\Parameter(
7507 * name="uuid",
7508 * in="path",
7509 * description="The uuid for the Condition resource.",
7510 * required=true,
7511 * @OA\Schema(
7512 * type="string"
7514 * ),
7515 * @OA\Response(
7516 * response="200",
7517 * description="Standard Response",
7518 * @OA\MediaType(
7519 * mediaType="application/json",
7520 * @OA\Schema(
7521 * @OA\Property(
7522 * property="json object",
7523 * description="FHIR Json object.",
7524 * type="object"
7525 * ),
7526 * example={
7527 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7528 * "meta": {
7529 * "versionId": "1",
7530 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7531 * },
7532 * "resourceType": "Condition",
7533 * "clinicalStatus": {
7534 * "coding": {
7536 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7537 * "code": "inactive",
7538 * "display": "Inactive"
7541 * },
7542 * "verificationStatus": {
7543 * "coding": {
7545 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7546 * "code": "unconfirmed",
7547 * "display": "Unconfirmed"
7550 * },
7551 * "category": {
7553 * "coding": {
7555 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7556 * "code": "problem-list-item",
7557 * "display": "Problem List Item"
7561 * },
7562 * "code": {
7563 * "coding": {
7565 * "system": "http://snomed.info/sct",
7566 * "code": "444814009",
7567 * "display": ""
7570 * },
7571 * "subject": {
7572 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7577 * ),
7578 * @OA\Response(
7579 * response="400",
7580 * ref="#/components/responses/badrequest"
7581 * ),
7582 * @OA\Response(
7583 * response="401",
7584 * ref="#/components/responses/unauthorized"
7585 * ),
7586 * @OA\Response(
7587 * response="404",
7588 * ref="#/components/responses/uuidnotfound"
7589 * ),
7590 * security={{"openemr_auth":{}}}
7593 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
7594 if ($request->isPatientRequest()) {
7595 // only allow access to data of binded patient
7596 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7597 } else {
7598 RestConfig::authorization_check("patients", "med");
7599 $return = (new FhirConditionRestController())->getOne($uuid);
7601 RestConfig::apiLog($return);
7602 return $return;
7606 * @OA\Get(
7607 * path="/fhir/Coverage",
7608 * description="Returns a list of Coverage resources.",
7609 * tags={"fhir"},
7610 * @OA\Parameter(
7611 * name="_id",
7612 * in="query",
7613 * description="The uuid for the Coverage resource.",
7614 * required=false,
7615 * @OA\Schema(
7616 * type="string"
7618 * ),
7619 * @OA\Parameter(
7620 * name="patient",
7621 * in="query",
7622 * description="The uuid for the patient.",
7623 * required=false,
7624 * @OA\Schema(
7625 * type="string"
7627 * ),
7628 * @OA\Parameter(
7629 * name="payor",
7630 * in="query",
7631 * description="The payor of the Coverage resource.",
7632 * required=false,
7633 * @OA\Schema(
7634 * type="string"
7636 * ),
7637 * @OA\Response(
7638 * response="200",
7639 * description="Standard Response",
7640 * @OA\MediaType(
7641 * mediaType="application/json",
7642 * @OA\Schema(
7643 * @OA\Property(
7644 * property="json object",
7645 * description="FHIR Json object.",
7646 * type="object"
7647 * ),
7648 * example={
7649 * "meta": {
7650 * "lastUpdated": "2021-09-14T09:13:51"
7651 * },
7652 * "resourceType": "Bundle",
7653 * "type": "collection",
7654 * "total": 0,
7655 * "link": {
7657 * "relation": "self",
7658 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7664 * ),
7665 * @OA\Response(
7666 * response="400",
7667 * ref="#/components/responses/badrequest"
7668 * ),
7669 * @OA\Response(
7670 * response="401",
7671 * ref="#/components/responses/unauthorized"
7672 * ),
7673 * security={{"openemr_auth":{}}}
7677 * TODO
7678 * 1. Broken when trying to search with parameters.
7680 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
7681 RestConfig::authorization_check("admin", "super");
7682 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7683 RestConfig::apiLog($return);
7684 return $return;
7688 * @OA\Get(
7689 * path="/fhir/Coverage/{uuid}",
7690 * description="Returns a single Coverage resource.",
7691 * tags={"fhir"},
7692 * @OA\Parameter(
7693 * name="uuid",
7694 * in="path",
7695 * description="The uuid for the Coverage resource.",
7696 * required=true,
7697 * @OA\Schema(
7698 * type="string"
7700 * ),
7701 * @OA\Response(
7702 * response="200",
7703 * ref="#/components/responses/standard"
7704 * ),
7705 * @OA\Response(
7706 * response="400",
7707 * ref="#/components/responses/badrequest"
7708 * ),
7709 * @OA\Response(
7710 * response="401",
7711 * ref="#/components/responses/unauthorized"
7712 * ),
7713 * @OA\Response(
7714 * response="404",
7715 * ref="#/components/responses/uuidnotfound"
7716 * ),
7717 * security={{"openemr_auth":{}}}
7721 * TODO
7722 * 1. Broken. Fix and then add standard response example.
7724 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
7725 RestConfig::authorization_check("admin", "super");
7726 $return = (new FhirCoverageRestController())->getOne($uuid);
7727 RestConfig::apiLog($return);
7728 return $return;
7732 * @OA\Get(
7733 * path="/fhir/Device",
7734 * description="Returns a list of Device resources.",
7735 * tags={"fhir"},
7736 * @OA\Parameter(
7737 * name="_id",
7738 * in="query",
7739 * description="The uuid for the Device resource.",
7740 * required=false,
7741 * @OA\Schema(
7742 * type="string"
7744 * ),
7745 * @OA\Parameter(
7746 * name="patient",
7747 * in="query",
7748 * description="The uuid for the patient.",
7749 * required=false,
7750 * @OA\Schema(
7751 * type="string"
7753 * ),
7754 * @OA\Response(
7755 * response="200",
7756 * description="Standard Response",
7757 * @OA\MediaType(
7758 * mediaType="application/json",
7759 * @OA\Schema(
7760 * @OA\Property(
7761 * property="json object",
7762 * description="FHIR Json object.",
7763 * type="object"
7764 * ),
7765 * example={
7766 * "meta": {
7767 * "lastUpdated": "2021-09-14T09:13:51"
7768 * },
7769 * "resourceType": "Bundle",
7770 * "type": "collection",
7771 * "total": 0,
7772 * "link": {
7774 * "relation": "self",
7775 * "url": "https://localhost:9300/apis/default/fhir/Device"
7781 * ),
7782 * @OA\Response(
7783 * response="400",
7784 * ref="#/components/responses/badrequest"
7785 * ),
7786 * @OA\Response(
7787 * response="401",
7788 * ref="#/components/responses/unauthorized"
7789 * ),
7790 * security={{"openemr_auth":{}}}
7793 "GET /fhir/Device" => function (HttpRestRequest $request) {
7794 if ($request->isPatientRequest()) {
7795 // only allow access to data of binded patient
7796 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7797 } else {
7798 RestConfig::authorization_check("admin", "super");
7799 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
7801 RestConfig::apiLog($return);
7802 return $return;
7806 * @OA\Get(
7807 * path="/fhir/Device/{uuid}",
7808 * description="Returns a single Device resource.",
7809 * tags={"fhir"},
7810 * @OA\Parameter(
7811 * name="uuid",
7812 * in="path",
7813 * description="The uuid for the Device resource.",
7814 * required=true,
7815 * @OA\Schema(
7816 * type="string"
7818 * ),
7819 * @OA\Response(
7820 * response="200",
7821 * description="Standard Response",
7822 * @OA\MediaType(
7823 * mediaType="application/json",
7824 * @OA\Schema(
7825 * @OA\Property(
7826 * property="json object",
7827 * description="FHIR Json object.",
7828 * type="object"
7829 * ),
7830 * example={
7831 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
7832 * "meta": {
7833 * "versionId": "1",
7834 * "lastUpdated": "2021-09-18T19:28:59+00:00"
7835 * },
7836 * "resourceType": "Device",
7837 * "udiCarrier": {
7839 * "deviceIdentifier": "08717648200274",
7840 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
7842 * },
7843 * "distinctIdentifier": "A99971312345600",
7844 * "manufactureDate": "2013-02-01",
7845 * "expirationDate": "2014-02-01",
7846 * "lotNumber": "000000000000XYZ123",
7847 * "serialNumber": "000025",
7848 * "type": {
7849 * "extension": {
7851 * "valueCode": "unknown",
7852 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
7855 * },
7856 * "patient": {
7857 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
7858 * "type": "Patient"
7863 * ),
7864 * @OA\Response(
7865 * response="400",
7866 * ref="#/components/responses/badrequest"
7867 * ),
7868 * @OA\Response(
7869 * response="401",
7870 * ref="#/components/responses/unauthorized"
7871 * ),
7872 * @OA\Response(
7873 * response="404",
7874 * ref="#/components/responses/uuidnotfound"
7875 * ),
7876 * security={{"openemr_auth":{}}}
7879 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
7880 if ($request->isPatientRequest()) {
7881 // only allow access to data of binded patient
7882 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
7883 } else {
7884 RestConfig::authorization_check("admin", "super");
7885 $return = (new FhirDeviceRestController())->getOne($uuid);
7887 RestConfig::apiLog($return);
7888 return $return;
7892 * @OA\Get(
7893 * path="/fhir/DiagnosticReport",
7894 * description="Returns a list of DiagnosticReport resources.",
7895 * tags={"fhir"},
7896 * @OA\Parameter(
7897 * name="_id",
7898 * in="query",
7899 * description="The uuid for the DiagnosticReport resource.",
7900 * required=false,
7901 * @OA\Schema(
7902 * type="string"
7904 * ),
7905 * @OA\Parameter(
7906 * name="patient",
7907 * in="query",
7908 * description="The uuid for the patient.",
7909 * required=false,
7910 * @OA\Schema(
7911 * type="string"
7913 * ),
7914 * @OA\Parameter(
7915 * name="code",
7916 * in="query",
7917 * description="The code of the DiagnosticReport resource.",
7918 * required=false,
7919 * @OA\Schema(
7920 * type="string"
7922 * ),
7923 * @OA\Parameter(
7924 * name="category",
7925 * in="query",
7926 * description="The category of the DiagnosticReport resource.",
7927 * required=false,
7928 * @OA\Schema(
7929 * type="string"
7931 * ),
7932 * @OA\Parameter(
7933 * name="date",
7934 * in="query",
7935 * description="The datetime of the DiagnosticReport resource.",
7936 * required=false,
7937 * @OA\Schema(
7938 * type="string"
7940 * ),
7941 * @OA\Response(
7942 * response="200",
7943 * description="Standard Response",
7944 * @OA\MediaType(
7945 * mediaType="application/json",
7946 * @OA\Schema(
7947 * @OA\Property(
7948 * property="json object",
7949 * description="FHIR Json object.",
7950 * type="object"
7951 * ),
7952 * example={
7953 * "meta": {
7954 * "lastUpdated": "2021-09-14T09:13:51"
7955 * },
7956 * "resourceType": "Bundle",
7957 * "type": "collection",
7958 * "total": 0,
7959 * "link": {
7961 * "relation": "self",
7962 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
7968 * ),
7969 * @OA\Response(
7970 * response="400",
7971 * ref="#/components/responses/badrequest"
7972 * ),
7973 * @OA\Response(
7974 * response="401",
7975 * ref="#/components/responses/unauthorized"
7976 * ),
7977 * security={{"openemr_auth":{}}}
7980 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
7981 $getParams = $request->getQueryParams();
7982 if ($request->isPatientRequest()) {
7983 // only allow access to data of binded patient
7984 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
7985 } else {
7986 RestConfig::authorization_check("admin", "super");
7987 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
7989 RestConfig::apiLog($return);
7990 return $return;
7994 * @OA\Get(
7995 * path="/fhir/DiagnosticReport/{uuid}",
7996 * description="Returns a single DiagnosticReport resource.",
7997 * tags={"fhir"},
7998 * @OA\Parameter(
7999 * name="uuid",
8000 * in="path",
8001 * description="The uuid for the DiagnosticReport resource.",
8002 * required=true,
8003 * @OA\Schema(
8004 * type="string"
8006 * ),
8007 * @OA\Response(
8008 * response="200",
8009 * description="Standard Response",
8010 * @OA\MediaType(
8011 * mediaType="application/json",
8012 * @OA\Schema(
8013 * @OA\Property(
8014 * property="json object",
8015 * description="FHIR Json object.",
8016 * type="object"
8017 * ),
8018 * example={
8019 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8020 * "meta": {
8021 * "versionId": "1",
8022 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8023 * },
8024 * "resourceType": "DiagnosticReport",
8025 * "status": "final",
8026 * "category": {
8028 * "coding": {
8030 * "system": "http://loinc.org",
8031 * "code": "LP7839-6",
8032 * "display": "Pathology"
8036 * },
8037 * "code": {
8038 * "coding": {
8040 * "system": "http://loinc.org",
8041 * "code": "11502-2",
8042 * "display": "Laboratory report"
8045 * },
8046 * "subject": {
8047 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8048 * "type": "Patient"
8049 * },
8050 * "encounter": {
8051 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8052 * "type": "Encounter"
8053 * },
8054 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8055 * "issued": "2015-06-22T00:00:00+00:00",
8056 * "performer": {
8058 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8059 * "type": "Organization"
8061 * },
8062 * "presentedForm": {
8064 * "contentType": "text/plain",
8065 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8071 * ),
8072 * @OA\Response(
8073 * response="400",
8074 * ref="#/components/responses/badrequest"
8075 * ),
8076 * @OA\Response(
8077 * response="401",
8078 * ref="#/components/responses/unauthorized"
8079 * ),
8080 * @OA\Response(
8081 * response="404",
8082 * ref="#/components/responses/uuidnotfound"
8083 * ),
8084 * security={{"openemr_auth":{}}}
8087 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8088 $getParams = $request->getQueryParams();
8089 if ($request->isPatientRequest()) {
8090 // only allow access to data of binded patient
8091 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8092 } else {
8093 RestConfig::authorization_check("admin", "super");
8094 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8096 RestConfig::apiLog($return);
8097 return $return;
8101 * @OA\Get(
8102 * path="/fhir/DocumentReference",
8103 * description="Returns a list of DocumentReference resources.",
8104 * tags={"fhir"},
8105 * @OA\Parameter(
8106 * name="_id",
8107 * in="query",
8108 * description="The uuid for the DocumentReference resource.",
8109 * required=false,
8110 * @OA\Schema(
8111 * type="string"
8113 * ),
8114 * @OA\Parameter(
8115 * name="patient",
8116 * in="query",
8117 * description="The uuid for the patient.",
8118 * required=false,
8119 * @OA\Schema(
8120 * type="string"
8122 * ),
8123 * @OA\Parameter(
8124 * name="type",
8125 * in="query",
8126 * description="The type of the DocumentReference resource.",
8127 * required=false,
8128 * @OA\Schema(
8129 * type="string"
8131 * ),
8132 * @OA\Parameter(
8133 * name="category",
8134 * in="query",
8135 * description="The category of the DocumentReference resource.",
8136 * required=false,
8137 * @OA\Schema(
8138 * type="string"
8140 * ),
8141 * @OA\Parameter(
8142 * name="date",
8143 * in="query",
8144 * description="The datetime of the DocumentReference resource.",
8145 * required=false,
8146 * @OA\Schema(
8147 * type="string"
8149 * ),
8150 * @OA\Response(
8151 * response="200",
8152 * description="Standard Response",
8153 * @OA\MediaType(
8154 * mediaType="application/json",
8155 * @OA\Schema(
8156 * @OA\Property(
8157 * property="json object",
8158 * description="FHIR Json object.",
8159 * type="object"
8160 * ),
8161 * example={
8162 * "meta": {
8163 * "lastUpdated": "2021-09-14T09:13:51"
8164 * },
8165 * "resourceType": "Bundle",
8166 * "type": "collection",
8167 * "total": 0,
8168 * "link": {
8170 * "relation": "self",
8171 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8177 * ),
8178 * @OA\Response(
8179 * response="400",
8180 * ref="#/components/responses/badrequest"
8181 * ),
8182 * @OA\Response(
8183 * response="401",
8184 * ref="#/components/responses/unauthorized"
8185 * ),
8186 * security={{"openemr_auth":{}}}
8189 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8190 $getParams = $request->getQueryParams();
8191 if ($request->isPatientRequest()) {
8192 // only allow access to data of binded patient
8193 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8194 } else {
8195 RestConfig::authorization_check("admin", "super");
8196 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8198 RestConfig::apiLog($return);
8199 return $return;
8203 * @OA\Get(
8204 * path="/fhir/DocumentReference/{uuid}",
8205 * description="Returns a single DocumentReference resource.",
8206 * tags={"fhir"},
8207 * @OA\Parameter(
8208 * name="uuid",
8209 * in="path",
8210 * description="The uuid for the DocumentReference resource.",
8211 * required=true,
8212 * @OA\Schema(
8213 * type="string"
8215 * ),
8216 * @OA\Response(
8217 * response="200",
8218 * description="Standard Response",
8219 * @OA\MediaType(
8220 * mediaType="application/json",
8221 * @OA\Schema(
8222 * @OA\Property(
8223 * property="json object",
8224 * description="FHIR Json object.",
8225 * type="object"
8226 * ),
8227 * example={
8228 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8229 * "meta": {
8230 * "versionId": "1",
8231 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8232 * },
8233 * "resourceType": "DocumentReference",
8234 * "identifier": {
8236 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8238 * },
8239 * "status": "current",
8240 * "type": {
8241 * "coding": {
8243 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8244 * "code": "UNK",
8245 * "display": "unknown"
8248 * },
8249 * "category": {
8251 * "coding": {
8253 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8254 * "code": "openemr-document",
8255 * "display": "OpenEMR Document"
8259 * },
8260 * "subject": {
8261 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8262 * "type": "Patient"
8263 * },
8264 * "date": "2021-09-19T03:15:56+00:00",
8265 * "author": {
8266 * null
8267 * },
8268 * "content": {
8270 * "attachment": {
8271 * "contentType": "image/gif",
8272 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8273 * },
8274 * "format": {
8275 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8276 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8277 * "display": "mimeType Sufficient"
8284 * ),
8285 * @OA\Response(
8286 * response="400",
8287 * ref="#/components/responses/badrequest"
8288 * ),
8289 * @OA\Response(
8290 * response="401",
8291 * ref="#/components/responses/unauthorized"
8292 * ),
8293 * @OA\Response(
8294 * response="404",
8295 * ref="#/components/responses/uuidnotfound"
8296 * ),
8297 * security={{"openemr_auth":{}}}
8300 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
8301 $getParams = $request->getQueryParams();
8302 if ($request->isPatientRequest()) {
8303 // only allow access to data of binded patient
8304 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8305 } else {
8306 RestConfig::authorization_check("admin", "super");
8307 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8309 RestConfig::apiLog($return);
8310 return $return;
8314 * @OA\Get(
8315 * path="/fhir/Document/{id}/Binary",
8316 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8317 * tags={"fhir"},
8318 * @OA\Parameter(
8319 * name="id",
8320 * in="path",
8321 * description="The id for the Document.",
8322 * required=true,
8323 * @OA\Schema(
8324 * type="string"
8326 * ),
8327 * @OA\Response(
8328 * response="200",
8329 * ref="#/components/responses/standard"
8330 * ),
8331 * @OA\Response(
8332 * response="400",
8333 * ref="#/components/responses/badrequest"
8334 * ),
8335 * @OA\Response(
8336 * response="401",
8337 * ref="#/components/responses/unauthorized"
8338 * ),
8339 * security={{"openemr_auth":{}}}
8343 * TODO
8345 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest $request) {
8346 // currently only allow users with the same permissions as export to take a file out
8347 // this could be relaxed to allow other types of files ie such as patient access etc.
8348 RestConfig::authorization_check("admin", "users");
8350 // Grab the document id
8351 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
8352 $response = $docController->downloadDocument($documentId, $request->getRequestUserId());
8353 return $response;
8357 * @OA\Get(
8358 * path="/fhir/Encounter",
8359 * description="Returns a list of Encounter resources.",
8360 * tags={"fhir"},
8361 * @OA\Parameter(
8362 * name="_id",
8363 * in="query",
8364 * description="The uuid for the Encounter resource.",
8365 * required=false,
8366 * @OA\Schema(
8367 * type="string"
8369 * ),
8370 * @OA\Parameter(
8371 * name="patient",
8372 * in="query",
8373 * description="The uuid for the patient.",
8374 * required=false,
8375 * @OA\Schema(
8376 * type="string"
8378 * ),
8379 * @OA\Parameter(
8380 * name="date",
8381 * in="query",
8382 * description="The datetime of the Encounter resource.",
8383 * required=false,
8384 * @OA\Schema(
8385 * type="string"
8387 * ),
8388 * @OA\Response(
8389 * response="200",
8390 * description="Standard Response",
8391 * @OA\MediaType(
8392 * mediaType="application/json",
8393 * @OA\Schema(
8394 * @OA\Property(
8395 * property="json object",
8396 * description="FHIR Json object.",
8397 * type="object"
8398 * ),
8399 * example={
8400 * "meta": {
8401 * "lastUpdated": "2021-09-14T09:13:51"
8402 * },
8403 * "resourceType": "Bundle",
8404 * "type": "collection",
8405 * "total": 0,
8406 * "link": {
8408 * "relation": "self",
8409 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8415 * ),
8416 * @OA\Response(
8417 * response="400",
8418 * ref="#/components/responses/badrequest"
8419 * ),
8420 * @OA\Response(
8421 * response="401",
8422 * ref="#/components/responses/unauthorized"
8423 * ),
8424 * security={{"openemr_auth":{}}}
8427 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
8428 $getParams = $request->getQueryParams();
8429 if ($request->isPatientRequest()) {
8430 // only allow access to data of binded patient
8431 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8432 } else {
8433 RestConfig::authorization_check("encounters", "auth_a");
8434 $return = (new FhirEncounterRestController())->getAll($getParams);
8436 RestConfig::apiLog($return);
8437 return $return;
8441 * @OA\Get(
8442 * path="/fhir/Encounter/{uuid}",
8443 * description="Returns a single Encounter resource.",
8444 * tags={"fhir"},
8445 * @OA\Parameter(
8446 * name="uuid",
8447 * in="path",
8448 * description="The uuid for the Encounter resource.",
8449 * required=true,
8450 * @OA\Schema(
8451 * type="string"
8453 * ),
8454 * @OA\Response(
8455 * response="200",
8456 * description="Standard Response",
8457 * @OA\MediaType(
8458 * mediaType="application/json",
8459 * @OA\Schema(
8460 * @OA\Property(
8461 * property="json object",
8462 * description="FHIR Json object.",
8463 * type="object"
8464 * ),
8465 * example={
8466 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8467 * "meta": {
8468 * "versionId": "1",
8469 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8470 * },
8471 * "resourceType": "Encounter",
8472 * "identifier": {
8474 * "system": "urn:ietf:rfc:3986",
8475 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8477 * },
8478 * "status": "finished",
8479 * "class": {
8480 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8481 * "code": "AMB",
8482 * "display": "ambulatory"
8483 * },
8484 * "type": {
8486 * "coding": {
8488 * "system": "http://snomed.info/sct",
8489 * "code": "185349003",
8490 * "display": "Encounter for check up (procedure)"
8494 * },
8495 * "subject": {
8496 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8497 * "type": "Patient"
8498 * },
8499 * "participant": {
8501 * "type": {
8503 * "coding": {
8505 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8506 * "code": "PPRF",
8507 * "display": "Primary Performer"
8511 * },
8512 * "period": {
8513 * "start": "2012-08-13T00:00:00+00:00"
8514 * },
8515 * "individual": {
8516 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8517 * "type": "Practitioner"
8520 * },
8521 * "period": {
8522 * "start": "2012-08-13T00:00:00+00:00"
8527 * ),
8528 * @OA\Response(
8529 * response="400",
8530 * ref="#/components/responses/badrequest"
8531 * ),
8532 * @OA\Response(
8533 * response="401",
8534 * ref="#/components/responses/unauthorized"
8535 * ),
8536 * @OA\Response(
8537 * response="404",
8538 * ref="#/components/responses/uuidnotfound"
8539 * ),
8540 * security={{"openemr_auth":{}}}
8543 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
8544 if ($request->isPatientRequest()) {
8545 // only allow access to data of binded patient
8546 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8547 } else {
8548 RestConfig::authorization_check("admin", "super");
8549 $return = (new FhirEncounterRestController())->getOne($uuid);
8551 RestConfig::apiLog($return);
8552 return $return;
8556 * @OA\Get(
8557 * path="/fhir/Goal",
8558 * description="Returns a list of Condition resources.",
8559 * tags={"fhir"},
8560 * @OA\Parameter(
8561 * name="_id",
8562 * in="query",
8563 * description="The uuid for the Goal resource.",
8564 * required=false,
8565 * @OA\Schema(
8566 * type="string"
8568 * ),
8569 * @OA\Parameter(
8570 * name="patient",
8571 * in="query",
8572 * description="The uuid for the patient.",
8573 * required=false,
8574 * @OA\Schema(
8575 * type="string"
8577 * ),
8578 * @OA\Response(
8579 * response="200",
8580 * description="Standard Response",
8581 * @OA\MediaType(
8582 * mediaType="application/json",
8583 * @OA\Schema(
8584 * @OA\Property(
8585 * property="json object",
8586 * description="FHIR Json object.",
8587 * type="object"
8588 * ),
8589 * example={
8590 * "meta": {
8591 * "lastUpdated": "2021-09-14T09:13:51"
8592 * },
8593 * "resourceType": "Bundle",
8594 * "type": "collection",
8595 * "total": 0,
8596 * "link": {
8598 * "relation": "self",
8599 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8605 * ),
8606 * @OA\Response(
8607 * response="400",
8608 * ref="#/components/responses/badrequest"
8609 * ),
8610 * @OA\Response(
8611 * response="401",
8612 * ref="#/components/responses/unauthorized"
8613 * ),
8614 * security={{"openemr_auth":{}}}
8617 "GET /fhir/Goal" => function (HttpRestRequest $request) {
8618 $getParams = $request->getQueryParams();
8619 if ($request->isPatientRequest()) {
8620 // only allow access to data of binded patient
8621 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8622 } else {
8623 RestConfig::authorization_check("admin", "super");
8624 $return = (new FhirGoalRestController())->getAll($getParams);
8626 RestConfig::apiLog($return);
8627 return $return;
8631 * @OA\Get(
8632 * path="/fhir/Goal/{uuid}",
8633 * description="Returns a single Goal resource.",
8634 * tags={"fhir"},
8635 * @OA\Parameter(
8636 * name="uuid",
8637 * in="path",
8638 * description="The uuid for the Goal resource.",
8639 * required=true,
8640 * @OA\Schema(
8641 * type="string"
8643 * ),
8644 * @OA\Response(
8645 * response="200",
8646 * description="Standard Response",
8647 * @OA\MediaType(
8648 * mediaType="application/json",
8649 * @OA\Schema(
8650 * @OA\Property(
8651 * property="json object",
8652 * description="FHIR Json object.",
8653 * type="object"
8654 * ),
8655 * example={
8656 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8657 * "meta": {
8658 * "versionId": "1",
8659 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8660 * },
8661 * "resourceType": "Goal",
8662 * "lifecycleStatus": "active",
8663 * "description": {
8664 * "text": "Eating more vegetables."
8665 * },
8666 * "subject": {
8667 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8668 * "type": "Patient"
8669 * },
8670 * "target": {
8672 * "measure": {
8673 * "extension": {
8675 * "valueCode": "unknown",
8676 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8679 * },
8680 * "detailString": "Eating more vegetables.",
8681 * "dueDate": "2021-09-09"
8687 * ),
8688 * @OA\Response(
8689 * response="400",
8690 * ref="#/components/responses/badrequest"
8691 * ),
8692 * @OA\Response(
8693 * response="401",
8694 * ref="#/components/responses/unauthorized"
8695 * ),
8696 * @OA\Response(
8697 * response="404",
8698 * ref="#/components/responses/uuidnotfound"
8699 * ),
8700 * security={{"openemr_auth":{}}}
8703 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
8704 if ($request->isPatientRequest()) {
8705 // only allow access to data of binded patient
8706 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
8707 } else {
8708 RestConfig::authorization_check("admin", "super");
8709 $return = (new FhirGoalRestController())->getOne($uuid);
8711 RestConfig::apiLog($return);
8712 return $return;
8716 * @OA\Get(
8717 * path="/fhir/Group",
8718 * description="Returns a list of Group resources.",
8719 * tags={"fhir"},
8720 * @OA\Parameter(
8721 * name="_id",
8722 * in="query",
8723 * description="The uuid for the Group resource.",
8724 * required=false,
8725 * @OA\Schema(
8726 * type="string"
8728 * ),
8729 * @OA\Parameter(
8730 * name="patient",
8731 * in="query",
8732 * description="The uuid for the patient.",
8733 * required=false,
8734 * @OA\Schema(
8735 * type="string"
8737 * ),
8738 * @OA\Response(
8739 * response="200",
8740 * description="Standard Response",
8741 * @OA\MediaType(
8742 * mediaType="application/json",
8743 * @OA\Schema(
8744 * @OA\Property(
8745 * property="json object",
8746 * description="FHIR Json object.",
8747 * type="object"
8748 * ),
8749 * example={
8750 * "meta": {
8751 * "lastUpdated": "2021-09-14T09:13:51"
8752 * },
8753 * "resourceType": "Bundle",
8754 * "type": "collection",
8755 * "total": 0,
8756 * "link": {
8758 * "relation": "self",
8759 * "url": "https://localhost:9300/apis/default/fhir/Group"
8765 * ),
8766 * @OA\Response(
8767 * response="400",
8768 * ref="#/components/responses/badrequest"
8769 * ),
8770 * @OA\Response(
8771 * response="401",
8772 * ref="#/components/responses/unauthorized"
8773 * ),
8774 * security={{"openemr_auth":{}}}
8778 * TODO
8780 'GET /fhir/Group' => function (HttpRestRequest $request) {
8781 RestConfig::authorization_check("admin", "users");
8782 $getParams = $request->getQueryParams();
8783 if ($request->isPatientRequest()) {
8784 // only allow access to data of binded patient
8785 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
8786 } else {
8787 $return = (new FhirGroupRestController())->getAll($getParams);
8789 RestConfig::apiLog($return);
8790 return $return;
8794 * @OA\Get(
8795 * path="/fhir/Group/{uuid}",
8796 * description="Returns a single Group resource.",
8797 * tags={"fhir"},
8798 * @OA\Parameter(
8799 * name="uuid",
8800 * in="path",
8801 * description="The uuid for the Group resource.",
8802 * required=true,
8803 * @OA\Schema(
8804 * type="string"
8806 * ),
8807 * @OA\Response(
8808 * response="200",
8809 * ref="#/components/responses/standard"
8810 * ),
8811 * @OA\Response(
8812 * response="400",
8813 * ref="#/components/responses/badrequest"
8814 * ),
8815 * @OA\Response(
8816 * response="401",
8817 * ref="#/components/responses/unauthorized"
8818 * ),
8819 * @OA\Response(
8820 * response="404",
8821 * ref="#/components/responses/uuidnotfound"
8822 * ),
8823 * security={{"openemr_auth":{}}}
8827 * TODO
8829 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
8830 RestConfig::authorization_check("admin", "users");
8831 if ($request->isPatientRequest()) {
8832 // only allow access to data of binded patient
8833 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
8834 } else {
8835 $return = (new FhirGroupRestController())->getOne($uuid);
8837 RestConfig::apiLog($return);
8838 return $return;
8842 * @OA\Get(
8843 * path="/fhir/Group/{id}/$export",
8844 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8845 * tags={"fhir"},
8846 * @OA\Response(
8847 * response="200",
8848 * ref="#/components/responses/standard"
8849 * ),
8850 * @OA\Response(
8851 * response="400",
8852 * ref="#/components/responses/badrequest"
8853 * ),
8854 * @OA\Response(
8855 * response="401",
8856 * ref="#/components/responses/unauthorized"
8857 * ),
8858 * security={{"openemr_auth":{}}}
8862 * TODO
8864 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
8865 RestConfig::authorization_check("admin", "users");
8866 $fhirExportService = new FhirExportRestController($request);
8867 $exportParams = $request->getQueryParams();
8868 $exportParams['groupId'] = $groupId;
8869 $return = $fhirExportService->processExport(
8870 $exportParams,
8871 'Group',
8872 $request->getHeader('Accept'),
8873 $request->getHeader('Prefer')
8875 RestConfig::apiLog($return);
8876 return $return;
8880 * @OA\Get(
8881 * path="/fhir/Immunization",
8882 * description="Returns a list of Immunization resources.",
8883 * tags={"fhir"},
8884 * @OA\Parameter(
8885 * name="_id",
8886 * in="query",
8887 * description="The uuid for the Immunization resource.",
8888 * required=false,
8889 * @OA\Schema(
8890 * type="string"
8892 * ),
8893 * @OA\Parameter(
8894 * name="patient",
8895 * in="query",
8896 * description="The uuid for the patient.",
8897 * required=false,
8898 * @OA\Schema(
8899 * type="string"
8901 * ),
8902 * @OA\Response(
8903 * response="200",
8904 * description="Standard Response",
8905 * @OA\MediaType(
8906 * mediaType="application/json",
8907 * @OA\Schema(
8908 * @OA\Property(
8909 * property="json object",
8910 * description="FHIR Json object.",
8911 * type="object"
8912 * ),
8913 * example={
8914 * "meta": {
8915 * "lastUpdated": "2021-09-14T09:13:51"
8916 * },
8917 * "resourceType": "Bundle",
8918 * "type": "collection",
8919 * "total": 0,
8920 * "link": {
8922 * "relation": "self",
8923 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
8929 * ),
8930 * @OA\Response(
8931 * response="400",
8932 * ref="#/components/responses/badrequest"
8933 * ),
8934 * @OA\Response(
8935 * response="401",
8936 * ref="#/components/responses/unauthorized"
8937 * ),
8938 * security={{"openemr_auth":{}}}
8942 * TODO
8943 * 1. Broken sql query.
8945 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
8946 $getParams = $request->getQueryParams();
8947 if ($request->isPatientRequest()) {
8948 // only allow access to data of binded patient
8949 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
8950 } else {
8951 RestConfig::authorization_check("patients", "med");
8952 $return = (new FhirImmunizationRestController())->getAll($getParams);
8954 RestConfig::apiLog($return);
8955 return $return;
8959 * @OA\Get(
8960 * path="/fhir/Immunization/{uuid}",
8961 * description="Returns a single Immunization resource.",
8962 * tags={"fhir"},
8963 * @OA\Parameter(
8964 * name="uuid",
8965 * in="path",
8966 * description="The uuid for the Immunization resource.",
8967 * required=true,
8968 * @OA\Schema(
8969 * type="string"
8971 * ),
8972 * @OA\Response(
8973 * response="200",
8974 * ref="#/components/responses/standard"
8975 * ),
8976 * @OA\Response(
8977 * response="400",
8978 * ref="#/components/responses/badrequest"
8979 * ),
8980 * @OA\Response(
8981 * response="401",
8982 * ref="#/components/responses/unauthorized"
8983 * ),
8984 * @OA\Response(
8985 * response="404",
8986 * ref="#/components/responses/uuidnotfound"
8987 * ),
8988 * security={{"openemr_auth":{}}}
8992 * TODO
8993 * 1. Broken sql query.
8995 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
8996 if ($request->isPatientRequest()) {
8997 // only allow access to data of binded patient
8998 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
8999 } else {
9000 RestConfig::authorization_check("patients", "med");
9001 $return = (new FhirImmunizationRestController())->getOne($uuid);
9003 RestConfig::apiLog($return);
9004 return $return;
9008 * @OA\Get(
9009 * path="/fhir/Location",
9010 * description="Returns a list of Location resources.",
9011 * tags={"fhir"},
9012 * @OA\Parameter(
9013 * name="_id",
9014 * in="query",
9015 * description="The uuid for the Location resource.",
9016 * required=false,
9017 * @OA\Schema(
9018 * type="string"
9020 * ),
9021 * @OA\Response(
9022 * response="200",
9023 * description="Standard Response",
9024 * @OA\MediaType(
9025 * mediaType="application/json",
9026 * @OA\Schema(
9027 * @OA\Property(
9028 * property="json object",
9029 * description="FHIR Json object.",
9030 * type="object"
9031 * ),
9032 * example={
9033 * "meta": {
9034 * "lastUpdated": "2021-09-14T09:13:51"
9035 * },
9036 * "resourceType": "Bundle",
9037 * "type": "collection",
9038 * "total": 0,
9039 * "link": {
9041 * "relation": "self",
9042 * "url": "https://localhost:9300/apis/default/fhir/Location"
9048 * ),
9049 * @OA\Response(
9050 * response="400",
9051 * ref="#/components/responses/badrequest"
9052 * ),
9053 * @OA\Response(
9054 * response="401",
9055 * ref="#/components/responses/unauthorized"
9056 * ),
9057 * security={{"openemr_auth":{}}}
9060 "GET /fhir/Location" => function (HttpRestRequest $request) {
9061 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9062 RestConfig::apiLog($return);
9063 return $return;
9067 * @OA\Get(
9068 * path="/fhir/Location/{uuid}",
9069 * description="Returns a single Location resource.",
9070 * tags={"fhir"},
9071 * @OA\Parameter(
9072 * name="uuid",
9073 * in="path",
9074 * description="The uuid for the Location resource.",
9075 * required=true,
9076 * @OA\Schema(
9077 * type="string"
9079 * ),
9080 * @OA\Response(
9081 * response="200",
9082 * description="Standard Response",
9083 * @OA\MediaType(
9084 * mediaType="application/json",
9085 * @OA\Schema(
9086 * @OA\Property(
9087 * property="json object",
9088 * description="FHIR Json object.",
9089 * type="object"
9090 * ),
9091 * example={
9092 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9093 * "meta": {
9094 * "versionId": "1",
9095 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9096 * },
9097 * "resourceType": "Location",
9098 * "status": "active",
9099 * "name": "Your Clinic Name Here",
9100 * "telecom": {
9102 * "system": "phone",
9103 * "value": "000-000-0000"
9104 * },
9106 * "system": "fax",
9107 * "value": "000-000-0000"
9113 * ),
9114 * @OA\Response(
9115 * response="400",
9116 * ref="#/components/responses/badrequest"
9117 * ),
9118 * @OA\Response(
9119 * response="401",
9120 * ref="#/components/responses/unauthorized"
9121 * ),
9122 * @OA\Response(
9123 * response="404",
9124 * ref="#/components/responses/uuidnotfound"
9125 * ),
9126 * security={{"openemr_auth":{}}}
9129 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9130 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9131 RestConfig::apiLog($return);
9132 return $return;
9136 * @OA\Get(
9137 * path="/fhir/Medication",
9138 * description="Returns a list of Medication resources.",
9139 * tags={"fhir"},
9140 * @OA\Response(
9141 * response="200",
9142 * description="Standard Response",
9143 * @OA\MediaType(
9144 * mediaType="application/json",
9145 * @OA\Schema(
9146 * @OA\Property(
9147 * property="json object",
9148 * description="FHIR Json object.",
9149 * type="object"
9150 * ),
9151 * example={
9152 * "meta": {
9153 * "lastUpdated": "2021-09-14T09:13:51"
9154 * },
9155 * "resourceType": "Bundle",
9156 * "type": "collection",
9157 * "total": 0,
9158 * "link": {
9160 * "relation": "self",
9161 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9167 * ),
9168 * @OA\Response(
9169 * response="400",
9170 * ref="#/components/responses/badrequest"
9171 * ),
9172 * @OA\Response(
9173 * response="401",
9174 * ref="#/components/responses/unauthorized"
9175 * ),
9176 * security={{"openemr_auth":{}}}
9179 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9180 RestConfig::authorization_check("patients", "med");
9181 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9182 RestConfig::apiLog($return);
9183 return $return;
9187 * @OA\Get(
9188 * path="/fhir/Medication/{uuid}",
9189 * description="Returns a single Medication resource.",
9190 * tags={"fhir"},
9191 * @OA\Parameter(
9192 * name="uuid",
9193 * in="path",
9194 * description="The uuid for the Medication resource.",
9195 * required=true,
9196 * @OA\Schema(
9197 * type="string"
9199 * ),
9200 * @OA\Response(
9201 * response="200",
9202 * ref="#/components/responses/standard"
9203 * ),
9204 * @OA\Response(
9205 * response="400",
9206 * ref="#/components/responses/badrequest"
9207 * ),
9208 * @OA\Response(
9209 * response="401",
9210 * ref="#/components/responses/unauthorized"
9211 * ),
9212 * @OA\Response(
9213 * response="404",
9214 * ref="#/components/responses/uuidnotfound"
9215 * ),
9216 * security={{"openemr_auth":{}}}
9220 * TODO
9221 * 1. Broken uuid validation.
9223 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
9224 RestConfig::authorization_check("patients", "med");
9225 $return = (new FhirMedicationRestController())->getOne($uuid);
9226 RestConfig::apiLog($return);
9227 return $return;
9231 * @OA\Get(
9232 * path="/fhir/MedicationRequest",
9233 * description="Returns a list of MedicationRequest resources.",
9234 * tags={"fhir"},
9235 * @OA\Parameter(
9236 * name="_id",
9237 * in="query",
9238 * description="The uuid for the MedicationRequest resource.",
9239 * required=false,
9240 * @OA\Schema(
9241 * type="string"
9243 * ),
9244 * @OA\Parameter(
9245 * name="patient",
9246 * in="query",
9247 * description="The uuid for the patient.",
9248 * required=false,
9249 * @OA\Schema(
9250 * type="string"
9252 * ),
9253 * @OA\Parameter(
9254 * name="intent",
9255 * in="query",
9256 * description="The intent of the MedicationRequest resource.",
9257 * required=false,
9258 * @OA\Schema(
9259 * type="string"
9261 * ),
9262 * @OA\Parameter(
9263 * name="status",
9264 * in="query",
9265 * description="The status of the MedicationRequest resource.",
9266 * required=false,
9267 * @OA\Schema(
9268 * type="string"
9270 * ),
9271 * @OA\Response(
9272 * response="200",
9273 * description="Standard Response",
9274 * @OA\MediaType(
9275 * mediaType="application/json",
9276 * @OA\Schema(
9277 * @OA\Property(
9278 * property="json object",
9279 * description="FHIR Json object.",
9280 * type="object"
9281 * ),
9282 * example={
9283 * "meta": {
9284 * "lastUpdated": "2021-09-14T09:13:51"
9285 * },
9286 * "resourceType": "Bundle",
9287 * "type": "collection",
9288 * "total": 0,
9289 * "link": {
9291 * "relation": "self",
9292 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9298 * ),
9299 * @OA\Response(
9300 * response="400",
9301 * ref="#/components/responses/badrequest"
9302 * ),
9303 * @OA\Response(
9304 * response="401",
9305 * ref="#/components/responses/unauthorized"
9306 * ),
9307 * security={{"openemr_auth":{}}}
9310 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
9311 $getParams = $request->getQueryParams();
9312 if ($request->isPatientRequest()) {
9313 // only allow access to data of binded patient
9314 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9315 } else {
9316 RestConfig::authorization_check("patients", "med");
9317 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9319 RestConfig::apiLog($return);
9320 return $return;
9324 * @OA\Get(
9325 * path="/fhir/MedicationRequest/{uuid}",
9326 * description="Returns a single MedicationRequest resource.",
9327 * tags={"fhir"},
9328 * @OA\Parameter(
9329 * name="uuid",
9330 * in="path",
9331 * description="The uuid for the MedicationRequest resource.",
9332 * required=true,
9333 * @OA\Schema(
9334 * type="string"
9336 * ),
9337 * @OA\Response(
9338 * response="200",
9339 * description="Standard Response",
9340 * @OA\MediaType(
9341 * mediaType="application/json",
9342 * @OA\Schema(
9343 * @OA\Property(
9344 * property="json object",
9345 * description="FHIR Json object.",
9346 * type="object"
9347 * ),
9348 * example={
9349 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9350 * "meta": {
9351 * "versionId": "1",
9352 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9353 * },
9354 * "resourceType": "MedicationRequest",
9355 * "status": "active",
9356 * "intent": "order",
9357 * "category": {
9359 * "coding": {
9361 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9362 * "code": "community",
9363 * "display": "Home/Community"
9367 * },
9368 * "reportedBoolean": false,
9369 * "medicationCodeableConcept": {
9370 * "coding": {
9372 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9373 * "code": "1738139",
9374 * "display": "Acetaminophen 325 MG Oral Tablet"
9377 * },
9378 * "subject": {
9379 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9380 * "type": "Patient"
9381 * },
9382 * "authoredOn": "2021-09-18T00:00:00+00:00",
9383 * "requester": {
9384 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9385 * "type": "Practitioner"
9390 * ),
9391 * @OA\Response(
9392 * response="400",
9393 * ref="#/components/responses/badrequest"
9394 * ),
9395 * @OA\Response(
9396 * response="401",
9397 * ref="#/components/responses/unauthorized"
9398 * ),
9399 * @OA\Response(
9400 * response="404",
9401 * ref="#/components/responses/uuidnotfound"
9402 * ),
9403 * security={{"openemr_auth":{}}}
9406 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
9407 if ($request->isPatientRequest()) {
9408 // only allow access to data of binded patient
9409 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9410 } else {
9411 RestConfig::authorization_check("patients", "med");
9412 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9414 RestConfig::apiLog($return);
9415 return $return;
9419 * @OA\Get(
9420 * path="/fhir/Observation",
9421 * description="Returns a list of Observation resources.",
9422 * tags={"fhir"},
9423 * @OA\Parameter(
9424 * name="_id",
9425 * in="query",
9426 * description="The uuid for the Observation resource.",
9427 * required=false,
9428 * @OA\Schema(
9429 * type="string"
9431 * ),
9432 * @OA\Parameter(
9433 * name="patient",
9434 * in="query",
9435 * description="The uuid for the patient.",
9436 * required=false,
9437 * @OA\Schema(
9438 * type="string"
9440 * ),
9441 * @OA\Parameter(
9442 * name="code",
9443 * in="query",
9444 * description="The code of the Observation resource.",
9445 * required=false,
9446 * @OA\Schema(
9447 * type="string"
9449 * ),
9450 * @OA\Parameter(
9451 * name="category",
9452 * in="query",
9453 * description="The category of the Observation resource.",
9454 * required=false,
9455 * @OA\Schema(
9456 * type="string"
9458 * ),
9459 * @OA\Parameter(
9460 * name="date",
9461 * in="query",
9462 * description="The datetime of the Observation resource.",
9463 * required=false,
9464 * @OA\Schema(
9465 * type="string"
9467 * ),
9468 * @OA\Response(
9469 * response="200",
9470 * description="Standard Response",
9471 * @OA\MediaType(
9472 * mediaType="application/json",
9473 * @OA\Schema(
9474 * @OA\Property(
9475 * property="json object",
9476 * description="FHIR Json object.",
9477 * type="object"
9478 * ),
9479 * example={
9480 * "meta": {
9481 * "lastUpdated": "2021-09-14T09:13:51"
9482 * },
9483 * "resourceType": "Bundle",
9484 * "type": "collection",
9485 * "total": 0,
9486 * "link": {
9488 * "relation": "self",
9489 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9495 * ),
9496 * @OA\Response(
9497 * response="400",
9498 * ref="#/components/responses/badrequest"
9499 * ),
9500 * @OA\Response(
9501 * response="401",
9502 * ref="#/components/responses/unauthorized"
9503 * ),
9504 * security={{"openemr_auth":{}}}
9507 "GET /fhir/Observation" => function (HttpRestRequest $request) {
9508 $getParams = $request->getQueryParams();
9509 if ($request->isPatientRequest()) {
9510 // only allow access to data of binded patient
9511 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9512 } else {
9513 RestConfig::authorization_check("patients", "med");
9514 $return = (new FhirObservationRestController())->getAll($getParams);
9516 RestConfig::apiLog($return);
9517 return $return;
9521 * @OA\Get(
9522 * path="/fhir/Observation/{uuid}",
9523 * description="Returns a single Observation resource.",
9524 * tags={"fhir"},
9525 * @OA\Parameter(
9526 * name="uuid",
9527 * in="path",
9528 * description="The uuid for the Observation resource.",
9529 * required=true,
9530 * @OA\Schema(
9531 * type="string"
9533 * ),
9534 * @OA\Response(
9535 * response="200",
9536 * description="Standard Response",
9537 * @OA\MediaType(
9538 * mediaType="application/json",
9539 * @OA\Schema(
9540 * @OA\Property(
9541 * property="json object",
9542 * description="FHIR Json object.",
9543 * type="object"
9544 * ),
9545 * example={
9546 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9547 * "meta": {
9548 * "versionId": "1",
9549 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9550 * },
9551 * "resourceType": "Observation",
9552 * "status": "final",
9553 * "category": {
9555 * "coding": {
9557 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9558 * "code": "vital-signs"
9562 * },
9563 * "code": {
9564 * "coding": {
9566 * "system": "http://loinc.org",
9567 * "code": "85354-9",
9568 * "display": "Blood pressure systolic and diastolic"
9571 * },
9572 * "subject": {
9573 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9574 * "type": "Patient"
9575 * },
9576 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9577 * "component": {
9579 * "code": {
9580 * "coding": {
9582 * "system": "http://loinc.org",
9583 * "code": "8480-6",
9584 * "display": "Systolic blood pressure"
9587 * },
9588 * "valueQuantity": {
9589 * "value": 122,
9590 * "unit": "mm[Hg]",
9591 * "system": "http://unitsofmeasure.org",
9592 * "code": "mm[Hg]"
9594 * },
9596 * "code": {
9597 * "coding": {
9599 * "system": "http://loinc.org",
9600 * "code": "8462-4",
9601 * "display": "Diastolic blood pressure"
9604 * },
9605 * "valueQuantity": {
9606 * "value": 77,
9607 * "unit": "mm[Hg]",
9608 * "system": "http://unitsofmeasure.org",
9609 * "code": "mm[Hg]"
9616 * ),
9617 * @OA\Response(
9618 * response="400",
9619 * ref="#/components/responses/badrequest"
9620 * ),
9621 * @OA\Response(
9622 * response="401",
9623 * ref="#/components/responses/unauthorized"
9624 * ),
9625 * @OA\Response(
9626 * response="404",
9627 * ref="#/components/responses/uuidnotfound"
9628 * ),
9629 * security={{"openemr_auth":{}}}
9632 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
9633 if ($request->isPatientRequest()) {
9634 // only allow access to data of binded patient
9635 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
9636 } else {
9637 RestConfig::authorization_check("patients", "med");
9638 $return = (new FhirObservationRestController())->getOne($uuid);
9640 RestConfig::apiLog($return);
9641 return $return;
9645 * @OA\Get(
9646 * path="/fhir/Organization",
9647 * description="Returns a list of Organization resources.",
9648 * tags={"fhir"},
9649 * @OA\Parameter(
9650 * name="_id",
9651 * in="query",
9652 * description="The uuid for the Organization resource.",
9653 * required=false,
9654 * @OA\Schema(
9655 * type="string"
9657 * ),
9658 * @OA\Parameter(
9659 * name="name",
9660 * in="query",
9661 * description="The name of the Organization resource.",
9662 * required=false,
9663 * @OA\Schema(
9664 * type="string"
9666 * ),
9667 * @OA\Parameter(
9668 * name="email",
9669 * in="query",
9670 * description="The email of the Organization resource.",
9671 * required=false,
9672 * @OA\Schema(
9673 * type="string"
9675 * ),
9676 * @OA\Parameter(
9677 * name="phone",
9678 * in="query",
9679 * description="The phone of the Organization resource.",
9680 * required=false,
9681 * @OA\Schema(
9682 * type="string"
9684 * ),
9685 * @OA\Parameter(
9686 * name="telecom",
9687 * in="query",
9688 * description="The telecom of the Organization resource.",
9689 * required=false,
9690 * @OA\Schema(
9691 * type="string"
9693 * ),
9694 * @OA\Parameter(
9695 * name="address",
9696 * in="query",
9697 * description="The address of the Organization resource.",
9698 * required=false,
9699 * @OA\Schema(
9700 * type="string"
9702 * ),
9703 * @OA\Parameter(
9704 * name="address-city",
9705 * in="query",
9706 * description="The address-city of the Organization resource.",
9707 * required=false,
9708 * @OA\Schema(
9709 * type="string"
9711 * ),
9712 * @OA\Parameter(
9713 * name="address-postalcode",
9714 * in="query",
9715 * description="The address-postalcode of the Organization resource.",
9716 * required=false,
9717 * @OA\Schema(
9718 * type="string"
9720 * ),
9721 * @OA\Parameter(
9722 * name="address-state",
9723 * in="query",
9724 * description="The address-state of the Organization resource.",
9725 * required=false,
9726 * @OA\Schema(
9727 * type="string"
9729 * ),
9730 * @OA\Response(
9731 * response="200",
9732 * description="Standard Response",
9733 * @OA\MediaType(
9734 * mediaType="application/json",
9735 * @OA\Schema(
9736 * @OA\Property(
9737 * property="json object",
9738 * description="FHIR Json object.",
9739 * type="object"
9740 * ),
9741 * example={
9742 * "meta": {
9743 * "lastUpdated": "2021-09-14T09:13:51"
9744 * },
9745 * "resourceType": "Bundle",
9746 * "type": "collection",
9747 * "total": 0,
9748 * "link": {
9750 * "relation": "self",
9751 * "url": "https://localhost:9300/apis/default/fhir/Organization"
9757 * ),
9758 * @OA\Response(
9759 * response="400",
9760 * ref="#/components/responses/badrequest"
9761 * ),
9762 * @OA\Response(
9763 * response="401",
9764 * ref="#/components/responses/unauthorized"
9765 * ),
9766 * security={{"openemr_auth":{}}}
9769 "GET /fhir/Organization" => function (HttpRestRequest $request) {
9770 if (!$request->isPatientRequest()) {
9771 RestConfig::authorization_check("admin", "users");
9773 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
9774 RestConfig::apiLog($return);
9775 return $return;
9779 * @OA\Get(
9780 * path="/fhir/Organization/{uuid}",
9781 * description="Returns a single Organization resource.",
9782 * tags={"fhir"},
9783 * @OA\Parameter(
9784 * name="uuid",
9785 * in="path",
9786 * description="The uuid for the Organization resource.",
9787 * required=true,
9788 * @OA\Schema(
9789 * type="string"
9791 * ),
9792 * @OA\Response(
9793 * response="200",
9794 * description="Standard Response",
9795 * @OA\MediaType(
9796 * mediaType="application/json",
9797 * @OA\Schema(
9798 * @OA\Property(
9799 * property="json object",
9800 * description="FHIR Json object.",
9801 * type="object"
9802 * ),
9803 * example={
9804 * "id": "946da616-fae2-409d-b24d-56425bfb3316",
9805 * "meta": {
9806 * "versionId": "1",
9807 * "lastUpdated": "2021-09-21T16:47:36+00:00"
9808 * },
9809 * "resourceType": "Organization",
9810 * "text": {
9811 * "status": "generated",
9812 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Your Clinic Name Here</p></div>"
9813 * },
9814 * "active": true,
9815 * "type": {
9817 * "coding": {
9819 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
9820 * "code": "prov",
9821 * "display": "Healthcare Provider"
9825 * },
9826 * "name": "Your Clinic Name Here",
9827 * "telecom": {
9829 * "system": "phone",
9830 * "value": "000-000-0000",
9831 * "use": "work"
9832 * },
9834 * "system": "fax",
9835 * "value": "000-000-0000",
9836 * "use": "work"
9838 * },
9839 * "address": {
9840 * null
9845 * ),
9846 * @OA\Response(
9847 * response="400",
9848 * ref="#/components/responses/badrequest"
9849 * ),
9850 * @OA\Response(
9851 * response="401",
9852 * ref="#/components/responses/unauthorized"
9853 * ),
9854 * @OA\Response(
9855 * response="404",
9856 * ref="#/components/responses/uuidnotfound"
9857 * ),
9858 * security={{"openemr_auth":{}}}
9861 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
9862 $patientUUID = null;
9863 if (!$request->isPatientRequest()) {
9864 RestConfig::authorization_check("admin", "users");
9865 } else {
9866 $patientUUID = $request->getPatientUUIDString();
9868 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
9870 RestConfig::apiLog($return);
9871 return $return;
9875 * @OA\Post(
9876 * path="/fhir/Organization",
9877 * description="Adds a Organization resource.",
9878 * tags={"fhir"},
9879 * @OA\RequestBody(
9880 * required=true,
9881 * @OA\MediaType(
9882 * mediaType="application/json",
9883 * @OA\Schema(
9884 * description="The json object for the Organization resource.",
9885 * type="object"
9888 * ),
9889 * @OA\Response(
9890 * response="200",
9891 * ref="#/components/responses/standard"
9892 * ),
9893 * @OA\Response(
9894 * response="400",
9895 * ref="#/components/responses/badrequest"
9896 * ),
9897 * @OA\Response(
9898 * response="401",
9899 * ref="#/components/responses/unauthorized"
9900 * ),
9901 * security={{"openemr_auth":{}}}
9905 * TODO
9907 "POST /fhir/Organization" => function (HttpRestRequest $request) {
9908 RestConfig::authorization_check("admin", "super");
9909 $data = (array) (json_decode(file_get_contents("php://input"), true));
9910 $return = (new FhirOrganizationRestController())->post($data);
9911 RestConfig::apiLog($return, $data);
9912 return $return;
9916 * @OA\Put(
9917 * path="/fhir/Organization/{uuid}",
9918 * description="Modifies a Organization resource.",
9919 * tags={"fhir"},
9920 * @OA\Parameter(
9921 * name="uuid",
9922 * in="path",
9923 * description="The uuid for the organization.",
9924 * required=true,
9925 * @OA\Schema(
9926 * type="string"
9928 * ),
9929 * @OA\RequestBody(
9930 * required=true,
9931 * @OA\MediaType(
9932 * mediaType="application/json",
9933 * @OA\Schema(
9934 * description="The json object for the Organization resource.",
9935 * type="object"
9938 * ),
9939 * @OA\Response(
9940 * response="200",
9941 * ref="#/components/responses/standard"
9942 * ),
9943 * @OA\Response(
9944 * response="400",
9945 * ref="#/components/responses/badrequest"
9946 * ),
9947 * @OA\Response(
9948 * response="401",
9949 * ref="#/components/responses/unauthorized"
9950 * ),
9951 * security={{"openemr_auth":{}}}
9955 * TODO
9957 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
9958 RestConfig::authorization_check("admin", "super");
9959 $data = (array) (json_decode(file_get_contents("php://input"), true));
9960 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
9961 RestConfig::apiLog($return, $data);
9962 return $return;
9966 * @OA\Post(
9967 * path="/fhir/Patient",
9968 * description="Adds a Patient resource.",
9969 * tags={"fhir"},
9970 * @OA\RequestBody(
9971 * required=true,
9972 * @OA\MediaType(
9973 * mediaType="application/json",
9974 * @OA\Schema(
9975 * description="The json object for the Patient resource.",
9976 * type="object"
9979 * ),
9980 * @OA\Response(
9981 * response="200",
9982 * ref="#/components/responses/standard"
9983 * ),
9984 * @OA\Response(
9985 * response="400",
9986 * ref="#/components/responses/badrequest"
9987 * ),
9988 * @OA\Response(
9989 * response="401",
9990 * ref="#/components/responses/unauthorized"
9991 * ),
9992 * security={{"openemr_auth":{}}}
9996 * TODO
9998 "POST /fhir/Patient" => function (HttpRestRequest $request) {
9999 RestConfig::authorization_check("patients", "demo");
10000 $data = (array) (json_decode(file_get_contents("php://input"), true));
10001 $return = (new FhirPatientRestController())->post($data);
10002 RestConfig::apiLog($return, $data);
10003 return $return;
10007 * @OA\Put(
10008 * path="/fhir/Patient/{uuid}",
10009 * description="Modifies a Patient resource.",
10010 * tags={"fhir"},
10011 * @OA\Parameter(
10012 * name="uuid",
10013 * in="path",
10014 * description="The uuid for the Patient resource.",
10015 * required=true,
10016 * @OA\Schema(
10017 * type="string"
10019 * ),
10020 * @OA\RequestBody(
10021 * required=true,
10022 * @OA\MediaType(
10023 * mediaType="application/json",
10024 * @OA\Schema(
10025 * description="The json object for the Patient resource.",
10026 * type="object"
10029 * ),
10030 * @OA\Response(
10031 * response="200",
10032 * ref="#/components/responses/standard"
10033 * ),
10034 * @OA\Response(
10035 * response="400",
10036 * ref="#/components/responses/badrequest"
10037 * ),
10038 * @OA\Response(
10039 * response="401",
10040 * ref="#/components/responses/unauthorized"
10041 * ),
10042 * security={{"openemr_auth":{}}}
10046 * TODO
10048 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10049 RestConfig::authorization_check("patients", "demo");
10050 $data = (array) (json_decode(file_get_contents("php://input"), true));
10051 $return = (new FhirPatientRestController())->put($uuid, $data);
10052 RestConfig::apiLog($return, $data);
10053 return $return;
10057 * @OA\Get(
10058 * path="/fhir/Patient",
10059 * description="Returns a list of Patient resources.",
10060 * tags={"fhir"},
10061 * @OA\Parameter(
10062 * name="_id",
10063 * in="query",
10064 * description="The uuid for the Patient resource.",
10065 * required=false,
10066 * @OA\Schema(
10067 * type="string"
10069 * ),
10070 * @OA\Parameter(
10071 * name="identifier",
10072 * in="query",
10073 * description="The identifier of the Patient resource.",
10074 * required=false,
10075 * @OA\Schema(
10076 * type="string"
10078 * ),
10079 * @OA\Parameter(
10080 * name="name",
10081 * in="query",
10082 * description="The name of the Patient resource.",
10083 * required=false,
10084 * @OA\Schema(
10085 * type="string"
10087 * ),
10088 * @OA\Parameter(
10089 * name="birthdate",
10090 * in="query",
10091 * description="The birthdate of the Patient resource.",
10092 * required=false,
10093 * @OA\Schema(
10094 * type="string"
10096 * ),
10097 * @OA\Parameter(
10098 * name="gender",
10099 * in="query",
10100 * description="The gender of the Patient resource.",
10101 * required=false,
10102 * @OA\Schema(
10103 * type="string"
10105 * ),
10106 * @OA\Parameter(
10107 * name="address",
10108 * in="query",
10109 * description="The address of the Patient resource.",
10110 * required=false,
10111 * @OA\Schema(
10112 * type="string"
10114 * ),
10115 * @OA\Parameter(
10116 * name="address-city",
10117 * in="query",
10118 * description="The address-city of the Patient resource.",
10119 * required=false,
10120 * @OA\Schema(
10121 * type="string"
10123 * ),
10124 * @OA\Parameter(
10125 * name="address-postalcode",
10126 * in="query",
10127 * description="The address-postalcode of the Patient resource.",
10128 * required=false,
10129 * @OA\Schema(
10130 * type="string"
10132 * ),
10133 * @OA\Parameter(
10134 * name="address-state",
10135 * in="query",
10136 * description="The address-state of the Patient resource.",
10137 * required=false,
10138 * @OA\Schema(
10139 * type="string"
10141 * ),
10142 * @OA\Parameter(
10143 * name="email",
10144 * in="query",
10145 * description="The email of the Patient resource.",
10146 * required=false,
10147 * @OA\Schema(
10148 * type="string"
10150 * ),
10151 * @OA\Parameter(
10152 * name="family",
10153 * in="query",
10154 * description="The family name of the Patient resource.",
10155 * required=false,
10156 * @OA\Schema(
10157 * type="string"
10159 * ),
10160 * @OA\Parameter(
10161 * name="given",
10162 * in="query",
10163 * description="The given name of the Patient resource.",
10164 * required=false,
10165 * @OA\Schema(
10166 * type="string"
10168 * ),
10169 * @OA\Parameter(
10170 * name="phone",
10171 * in="query",
10172 * description="The phone number of the Patient resource.",
10173 * required=false,
10174 * @OA\Schema(
10175 * type="string"
10177 * ),
10178 * @OA\Parameter(
10179 * name="telecom",
10180 * in="query",
10181 * description="The fax number of the Patient resource.",
10182 * required=false,
10183 * @OA\Schema(
10184 * type="string"
10186 * ),
10187 * @OA\Response(
10188 * response="200",
10189 * description="Standard Response",
10190 * @OA\MediaType(
10191 * mediaType="application/json",
10192 * @OA\Schema(
10193 * @OA\Property(
10194 * property="json object",
10195 * description="FHIR Json object.",
10196 * type="object"
10197 * ),
10198 * example={
10199 * "meta": {
10200 * "lastUpdated": "2021-09-14T09:13:51"
10201 * },
10202 * "resourceType": "Bundle",
10203 * "type": "collection",
10204 * "total": 0,
10205 * "link": {
10207 * "relation": "self",
10208 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10214 * ),
10215 * @OA\Response(
10216 * response="400",
10217 * ref="#/components/responses/badrequest"
10218 * ),
10219 * @OA\Response(
10220 * response="401",
10221 * ref="#/components/responses/unauthorized"
10222 * ),
10223 * security={{"openemr_auth":{}}}
10226 "GET /fhir/Patient" => function (HttpRestRequest $request) {
10227 $params = $request->getQueryParams();
10228 if ($request->isPatientRequest()) {
10229 // only allow access to data of binded patient
10230 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
10231 // need to use getAll rather than getOne)
10232 $params['_id'] = $request->getPatientUUIDString();
10233 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
10234 } else {
10235 RestConfig::authorization_check("patients", "demo");
10236 $return = (new FhirPatientRestController())->getAll($params);
10238 RestConfig::apiLog($return);
10239 return $return;
10243 * @OA\Get(
10244 * path="/fhir/Patient/$export",
10245 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
10246 * tags={"fhir"},
10247 * @OA\Response(
10248 * response="200",
10249 * ref="#/components/responses/standard"
10250 * ),
10251 * @OA\Response(
10252 * response="400",
10253 * ref="#/components/responses/badrequest"
10254 * ),
10255 * @OA\Response(
10256 * response="401",
10257 * ref="#/components/responses/unauthorized"
10258 * ),
10259 * security={{"openemr_auth":{}}}
10263 * TODO
10265 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
10266 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
10267 RestConfig::authorization_check("admin", "users");
10268 $fhirExportService = new FhirExportRestController($request);
10269 $return = $fhirExportService->processExport(
10270 $request->getQueryParams(),
10271 'Patient',
10272 $request->getHeader('Accept'),
10273 $request->getHeader('Prefer')
10275 RestConfig::apiLog($return);
10276 return $return;
10280 * @OA\Get(
10281 * path="/fhir/Patient/{uuid}",
10282 * description="Returns a single Patient resource.",
10283 * tags={"fhir"},
10284 * @OA\Parameter(
10285 * name="uuid",
10286 * in="path",
10287 * description="The uuid for the Patient resource.",
10288 * required=true,
10289 * @OA\Schema(
10290 * type="string"
10292 * ),
10293 * @OA\Response(
10294 * response="200",
10295 * description="Standard Response",
10296 * @OA\MediaType(
10297 * mediaType="application/json",
10298 * @OA\Schema(
10299 * @OA\Property(
10300 * property="json object",
10301 * description="FHIR Json object.",
10302 * type="object"
10303 * ),
10304 * example={
10305 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
10306 * "meta": {
10307 * "versionId": "1",
10308 * "lastUpdated": "2021-09-21T17:08:03+00:00"
10309 * },
10310 * "resourceType": "Patient",
10311 * "text": {
10312 * "status": "generated",
10313 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
10314 * },
10315 * "extension": {
10317 * "valueCode": "F",
10318 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10319 * },
10321 * "extension": {
10323 * "valueCoding": {
10324 * "system": "urn:oid:2.16.840.1.113883.6.238",
10325 * "code": "1006-6",
10326 * "display": "Abenaki"
10327 * },
10328 * "url": "ombCategory"
10329 * },
10331 * "valueString": "Abenaki",
10332 * "url": "text"
10334 * },
10335 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10336 * },
10338 * "extension": {
10340 * "valueString": "Declined To Specify",
10341 * "url": "text"
10343 * },
10344 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
10346 * },
10347 * "identifier": {
10349 * "use": "official",
10350 * "type": {
10351 * "coding": {
10353 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10354 * "code": "PT"
10357 * },
10358 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10359 * "value": "1"
10361 * },
10362 * "active": true,
10363 * "name": {
10365 * "use": "official",
10366 * "family": "Von197",
10367 * "given": {
10368 * "Aurore252"
10371 * },
10372 * "gender": "female",
10373 * "birthDate": "1970-07-03",
10374 * "address": {
10376 * "line": {
10377 * "245 Crona Wall"
10378 * },
10379 * "city": "Boston",
10380 * "state": "Massachusetts",
10381 * "postalCode": "02215",
10382 * "period": {
10383 * "start": "2020-09-21T17:08:03.532+00:00"
10386 * },
10387 * "communication": {
10389 * "language": {
10390 * "coding": {
10392 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10393 * "code": "unknown",
10394 * "display": "Unknown"
10403 * ),
10404 * @OA\Response(
10405 * response="400",
10406 * ref="#/components/responses/badrequest"
10407 * ),
10408 * @OA\Response(
10409 * response="401",
10410 * ref="#/components/responses/unauthorized"
10411 * ),
10412 * @OA\Response(
10413 * response="404",
10414 * ref="#/components/responses/uuidnotfound"
10415 * ),
10416 * security={{"openemr_auth":{}}}
10419 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10420 if ($request->isPatientRequest()) {
10421 // only allow access to data of binded patient
10422 if (empty($id) || ($id != $request->getPatientUUIDString())) {
10423 throw new AccessDeniedException("patients", "demo", "patient id invalid");
10425 $id = $request->getPatientUUIDString();
10426 } else {
10427 RestConfig::authorization_check("patients", "demo");
10429 $return = (new FhirPatientRestController())->getOne($uuid);
10430 RestConfig::apiLog($return);
10431 return $return;
10435 * @OA\Get(
10436 * path="/fhir/Person",
10437 * description="Returns a list of Person resources.",
10438 * tags={"fhir"},
10439 * @OA\Parameter(
10440 * name="name",
10441 * in="query",
10442 * description="The name of the Person resource.",
10443 * required=false,
10444 * @OA\Schema(
10445 * type="string"
10447 * ),
10448 * @OA\Parameter(
10449 * name="active",
10450 * in="query",
10451 * description="The active status of the Person resource.",
10452 * required=false,
10453 * @OA\Schema(
10454 * type="string"
10456 * ),
10457 * @OA\Parameter(
10458 * name="address",
10459 * in="query",
10460 * description="The address of the Person resource.",
10461 * required=false,
10462 * @OA\Schema(
10463 * type="string"
10465 * ),
10466 * @OA\Parameter(
10467 * name="address-city",
10468 * in="query",
10469 * description="The address-city of the Person resource.",
10470 * required=false,
10471 * @OA\Schema(
10472 * type="string"
10474 * ),
10475 * @OA\Parameter(
10476 * name="address-postalcode",
10477 * in="query",
10478 * description="The address-postalcode of the Person resource.",
10479 * required=false,
10480 * @OA\Schema(
10481 * type="string"
10483 * ),
10484 * @OA\Parameter(
10485 * name="address-state",
10486 * in="query",
10487 * description="The address-state of the Person resource.",
10488 * required=false,
10489 * @OA\Schema(
10490 * type="string"
10492 * ),
10493 * @OA\Parameter(
10494 * name="email",
10495 * in="query",
10496 * description="The email of the Person resource.",
10497 * required=false,
10498 * @OA\Schema(
10499 * type="string"
10501 * ),
10502 * @OA\Parameter(
10503 * name="family",
10504 * in="query",
10505 * description="The family name of the Person resource.",
10506 * required=false,
10507 * @OA\Schema(
10508 * type="string"
10510 * ),
10511 * @OA\Parameter(
10512 * name="given",
10513 * in="query",
10514 * description="The given name of the Person resource.",
10515 * required=false,
10516 * @OA\Schema(
10517 * type="string"
10519 * ),
10520 * @OA\Parameter(
10521 * name="phone",
10522 * in="query",
10523 * description="The phone number of the Person resource.",
10524 * required=false,
10525 * @OA\Schema(
10526 * type="string"
10528 * ),
10529 * @OA\Parameter(
10530 * name="telecom",
10531 * in="query",
10532 * description="The fax number of the Person resource.",
10533 * required=false,
10534 * @OA\Schema(
10535 * type="string"
10537 * ),
10538 * @OA\Response(
10539 * response="200",
10540 * description="Standard Response",
10541 * @OA\MediaType(
10542 * mediaType="application/json",
10543 * @OA\Schema(
10544 * @OA\Property(
10545 * property="json object",
10546 * description="FHIR Json object.",
10547 * type="object"
10548 * ),
10549 * example={
10550 * "meta": {
10551 * "lastUpdated": "2021-09-14T09:13:51"
10552 * },
10553 * "resourceType": "Bundle",
10554 * "type": "collection",
10555 * "total": 0,
10556 * "link": {
10558 * "relation": "self",
10559 * "url": "https://localhost:9300/apis/default/fhir/Person"
10565 * ),
10566 * @OA\Response(
10567 * response="400",
10568 * ref="#/components/responses/badrequest"
10569 * ),
10570 * @OA\Response(
10571 * response="401",
10572 * ref="#/components/responses/unauthorized"
10573 * ),
10574 * security={{"openemr_auth":{}}}
10578 * TODO
10579 * 1. Broken sql query.
10581 "GET /fhir/Person" => function (HttpRestRequest $request) {
10582 RestConfig::authorization_check("admin", "users");
10583 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
10584 RestConfig::apiLog($return);
10585 return $return;
10589 * @OA\Get(
10590 * path="/fhir/Person/{uuid}",
10591 * description="Returns a single Person resource.",
10592 * tags={"fhir"},
10593 * @OA\Parameter(
10594 * name="uuid",
10595 * in="path",
10596 * description="The uuid for the Person resource.",
10597 * required=true,
10598 * @OA\Schema(
10599 * type="string"
10601 * ),
10602 * @OA\Response(
10603 * response="200",
10604 * ref="#/components/responses/standard"
10605 * ),
10606 * @OA\Response(
10607 * response="400",
10608 * ref="#/components/responses/badrequest"
10609 * ),
10610 * @OA\Response(
10611 * response="401",
10612 * ref="#/components/responses/unauthorized"
10613 * ),
10614 * @OA\Response(
10615 * response="404",
10616 * ref="#/components/responses/uuidnotfound"
10617 * ),
10618 * security={{"openemr_auth":{}}}
10622 * TODO
10623 * 1. Broken sql query.
10625 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
10626 RestConfig::authorization_check("admin", "users");
10627 $return = (new FhirPersonRestController())->getOne($uuid);
10628 RestConfig::apiLog($return);
10629 return $return;
10633 * @OA\Get(
10634 * path="/fhir/Practitioner",
10635 * description="Returns a list of Practitioner resources.",
10636 * tags={"fhir"},
10637 * @OA\Parameter(
10638 * name="_id",
10639 * in="query",
10640 * description="The uuid for the Practitioner resource.",
10641 * required=false,
10642 * @OA\Schema(
10643 * type="string"
10645 * ),
10646 * @OA\Parameter(
10647 * name="name",
10648 * in="query",
10649 * description="The name of the Practitioner resource.",
10650 * required=false,
10651 * @OA\Schema(
10652 * type="string"
10654 * ),
10655 * @OA\Parameter(
10656 * name="active",
10657 * in="query",
10658 * description="The active status of the Practitioner resource.",
10659 * required=false,
10660 * @OA\Schema(
10661 * type="string"
10663 * ),
10664 * @OA\Parameter(
10665 * name="address",
10666 * in="query",
10667 * description="The address of the Practitioner resource.",
10668 * required=false,
10669 * @OA\Schema(
10670 * type="string"
10672 * ),
10673 * @OA\Parameter(
10674 * name="address-city",
10675 * in="query",
10676 * description="The address-city of the Practitioner resource.",
10677 * required=false,
10678 * @OA\Schema(
10679 * type="string"
10681 * ),
10682 * @OA\Parameter(
10683 * name="address-postalcode",
10684 * in="query",
10685 * description="The address-postalcode of the Practitioner resource.",
10686 * required=false,
10687 * @OA\Schema(
10688 * type="string"
10690 * ),
10691 * @OA\Parameter(
10692 * name="address-state",
10693 * in="query",
10694 * description="The address-state of the Practitioner resource.",
10695 * required=false,
10696 * @OA\Schema(
10697 * type="string"
10699 * ),
10700 * @OA\Parameter(
10701 * name="email",
10702 * in="query",
10703 * description="The email of the Practitioner resource.",
10704 * required=false,
10705 * @OA\Schema(
10706 * type="string"
10708 * ),
10709 * @OA\Parameter(
10710 * name="family",
10711 * in="query",
10712 * description="The family name of the Practitioner resource.",
10713 * required=false,
10714 * @OA\Schema(
10715 * type="string"
10717 * ),
10718 * @OA\Parameter(
10719 * name="given",
10720 * in="query",
10721 * description="The given name of the Practitioner resource.",
10722 * required=false,
10723 * @OA\Schema(
10724 * type="string"
10726 * ),
10727 * @OA\Parameter(
10728 * name="phone",
10729 * in="query",
10730 * description="The phone number of the Practitioner resource.",
10731 * required=false,
10732 * @OA\Schema(
10733 * type="string"
10735 * ),
10736 * @OA\Parameter(
10737 * name="telecom",
10738 * in="query",
10739 * description="The fax number of the Practitioner resource.",
10740 * required=false,
10741 * @OA\Schema(
10742 * type="string"
10744 * ),
10745 * @OA\Response(
10746 * response="200",
10747 * description="Standard Response",
10748 * @OA\MediaType(
10749 * mediaType="application/json",
10750 * @OA\Schema(
10751 * @OA\Property(
10752 * property="json object",
10753 * description="FHIR Json object.",
10754 * type="object"
10755 * ),
10756 * example={
10757 * "meta": {
10758 * "lastUpdated": "2021-09-14T09:13:51"
10759 * },
10760 * "resourceType": "Bundle",
10761 * "type": "collection",
10762 * "total": 0,
10763 * "link": {
10765 * "relation": "self",
10766 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
10772 * ),
10773 * @OA\Response(
10774 * response="400",
10775 * ref="#/components/responses/badrequest"
10776 * ),
10777 * @OA\Response(
10778 * response="401",
10779 * ref="#/components/responses/unauthorized"
10780 * ),
10781 * security={{"openemr_auth":{}}}
10784 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
10786 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10787 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10788 // I don't believe patients are assigned to a particular practitioner
10789 // should we allow just open api access to admin information? Should we restrict particular pieces
10790 // of data in the practitioner side (phone number, address information) based on a permission set?
10791 if (!$request->isPatientRequest()) {
10792 RestConfig::authorization_check("admin", "users");
10794 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
10795 RestConfig::apiLog($return);
10796 return $return;
10800 * @OA\Get(
10801 * path="/fhir/Practitioner/{uuid}",
10802 * description="Returns a single Practitioner resource.",
10803 * tags={"fhir"},
10804 * @OA\Parameter(
10805 * name="uuid",
10806 * in="path",
10807 * description="The uuid for the Practitioner resource.",
10808 * required=true,
10809 * @OA\Schema(
10810 * type="string"
10812 * ),
10813 * @OA\Response(
10814 * response="200",
10815 * description="Standard Response",
10816 * @OA\MediaType(
10817 * mediaType="application/json",
10818 * @OA\Schema(
10819 * @OA\Property(
10820 * property="json object",
10821 * description="FHIR Json object.",
10822 * type="object"
10823 * ),
10824 * example={
10825 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
10826 * "meta": {
10827 * "versionId": "1",
10828 * "lastUpdated": "2021-09-21T17:41:57+00:00"
10829 * },
10830 * "resourceType": "Practitioner",
10831 * "text": {
10832 * "status": "generated",
10833 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
10834 * },
10835 * "identifier": {
10837 * "system": "http://hl7.org/fhir/sid/us-npi",
10838 * "value": "11223344554543"
10840 * },
10841 * "active": true,
10842 * "name": {
10844 * "use": "official",
10845 * "family": "Smith",
10846 * "given": {
10847 * "Billy"
10854 * ),
10855 * @OA\Response(
10856 * response="400",
10857 * ref="#/components/responses/badrequest"
10858 * ),
10859 * @OA\Response(
10860 * response="401",
10861 * ref="#/components/responses/unauthorized"
10862 * ),
10863 * @OA\Response(
10864 * response="404",
10865 * ref="#/components/responses/uuidnotfound"
10866 * ),
10867 * security={{"openemr_auth":{}}}
10870 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
10871 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10872 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10873 // I don't believe patients are assigned to a particular practitioner
10874 // should we allow just open api access to admin information? Should we restrict particular pieces
10875 // of data in the practitioner side (phone number, address information) based on a permission set?
10876 if (!$request->isPatientRequest()) {
10877 RestConfig::authorization_check("admin", "users");
10879 $return = (new FhirPractitionerRestController())->getOne($uuid);
10880 RestConfig::apiLog($return);
10881 return $return;
10885 * @OA\Post(
10886 * path="/fhir/Practitioner",
10887 * description="Adds a Practitioner resources.",
10888 * tags={"fhir"},
10889 * @OA\RequestBody(
10890 * required=true,
10891 * @OA\MediaType(
10892 * mediaType="application/json",
10893 * @OA\Schema(
10894 * description="The json object for the Practitioner resource.",
10895 * type="object"
10898 * ),
10899 * @OA\Response(
10900 * response="200",
10901 * ref="#/components/responses/standard"
10902 * ),
10903 * @OA\Response(
10904 * response="400",
10905 * ref="#/components/responses/badrequest"
10906 * ),
10907 * @OA\Response(
10908 * response="401",
10909 * ref="#/components/responses/unauthorized"
10910 * ),
10911 * security={{"openemr_auth":{}}}
10915 * TODO
10916 * 1. Broken sql query.
10918 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
10919 RestConfig::authorization_check("admin", "users");
10920 $data = (array) (json_decode(file_get_contents("php://input"), true));
10921 $return = (new FhirPractitionerRestController())->post($data);
10922 RestConfig::apiLog($return, $data);
10923 return $return;
10927 * @OA\Put(
10928 * path="/fhir/Practitioner/{uuid}",
10929 * description="Modify a Practitioner resource.",
10930 * tags={"fhir"},
10931 * @OA\Parameter(
10932 * name="uuid",
10933 * in="path",
10934 * description="The uuid for the Practitioner resource.",
10935 * required=true,
10936 * @OA\Schema(
10937 * type="string"
10939 * ),
10940 * @OA\RequestBody(
10941 * required=true,
10942 * @OA\MediaType(
10943 * mediaType="application/json",
10944 * @OA\Schema(
10945 * description="The json object for the Practitioner resource.",
10946 * type="object"
10949 * ),
10950 * @OA\Response(
10951 * response="200",
10952 * ref="#/components/responses/standard"
10953 * ),
10954 * @OA\Response(
10955 * response="400",
10956 * ref="#/components/responses/badrequest"
10957 * ),
10958 * @OA\Response(
10959 * response="401",
10960 * ref="#/components/responses/unauthorized"
10961 * ),
10962 * security={{"openemr_auth":{}}}
10966 * TODO
10967 * 1. Broken sql query.
10969 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
10970 RestConfig::authorization_check("admin", "users");
10971 $data = (array) (json_decode(file_get_contents("php://input"), true));
10972 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
10973 RestConfig::apiLog($return, $data);
10974 return $return;
10978 * @OA\Get(
10979 * path="/fhir/PractitionerRole",
10980 * description="Returns a list of PractitionerRole resources.",
10981 * tags={"fhir"},
10982 * @OA\Parameter(
10983 * name="specialty",
10984 * in="query",
10985 * description="The specialty of the PractitionerRole resource.",
10986 * required=false,
10987 * @OA\Schema(
10988 * type="string"
10990 * ),
10991 * @OA\Parameter(
10992 * name="practitioner",
10993 * in="query",
10994 * description="The practitioner of the PractitionerRole resource.",
10995 * required=false,
10996 * @OA\Schema(
10997 * type="string"
10999 * ),
11000 * @OA\Response(
11001 * response="200",
11002 * description="Standard Response",
11003 * @OA\MediaType(
11004 * mediaType="application/json",
11005 * @OA\Schema(
11006 * @OA\Property(
11007 * property="json object",
11008 * description="FHIR Json object.",
11009 * type="object"
11010 * ),
11011 * example={
11012 * "meta": {
11013 * "lastUpdated": "2021-09-14T09:13:51"
11014 * },
11015 * "resourceType": "Bundle",
11016 * "type": "collection",
11017 * "total": 0,
11018 * "link": {
11020 * "relation": "self",
11021 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11027 * ),
11028 * @OA\Response(
11029 * response="400",
11030 * ref="#/components/responses/badrequest"
11031 * ),
11032 * @OA\Response(
11033 * response="401",
11034 * ref="#/components/responses/unauthorized"
11035 * ),
11036 * security={{"openemr_auth":{}}}
11039 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
11040 RestConfig::authorization_check("admin", "users");
11041 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11042 RestConfig::apiLog($return);
11043 return $return;
11047 * @OA\Get(
11048 * path="/fhir/PractitionerRole/{uuid}",
11049 * description="Returns a single PractitionerRole resource.",
11050 * tags={"fhir"},
11051 * @OA\Parameter(
11052 * name="uuid",
11053 * in="path",
11054 * description="The uuid for the PractitionerRole resource.",
11055 * required=true,
11056 * @OA\Schema(
11057 * type="string"
11059 * ),
11060 * @OA\Response(
11061 * response="200",
11062 * ref="#/components/responses/standard"
11063 * ),
11064 * @OA\Response(
11065 * response="400",
11066 * ref="#/components/responses/badrequest"
11067 * ),
11068 * @OA\Response(
11069 * response="401",
11070 * ref="#/components/responses/unauthorized"
11071 * ),
11072 * @OA\Response(
11073 * response="404",
11074 * ref="#/components/responses/uuidnotfound"
11075 * ),
11076 * security={{"openemr_auth":{}}}
11080 * TODO
11081 * 1. Broken _id validation.
11083 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
11084 RestConfig::authorization_check("admin", "users");
11085 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
11086 RestConfig::apiLog($return);
11087 return $return;
11091 * @OA\Get(
11092 * path="/fhir/Procedure",
11093 * description="Returns a list of Procedure resources.",
11094 * tags={"fhir"},
11095 * @OA\Parameter(
11096 * name="_id",
11097 * in="query",
11098 * description="The uuid for the Procedure resource.",
11099 * required=false,
11100 * @OA\Schema(
11101 * type="string"
11103 * ),
11104 * @OA\Parameter(
11105 * name="patient",
11106 * in="query",
11107 * description="The uuid for the patient.",
11108 * required=false,
11109 * @OA\Schema(
11110 * type="string"
11112 * ),
11113 * @OA\Parameter(
11114 * name="date",
11115 * in="query",
11116 * description="The datetime of the Procedure resource.",
11117 * required=false,
11118 * @OA\Schema(
11119 * type="string"
11121 * ),
11122 * @OA\Response(
11123 * response="200",
11124 * description="Standard Response",
11125 * @OA\MediaType(
11126 * mediaType="application/json",
11127 * @OA\Schema(
11128 * @OA\Property(
11129 * property="json object",
11130 * description="FHIR Json object.",
11131 * type="object"
11132 * ),
11133 * example={
11134 * "meta": {
11135 * "lastUpdated": "2021-09-14T09:13:51"
11136 * },
11137 * "resourceType": "Bundle",
11138 * "type": "collection",
11139 * "total": 0,
11140 * "link": {
11142 * "relation": "self",
11143 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
11149 * ),
11150 * @OA\Response(
11151 * response="400",
11152 * ref="#/components/responses/badrequest"
11153 * ),
11154 * @OA\Response(
11155 * response="401",
11156 * ref="#/components/responses/unauthorized"
11157 * ),
11158 * security={{"openemr_auth":{}}}
11162 * TODO
11163 * 1. Broken sql query.
11165 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
11166 if ($request->isPatientRequest()) {
11167 // only allow access to data of binded patient
11168 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11169 } else {
11170 RestConfig::authorization_check("patients", "med");
11171 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
11173 RestConfig::apiLog($return);
11174 return $return;
11178 * @OA\Get(
11179 * path="/fhir/Procedure/{uuid}",
11180 * description="Returns a single Procedure resource.",
11181 * tags={"fhir"},
11182 * @OA\Parameter(
11183 * name="uuid",
11184 * in="path",
11185 * description="The uuid for the Procedure resource.",
11186 * required=true,
11187 * @OA\Schema(
11188 * type="string"
11190 * ),
11191 * @OA\Response(
11192 * response="200",
11193 * ref="#/components/responses/standard"
11194 * ),
11195 * @OA\Response(
11196 * response="400",
11197 * ref="#/components/responses/badrequest"
11198 * ),
11199 * @OA\Response(
11200 * response="401",
11201 * ref="#/components/responses/unauthorized"
11202 * ),
11203 * @OA\Response(
11204 * response="404",
11205 * ref="#/components/responses/uuidnotfound"
11206 * ),
11207 * security={{"openemr_auth":{}}}
11211 * TODO
11212 * 1. Broken sql query.
11214 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
11215 if ($request->isPatientRequest()) {
11216 // only allow access to data of binded patient
11217 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
11218 } else {
11219 RestConfig::authorization_check("patients", "med");
11220 $return = (new FhirProcedureRestController())->getOne($uuid);
11222 RestConfig::apiLog($return);
11223 return $return;
11227 * @OA\Get(
11228 * path="/fhir/Provenance/{uuid}",
11229 * description="Returns a single Provenance resource.",
11230 * tags={"fhir"},
11231 * @OA\Parameter(
11232 * name="uuid",
11233 * in="path",
11234 * description="The uuid for the Provenance resource.",
11235 * required=true,
11236 * @OA\Schema(
11237 * type="string"
11239 * ),
11240 * @OA\Response(
11241 * response="200",
11242 * ref="#/components/responses/standard"
11243 * ),
11244 * @OA\Response(
11245 * response="400",
11246 * ref="#/components/responses/badrequest"
11247 * ),
11248 * @OA\Response(
11249 * response="401",
11250 * ref="#/components/responses/unauthorized"
11251 * ),
11252 * @OA\Response(
11253 * response="404",
11254 * ref="#/components/responses/uuidnotfound"
11255 * ),
11256 * security={{"openemr_auth":{}}}
11260 * TODO
11262 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
11263 if ($request->isPatientRequest()) {
11264 // only allow access to data of binded patient
11265 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
11266 } else {
11267 RestConfig::authorization_check("admin", "super");
11268 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
11270 RestConfig::apiLog($return);
11271 return $return;
11275 * @OA\Get(
11276 * path="/fhir/Provenance",
11277 * description="Returns a list of Provenance resources.",
11278 * tags={"fhir"},
11279 * @OA\Parameter(
11280 * name="_id",
11281 * in="query",
11282 * description="The uuid for the Provenance resource.",
11283 * required=false,
11284 * @OA\Schema(
11285 * type="string"
11287 * ),
11288 * @OA\Response(
11289 * response="200",
11290 * description="Standard Response",
11291 * @OA\MediaType(
11292 * mediaType="application/json",
11293 * @OA\Schema(
11294 * @OA\Property(
11295 * property="json object",
11296 * description="FHIR Json object.",
11297 * type="object"
11298 * ),
11299 * example={
11300 * "meta": {
11301 * "lastUpdated": "2021-09-14T09:13:51"
11302 * },
11303 * "resourceType": "Bundle",
11304 * "type": "collection",
11305 * "total": 0,
11306 * "link": {
11308 * "relation": "self",
11309 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
11315 * ),
11316 * @OA\Response(
11317 * response="400",
11318 * ref="#/components/responses/badrequest"
11319 * ),
11320 * @OA\Response(
11321 * response="401",
11322 * ref="#/components/responses/unauthorized"
11323 * ),
11324 * security={{"openemr_auth":{}}}
11328 * TODO
11330 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
11331 // property to support which is why this endpoint exists.
11332 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
11333 if ($request->isPatientRequest()) {
11334 // only allow access to data of binded patient
11335 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11336 } else {
11337 // TODO: it seems like regular users should be able to grab authorship / provenance information
11338 RestConfig::authorization_check("admin", "super");
11339 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
11341 RestConfig::apiLog($return);
11342 return $return;
11345 // other endpoints
11348 * @OA\Get(
11349 * path="/fhir/metadata",
11350 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
11351 * tags={"fhir"},
11352 * @OA\Response(
11353 * response="200",
11354 * description="Return CapabilityStatement resource of the fhir server"
11358 "GET /fhir/metadata" => function () {
11359 $return = (new FhirMetaDataRestController())->getMetaData();
11360 RestConfig::apiLog($return);
11361 return $return;
11365 * @OA\Get(
11366 * path="/fhir/.well-known/smart-configuration",
11367 * description="Returns smart configuration of the fhir server.",
11368 * tags={"fhir"},
11369 * @OA\Response(
11370 * response="200",
11371 * description="Return smart configuration of the fhir server"
11375 "GET /fhir/.well-known/smart-configuration" => function () {
11376 $authController = new \OpenEMR\RestControllers\AuthorizationController();
11377 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
11378 RestConfig::apiLog($return);
11379 return $return;
11382 // FHIR root level operations
11385 * @OA\Get(
11386 * path="/fhir/$export",
11387 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11388 * tags={"fhir"},
11389 * @OA\Response(
11390 * response="200",
11391 * ref="#/components/responses/standard"
11392 * ),
11393 * @OA\Response(
11394 * response="400",
11395 * ref="#/components/responses/badrequest"
11396 * ),
11397 * @OA\Response(
11398 * response="401",
11399 * ref="#/components/responses/unauthorized"
11400 * ),
11401 * security={{"openemr_auth":{}}}
11405 * TODO
11407 'GET /fhir/$export' => function (HttpRestRequest $request) {
11408 RestConfig::authorization_check("admin", "users");
11409 $fhirExportService = new FhirExportRestController($request);
11410 $return = $fhirExportService->processExport(
11411 $request->getQueryParams(),
11412 'System',
11413 $request->getHeader('Accept'),
11414 $request->getHeader('Prefer')
11416 RestConfig::apiLog($return);
11417 return $return;
11420 // these two operations are adopted based on the documentation used in the IBM FHIR Server
11421 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
11422 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
11425 * @OA\Get(
11426 * path="/fhir/$bulkdata-status",
11427 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11428 * tags={"fhir"},
11429 * @OA\Response(
11430 * response="200",
11431 * ref="#/components/responses/standard"
11432 * ),
11433 * @OA\Response(
11434 * response="400",
11435 * ref="#/components/responses/badrequest"
11436 * ),
11437 * @OA\Response(
11438 * response="401",
11439 * ref="#/components/responses/unauthorized"
11440 * ),
11441 * security={{"openemr_auth":{}}}
11445 * TODO
11447 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
11448 RestConfig::authorization_check("admin", "users");
11449 $jobUuidString = $request->getQueryParam('job');
11450 // if we were truly async we would return 202 here to say we are in progress with a JSON response
11451 // since OpenEMR data is so small we just return the JSON from the database
11452 $fhirExportService = new FhirExportRestController($request);
11453 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
11454 RestConfig::apiLog($return);
11455 return $return;
11459 * @OA\Delete(
11460 * path="/fhir/$bulkdata-status",
11461 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11462 * tags={"fhir"},
11463 * @OA\Response(
11464 * response="200",
11465 * ref="#/components/responses/standard"
11466 * ),
11467 * @OA\Response(
11468 * response="400",
11469 * ref="#/components/responses/badrequest"
11470 * ),
11471 * @OA\Response(
11472 * response="401",
11473 * ref="#/components/responses/unauthorized"
11474 * ),
11475 * security={{"openemr_auth":{}}}
11479 * TODO
11481 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
11482 RestConfig::authorization_check("admin", "users");
11483 $job = $request->getQueryParam('job');
11484 $fhirExportService = new FhirExportRestController($request);
11485 $return = $fhirExportService->processDeleteExportForJob($job);
11486 RestConfig::apiLog($return);
11487 return $return;
11491 // Note that the portal (api) route is only for patient role
11492 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
11493 RestConfig::$PORTAL_ROUTE_MAP = array(
11495 * @OA\Get(
11496 * path="/portal/patient",
11497 * description="Returns the patient.",
11498 * tags={"standard-patient"},
11499 * @OA\Response(
11500 * response="200",
11501 * description="Standard response",
11502 * @OA\MediaType(
11503 * mediaType="application/json",
11504 * @OA\Schema(ref="#/components/schemas/api_patient_response")
11506 * ),
11507 * @OA\Response(
11508 * response="401",
11509 * ref="#/components/responses/unauthorized"
11510 * ),
11511 * security={{"openemr_auth":{}}}
11514 "GET /portal/patient" => function (HttpRestRequest $request) {
11515 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
11516 RestConfig::apiLog($return);
11517 return $return;
11521 * @OA\Get(
11522 * path="/portal/patient/encounter",
11523 * description="Returns encounters for the patient.",
11524 * tags={"standard-patient"},
11525 * @OA\Response(
11526 * response="200",
11527 * ref="#/components/responses/standard"
11528 * ),
11529 * @OA\Response(
11530 * response="400",
11531 * ref="#/components/responses/badrequest"
11532 * ),
11533 * @OA\Response(
11534 * response="401",
11535 * ref="#/components/responses/unauthorized"
11536 * ),
11537 * security={{"openemr_auth":{}}}
11540 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
11541 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
11542 RestConfig::apiLog($return);
11543 return $return;
11547 * @OA\Get(
11548 * path="/portal/patient/encounter/{euuid}",
11549 * description="Returns a selected encounter by its uuid.",
11550 * tags={"standard-patient"},
11551 * @OA\Parameter(
11552 * name="euuid",
11553 * in="path",
11554 * description="The uuid for the encounter.",
11555 * required=true,
11556 * @OA\Schema(
11557 * type="string"
11559 * ),
11560 * @OA\Response(
11561 * response="200",
11562 * ref="#/components/responses/standard"
11563 * ),
11564 * @OA\Response(
11565 * response="400",
11566 * ref="#/components/responses/badrequest"
11567 * ),
11568 * @OA\Response(
11569 * response="401",
11570 * ref="#/components/responses/unauthorized"
11571 * ),
11572 * security={{"openemr_auth":{}}}
11575 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
11576 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
11577 RestConfig::apiLog($return);
11578 return $return;