Openemr fixes #5215 bulk export provenance, fixes #5216 api docs (#5217)
[openemr.git] / _rest_routes.inc.php
blobcbd03008a9d29daf2a55f57469233c9fe4229c6f
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="7.0.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/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
40 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
41 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
42 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
43 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
44 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
45 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
46 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
47 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
48 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
49 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
50 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
51 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
52 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
53 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
54 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
55 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
56 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
57 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
58 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
59 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
60 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
61 * "system/Device.read": "Read all device resources in the system (api:fhir)",
62 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
63 * "system/Document.read": "Read all document resources in the system (api:fhir)",
64 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
65 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
66 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
67 * "system/Group.read": "Read all group resources in the system (api:fhir)",
68 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
69 * "system/Location.read": "Read all location resources in the system (api:fhir)",
70 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
71 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
72 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
73 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
74 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
75 * "system/Person.read": "Read all person resources in the system (api:fhir)",
76 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
77 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
78 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
79 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
80 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
81 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
82 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
83 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
84 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
85 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
86 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
87 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
88 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
89 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
90 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
91 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
92 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
93 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
94 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
95 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
96 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
97 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
98 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
99 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
100 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
101 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
102 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
103 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
104 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
105 * "api:oemr": "Standard OpenEMR API",
106 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
107 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
108 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
109 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
110 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
111 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
112 * "user/document.read": "Read documents the user has access to (api:oemr)",
113 * "user/document.write": "Write documents the user has access to (api:oemr)",
114 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
115 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
116 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
117 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
118 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
119 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
120 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
121 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
122 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
123 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
124 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
125 * "user/list.read": "Read lists the user has access to (api:oemr)",
126 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
127 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
128 * "user/medication.read": "Read medications the user has access to (api:oemr)",
129 * "user/medication.write": "Write medications the user has access to (api:oemr)",
130 * "user/message.write": "Read messages the user has access to (api:oemr)",
131 * "user/patient.read": "Read patients the user has access to (api:oemr)",
132 * "user/patient.write": "Write patients the user has access to (api:oemr)",
133 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
134 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
135 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
136 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
137 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
138 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
139 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
140 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
141 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
142 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
143 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
144 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
145 * "api:port": "Standard Patient Portal OpenEMR API",
146 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
147 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
151 * @OA\Tag(
152 * name="fhir",
153 * description="FHIR R4 API"
155 * @OA\Tag(
156 * name="standard",
157 * description="Standard OpenEMR API"
159 * @OA\Tag(
160 * name="standard-patient",
161 * description="Standard Patient Portal OpenEMR API"
163 * @OA\Response(
164 * response="standard",
165 * description="Standard Response",
166 * @OA\MediaType(
167 * mediaType="application/json",
168 * @OA\Schema(
169 * @OA\Property(
170 * property="validationErrors",
171 * description="Validation errors.",
172 * type="array",
173 * @OA\Items(
174 * type="object",
175 * ),
176 * ),
177 * @OA\Property(
178 * property="internalErrors",
179 * description="Internal errors.",
180 * type="array",
181 * @OA\Items(
182 * type="object",
183 * ),
184 * ),
185 * @OA\Property(
186 * property="data",
187 * description="Returned data.",
188 * type="array",
189 * @OA\Items(
190 * type="object",
191 * ),
192 * ),
193 * example={
194 * "validationErrors": {},
195 * "error_description": {},
196 * "data": {}
201 * @OA\Response(
202 * response="badrequest",
203 * description="Bad Request",
204 * @OA\MediaType(
205 * mediaType="application/json",
206 * @OA\Schema(
207 * @OA\Property(
208 * property="validationErrors",
209 * description="Validation errors.",
210 * type="object"
211 * ),
212 * example={
213 * "validationErrors":
215 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
221 * @OA\Response(
222 * response="unauthorized",
223 * description="Unauthorized",
224 * @OA\MediaType(
225 * mediaType="application/json",
226 * @OA\Schema(
227 * @OA\Property(
228 * property="error",
229 * description="The error.",
230 * type="string"
231 * ),
232 * @OA\Property(
233 * property="error_description",
234 * description="The description of the error.",
235 * type="string"
236 * ),
237 * @OA\Property(
238 * property="hint",
239 * description="More specific information on the error.",
240 * type="string"
241 * ),
242 * @OA\Property(
243 * property="message",
244 * description="Message regarding the error.",
245 * type="string"
246 * ),
247 * example={
248 * "error": "access_denied",
249 * "error_description": "The resource owner or authorization server denied the request.",
250 * "hint": "Missing ""Authorization"" header",
251 * "message": "The resource owner or authorization server denied the request."
256 * @OA\Response(
257 * response="uuidnotfound",
258 * description="Not Found",
259 * @OA\MediaType(
260 * mediaType="application/json",
261 * @OA\Schema(
262 * @OA\Property(
263 * property="empty",
264 * description="empty",
265 * type="object"
266 * ),
267 * example={}
273 // Lets keep our controller classes with the routes.
275 use OpenEMR\Common\Acl\AccessDeniedException;
276 use OpenEMR\Common\Http\HttpRestRequest;
277 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
278 use OpenEMR\RestControllers\FacilityRestController;
279 use OpenEMR\RestControllers\VersionRestController;
280 use OpenEMR\RestControllers\ProductRegistrationRestController;
281 use OpenEMR\RestControllers\PatientRestController;
282 use OpenEMR\RestControllers\EncounterRestController;
283 use OpenEMR\RestControllers\PractitionerRestController;
284 use OpenEMR\RestControllers\ListRestController;
285 use OpenEMR\RestControllers\InsuranceCompanyRestController;
286 use OpenEMR\RestControllers\AppointmentRestController;
287 use OpenEMR\RestControllers\ConditionRestController;
288 use OpenEMR\RestControllers\ONoteRestController;
289 use OpenEMR\RestControllers\DocumentRestController;
290 use OpenEMR\RestControllers\DrugRestController;
291 use OpenEMR\RestControllers\ImmunizationRestController;
292 use OpenEMR\RestControllers\InsuranceRestController;
293 use OpenEMR\RestControllers\MessageRestController;
294 use OpenEMR\RestControllers\PrescriptionRestController;
295 use OpenEMR\RestControllers\ProcedureRestController;
296 use OpenEMR\RestControllers\TransactionRestController;
298 // Note some Http clients may not send auth as json so a function
299 // is implemented to determine and parse encoding on auth route's.
301 // Note that the api route is only for users role
302 // (there is a mechanism in place to ensure only user role can access the api route)
303 RestConfig::$ROUTE_MAP = array(
305 * @OA\Get(
306 * path="/api/facility",
307 * description="Returns a single facility.",
308 * tags={"standard"},
309 * @OA\Parameter(
310 * name="name",
311 * in="query",
312 * description="The name for the facility.",
313 * required=false,
314 * @OA\Schema(
315 * type="string"
317 * ),
318 * @OA\Parameter(
319 * name="facility_npi",
320 * in="query",
321 * description="The facility_npi for the facility.",
322 * required=false,
323 * @OA\Schema(
324 * type="string"
326 * ),
327 * @OA\Parameter(
328 * name="phone",
329 * in="query",
330 * description="The phone for the facility.",
331 * required=false,
332 * @OA\Schema(
333 * type="string"
335 * ),
336 * @OA\Parameter(
337 * name="fax",
338 * in="query",
339 * description="The fax for the facility.",
340 * required=false,
341 * @OA\Schema(
342 * type="string"
344 * ),
345 * @OA\Parameter(
346 * name="street",
347 * in="query",
348 * description="The street for the facility.",
349 * required=false,
350 * @OA\Schema(
351 * type="string"
353 * ),
354 * @OA\Parameter(
355 * name="city",
356 * in="query",
357 * description="The city for the facility.",
358 * required=false,
359 * @OA\Schema(
360 * type="string"
362 * ),
363 * @OA\Parameter(
364 * name="state",
365 * in="query",
366 * description="The state for the facility.",
367 * required=false,
368 * @OA\Schema(
369 * type="string"
371 * ),
372 * @OA\Parameter(
373 * name="postal_code",
374 * in="query",
375 * description="The postal_code for the facility.",
376 * required=false,
377 * @OA\Schema(
378 * type="string"
380 * ),
381 * @OA\Parameter(
382 * name="country_code",
383 * in="query",
384 * description="The country_code for the facility.",
385 * required=false,
386 * @OA\Schema(
387 * type="string"
389 * ),
390 * @OA\Parameter(
391 * name="federal_ein",
392 * in="query",
393 * description="The federal_ein for the facility.",
394 * required=false,
395 * @OA\Schema(
396 * type="string"
398 * ),
399 * @OA\Parameter(
400 * name="website",
401 * in="query",
402 * description="The website for the facility.",
403 * required=false,
404 * @OA\Schema(
405 * type="string"
407 * ),
408 * @OA\Parameter(
409 * name="email",
410 * in="query",
411 * description="The email for the facility.",
412 * required=false,
413 * @OA\Schema(
414 * type="string"
416 * ),
417 * @OA\Parameter(
418 * name="domain_identifier",
419 * in="query",
420 * description="The domain_identifier for the facility.",
421 * required=false,
422 * @OA\Schema(
423 * type="string"
425 * ),
426 * @OA\Parameter(
427 * name="facility_taxonomy",
428 * in="query",
429 * description="The facility_taxonomy for the facility.",
430 * required=false,
431 * @OA\Schema(
432 * type="string"
434 * ),
435 * @OA\Parameter(
436 * name="facility_code",
437 * in="query",
438 * description="The facility_code for the facility.",
439 * required=false,
440 * @OA\Schema(
441 * type="string"
443 * ),
444 * @OA\Parameter(
445 * name="billing_location",
446 * in="query",
447 * description="The billing_location setting for the facility.",
448 * required=false,
449 * @OA\Schema(
450 * type="string"
452 * ),
453 * @OA\Parameter(
454 * name="accepts_assignment",
455 * in="query",
456 * description="The accepts_assignment setting for the facility.",
457 * required=false,
458 * @OA\Schema(
459 * type="string"
461 * ),
462 * @OA\Parameter(
463 * name="oid",
464 * in="query",
465 * description="The oid for the facility.",
466 * required=false,
467 * @OA\Schema(
468 * type="string"
470 * ),
471 * @OA\Parameter(
472 * name="service_location",
473 * in="query",
474 * description="The service_location setting for the facility.",
475 * required=false,
476 * @OA\Schema(
477 * type="string"
479 * ),
480 * @OA\Response(
481 * response="200",
482 * ref="#/components/responses/standard"
483 * ),
484 * @OA\Response(
485 * response="400",
486 * ref="#/components/responses/badrequest"
487 * ),
488 * @OA\Response(
489 * response="401",
490 * ref="#/components/responses/unauthorized"
491 * ),
492 * security={{"openemr_auth":{}}}
495 "GET /api/facility" => function () {
496 RestConfig::authorization_check("admin", "users");
497 $return = (new FacilityRestController())->getAll($_GET);
498 RestConfig::apiLog($return);
499 return $return;
503 * @OA\Get(
504 * path="/api/facility/{fuuid}",
505 * description="Returns a single facility.",
506 * tags={"standard"},
507 * @OA\Parameter(
508 * name="fuuid",
509 * in="path",
510 * description="The uuid for the facility.",
511 * required=true,
512 * @OA\Schema(
513 * type="string"
515 * ),
516 * @OA\Response(
517 * response="200",
518 * ref="#/components/responses/standard"
519 * ),
520 * @OA\Response(
521 * response="400",
522 * ref="#/components/responses/badrequest"
523 * ),
524 * @OA\Response(
525 * response="401",
526 * ref="#/components/responses/unauthorized"
527 * ),
528 * security={{"openemr_auth":{}}}
531 "GET /api/facility/:fuuid" => function ($fuuid) {
532 RestConfig::authorization_check("admin", "users");
533 $return = (new FacilityRestController())->getOne($fuuid);
534 RestConfig::apiLog($return);
535 return $return;
539 * @OA\Post(
540 * path="/api/facility",
541 * description="Creates a facility in the system",
542 * tags={"standard"},
543 * @OA\RequestBody(
544 * required=true,
545 * @OA\MediaType(
546 * mediaType="application/json",
547 * @OA\Schema(
548 * @OA\Property(
549 * property="name",
550 * description="The name for the facility.",
551 * type="string"
552 * ),
553 * @OA\Property(
554 * property="facility_npi",
555 * description="The facility_npi for the facility.",
556 * type="string"
557 * ),
558 * @OA\Property(
559 * property="phone",
560 * description="The phone for the facility.",
561 * type="string"
562 * ),
563 * @OA\Property(
564 * property="fax",
565 * description="The fax for the facility.",
566 * type="string"
567 * ),
568 * @OA\Property(
569 * property="street",
570 * description="The street for the facility.",
571 * type="string"
572 * ),
573 * @OA\Property(
574 * property="city",
575 * description="The city for the facility.",
576 * type="string"
577 * ),
578 * @OA\Property(
579 * property="state",
580 * description="The state for the facility.",
581 * type="string"
582 * ),
583 * @OA\Property(
584 * property="postal_code",
585 * description="The postal_code for the facility.",
586 * type="string"
587 * ),
588 * @OA\Property(
589 * property="country_code",
590 * description="The country_code for the facility.",
591 * type="string"
592 * ),
593 * @OA\Property(
594 * property="federal_ein",
595 * description="The federal_ein for the facility.",
596 * type="string"
597 * ),
598 * @OA\Property(
599 * property="website",
600 * description="The website for the facility.",
601 * type="string"
602 * ),
603 * @OA\Property(
604 * property="email",
605 * description="The email for the facility.",
606 * type="string"
607 * ),
608 * @OA\Property(
609 * property="domain_identifier",
610 * description="The domain_identifier for the facility.",
611 * type="string"
612 * ),
613 * @OA\Property(
614 * property="facility_taxonomy",
615 * description="The facility_taxonomy for the facility.",
616 * type="string"
617 * ),
618 * @OA\Property(
619 * property="facility_code",
620 * description="The facility_code for the facility.",
621 * type="string"
622 * ),
623 * @OA\Property(
624 * property="billing_location",
625 * description="The billing_location setting for the facility.",
626 * type="string"
627 * ),
628 * @OA\Property(
629 * property="accepts_assignment",
630 * description="The accepts_assignment setting for the facility.",
631 * type="string"
632 * ),
633 * @OA\Property(
634 * property="oid",
635 * description="The oid for the facility.",
636 * type="string"
637 * ),
638 * @OA\Property(
639 * property="service_location",
640 * description="The service_location setting for the facility.",
641 * type="string"
642 * ),
643 * required={"name", "facility_npi"},
644 * example={
645 * "name": "Aquaria",
646 * "facility_npi": "123456789123",
647 * "phone": "808-606-3030",
648 * "fax": "808-606-3031",
649 * "street": "1337 Bit Shifter Ln",
650 * "city": "San Lorenzo",
651 * "state": "ZZ",
652 * "postal_code": "54321",
653 * "country_code": "US",
654 * "federal_ein": "4343434",
655 * "website": "https://example.com",
656 * "email": "foo@bar.com",
657 * "domain_identifier": "",
658 * "facility_taxonomy": "",
659 * "facility_code": "",
660 * "billing_location": "1",
661 * "accepts_assignment": "1",
662 * "oid": "",
663 * "service_location": "1"
667 * ),
668 * @OA\Response(
669 * response="200",
670 * ref="#/components/responses/standard"
671 * ),
672 * @OA\Response(
673 * response="400",
674 * ref="#/components/responses/badrequest"
675 * ),
676 * @OA\Response(
677 * response="401",
678 * ref="#/components/responses/unauthorized"
679 * ),
680 * security={{"openemr_auth":{}}}
683 "POST /api/facility" => function () {
684 RestConfig::authorization_check("admin", "super");
685 $data = (array) (json_decode(file_get_contents("php://input")));
686 $return = (new FacilityRestController())->post($data);
687 RestConfig::apiLog($return, $data);
688 return $return;
692 * @OA\Put(
693 * path="/api/facility/{fuuid}",
694 * description="Updates a facility in the system",
695 * tags={"standard"},
696 * @OA\Parameter(
697 * name="fuuid",
698 * in="path",
699 * description="The uuid for the facility.",
700 * required=true,
701 * @OA\Schema(
702 * type="string"
704 * ),
705 * @OA\RequestBody(
706 * required=true,
707 * @OA\MediaType(
708 * mediaType="application/json",
709 * @OA\Schema(
710 * @OA\Property(
711 * property="name",
712 * description="The name for the facility.",
713 * type="string"
714 * ),
715 * @OA\Property(
716 * property="facility_npi",
717 * description="The facility_npi for the facility.",
718 * type="string"
719 * ),
720 * @OA\Property(
721 * property="phone",
722 * description="The phone for the facility.",
723 * type="string"
724 * ),
725 * @OA\Property(
726 * property="fax",
727 * description="The fax for the facility.",
728 * type="string"
729 * ),
730 * @OA\Property(
731 * property="street",
732 * description="The street for the facility.",
733 * type="string"
734 * ),
735 * @OA\Property(
736 * property="city",
737 * description="The city for the facility.",
738 * type="string"
739 * ),
740 * @OA\Property(
741 * property="state",
742 * description="The state for the facility.",
743 * type="string"
744 * ),
745 * @OA\Property(
746 * property="postal_code",
747 * description="The postal_code for the facility.",
748 * type="string"
749 * ),
750 * @OA\Property(
751 * property="country_code",
752 * description="The country_code for the facility.",
753 * type="string"
754 * ),
755 * @OA\Property(
756 * property="federal_ein",
757 * description="The federal_ein for the facility.",
758 * type="string"
759 * ),
760 * @OA\Property(
761 * property="website",
762 * description="The website for the facility.",
763 * type="string"
764 * ),
765 * @OA\Property(
766 * property="email",
767 * description="The email for the facility.",
768 * type="string"
769 * ),
770 * @OA\Property(
771 * property="domain_identifier",
772 * description="The domain_identifier for the facility.",
773 * type="string"
774 * ),
775 * @OA\Property(
776 * property="facility_taxonomy",
777 * description="The facility_taxonomy for the facility.",
778 * type="string"
779 * ),
780 * @OA\Property(
781 * property="facility_code",
782 * description="The facility_code for the facility.",
783 * type="string"
784 * ),
785 * @OA\Property(
786 * property="billing_location",
787 * description="The billing_location setting for the facility.",
788 * type="string"
789 * ),
790 * @OA\Property(
791 * property="accepts_assignment",
792 * description="The accepts_assignment setting for the facility.",
793 * type="string"
794 * ),
795 * @OA\Property(
796 * property="oid",
797 * description="The oid for the facility.",
798 * type="string"
799 * ),
800 * @OA\Property(
801 * property="service_location",
802 * description="The service_location setting for the facility.",
803 * type="string"
804 * ),
805 * example={
806 * "name": "Aquaria",
807 * "facility_npi": "123456789123",
808 * "phone": "808-606-3030",
809 * "fax": "808-606-3031",
810 * "street": "1337 Bit Shifter Ln",
811 * "city": "San Lorenzo",
812 * "state": "ZZ",
813 * "postal_code": "54321",
814 * "country_code": "US",
815 * "federal_ein": "4343434",
816 * "website": "https://example.com",
817 * "email": "foo@bar.com",
818 * "domain_identifier": "",
819 * "facility_taxonomy": "",
820 * "facility_code": "",
821 * "billing_location": "1",
822 * "accepts_assignment": "1",
823 * "oid": "",
824 * "service_location": "1"
828 * ),
829 * @OA\Response(
830 * response="200",
831 * ref="#/components/responses/standard"
832 * ),
833 * @OA\Response(
834 * response="400",
835 * ref="#/components/responses/badrequest"
836 * ),
837 * @OA\Response(
838 * response="401",
839 * ref="#/components/responses/unauthorized"
840 * ),
841 * security={{"openemr_auth":{}}}
844 "PUT /api/facility/:fuuid" => function ($fuuid) {
845 RestConfig::authorization_check("admin", "super");
846 $data = (array) (json_decode(file_get_contents("php://input")));
847 $return = (new FacilityRestController())->patch($fuuid, $data);
848 RestConfig::apiLog($return, $data);
849 return $return;
853 * @OA\Get(
854 * path="/api/patient",
855 * description="Retrieves a list of patients",
856 * tags={"standard"},
857 * @OA\Parameter(
858 * name="fname",
859 * in="query",
860 * description="The first name for the patient.",
861 * required=false,
862 * @OA\Schema(
863 * type="string"
865 * ),
866 * @OA\Parameter(
867 * name="lname",
868 * in="query",
869 * description="The last name for the patient.",
870 * required=false,
871 * @OA\Schema(
872 * type="string"
874 * ),
875 * @OA\Parameter(
876 * name="ss",
877 * in="query",
878 * description="The social security number for the patient.",
879 * required=false,
880 * @OA\Schema(
881 * type="string"
883 * ),
884 * @OA\Parameter(
885 * name="street",
886 * in="query",
887 * description="The street for the patient.",
888 * required=false,
889 * @OA\Schema(
890 * type="string"
892 * ),
893 * @OA\Parameter(
894 * name="postal_code",
895 * in="query",
896 * description="The postal code for the patient.",
897 * required=false,
898 * @OA\Schema(
899 * type="string"
901 * ),
902 * @OA\Parameter(
903 * name="city",
904 * in="query",
905 * description="The city for the patient.",
906 * required=false,
907 * @OA\Schema(
908 * type="string"
910 * ),
911 * @OA\Parameter(
912 * name="state",
913 * in="query",
914 * description="The state for the patient.",
915 * required=false,
916 * @OA\Schema(
917 * type="string"
919 * ),
920 * @OA\Parameter(
921 * name="phone_home",
922 * in="query",
923 * description="The home phone for the patient.",
924 * required=false,
925 * @OA\Schema(
926 * type="string"
928 * ),
929 * @OA\Parameter(
930 * name="phone_biz",
931 * in="query",
932 * description="The business phone for the patient.",
933 * required=false,
934 * @OA\Schema(
935 * type="string"
937 * ),
938 * @OA\Parameter(
939 * name="phone_cell",
940 * in="query",
941 * description="The cell phone for the patient.",
942 * required=false,
943 * @OA\Schema(
944 * type="string"
946 * ),
947 * @OA\Parameter(
948 * name="postal_contact",
949 * in="query",
950 * description="The postal_contact for the patient.",
951 * required=false,
952 * @OA\Schema(
953 * type="string"
955 * ),
956 * @OA\Parameter(
957 * name="sex",
958 * in="query",
959 * description="The gender for the patient.",
960 * required=false,
961 * @OA\Schema(
962 * type="string"
964 * ),
965 * @OA\Parameter(
966 * name="country_code",
967 * in="query",
968 * description="The country code for the patient.",
969 * required=false,
970 * @OA\Schema(
971 * type="string"
973 * ),
974 * @OA\Parameter(
975 * name="email",
976 * in="query",
977 * description="The email for the patient.",
978 * required=false,
979 * @OA\Schema(
980 * type="string"
982 * ),
983 * @OA\Parameter(
984 * name="DOB",
985 * in="query",
986 * description="The DOB for the patient.",
987 * required=false,
988 * @OA\Schema(
989 * type="string"
991 * ),
992 * @OA\Response(
993 * response="200",
994 * ref="#/components/responses/standard"
995 * ),
996 * @OA\Response(
997 * response="400",
998 * ref="#/components/responses/badrequest"
999 * ),
1000 * @OA\Response(
1001 * response="401",
1002 * ref="#/components/responses/unauthorized"
1003 * ),
1004 * security={{"openemr_auth":{}}}
1007 "GET /api/patient" => function () {
1008 RestConfig::authorization_check("patients", "demo");
1009 $return = (new PatientRestController())->getAll($_GET);
1010 RestConfig::apiLog($return);
1011 return $return;
1015 * Schema for the patient request
1017 * @OA\Schema(
1018 * schema="api_patient_request",
1019 * @OA\Property(
1020 * property="title",
1021 * description="The title of patient.",
1022 * type="string"
1023 * ),
1024 * @OA\Property(
1025 * property="fname",
1026 * description="The fname of patient.",
1027 * type="string"
1028 * ),
1029 * @OA\Property(
1030 * property="mname",
1031 * description="The mname of patient.",
1032 * type="string"
1033 * ),
1034 * @OA\Property(
1035 * property="lname",
1036 * description="The lname of patient.",
1037 * type="string"
1038 * ),
1039 * @OA\Property(
1040 * property="street",
1041 * description="The street address of patient.",
1042 * type="string"
1043 * ),
1044 * @OA\Property(
1045 * property="postal_code",
1046 * description="The postal code of patient.",
1047 * type="string"
1048 * ),
1049 * @OA\Property(
1050 * property="city",
1051 * description="The city of patient.",
1052 * type="string"
1053 * ),
1054 * @OA\Property(
1055 * property="state",
1056 * description="The state of patient.",
1057 * type="string"
1058 * ),
1059 * @OA\Property(
1060 * property="country_code",
1061 * description="The country code of patient.",
1062 * type="string"
1063 * ),
1064 * @OA\Property(
1065 * property="phone_contact",
1066 * description="The phone contact of patient.",
1067 * type="string"
1068 * ),
1069 * @OA\Property(
1070 * property="DOB",
1071 * description="The DOB of patient.",
1072 * type="string"
1073 * ),
1074 * @OA\Property(
1075 * property="sex",
1076 * description="The lname of patient.",
1077 * type="string"
1078 * ),
1079 * @OA\Property(
1080 * property="race",
1081 * description="The race of patient.",
1082 * type="string"
1083 * ),
1084 * @OA\Property(
1085 * property="ethnicity",
1086 * description="The ethnicity of patient.",
1087 * type="string"
1088 * ),
1089 * required={"fname", "lname", "DOB", "sex"},
1090 * example={
1091 * "title": "Mr",
1092 * "fname": "Foo",
1093 * "mname": "",
1094 * "lname": "Bar",
1095 * "street": "456 Tree Lane",
1096 * "postal_code": "08642",
1097 * "city": "FooTown",
1098 * "state": "FL",
1099 * "country_code": "US",
1100 * "phone_contact": "123-456-7890",
1101 * "DOB": "1992-02-02",
1102 * "sex": "Male",
1103 * "race": "",
1104 * "ethnicity": ""
1109 * @OA\Post(
1110 * path="/api/patient",
1111 * description="Creates a new patient",
1112 * tags={"standard"},
1113 * @OA\RequestBody(
1114 * required=true,
1115 * @OA\MediaType(
1116 * mediaType="application/json",
1117 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1119 * ),
1120 * @OA\Response(
1121 * response="200",
1122 * description="Standard response",
1123 * @OA\MediaType(
1124 * mediaType="application/json",
1125 * @OA\Schema(
1126 * @OA\Property(
1127 * property="validationErrors",
1128 * description="Validation errors.",
1129 * type="array",
1130 * @OA\Items(
1131 * type="object",
1132 * ),
1133 * ),
1134 * @OA\Property(
1135 * property="internalErrors",
1136 * description="Internal errors.",
1137 * type="array",
1138 * @OA\Items(
1139 * type="object",
1140 * ),
1141 * ),
1142 * @OA\Property(
1143 * property="data",
1144 * description="Returned data.",
1145 * type="array",
1146 * @OA\Items(
1147 * @OA\Property(
1148 * property="pid",
1149 * description="patient pid",
1150 * type="integer",
1152 * ),
1153 * ),
1154 * example={
1155 * "validationErrors": {},
1156 * "error_description": {},
1157 * "data": {
1158 * "pid": 1
1163 * ),
1164 * @OA\Response(
1165 * response="401",
1166 * ref="#/components/responses/unauthorized"
1167 * ),
1168 * security={{"openemr_auth":{}}}
1171 "POST /api/patient" => function () {
1172 RestConfig::authorization_check("patients", "demo");
1173 $data = (array) (json_decode(file_get_contents("php://input")));
1174 $return = (new PatientRestController())->post($data);
1175 RestConfig::apiLog($return, $data);
1176 return $return;
1180 * Schema for the patient response
1182 * @OA\Schema(
1183 * schema="api_patient_response",
1184 * @OA\Property(
1185 * property="validationErrors",
1186 * description="Validation errors.",
1187 * type="array",
1188 * @OA\Items(
1189 * type="object",
1190 * ),
1191 * ),
1192 * @OA\Property(
1193 * property="internalErrors",
1194 * description="Internal errors.",
1195 * type="array",
1196 * @OA\Items(
1197 * type="object",
1198 * ),
1199 * ),
1200 * @OA\Property(
1201 * property="data",
1202 * description="Returned data.",
1203 * type="array",
1204 * @OA\Items(
1205 * @OA\Property(
1206 * property="id",
1207 * description="patient id",
1208 * type="string",
1209 * ),
1210 * @OA\Property(
1211 * property="pid",
1212 * description="patient pid",
1213 * type="string",
1214 * ),
1215 * @OA\Property(
1216 * property="pubpid",
1217 * description="patient public id",
1218 * type="string",
1219 * ),
1220 * @OA\Property(
1221 * property="title",
1222 * description="patient title",
1223 * type="string",
1224 * ),
1225 * @OA\Property(
1226 * property="fname",
1227 * description="patient first name",
1228 * type="string",
1229 * ),
1230 * @OA\Property(
1231 * property="mname",
1232 * description="patient middle name",
1233 * type="string",
1234 * ),
1235 * @OA\Property(
1236 * property="lname",
1237 * description="patient last name",
1238 * type="string",
1239 * ),
1240 * @OA\Property(
1241 * property="ss",
1242 * description="patient social security number",
1243 * type="string",
1244 * ),
1245 * @OA\Property(
1246 * property="street",
1247 * description="patient street address",
1248 * type="string",
1249 * ),
1250 * @OA\Property(
1251 * property="postal_code",
1252 * description="patient postal code",
1253 * type="string",
1254 * ),
1255 * @OA\Property(
1256 * property="city",
1257 * description="patient city",
1258 * type="string",
1259 * ),
1260 * @OA\Property(
1261 * property="state",
1262 * description="patient state",
1263 * type="string",
1264 * ),
1265 * @OA\Property(
1266 * property="county",
1267 * description="patient county",
1268 * type="string",
1269 * ),
1270 * @OA\Property(
1271 * property="country_code",
1272 * description="patient country code",
1273 * type="string",
1274 * ),
1275 * @OA\Property(
1276 * property="drivers_license",
1277 * description="patient drivers license id",
1278 * type="string",
1279 * ),
1280 * @OA\Property(
1281 * property="contact_relationship",
1282 * description="patient contact relationship",
1283 * type="string",
1284 * ),
1285 * @OA\Property(
1286 * property="phone_contact",
1287 * description="patient phone contact",
1288 * type="string",
1289 * ),
1290 * @OA\Property(
1291 * property="phone_home",
1292 * description="patient home phone",
1293 * type="string",
1294 * ),
1295 * @OA\Property(
1296 * property="phone_biz",
1297 * description="patient work phone",
1298 * type="string",
1299 * ),
1300 * @OA\Property(
1301 * property="phone_cell",
1302 * description="patient mobile phone",
1303 * type="string",
1304 * ),
1305 * @OA\Property(
1306 * property="email",
1307 * description="patient email",
1308 * type="string",
1309 * ),
1310 * @OA\Property(
1311 * property="DOB",
1312 * description="patient DOB",
1313 * type="string",
1314 * ),
1315 * @OA\Property(
1316 * property="sex",
1317 * description="patient sex (gender)",
1318 * type="string",
1319 * ),
1320 * @OA\Property(
1321 * property="race",
1322 * description="patient race",
1323 * type="string",
1324 * ),
1325 * @OA\Property(
1326 * property="ethnicity",
1327 * description="patient ethnicity",
1328 * type="string",
1329 * ),
1330 * @OA\Property(
1331 * property="status",
1332 * description="patient status",
1333 * type="string",
1334 * ),
1335 * ),
1336 * ),
1337 * example={
1338 * "validationErrors": {},
1339 * "error_description": {},
1340 * "data": {
1341 * "id": "193",
1342 * "pid": "1",
1343 * "pubpid": "",
1344 * "title": "Mr",
1345 * "fname": "Baz",
1346 * "mname": "",
1347 * "lname": "Bop",
1348 * "ss": "",
1349 * "street": "456 Tree Lane",
1350 * "postal_code": "08642",
1351 * "city": "FooTown",
1352 * "state": "FL",
1353 * "county": "",
1354 * "country_code": "US",
1355 * "drivers_license": "",
1356 * "contact_relationship": "",
1357 * "phone_contact": "123-456-7890",
1358 * "phone_home": "",
1359 * "phone_biz": "",
1360 * "phone_cell": "",
1361 * "email": "",
1362 * "DOB": "1992-02-03",
1363 * "sex": "Male",
1364 * "race": "",
1365 * "ethnicity": "",
1366 * "status": ""
1372 * @OA\Put(
1373 * path="/api/patient/{puuid}",
1374 * description="Updates a patient",
1375 * tags={"standard"},
1376 * @OA\Parameter(
1377 * name="puuid",
1378 * in="path",
1379 * description="The uuid for the patient.",
1380 * required=true,
1381 * @OA\Schema(
1382 * type="string"
1384 * ),
1385 * @OA\RequestBody(
1386 * required=true,
1387 * @OA\MediaType(
1388 * mediaType="application/json",
1389 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1391 * ),
1392 * @OA\Response(
1393 * response="200",
1394 * description="Standard response",
1395 * @OA\MediaType(
1396 * mediaType="application/json",
1397 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1399 * ),
1400 * @OA\Response(
1401 * response="401",
1402 * ref="#/components/responses/unauthorized"
1403 * ),
1404 * security={{"openemr_auth":{}}}
1407 "PUT /api/patient/:puuid" => function ($puuid) {
1408 RestConfig::authorization_check("patients", "demo");
1409 $data = (array) (json_decode(file_get_contents("php://input")));
1410 $return = (new PatientRestController())->put($puuid, $data);
1411 RestConfig::apiLog($return, $data);
1412 return $return;
1416 * @OA\Get(
1417 * path="/api/patient/{puuid}",
1418 * description="Retrieves a single patient by their uuid",
1419 * tags={"standard"},
1420 * @OA\Parameter(
1421 * name="puuid",
1422 * in="path",
1423 * description="The uuid for the patient.",
1424 * required=true,
1425 * @OA\Schema(
1426 * type="string"
1428 * ),
1429 * @OA\Response(
1430 * response="200",
1431 * description="Standard response",
1432 * @OA\MediaType(
1433 * mediaType="application/json",
1434 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1436 * ),
1437 * @OA\Response(
1438 * response="401",
1439 * ref="#/components/responses/unauthorized"
1440 * ),
1441 * security={{"openemr_auth":{}}}
1444 "GET /api/patient/:puuid" => function ($puuid) {
1445 RestConfig::authorization_check("patients", "demo");
1446 $return = (new PatientRestController())->getOne($puuid);
1447 RestConfig::apiLog($return);
1448 return $return;
1452 * @OA\Get(
1453 * path="/api/patient/{puuid}/encounter",
1454 * description="Retrieves a list of encounters for a single patient",
1455 * tags={"standard"},
1456 * @OA\Parameter(
1457 * name="puuid",
1458 * in="path",
1459 * description="The uuid for the patient.",
1460 * required=true,
1461 * @OA\Schema(
1462 * type="string"
1464 * ),
1465 * @OA\Response(
1466 * response="200",
1467 * ref="#/components/responses/standard"
1468 * ),
1469 * @OA\Response(
1470 * response="400",
1471 * ref="#/components/responses/badrequest"
1472 * ),
1473 * @OA\Response(
1474 * response="401",
1475 * ref="#/components/responses/unauthorized"
1476 * ),
1477 * security={{"openemr_auth":{}}}
1480 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1481 RestConfig::authorization_check("encounters", "auth_a");
1482 $return = (new EncounterRestController())->getAll($puuid);
1483 RestConfig::apiLog($return);
1484 return $return;
1488 * Schema for the encounter request
1490 * @OA\Schema(
1491 * schema="api_encounter_request",
1492 * @OA\Property(
1493 * property="date",
1494 * description="The date of encounter.",
1495 * type="string"
1496 * ),
1497 * @OA\Property(
1498 * property="onset_date",
1499 * description="The onset date of encounter.",
1500 * type="string"
1501 * ),
1502 * @OA\Property(
1503 * property="reason",
1504 * description="The reason of encounter.",
1505 * type="string"
1506 * ),
1507 * @OA\Property(
1508 * property="facility",
1509 * description="The facility of encounter.",
1510 * type="string"
1511 * ),
1512 * @OA\Property(
1513 * property="pc_catid",
1514 * description="The pc_catid of encounter.",
1515 * type="string"
1516 * ),
1517 * @OA\Property(
1518 * property="facility_id",
1519 * description="The facility id of encounter.",
1520 * type="string"
1521 * ),
1522 * @OA\Property(
1523 * property="billing_facility",
1524 * description="The billing facility id of encounter.",
1525 * type="string"
1526 * ),
1527 * @OA\Property(
1528 * property="sensitivity",
1529 * description="The sensitivity of encounter.",
1530 * type="string"
1531 * ),
1532 * @OA\Property(
1533 * property="referral_source",
1534 * description="The referral source of encounter.",
1535 * type="string"
1536 * ),
1537 * @OA\Property(
1538 * property="pos_code",
1539 * description="The pos_code of encounter.",
1540 * type="string"
1541 * ),
1542 * @OA\Property(
1543 * property="external_id",
1544 * description="The external id of encounter.",
1545 * type="string"
1546 * ),
1547 * @OA\Property(
1548 * property="provider_id",
1549 * description="The provider id of encounter.",
1550 * type="string"
1551 * ),
1552 * @OA\Property(
1553 * property="class_code",
1554 * description="The class_code of encounter.",
1555 * type="string"
1556 * ),
1557 * required={"pc_catid", "class_code"},
1558 * example={
1559 * "date":"2020-11-10",
1560 * "onset_date": "",
1561 * "reason": "Pregnancy Test",
1562 * "facility": "Owerri General Hospital",
1563 * "pc_catid": "5",
1564 * "facility_id": "3",
1565 * "billing_facility": "3",
1566 * "sensitivity": "normal",
1567 * "referral_source": "",
1568 * "pos_code": "0",
1569 * "external_id": "",
1570 * "provider_id": "1",
1571 * "class_code" : "AMB"
1576 * @OA\Post(
1577 * path="/api/patient/{puuid}/encounter",
1578 * description="Creates a new encounter",
1579 * tags={"standard"},
1580 * @OA\Parameter(
1581 * name="puuid",
1582 * in="path",
1583 * description="The uuid for the patient.",
1584 * required=true,
1585 * @OA\Schema(
1586 * type="string"
1588 * ),
1589 * @OA\RequestBody(
1590 * required=true,
1591 * @OA\MediaType(
1592 * mediaType="application/json",
1593 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1595 * ),
1596 * @OA\Response(
1597 * response="200",
1598 * description="Standard response",
1599 * @OA\MediaType(
1600 * mediaType="application/json",
1601 * @OA\Schema(
1602 * @OA\Property(
1603 * property="validationErrors",
1604 * description="Validation errors.",
1605 * type="array",
1606 * @OA\Items(
1607 * type="object",
1608 * ),
1609 * ),
1610 * @OA\Property(
1611 * property="internalErrors",
1612 * description="Internal errors.",
1613 * type="array",
1614 * @OA\Items(
1615 * type="object",
1616 * ),
1617 * ),
1618 * @OA\Property(
1619 * property="data",
1620 * description="Returned data.",
1621 * type="array",
1622 * @OA\Items(
1623 * @OA\Property(
1624 * property="encounter",
1625 * description="encounter id",
1626 * type="integer",
1627 * ),
1628 * @OA\Property(
1629 * property="uuid",
1630 * description="encounter uuid",
1631 * type="string",
1633 * ),
1634 * ),
1635 * example={
1636 * "validationErrors": {},
1637 * "error_description": {},
1638 * "data": {
1639 * "encounter": 1,
1640 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1645 * ),
1646 * @OA\Response(
1647 * response="401",
1648 * ref="#/components/responses/unauthorized"
1649 * ),
1650 * security={{"openemr_auth":{}}}
1653 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1654 RestConfig::authorization_check("encounters", "auth_a");
1655 $data = (array) (json_decode(file_get_contents("php://input")));
1656 $return = (new EncounterRestController())->post($puuid, $data);
1657 RestConfig::apiLog($return, $data);
1658 return $return;
1662 * Schema for the encounter response
1664 * @OA\Schema(
1665 * schema="api_encounter_response",
1666 * @OA\Property(
1667 * property="validationErrors",
1668 * description="Validation errors.",
1669 * type="array",
1670 * @OA\Items(
1671 * type="object",
1672 * ),
1673 * ),
1674 * @OA\Property(
1675 * property="internalErrors",
1676 * description="Internal errors.",
1677 * type="array",
1678 * @OA\Items(
1679 * type="object",
1680 * ),
1681 * ),
1682 * @OA\Property(
1683 * property="data",
1684 * description="Returned data.",
1685 * type="array",
1686 * @OA\Items(
1687 * @OA\Property(
1688 * property="id",
1689 * description="encounter id",
1690 * type="string",
1691 * ),
1692 * @OA\Property(
1693 * property="uuid",
1694 * description="encounter uuid",
1695 * type="string",
1696 * ),
1697 * @OA\Property(
1698 * property="date",
1699 * description="encounter date",
1700 * type="string",
1701 * ),
1702 * @OA\Property(
1703 * property="reason",
1704 * description="encounter reason",
1705 * type="string",
1706 * ),
1707 * @OA\Property(
1708 * property="facility",
1709 * description="encounter facility name",
1710 * type="string",
1711 * ),
1712 * @OA\Property(
1713 * property="facility_id",
1714 * description="encounter facility id name",
1715 * type="string",
1716 * ),
1717 * @OA\Property(
1718 * property="pid",
1719 * description="encounter for patient pid",
1720 * type="string",
1721 * ),
1722 * @OA\Property(
1723 * property="onset_date",
1724 * description="encounter onset date",
1725 * type="string",
1726 * ),
1727 * @OA\Property(
1728 * property="sensitivity",
1729 * description="encounter sensitivity",
1730 * type="string",
1731 * ),
1732 * @OA\Property(
1733 * property="billing_note",
1734 * description="encounter billing note",
1735 * type="string",
1736 * ),
1737 * @OA\Property(
1738 * property="pc_catid",
1739 * description="encounter pc_catid",
1740 * type="string",
1741 * ),
1742 * @OA\Property(
1743 * property="last_level_billed",
1744 * description="encounter last_level_billed",
1745 * type="string",
1746 * ),
1747 * @OA\Property(
1748 * property="last_level_closed",
1749 * description="encounter last_level_closed",
1750 * type="string",
1751 * ),
1752 * @OA\Property(
1753 * property="last_stmt_date",
1754 * description="encounter last_stmt_date",
1755 * type="string",
1756 * ),
1757 * @OA\Property(
1758 * property="stmt_count",
1759 * description="encounter stmt_count",
1760 * type="string",
1761 * ),
1762 * @OA\Property(
1763 * property="provider_id",
1764 * description="provider id",
1765 * type="string",
1766 * ),
1767 * @OA\Property(
1768 * property="supervisor_id",
1769 * description="encounter supervisor id",
1770 * type="string",
1771 * ),
1772 * @OA\Property(
1773 * property="invoice_refno",
1774 * description="encounter invoice_refno",
1775 * type="string",
1776 * ),
1777 * @OA\Property(
1778 * property="referral_source",
1779 * description="encounter referral source",
1780 * type="string",
1781 * ),
1782 * @OA\Property(
1783 * property="billing_facility",
1784 * description="encounter billing facility id",
1785 * type="string",
1786 * ),
1787 * @OA\Property(
1788 * property="external_id",
1789 * description="encounter external id",
1790 * type="string",
1791 * ),
1792 * @OA\Property(
1793 * property="pos_code",
1794 * description="encounter pos_code",
1795 * type="string",
1796 * ),
1797 * @OA\Property(
1798 * property="class_code",
1799 * description="encounter class_code",
1800 * type="string",
1801 * ),
1802 * @OA\Property(
1803 * property="class_title",
1804 * description="encounter class_title",
1805 * type="string",
1806 * ),
1807 * @OA\Property(
1808 * property="pc_catname",
1809 * description="encounter pc_catname",
1810 * type="string",
1811 * ),
1812 * @OA\Property(
1813 * property="billing_facility_name",
1814 * description="encounter billing facility name",
1815 * type="string",
1816 * ),
1817 * ),
1818 * ),
1819 * example={
1820 * "validationErrors": {},
1821 * "error_description": {},
1822 * "data": {
1823 * "id": "1",
1824 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1825 * "date": "2019-09-14 00:00:00",
1826 * "reason": "Pregnancy Test",
1827 * "facility": "Owerri General Hospital",
1828 * "facility_id": "3",
1829 * "pid": "1",
1830 * "onset_date": "2019-04-20 00:00:00",
1831 * "sensitivity": "normal",
1832 * "billing_note": null,
1833 * "pc_catid": "5",
1834 * "last_level_billed": "0",
1835 * "last_level_closed": "0",
1836 * "last_stmt_date": null,
1837 * "stmt_count": "0",
1838 * "provider_id": "1",
1839 * "supervisor_id": "0",
1840 * "invoice_refno": "",
1841 * "referral_source": "",
1842 * "billing_facility": "3",
1843 * "external_id": "",
1844 * "pos_code": "0",
1845 * "class_code": "AMB",
1846 * "class_title": "ambulatory",
1847 * "pc_catname": "Office Visit",
1848 * "billing_facility_name": "Owerri General Hospital"
1854 * @OA\Put(
1855 * path="/api/patient/{puuid}/encounter/{euuid}",
1856 * description="Modify a encounter",
1857 * tags={"standard"},
1858 * @OA\Parameter(
1859 * name="puuid",
1860 * in="path",
1861 * description="The uuid for the patient.",
1862 * required=true,
1863 * @OA\Schema(
1864 * type="string"
1866 * ),
1867 * @OA\Parameter(
1868 * name="euuid",
1869 * in="path",
1870 * description="The uuid for the encounter.",
1871 * required=true,
1872 * @OA\Schema(
1873 * type="string"
1875 * ),
1876 * @OA\RequestBody(
1877 * required=true,
1878 * @OA\MediaType(
1879 * mediaType="application/json",
1880 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1882 * ),
1883 * @OA\Response(
1884 * response="200",
1885 * description="Standard response",
1886 * @OA\MediaType(
1887 * mediaType="application/json",
1888 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1890 * ),
1891 * @OA\Response(
1892 * response="401",
1893 * ref="#/components/responses/unauthorized"
1894 * ),
1895 * security={{"openemr_auth":{}}}
1898 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1899 RestConfig::authorization_check("encounters", "auth_a");
1900 $data = (array) (json_decode(file_get_contents("php://input")));
1901 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1902 RestConfig::apiLog($return, $data);
1903 return $return;
1907 * @OA\Get(
1908 * path="/api/patient/{puuid}/encounter/{euuid}",
1909 * description="Retrieves a single encounter for a patient",
1910 * tags={"standard"},
1911 * @OA\Parameter(
1912 * name="puuid",
1913 * in="path",
1914 * description="The uuid for the patient.",
1915 * required=true,
1916 * @OA\Schema(
1917 * type="string"
1919 * ),
1920 * @OA\Parameter(
1921 * name="euuid",
1922 * in="path",
1923 * description="The uuid for the encounter.",
1924 * required=true,
1925 * @OA\Schema(
1926 * type="string"
1928 * ),
1929 * @OA\Response(
1930 * response="200",
1931 * description="Standard response",
1932 * @OA\MediaType(
1933 * mediaType="application/json",
1934 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1936 * ),
1937 * @OA\Response(
1938 * response="401",
1939 * ref="#/components/responses/unauthorized"
1940 * ),
1941 * security={{"openemr_auth":{}}}
1944 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1945 RestConfig::authorization_check("encounters", "auth_a");
1946 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1947 RestConfig::apiLog($return);
1948 return $return;
1952 * @OA\Get(
1953 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1954 * description="Retrieves soap notes from an encounter for a patient",
1955 * tags={"standard"},
1956 * @OA\Parameter(
1957 * name="pid",
1958 * in="path",
1959 * description="The pid for the patient.",
1960 * required=true,
1961 * @OA\Schema(
1962 * type="string"
1964 * ),
1965 * @OA\Parameter(
1966 * name="eid",
1967 * in="path",
1968 * description="The id for the encounter.",
1969 * required=true,
1970 * @OA\Schema(
1971 * type="string"
1973 * ),
1974 * @OA\Response(
1975 * response="200",
1976 * ref="#/components/responses/standard"
1977 * ),
1978 * @OA\Response(
1979 * response="400",
1980 * ref="#/components/responses/badrequest"
1981 * ),
1982 * @OA\Response(
1983 * response="401",
1984 * ref="#/components/responses/unauthorized"
1985 * ),
1986 * security={{"openemr_auth":{}}}
1989 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1990 RestConfig::authorization_check("encounters", "notes");
1991 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1992 RestConfig::apiLog($return);
1993 return $return;
1997 * Schema for the vital request
1999 * @OA\Schema(
2000 * schema="api_vital_request",
2001 * @OA\Property(
2002 * property="bps",
2003 * description="The bps of vitals.",
2004 * type="string"
2005 * ),
2006 * @OA\Property(
2007 * property="bpd",
2008 * description="The bpd of vitals.",
2009 * type="string"
2010 * ),
2011 * @OA\Property(
2012 * property="weight",
2013 * description="The weight of vitals. (unit is lb)",
2014 * type="string"
2015 * ),
2016 * @OA\Property(
2017 * property="height",
2018 * description="The height of vitals. (unit is inches)",
2019 * type="string"
2020 * ),
2021 * @OA\Property(
2022 * property="temperature",
2023 * description="The temperature of temperature. (unit is F)",
2024 * type="string"
2025 * ),
2026 * @OA\Property(
2027 * property="temp_method",
2028 * description="The temp_method of vitals.",
2029 * type="string"
2030 * ),
2031 * @OA\Property(
2032 * property="pulse",
2033 * description="The pulse of vitals.",
2034 * type="string"
2035 * ),
2036 * @OA\Property(
2037 * property="respiration",
2038 * description="The respiration of vitals.",
2039 * type="string"
2040 * ),
2041 * @OA\Property(
2042 * property="note",
2043 * description="The note (ie. comments) of vitals.",
2044 * type="string"
2045 * ),
2046 * @OA\Property(
2047 * property="waist_circ",
2048 * description="The waist circumference of vitals. (unit is inches)",
2049 * type="string"
2050 * ),
2051 * @OA\Property(
2052 * property="head_circ",
2053 * description="The head circumference of vitals. (unit is inches)",
2054 * type="string"
2055 * ),
2056 * @OA\Property(
2057 * property="oxygen_saturation",
2058 * description="The oxygen_saturation of vitals.",
2059 * type="string"
2060 * ),
2061 * example={
2062 * "bps": "130",
2063 * "bpd": "80",
2064 * "weight": "220",
2065 * "height": "70",
2066 * "temperature": "98",
2067 * "temp_method": "Oral",
2068 * "pulse": "60",
2069 * "respiration": "20",
2070 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2071 * "waist_circ": "37",
2072 * "head_circ": "22.2",
2073 * "oxygen_saturation": "96"
2078 * @OA\Post(
2079 * path="/api/patient/{pid}/encounter/{eid}/vital",
2080 * description="Submits a new vitals form",
2081 * tags={"standard"},
2082 * @OA\Parameter(
2083 * name="pid",
2084 * in="path",
2085 * description="The id for the patient.",
2086 * required=true,
2087 * @OA\Schema(
2088 * type="string"
2090 * ),
2091 * @OA\Parameter(
2092 * name="eid",
2093 * in="path",
2094 * description="The id for the encounter.",
2095 * required=true,
2096 * @OA\Schema(
2097 * type="string"
2099 * ),
2100 * @OA\RequestBody(
2101 * required=true,
2102 * @OA\MediaType(
2103 * mediaType="application/json",
2104 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2106 * ),
2107 * @OA\Response(
2108 * response="200",
2109 * ref="#/components/responses/standard"
2110 * ),
2111 * @OA\Response(
2112 * response="400",
2113 * ref="#/components/responses/badrequest"
2114 * ),
2115 * @OA\Response(
2116 * response="401",
2117 * ref="#/components/responses/unauthorized"
2118 * ),
2119 * security={{"openemr_auth":{}}}
2122 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2123 RestConfig::authorization_check("encounters", "notes");
2124 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2125 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2126 RestConfig::apiLog($return, $data);
2127 return $return;
2131 * @OA\Put(
2132 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2133 * description="Edit a vitals form",
2134 * tags={"standard"},
2135 * @OA\Parameter(
2136 * name="pid",
2137 * in="path",
2138 * description="The id for the patient.",
2139 * required=true,
2140 * @OA\Schema(
2141 * type="string"
2143 * ),
2144 * @OA\Parameter(
2145 * name="eid",
2146 * in="path",
2147 * description="The id for the encounter.",
2148 * required=true,
2149 * @OA\Schema(
2150 * type="string"
2152 * ),
2153 * @OA\Parameter(
2154 * name="vid",
2155 * in="path",
2156 * description="The id for the vitalss form.",
2157 * required=true,
2158 * @OA\Schema(
2159 * type="string"
2161 * ),
2162 * @OA\RequestBody(
2163 * required=true,
2164 * @OA\MediaType(
2165 * mediaType="application/json",
2166 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2168 * ),
2169 * @OA\Response(
2170 * response="200",
2171 * ref="#/components/responses/standard"
2172 * ),
2173 * @OA\Response(
2174 * response="400",
2175 * ref="#/components/responses/badrequest"
2176 * ),
2177 * @OA\Response(
2178 * response="401",
2179 * ref="#/components/responses/unauthorized"
2180 * ),
2181 * security={{"openemr_auth":{}}}
2184 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2185 RestConfig::authorization_check("encounters", "notes");
2186 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2187 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2188 RestConfig::apiLog($return, $data);
2189 return $return;
2193 * @OA\Get(
2194 * path="/api/patient/{pid}/encounter/{eid}/vital",
2195 * description="Retrieves all vitals from an encounter for a patient",
2196 * tags={"standard"},
2197 * @OA\Parameter(
2198 * name="pid",
2199 * in="path",
2200 * description="The pid for the patient.",
2201 * required=true,
2202 * @OA\Schema(
2203 * type="string"
2205 * ),
2206 * @OA\Parameter(
2207 * name="eid",
2208 * in="path",
2209 * description="The id for the encounter.",
2210 * required=true,
2211 * @OA\Schema(
2212 * type="string"
2214 * ),
2215 * @OA\Response(
2216 * response="200",
2217 * ref="#/components/responses/standard"
2218 * ),
2219 * @OA\Response(
2220 * response="400",
2221 * ref="#/components/responses/badrequest"
2222 * ),
2223 * @OA\Response(
2224 * response="401",
2225 * ref="#/components/responses/unauthorized"
2226 * ),
2227 * security={{"openemr_auth":{}}}
2230 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2231 RestConfig::authorization_check("encounters", "notes");
2232 $return = (new EncounterRestController())->getVitals($pid, $eid);
2233 RestConfig::apiLog($return);
2234 return $return;
2238 * @OA\Get(
2239 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2240 * description="Retrieves a vitals form from an encounter for a patient",
2241 * tags={"standard"},
2242 * @OA\Parameter(
2243 * name="pid",
2244 * in="path",
2245 * description="The pid for the patient.",
2246 * required=true,
2247 * @OA\Schema(
2248 * type="string"
2250 * ),
2251 * @OA\Parameter(
2252 * name="eid",
2253 * in="path",
2254 * description="The id for the encounter.",
2255 * required=true,
2256 * @OA\Schema(
2257 * type="string"
2259 * ),
2260 * @OA\Parameter(
2261 * name="vid",
2262 * in="path",
2263 * description="The id for the vitals form.",
2264 * required=true,
2265 * @OA\Schema(
2266 * type="string"
2268 * ),
2269 * @OA\Response(
2270 * response="200",
2271 * ref="#/components/responses/standard"
2272 * ),
2273 * @OA\Response(
2274 * response="400",
2275 * ref="#/components/responses/badrequest"
2276 * ),
2277 * @OA\Response(
2278 * response="401",
2279 * ref="#/components/responses/unauthorized"
2280 * ),
2281 * security={{"openemr_auth":{}}}
2284 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2285 RestConfig::authorization_check("encounters", "notes");
2286 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2287 RestConfig::apiLog($return);
2288 return $return;
2292 * @OA\Get(
2293 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2294 * description="Retrieves a soap note from an encounter for a patient",
2295 * tags={"standard"},
2296 * @OA\Parameter(
2297 * name="pid",
2298 * in="path",
2299 * description="The pid for the patient.",
2300 * required=true,
2301 * @OA\Schema(
2302 * type="string"
2304 * ),
2305 * @OA\Parameter(
2306 * name="eid",
2307 * in="path",
2308 * description="The id for the encounter.",
2309 * required=true,
2310 * @OA\Schema(
2311 * type="string"
2313 * ),
2314 * @OA\Parameter(
2315 * name="sid",
2316 * in="path",
2317 * description="The id for the soap note.",
2318 * required=true,
2319 * @OA\Schema(
2320 * type="string"
2322 * ),
2323 * @OA\Response(
2324 * response="200",
2325 * ref="#/components/responses/standard"
2326 * ),
2327 * @OA\Response(
2328 * response="400",
2329 * ref="#/components/responses/badrequest"
2330 * ),
2331 * @OA\Response(
2332 * response="401",
2333 * ref="#/components/responses/unauthorized"
2334 * ),
2335 * security={{"openemr_auth":{}}}
2338 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2339 RestConfig::authorization_check("encounters", "notes");
2340 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2341 RestConfig::apiLog($return);
2342 return $return;
2346 * Schema for the soap_note request
2348 * @OA\Schema(
2349 * schema="api_soap_note_request",
2350 * @OA\Property(
2351 * property="subjective",
2352 * description="The subjective of soap note.",
2353 * type="string"
2354 * ),
2355 * @OA\Property(
2356 * property="objective",
2357 * description="The objective of soap note.",
2358 * type="string"
2359 * ),
2360 * @OA\Property(
2361 * property="assessment",
2362 * description="The assessment of soap note.",
2363 * type="string"
2364 * ),
2365 * @OA\Property(
2366 * property="plan",
2367 * description="The plan of soap note.",
2368 * type="string"
2369 * ),
2370 * example={
2371 * "subjective": "The patient with mechanical fall and cut finger.",
2372 * "objective": "The patient with finger laceration on exam.",
2373 * "assessment": "The patient with finger laceration requiring sutures.",
2374 * "plan": "Sutured finger laceration."
2379 * @OA\Post(
2380 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2381 * description="Submits a new soap note",
2382 * tags={"standard"},
2383 * @OA\Parameter(
2384 * name="pid",
2385 * in="path",
2386 * description="The id for the patient.",
2387 * required=true,
2388 * @OA\Schema(
2389 * type="string"
2391 * ),
2392 * @OA\Parameter(
2393 * name="eid",
2394 * in="path",
2395 * description="The id for the encounter.",
2396 * required=true,
2397 * @OA\Schema(
2398 * type="string"
2400 * ),
2401 * @OA\RequestBody(
2402 * required=true,
2403 * @OA\MediaType(
2404 * mediaType="application/json",
2405 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2407 * ),
2408 * @OA\Response(
2409 * response="200",
2410 * ref="#/components/responses/standard"
2411 * ),
2412 * @OA\Response(
2413 * response="400",
2414 * ref="#/components/responses/badrequest"
2415 * ),
2416 * @OA\Response(
2417 * response="401",
2418 * ref="#/components/responses/unauthorized"
2419 * ),
2420 * security={{"openemr_auth":{}}}
2423 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2424 RestConfig::authorization_check("encounters", "notes");
2425 $data = (array) (json_decode(file_get_contents("php://input")));
2426 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2427 RestConfig::apiLog($return, $data);
2428 return $return;
2432 * @OA\Put(
2433 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2434 * description="Edit a soap note",
2435 * tags={"standard"},
2436 * @OA\Parameter(
2437 * name="pid",
2438 * in="path",
2439 * description="The id for the patient.",
2440 * required=true,
2441 * @OA\Schema(
2442 * type="string"
2444 * ),
2445 * @OA\Parameter(
2446 * name="eid",
2447 * in="path",
2448 * description="The id for the encounter.",
2449 * required=true,
2450 * @OA\Schema(
2451 * type="string"
2453 * ),
2454 * @OA\Parameter(
2455 * name="sid",
2456 * in="path",
2457 * description="The id for the soap noted.",
2458 * required=true,
2459 * @OA\Schema(
2460 * type="string"
2462 * ),
2463 * @OA\RequestBody(
2464 * required=true,
2465 * @OA\MediaType(
2466 * mediaType="application/json",
2467 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2469 * ),
2470 * @OA\Response(
2471 * response="200",
2472 * ref="#/components/responses/standard"
2473 * ),
2474 * @OA\Response(
2475 * response="400",
2476 * ref="#/components/responses/badrequest"
2477 * ),
2478 * @OA\Response(
2479 * response="401",
2480 * ref="#/components/responses/unauthorized"
2481 * ),
2482 * security={{"openemr_auth":{}}}
2485 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2486 RestConfig::authorization_check("encounters", "notes");
2487 $data = (array) (json_decode(file_get_contents("php://input")));
2488 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2489 RestConfig::apiLog($return, $data);
2490 return $return;
2495 * @OA\Get(
2496 * path="/api/practitioner",
2497 * description="Retrieves a list of practitioners",
2498 * tags={"standard"},
2499 * @OA\Parameter(
2500 * name="title",
2501 * in="query",
2502 * description="The title for the practitioner.",
2503 * required=false,
2504 * @OA\Schema(
2505 * type="string"
2507 * ),
2508 * @OA\Parameter(
2509 * name="fname",
2510 * in="query",
2511 * description="The first name for the practitioner.",
2512 * required=false,
2513 * @OA\Schema(
2514 * type="string"
2516 * ),
2517 * @OA\Parameter(
2518 * name="lname",
2519 * in="query",
2520 * description="The last name for the practitioner.",
2521 * required=false,
2522 * @OA\Schema(
2523 * type="string"
2525 * ),
2526 * @OA\Parameter(
2527 * name="mname",
2528 * in="query",
2529 * description="The middle name for the practitioner.",
2530 * required=false,
2531 * @OA\Schema(
2532 * type="string"
2534 * ),
2535 * @OA\Parameter(
2536 * name="federaltaxid",
2537 * in="query",
2538 * description="The federal tax id for the practitioner.",
2539 * required=false,
2540 * @OA\Schema(
2541 * type="string"
2543 * ),
2544 * @OA\Parameter(
2545 * name="federaldrugid",
2546 * in="query",
2547 * description="The federal drug id for the practitioner.",
2548 * required=false,
2549 * @OA\Schema(
2550 * type="string"
2552 * ),
2553 * @OA\Parameter(
2554 * name="upin",
2555 * in="query",
2556 * description="The upin for the practitioner.",
2557 * required=false,
2558 * @OA\Schema(
2559 * type="string"
2561 * ),
2562 * @OA\Parameter(
2563 * name="facility_id",
2564 * in="query",
2565 * description="The facility id for the practitioner.",
2566 * required=false,
2567 * @OA\Schema(
2568 * type="string"
2570 * ),
2571 * @OA\Parameter(
2572 * name="facility",
2573 * in="query",
2574 * description="The facility for the practitioner.",
2575 * required=false,
2576 * @OA\Schema(
2577 * type="string"
2579 * ),
2580 * @OA\Parameter(
2581 * name="npi",
2582 * in="query",
2583 * description="The npi for the practitioner.",
2584 * required=false,
2585 * @OA\Schema(
2586 * type="string"
2588 * ),
2589 * @OA\Parameter(
2590 * name="email",
2591 * in="query",
2592 * description="The email for the practitioner.",
2593 * required=false,
2594 * @OA\Schema(
2595 * type="string"
2597 * ),
2598 * @OA\Parameter(
2599 * name="specialty",
2600 * in="query",
2601 * description="The specialty for the practitioner.",
2602 * required=false,
2603 * @OA\Schema(
2604 * type="string"
2606 * ),
2607 * @OA\Parameter(
2608 * name="billname",
2609 * in="query",
2610 * description="The billname for the practitioner.",
2611 * required=false,
2612 * @OA\Schema(
2613 * type="string"
2615 * ),
2616 * @OA\Parameter(
2617 * name="url",
2618 * in="query",
2619 * description="The url for the practitioner.",
2620 * required=false,
2621 * @OA\Schema(
2622 * type="string"
2624 * ),
2625 * @OA\Parameter(
2626 * name="assistant",
2627 * in="query",
2628 * description="The assistant for the practitioner.",
2629 * required=false,
2630 * @OA\Schema(
2631 * type="string"
2633 * ),
2634 * @OA\Parameter(
2635 * name="organization",
2636 * in="query",
2637 * description="The organization for the practitioner.",
2638 * required=false,
2639 * @OA\Schema(
2640 * type="string"
2642 * ),
2643 * @OA\Parameter(
2644 * name="valedictory",
2645 * in="query",
2646 * description="The valedictory for the practitioner.",
2647 * required=false,
2648 * @OA\Schema(
2649 * type="string"
2651 * ),
2652 * @OA\Parameter(
2653 * name="street",
2654 * in="query",
2655 * description="The street for the practitioner.",
2656 * required=false,
2657 * @OA\Schema(
2658 * type="string"
2660 * ),
2661 * @OA\Parameter(
2662 * name="streetb",
2663 * in="query",
2664 * description="The street (line 2) for the practitioner.",
2665 * required=false,
2666 * @OA\Schema(
2667 * type="string"
2669 * ),
2670 * @OA\Parameter(
2671 * name="city",
2672 * in="query",
2673 * description="The city for the practitioner.",
2674 * required=false,
2675 * @OA\Schema(
2676 * type="string"
2678 * ),
2679 * @OA\Parameter(
2680 * name="state",
2681 * in="query",
2682 * description="The state for the practitioner.",
2683 * required=false,
2684 * @OA\Schema(
2685 * type="string"
2687 * ),
2688 * @OA\Parameter(
2689 * name="zip",
2690 * in="query",
2691 * description="The zip for the practitioner.",
2692 * required=false,
2693 * @OA\Schema(
2694 * type="string"
2696 * ),
2697 * @OA\Parameter(
2698 * name="phone",
2699 * in="query",
2700 * description="The phone for the practitioner.",
2701 * required=false,
2702 * @OA\Schema(
2703 * type="string"
2705 * ),
2706 * @OA\Parameter(
2707 * name="fax",
2708 * in="query",
2709 * description="The fax for the practitioner.",
2710 * required=false,
2711 * @OA\Schema(
2712 * type="string"
2714 * ),
2715 * @OA\Parameter(
2716 * name="phonew1",
2717 * in="query",
2718 * description="The phonew1 for the practitioner.",
2719 * required=false,
2720 * @OA\Schema(
2721 * type="string"
2723 * ),
2724 * @OA\Parameter(
2725 * name="phonecell",
2726 * in="query",
2727 * description="The phonecell for the practitioner.",
2728 * required=false,
2729 * @OA\Schema(
2730 * type="string"
2732 * ),
2733 * @OA\Parameter(
2734 * name="notes",
2735 * in="query",
2736 * description="The notes for the practitioner.",
2737 * required=false,
2738 * @OA\Schema(
2739 * type="string"
2741 * ),
2742 * @OA\Parameter(
2743 * name="state_license_number2",
2744 * in="query",
2745 * description="The state license number for the practitioner.",
2746 * required=false,
2747 * @OA\Schema(
2748 * type="string"
2750 * ),
2751 * @OA\Parameter(
2752 * name="username",
2753 * in="query",
2754 * description="The username for the practitioner.",
2755 * required=false,
2756 * @OA\Schema(
2757 * type="string"
2759 * ),
2760 * @OA\Response(
2761 * response="200",
2762 * ref="#/components/responses/standard"
2763 * ),
2764 * @OA\Response(
2765 * response="400",
2766 * ref="#/components/responses/badrequest"
2767 * ),
2768 * @OA\Response(
2769 * response="401",
2770 * ref="#/components/responses/unauthorized"
2771 * ),
2772 * security={{"openemr_auth":{}}}
2775 "GET /api/practitioner" => function () {
2776 RestConfig::authorization_check("admin", "users");
2777 $return = (new PractitionerRestController())->getAll($_GET);
2778 RestConfig::apiLog($return);
2779 return $return;
2783 * @OA\Get(
2784 * path="/api/practitioner/{pruuid}",
2785 * description="Retrieves a single practitioner by their uuid",
2786 * tags={"standard"},
2787 * @OA\Parameter(
2788 * name="pruuid",
2789 * in="path",
2790 * description="The uuid for the practitioner.",
2791 * required=true,
2792 * @OA\Schema(
2793 * type="string"
2795 * ),
2796 * @OA\Response(
2797 * response="200",
2798 * ref="#/components/responses/standard"
2799 * ),
2800 * @OA\Response(
2801 * response="400",
2802 * ref="#/components/responses/badrequest"
2803 * ),
2804 * @OA\Response(
2805 * response="401",
2806 * ref="#/components/responses/unauthorized"
2807 * ),
2808 * security={{"openemr_auth":{}}}
2811 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2812 RestConfig::authorization_check("admin", "users");
2813 $return = (new PractitionerRestController())->getOne($pruuid);
2814 RestConfig::apiLog($return);
2815 return $return;
2819 * @OA\Post(
2820 * path="/api/practitioner",
2821 * description="Submits a new practitioner",
2822 * tags={"standard"},
2823 * @OA\RequestBody(
2824 * required=true,
2825 * @OA\MediaType(
2826 * mediaType="application/json",
2827 * @OA\Schema(
2828 * @OA\Property(
2829 * property="title",
2830 * description="The title for the practitioner.",
2831 * type="string"
2832 * ),
2833 * @OA\Property(
2834 * property="fname",
2835 * description="The first name for the practitioner.",
2836 * type="string"
2837 * ),
2838 * @OA\Property(
2839 * property="mname",
2840 * description="The middle name for the practitioner.",
2841 * type="string"
2842 * ),
2843 * @OA\Property(
2844 * property="lname",
2845 * description="The last name for the practitioner.",
2846 * type="string"
2847 * ),
2848 * @OA\Property(
2849 * property="federaltaxid",
2850 * description="The federal tax id for the practitioner.",
2851 * type="string"
2852 * ),
2853 * @OA\Property(
2854 * property="federaldrugid",
2855 * description="The federal drug id for the practitioner.",
2856 * type="string"
2857 * ),
2858 * @OA\Property(
2859 * property="upin",
2860 * description="The upin for the practitioner.",
2861 * type="string"
2862 * ),
2863 * @OA\Property(
2864 * property="facility_id",
2865 * description="The facility_id for the practitioner.",
2866 * type="string"
2867 * ),
2868 * @OA\Property(
2869 * property="facility",
2870 * description="The facility name for the practitioner.",
2871 * type="string"
2872 * ),
2873 * @OA\Property(
2874 * property="npi",
2875 * description="The npi for the practitioner.",
2876 * type="string"
2877 * ),
2878 * @OA\Property(
2879 * property="email",
2880 * description="The email for the practitioner.",
2881 * type="string"
2882 * ),
2883 * @OA\Property(
2884 * property="specialty",
2885 * description="The specialty for the practitioner.",
2886 * type="string"
2887 * ),
2888 * @OA\Property(
2889 * property="billname",
2890 * description="The billname for the practitioner.",
2891 * type="string"
2892 * ),
2893 * @OA\Property(
2894 * property="url",
2895 * description="The url for the practitioner.",
2896 * type="string"
2897 * ),
2898 * @OA\Property(
2899 * property="assistant",
2900 * description="The assistant for the practitioner.",
2901 * type="string"
2902 * ),
2903 * @OA\Property(
2904 * property="valedictory",
2905 * description="The valedictory for the practitioner.",
2906 * type="string"
2907 * ),
2908 * @OA\Property(
2909 * property="street",
2910 * description="The street address for the practitioner.",
2911 * type="string"
2912 * ),
2913 * @OA\Property(
2914 * property="streetb",
2915 * description="The streetb address for the practitioner.",
2916 * type="string"
2917 * ),
2918 * @OA\Property(
2919 * property="city",
2920 * description="The city for the practitioner.",
2921 * type="string"
2922 * ),
2923 * @OA\Property(
2924 * property="state",
2925 * description="The state for the practitioner.",
2926 * type="string"
2927 * ),
2928 * @OA\Property(
2929 * property="zip",
2930 * description="The zip for the practitioner.",
2931 * type="string"
2932 * ),
2933 * @OA\Property(
2934 * property="phone",
2935 * description="The phone for the practitioner.",
2936 * type="string"
2937 * ),
2938 * @OA\Property(
2939 * property="fax",
2940 * description="The fax for the practitioner.",
2941 * type="string"
2942 * ),
2943 * @OA\Property(
2944 * property="phonew1",
2945 * description="The phonew1 for the practitioner.",
2946 * type="string"
2947 * ),
2948 * @OA\Property(
2949 * property="phonecell",
2950 * description="The phonecell for the practitioner.",
2951 * type="string"
2952 * ),
2953 * @OA\Property(
2954 * property="notes",
2955 * description="The notes for the practitioner.",
2956 * type="string"
2957 * ),
2958 * @OA\Property(
2959 * property="state_license_number",
2960 * description="The state license number for the practitioner.",
2961 * type="string"
2962 * ),
2963 * @OA\Property(
2964 * property="username",
2965 * description="The username for the practitioner.",
2966 * type="string"
2967 * ),
2968 * required={"fname", "lname", "npi"},
2969 * example={
2970 * "title": "Mrs.",
2971 * "fname": "Eduardo",
2972 * "mname": "Kathy",
2973 * "lname": "Perez",
2974 * "federaltaxid": "",
2975 * "federaldrugid": "",
2976 * "upin": "",
2977 * "facility_id": "3",
2978 * "facility": "Your Clinic Name Here",
2979 * "npi": "12345678901",
2980 * "email": "info@pennfirm.com",
2981 * "specialty": "",
2982 * "billname": null,
2983 * "url": null,
2984 * "assistant": null,
2985 * "organization": null,
2986 * "valedictory": null,
2987 * "street": "789 Third Avenue",
2988 * "streetb": "123 Cannaut Street",
2989 * "city": "San Diego",
2990 * "state": "CA",
2991 * "zip": "90210",
2992 * "phone": "(619) 555-9827",
2993 * "fax": null,
2994 * "phonew1": "(619) 555-7822",
2995 * "phonecell": "(619) 555-7821",
2996 * "notes": null,
2997 * "state_license_number": "123456",
2998 * "username": "eduardoperez"
3002 * ),
3003 * @OA\Response(
3004 * response="200",
3005 * description="Standard response",
3006 * @OA\MediaType(
3007 * mediaType="application/json",
3008 * @OA\Schema(
3009 * @OA\Property(
3010 * property="validationErrors",
3011 * description="Validation errors.",
3012 * type="array",
3013 * @OA\Items(
3014 * type="object",
3015 * ),
3016 * ),
3017 * @OA\Property(
3018 * property="internalErrors",
3019 * description="Internal errors.",
3020 * type="array",
3021 * @OA\Items(
3022 * type="object",
3023 * ),
3024 * ),
3025 * @OA\Property(
3026 * property="data",
3027 * description="Returned data.",
3028 * type="array",
3029 * @OA\Items(
3030 * @OA\Property(
3031 * property="id",
3032 * description="practitioner id",
3033 * type="integer",
3034 * ),
3035 * @OA\Property(
3036 * property="uuid",
3037 * description="practitioner uuid",
3038 * type="string",
3039 * ),
3040 * ),
3041 * ),
3042 * example={
3043 * "validationErrors": {},
3044 * "error_description": {},
3045 * "data": {
3046 * "id": 7,
3047 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3052 * ),
3053 * @OA\Response(
3054 * response="401",
3055 * ref="#/components/responses/unauthorized"
3056 * ),
3057 * security={{"openemr_auth":{}}}
3060 "POST /api/practitioner" => function () {
3061 RestConfig::authorization_check("admin", "users");
3062 $data = (array) (json_decode(file_get_contents("php://input")));
3063 $return = (new PractitionerRestController())->post($data);
3064 RestConfig::apiLog($return, $data);
3065 return $return;
3069 * @OA\Put(
3070 * path="/api/practitioner/{pruuid}",
3071 * description="Edit a practitioner",
3072 * tags={"standard"},
3073 * @OA\Parameter(
3074 * name="pruuid",
3075 * in="path",
3076 * description="The uuid for the practitioner.",
3077 * required=true,
3078 * @OA\Schema(
3079 * type="string"
3081 * ),
3082 * @OA\RequestBody(
3083 * required=true,
3084 * @OA\MediaType(
3085 * mediaType="application/json",
3086 * @OA\Schema(
3087 * @OA\Property(
3088 * property="title",
3089 * description="The title for the practitioner.",
3090 * type="string"
3091 * ),
3092 * @OA\Property(
3093 * property="fname",
3094 * description="The first name for the practitioner.",
3095 * type="string"
3096 * ),
3097 * @OA\Property(
3098 * property="mname",
3099 * description="The middle name for the practitioner.",
3100 * type="string"
3101 * ),
3102 * @OA\Property(
3103 * property="lname",
3104 * description="The last name for the practitioner.",
3105 * type="string"
3106 * ),
3107 * @OA\Property(
3108 * property="federaltaxid",
3109 * description="The federal tax id for the practitioner.",
3110 * type="string"
3111 * ),
3112 * @OA\Property(
3113 * property="federaldrugid",
3114 * description="The federal drug id for the practitioner.",
3115 * type="string"
3116 * ),
3117 * @OA\Property(
3118 * property="upin",
3119 * description="The upin for the practitioner.",
3120 * type="string"
3121 * ),
3122 * @OA\Property(
3123 * property="facility_id",
3124 * description="The facility_id for the practitioner.",
3125 * type="string"
3126 * ),
3127 * @OA\Property(
3128 * property="facility",
3129 * description="The facility name for the practitioner.",
3130 * type="string"
3131 * ),
3132 * @OA\Property(
3133 * property="npi",
3134 * description="The npi for the practitioner.",
3135 * type="string"
3136 * ),
3137 * @OA\Property(
3138 * property="email",
3139 * description="The email for the practitioner.",
3140 * type="string"
3141 * ),
3142 * @OA\Property(
3143 * property="specialty",
3144 * description="The specialty for the practitioner.",
3145 * type="string"
3146 * ),
3147 * @OA\Property(
3148 * property="billname",
3149 * description="The billname for the practitioner.",
3150 * type="string"
3151 * ),
3152 * @OA\Property(
3153 * property="url",
3154 * description="The url for the practitioner.",
3155 * type="string"
3156 * ),
3157 * @OA\Property(
3158 * property="assistant",
3159 * description="The assistant for the practitioner.",
3160 * type="string"
3161 * ),
3162 * @OA\Property(
3163 * property="valedictory",
3164 * description="The valedictory for the practitioner.",
3165 * type="string"
3166 * ),
3167 * @OA\Property(
3168 * property="street",
3169 * description="The street address for the practitioner.",
3170 * type="string"
3171 * ),
3172 * @OA\Property(
3173 * property="streetb",
3174 * description="The streetb address for the practitioner.",
3175 * type="string"
3176 * ),
3177 * @OA\Property(
3178 * property="city",
3179 * description="The city for the practitioner.",
3180 * type="string"
3181 * ),
3182 * @OA\Property(
3183 * property="state",
3184 * description="The state for the practitioner.",
3185 * type="string"
3186 * ),
3187 * @OA\Property(
3188 * property="zip",
3189 * description="The zip for the practitioner.",
3190 * type="string"
3191 * ),
3192 * @OA\Property(
3193 * property="phone",
3194 * description="The phone for the practitioner.",
3195 * type="string"
3196 * ),
3197 * @OA\Property(
3198 * property="fax",
3199 * description="The fax for the practitioner.",
3200 * type="string"
3201 * ),
3202 * @OA\Property(
3203 * property="phonew1",
3204 * description="The phonew1 for the practitioner.",
3205 * type="string"
3206 * ),
3207 * @OA\Property(
3208 * property="phonecell",
3209 * description="The phonecell for the practitioner.",
3210 * type="string"
3211 * ),
3212 * @OA\Property(
3213 * property="notes",
3214 * description="The notes for the practitioner.",
3215 * type="string"
3216 * ),
3217 * @OA\Property(
3218 * property="state_license_number",
3219 * description="The state license number for the practitioner.",
3220 * type="string"
3221 * ),
3222 * @OA\Property(
3223 * property="username",
3224 * description="The username for the practitioner.",
3225 * type="string"
3226 * ),
3227 * example={
3228 * "title": "Mr",
3229 * "fname": "Baz",
3230 * "mname": "",
3231 * "lname": "Bop",
3232 * "street": "456 Tree Lane",
3233 * "zip": "08642",
3234 * "city": "FooTown",
3235 * "state": "FL",
3236 * "phone": "123-456-7890"
3240 * ),
3241 * @OA\Response(
3242 * response="200",
3243 * description="Standard response",
3244 * @OA\MediaType(
3245 * mediaType="application/json",
3246 * @OA\Schema(
3247 * @OA\Property(
3248 * property="validationErrors",
3249 * description="Validation errors.",
3250 * type="array",
3251 * @OA\Items(
3252 * type="object",
3253 * ),
3254 * ),
3255 * @OA\Property(
3256 * property="internalErrors",
3257 * description="Internal errors.",
3258 * type="array",
3259 * @OA\Items(
3260 * type="object",
3261 * ),
3262 * ),
3263 * @OA\Property(
3264 * property="data",
3265 * description="Returned data.",
3266 * type="array",
3267 * @OA\Items(
3268 * @OA\Property(
3269 * property="id",
3270 * description="practitioner id",
3271 * type="string",
3272 * ),
3273 * @OA\Property(
3274 * property="uuid",
3275 * description="practitioner uuid",
3276 * type="string",
3277 * ),
3278 * @OA\Property(
3279 * property="title",
3280 * description="practitioner title",
3281 * type="string",
3282 * ),
3283 * @OA\Property(
3284 * property="fname",
3285 * description="practitioner fname",
3286 * type="string",
3287 * ),
3288 * @OA\Property(
3289 * property="lname",
3290 * description="practitioner lname",
3291 * type="string",
3292 * ),
3293 * @OA\Property(
3294 * property="mname",
3295 * description="practitioner mname",
3296 * type="string",
3297 * ),
3298 * @OA\Property(
3299 * property="federaltaxid",
3300 * description="practitioner federaltaxid",
3301 * type="string",
3302 * ),
3303 * @OA\Property(
3304 * property="federaldrugid",
3305 * description="practitioner federaldrugid",
3306 * type="string",
3307 * ),
3308 * @OA\Property(
3309 * property="upin",
3310 * description="practitioner upin",
3311 * type="string",
3312 * ),
3313 * @OA\Property(
3314 * property="facility_id",
3315 * description="practitioner facility_id",
3316 * type="string",
3317 * ),
3318 * @OA\Property(
3319 * property="facility",
3320 * description="practitioner facility",
3321 * type="string",
3322 * ),
3323 * @OA\Property(
3324 * property="npi",
3325 * description="practitioner npi",
3326 * type="string",
3327 * ),
3328 * @OA\Property(
3329 * property="email",
3330 * description="practitioner email",
3331 * type="string",
3332 * ),
3333 * @OA\Property(
3334 * property="active",
3335 * description="practitioner active setting",
3336 * type="string",
3337 * ),
3338 * @OA\Property(
3339 * property="specialty",
3340 * description="practitioner specialty",
3341 * type="string",
3342 * ),
3343 * @OA\Property(
3344 * property="billname",
3345 * description="practitioner billname",
3346 * type="string",
3347 * ),
3348 * @OA\Property(
3349 * property="url",
3350 * description="practitioner url",
3351 * type="string",
3352 * ),
3353 * @OA\Property(
3354 * property="assistant",
3355 * description="practitioner assistant",
3356 * type="string",
3357 * ),
3358 * @OA\Property(
3359 * property="organization",
3360 * description="practitioner organization",
3361 * type="string",
3362 * ),
3363 * @OA\Property(
3364 * property="valedictory",
3365 * description="practitioner valedictory",
3366 * type="string",
3367 * ),
3368 * @OA\Property(
3369 * property="street",
3370 * description="practitioner street",
3371 * type="string",
3372 * ),
3373 * @OA\Property(
3374 * property="streetb",
3375 * description="practitioner streetb",
3376 * type="string",
3377 * ),
3378 * @OA\Property(
3379 * property="city",
3380 * description="practitioner city",
3381 * type="string",
3382 * ),
3383 * @OA\Property(
3384 * property="state",
3385 * description="practitioner state",
3386 * type="string",
3387 * ),
3388 * @OA\Property(
3389 * property="zip",
3390 * description="practitioner zip",
3391 * type="string",
3392 * ),
3393 * @OA\Property(
3394 * property="phone",
3395 * description="practitioner phone",
3396 * type="string",
3397 * ),
3398 * @OA\Property(
3399 * property="fax",
3400 * description="fax",
3401 * type="string",
3402 * ),
3403 * @OA\Property(
3404 * property="phonew1",
3405 * description="practitioner phonew1",
3406 * type="string",
3407 * ),
3408 * @OA\Property(
3409 * property="phonecell",
3410 * description="practitioner phonecell",
3411 * type="string",
3412 * ),
3413 * @OA\Property(
3414 * property="notes",
3415 * description="practitioner notes",
3416 * type="string",
3417 * ),
3418 * @OA\Property(
3419 * property="state_license_number",
3420 * description="practitioner state license number",
3421 * type="string",
3422 * ),
3423 * @OA\Property(
3424 * property="abook_title",
3425 * description="practitioner abook title",
3426 * type="string",
3427 * ),
3428 * @OA\Property(
3429 * property="physician_title",
3430 * description="practitioner physician title",
3431 * type="string",
3432 * ),
3433 * @OA\Property(
3434 * property="physician_code",
3435 * description="practitioner physician code",
3436 * type="string",
3438 * ),
3439 * ),
3440 * example={
3441 * "validationErrors": {},
3442 * "error_description": {},
3443 * "data": {
3444 * "id": 7,
3445 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3446 * "title": "Mr",
3447 * "fname": "Baz",
3448 * "lname": "Bop",
3449 * "mname": "",
3450 * "federaltaxid": "",
3451 * "federaldrugid": "",
3452 * "upin": "",
3453 * "facility_id": "3",
3454 * "facility": "Your Clinic Name Here",
3455 * "npi": "0123456789",
3456 * "email": "info@pennfirm.com",
3457 * "active": "1",
3458 * "specialty": "",
3459 * "billname": "",
3460 * "url": "",
3461 * "assistant": "",
3462 * "organization": "",
3463 * "valedictory": "",
3464 * "street": "456 Tree Lane",
3465 * "streetb": "123 Cannaut Street",
3466 * "city": "FooTown",
3467 * "state": "FL",
3468 * "zip": "08642",
3469 * "phone": "123-456-7890",
3470 * "fax": "",
3471 * "phonew1": "(619) 555-7822",
3472 * "phonecell": "(619) 555-7821",
3473 * "notes": "",
3474 * "state_license_number": "123456",
3475 * "abook_title": null,
3476 * "physician_title": null,
3477 * "physician_code": null
3482 * ),
3483 * @OA\Response(
3484 * response="401",
3485 * ref="#/components/responses/unauthorized"
3486 * ),
3487 * security={{"openemr_auth":{}}}
3490 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3491 RestConfig::authorization_check("admin", "users");
3492 $data = (array) (json_decode(file_get_contents("php://input")));
3493 $return = (new PractitionerRestController())->patch($pruuid, $data);
3494 RestConfig::apiLog($return, $data);
3495 return $return;
3499 * @OA\Get(
3500 * path="/api/medical_problem",
3501 * description="Retrieves a list of medical problems",
3502 * tags={"standard"},
3503 * @OA\Parameter(
3504 * name="puuid",
3505 * in="query",
3506 * description="The uuid for the patient.",
3507 * required=false,
3508 * @OA\Schema(
3509 * type="string"
3511 * ),
3512 * @OA\Parameter(
3513 * name="condition_uuid",
3514 * in="query",
3515 * description="The uuid for the medical problem.",
3516 * required=false,
3517 * @OA\Schema(
3518 * type="string"
3520 * ),
3521 * @OA\Parameter(
3522 * name="title",
3523 * in="query",
3524 * description="The title for the medical problem.",
3525 * required=false,
3526 * @OA\Schema(
3527 * type="string"
3529 * ),
3530 * @OA\Parameter(
3531 * name="begdate",
3532 * in="query",
3533 * description="The start date for the medical problem.",
3534 * required=false,
3535 * @OA\Schema(
3536 * type="string"
3538 * ),
3539 * @OA\Parameter(
3540 * name="enddate",
3541 * in="query",
3542 * description="The end date for the medical problem.",
3543 * required=false,
3544 * @OA\Schema(
3545 * type="string"
3547 * ),
3548 * @OA\Parameter(
3549 * name="diagnosis",
3550 * in="query",
3551 * description="The diagnosis for the medical problem.",
3552 * required=false,
3553 * @OA\Schema(
3554 * type="string"
3556 * ),
3557 * @OA\Response(
3558 * response="200",
3559 * ref="#/components/responses/standard"
3560 * ),
3561 * @OA\Response(
3562 * response="400",
3563 * ref="#/components/responses/badrequest"
3564 * ),
3565 * @OA\Response(
3566 * response="401",
3567 * ref="#/components/responses/unauthorized"
3568 * ),
3569 * security={{"openemr_auth":{}}}
3572 "GET /api/medical_problem" => function () {
3573 RestConfig::authorization_check("encounters", "notes");
3574 $return = (new ConditionRestController())->getAll();
3575 RestConfig::apiLog($return);
3576 return $return;
3580 * @OA\Get(
3581 * path="/api/medical_problem/{muuid}",
3582 * description="Retrieves a single medical problem by their uuid",
3583 * tags={"standard"},
3584 * @OA\Parameter(
3585 * name="muuid",
3586 * in="path",
3587 * description="The uuid for the medical problem.",
3588 * required=true,
3589 * @OA\Schema(
3590 * type="string"
3592 * ),
3593 * @OA\Response(
3594 * response="200",
3595 * ref="#/components/responses/standard"
3596 * ),
3597 * @OA\Response(
3598 * response="400",
3599 * ref="#/components/responses/badrequest"
3600 * ),
3601 * @OA\Response(
3602 * response="401",
3603 * ref="#/components/responses/unauthorized"
3604 * ),
3605 * security={{"openemr_auth":{}}}
3608 "GET /api/medical_problem/:muuid" => function ($muuid) {
3609 RestConfig::authorization_check("encounters", "notes");
3610 $return = (new ConditionRestController())->getOne($muuid);
3611 RestConfig::apiLog($return);
3612 return $return;
3616 * @OA\Get(
3617 * path="/api/patient/{puuid}/medical_problem",
3618 * description="Retrieves all medical problems for a patient",
3619 * tags={"standard"},
3620 * @OA\Parameter(
3621 * name="puuid",
3622 * in="path",
3623 * description="The uuid for the patient.",
3624 * required=true,
3625 * @OA\Schema(
3626 * type="string"
3628 * ),
3629 * @OA\Response(
3630 * response="200",
3631 * ref="#/components/responses/standard"
3632 * ),
3633 * @OA\Response(
3634 * response="400",
3635 * ref="#/components/responses/badrequest"
3636 * ),
3637 * @OA\Response(
3638 * response="401",
3639 * ref="#/components/responses/unauthorized"
3640 * ),
3641 * security={{"openemr_auth":{}}}
3644 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3645 RestConfig::authorization_check("encounters", "notes");
3646 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3647 RestConfig::apiLog($return);
3648 return $return;
3652 * @OA\Get(
3653 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3654 * description="Retrieves a medical problem for a patient",
3655 * tags={"standard"},
3656 * @OA\Parameter(
3657 * name="puuid",
3658 * in="path",
3659 * description="The uuid for the patient.",
3660 * required=true,
3661 * @OA\Schema(
3662 * type="string"
3664 * ),
3665 * @OA\Parameter(
3666 * name="muuid",
3667 * in="path",
3668 * description="The uuid for the medical problem.",
3669 * required=true,
3670 * @OA\Schema(
3671 * type="string"
3673 * ),
3674 * @OA\Response(
3675 * response="200",
3676 * ref="#/components/responses/standard"
3677 * ),
3678 * @OA\Response(
3679 * response="400",
3680 * ref="#/components/responses/badrequest"
3681 * ),
3682 * @OA\Response(
3683 * response="401",
3684 * ref="#/components/responses/unauthorized"
3685 * ),
3686 * security={{"openemr_auth":{}}}
3689 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3690 RestConfig::authorization_check("patients", "med");
3691 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3692 RestConfig::apiLog($return);
3693 return $return;
3697 * Schema for the medical_problem request
3699 * @OA\Schema(
3700 * schema="api_medical_problem_request",
3701 * @OA\Property(
3702 * property="title",
3703 * description="The title of medical problem.",
3704 * type="string"
3705 * ),
3706 * @OA\Property(
3707 * property="begdate",
3708 * description="The beginning date of medical problem.",
3709 * type="string"
3710 * ),
3711 * @OA\Property(
3712 * property="enddate",
3713 * description="The end date of medical problem.",
3714 * type="string"
3715 * ),
3716 * @OA\Property(
3717 * property="diagnosis",
3718 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3719 * type="string"
3720 * ),
3721 * required={"title", "begdate"},
3722 * example={
3723 * "title": "Dermatochalasis",
3724 * "begdate": "2010-10-13",
3725 * "enddate": null,
3726 * "diagnosis": "ICD10:H02.839"
3731 * @OA\Post(
3732 * path="/api/patient/{puuid}/medical_problem",
3733 * description="Submits a new medical problem",
3734 * tags={"standard"},
3735 * @OA\Parameter(
3736 * name="puuid",
3737 * in="path",
3738 * description="The uuid for the patient.",
3739 * required=true,
3740 * @OA\Schema(
3741 * type="string"
3743 * ),
3744 * @OA\RequestBody(
3745 * required=true,
3746 * @OA\MediaType(
3747 * mediaType="application/json",
3748 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3750 * ),
3751 * @OA\Response(
3752 * response="200",
3753 * ref="#/components/responses/standard"
3754 * ),
3755 * @OA\Response(
3756 * response="400",
3757 * ref="#/components/responses/badrequest"
3758 * ),
3759 * @OA\Response(
3760 * response="401",
3761 * ref="#/components/responses/unauthorized"
3762 * ),
3763 * security={{"openemr_auth":{}}}
3766 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3767 RestConfig::authorization_check("patients", "med");
3768 $data = (array) (json_decode(file_get_contents("php://input")));
3769 $return = (new ConditionRestController())->post($puuid, $data);
3770 RestConfig::apiLog($return, $data);
3771 return $return;
3775 * @OA\Put(
3776 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3777 * description="Edit a medical problem",
3778 * tags={"standard"},
3779 * @OA\Parameter(
3780 * name="puuid",
3781 * in="path",
3782 * description="The uuid for the patient.",
3783 * required=true,
3784 * @OA\Schema(
3785 * type="string"
3787 * ),
3788 * @OA\Parameter(
3789 * name="muuid",
3790 * in="path",
3791 * description="The uuid for the medical problem.",
3792 * required=true,
3793 * @OA\Schema(
3794 * type="string"
3796 * ),
3797 * @OA\RequestBody(
3798 * required=true,
3799 * @OA\MediaType(
3800 * mediaType="application/json",
3801 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3803 * ),
3804 * @OA\Response(
3805 * response="200",
3806 * ref="#/components/responses/standard"
3807 * ),
3808 * @OA\Response(
3809 * response="400",
3810 * ref="#/components/responses/badrequest"
3811 * ),
3812 * @OA\Response(
3813 * response="401",
3814 * ref="#/components/responses/unauthorized"
3815 * ),
3816 * security={{"openemr_auth":{}}}
3819 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3820 RestConfig::authorization_check("patients", "med");
3821 $data = (array) (json_decode(file_get_contents("php://input")));
3822 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3823 RestConfig::apiLog($return, $data);
3824 return $return;
3828 * @OA\Delete(
3829 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3830 * description="Delete a medical problem",
3831 * tags={"standard"},
3832 * @OA\Parameter(
3833 * name="puuid",
3834 * in="path",
3835 * description="The uuid for the patient.",
3836 * required=true,
3837 * @OA\Schema(
3838 * type="string"
3840 * ),
3841 * @OA\Parameter(
3842 * name="muuid",
3843 * in="path",
3844 * description="The uuid for the medical problem.",
3845 * required=true,
3846 * @OA\Schema(
3847 * type="string"
3849 * ),
3850 * @OA\Response(
3851 * response="200",
3852 * ref="#/components/responses/standard"
3853 * ),
3854 * @OA\Response(
3855 * response="400",
3856 * ref="#/components/responses/badrequest"
3857 * ),
3858 * @OA\Response(
3859 * response="401",
3860 * ref="#/components/responses/unauthorized"
3861 * ),
3862 * security={{"openemr_auth":{}}}
3865 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3866 RestConfig::authorization_check("patients", "med");
3867 $return = (new ConditionRestController())->delete($puuid, $muuid);
3868 RestConfig::apiLog($return);
3869 return $return;
3873 * @OA\Get(
3874 * path="/api/allergy",
3875 * description="Retrieves a list of allergies",
3876 * tags={"standard"},
3877 * @OA\Parameter(
3878 * name="lists.pid",
3879 * in="query",
3880 * description="The uuid for the patient.",
3881 * required=false,
3882 * @OA\Schema(
3883 * type="string"
3885 * ),
3886 * @OA\Parameter(
3887 * name="lists.id",
3888 * in="query",
3889 * description="The uuid for the allergy.",
3890 * required=false,
3891 * @OA\Schema(
3892 * type="string"
3894 * ),
3895 * @OA\Parameter(
3896 * name="title",
3897 * in="query",
3898 * description="The title for the allergy.",
3899 * required=false,
3900 * @OA\Schema(
3901 * type="string"
3903 * ),
3904 * @OA\Parameter(
3905 * name="begdate",
3906 * in="query",
3907 * description="The start date for the allergy.",
3908 * required=false,
3909 * @OA\Schema(
3910 * type="string"
3912 * ),
3913 * @OA\Parameter(
3914 * name="enddate",
3915 * in="query",
3916 * description="The end date for the allergy.",
3917 * required=false,
3918 * @OA\Schema(
3919 * type="string"
3921 * ),
3922 * @OA\Parameter(
3923 * name="diagnosis",
3924 * in="query",
3925 * description="The diagnosis for the allergy.",
3926 * required=false,
3927 * @OA\Schema(
3928 * type="string"
3930 * ),
3931 * @OA\Response(
3932 * response="200",
3933 * ref="#/components/responses/standard"
3934 * ),
3935 * @OA\Response(
3936 * response="400",
3937 * ref="#/components/responses/badrequest"
3938 * ),
3939 * @OA\Response(
3940 * response="401",
3941 * ref="#/components/responses/unauthorized"
3942 * ),
3943 * security={{"openemr_auth":{}}}
3946 "GET /api/allergy" => function () {
3947 RestConfig::authorization_check("patients", "med");
3948 $return = (new AllergyIntoleranceRestController())->getAll();
3949 RestConfig::apiLog($return);
3950 return $return;
3954 * @OA\Get(
3955 * path="/api/allergy/{auuid}",
3956 * description="Retrieves a single allergy by their uuid",
3957 * tags={"standard"},
3958 * @OA\Parameter(
3959 * name="auuid",
3960 * in="path",
3961 * description="The uuid for the allergy.",
3962 * required=true,
3963 * @OA\Schema(
3964 * type="string"
3966 * ),
3967 * @OA\Response(
3968 * response="200",
3969 * ref="#/components/responses/standard"
3970 * ),
3971 * @OA\Response(
3972 * response="400",
3973 * ref="#/components/responses/badrequest"
3974 * ),
3975 * @OA\Response(
3976 * response="401",
3977 * ref="#/components/responses/unauthorized"
3978 * ),
3979 * security={{"openemr_auth":{}}}
3982 "GET /api/allergy/:auuid" => function ($auuid) {
3983 RestConfig::authorization_check("patients", "med");
3984 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3985 RestConfig::apiLog($return);
3986 return $return;
3990 * @OA\Get(
3991 * path="/api/patient/{puuid}/allergy",
3992 * description="Retrieves all allergies for a patient",
3993 * tags={"standard"},
3994 * @OA\Parameter(
3995 * name="puuid",
3996 * in="path",
3997 * description="The uuid for the patient.",
3998 * required=true,
3999 * @OA\Schema(
4000 * type="string"
4002 * ),
4003 * @OA\Response(
4004 * response="200",
4005 * ref="#/components/responses/standard"
4006 * ),
4007 * @OA\Response(
4008 * response="400",
4009 * ref="#/components/responses/badrequest"
4010 * ),
4011 * @OA\Response(
4012 * response="401",
4013 * ref="#/components/responses/unauthorized"
4014 * ),
4015 * security={{"openemr_auth":{}}}
4018 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4019 RestConfig::authorization_check("patients", "med");
4020 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4021 RestConfig::apiLog($return);
4022 return $return;
4026 * @OA\Get(
4027 * path="/api/patient/{puuid}/allergy/{auuid}",
4028 * description="Retrieves a allergy for a patient",
4029 * tags={"standard"},
4030 * @OA\Parameter(
4031 * name="puuid",
4032 * in="path",
4033 * description="The uuid for the patient.",
4034 * required=true,
4035 * @OA\Schema(
4036 * type="string"
4038 * ),
4039 * @OA\Parameter(
4040 * name="auuid",
4041 * in="path",
4042 * description="The uuid for the allergy.",
4043 * required=true,
4044 * @OA\Schema(
4045 * type="string"
4047 * ),
4048 * @OA\Response(
4049 * response="200",
4050 * ref="#/components/responses/standard"
4051 * ),
4052 * @OA\Response(
4053 * response="400",
4054 * ref="#/components/responses/badrequest"
4055 * ),
4056 * @OA\Response(
4057 * response="401",
4058 * ref="#/components/responses/unauthorized"
4059 * ),
4060 * security={{"openemr_auth":{}}}
4063 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4064 RestConfig::authorization_check("patients", "med");
4065 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4066 RestConfig::apiLog($return);
4067 return $return;
4071 * Schema for the allergy request
4073 * @OA\Schema(
4074 * schema="api_allergy_request",
4075 * @OA\Property(
4076 * property="title",
4077 * description="The title of allergy.",
4078 * type="string"
4079 * ),
4080 * @OA\Property(
4081 * property="begdate",
4082 * description="The beginning date of allergy.",
4083 * type="string"
4084 * ),
4085 * @OA\Property(
4086 * property="enddate",
4087 * description="The end date of allergy.",
4088 * type="string"
4089 * ),
4090 * @OA\Property(
4091 * property="diagnosis",
4092 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4093 * type="string"
4094 * ),
4095 * required={"title", "begdate"},
4096 * example={
4097 * "title": "Iodine",
4098 * "begdate": "2010-10-13",
4099 * "enddate": null
4104 * @OA\Post(
4105 * path="/api/patient/{puuid}/allergy",
4106 * description="Submits a new allergy",
4107 * tags={"standard"},
4108 * @OA\Parameter(
4109 * name="puuid",
4110 * in="path",
4111 * description="The uuid for the patient.",
4112 * required=true,
4113 * @OA\Schema(
4114 * type="string"
4116 * ),
4117 * @OA\RequestBody(
4118 * required=true,
4119 * @OA\MediaType(
4120 * mediaType="application/json",
4121 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4123 * ),
4124 * @OA\Response(
4125 * response="200",
4126 * ref="#/components/responses/standard"
4127 * ),
4128 * @OA\Response(
4129 * response="400",
4130 * ref="#/components/responses/badrequest"
4131 * ),
4132 * @OA\Response(
4133 * response="401",
4134 * ref="#/components/responses/unauthorized"
4135 * ),
4136 * security={{"openemr_auth":{}}}
4139 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4140 RestConfig::authorization_check("patients", "med");
4141 $data = (array) (json_decode(file_get_contents("php://input")));
4142 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4143 RestConfig::apiLog($return, $data);
4144 return $return;
4148 * @OA\Put(
4149 * path="/api/patient/{puuid}/allergy/{auuid}",
4150 * description="Edit a allergy",
4151 * tags={"standard"},
4152 * @OA\Parameter(
4153 * name="puuid",
4154 * in="path",
4155 * description="The uuid for the patient.",
4156 * required=true,
4157 * @OA\Schema(
4158 * type="string"
4160 * ),
4161 * @OA\Parameter(
4162 * name="auuid",
4163 * in="path",
4164 * description="The uuid for the allergy.",
4165 * required=true,
4166 * @OA\Schema(
4167 * type="string"
4169 * ),
4170 * @OA\RequestBody(
4171 * required=true,
4172 * @OA\MediaType(
4173 * mediaType="application/json",
4174 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4176 * ),
4177 * @OA\Response(
4178 * response="200",
4179 * ref="#/components/responses/standard"
4180 * ),
4181 * @OA\Response(
4182 * response="400",
4183 * ref="#/components/responses/badrequest"
4184 * ),
4185 * @OA\Response(
4186 * response="401",
4187 * ref="#/components/responses/unauthorized"
4188 * ),
4189 * security={{"openemr_auth":{}}}
4192 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4193 RestConfig::authorization_check("patients", "med");
4194 $data = (array) (json_decode(file_get_contents("php://input")));
4195 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4196 RestConfig::apiLog($return, $data);
4197 return $return;
4201 * @OA\Delete(
4202 * path="/api/patient/{puuid}/allergy/{auuid}",
4203 * description="Delete a medical problem",
4204 * tags={"standard"},
4205 * @OA\Parameter(
4206 * name="puuid",
4207 * in="path",
4208 * description="The uuid for the patient.",
4209 * required=true,
4210 * @OA\Schema(
4211 * type="string"
4213 * ),
4214 * @OA\Parameter(
4215 * name="auuid",
4216 * in="path",
4217 * description="The uuid for the allergy.",
4218 * required=true,
4219 * @OA\Schema(
4220 * type="string"
4222 * ),
4223 * @OA\Response(
4224 * response="200",
4225 * ref="#/components/responses/standard"
4226 * ),
4227 * @OA\Response(
4228 * response="400",
4229 * ref="#/components/responses/badrequest"
4230 * ),
4231 * @OA\Response(
4232 * response="401",
4233 * ref="#/components/responses/unauthorized"
4234 * ),
4235 * security={{"openemr_auth":{}}}
4238 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4239 RestConfig::authorization_check("patients", "med");
4240 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4241 RestConfig::apiLog($return);
4242 return $return;
4246 * @OA\Get(
4247 * path="/api/patient/{pid}/medication",
4248 * description="Retrieves all medications for a patient",
4249 * tags={"standard"},
4250 * @OA\Parameter(
4251 * name="pid",
4252 * in="path",
4253 * description="The pid for the patient.",
4254 * required=true,
4255 * @OA\Schema(
4256 * type="string"
4258 * ),
4259 * @OA\Response(
4260 * response="200",
4261 * ref="#/components/responses/standard"
4262 * ),
4263 * @OA\Response(
4264 * response="400",
4265 * ref="#/components/responses/badrequest"
4266 * ),
4267 * @OA\Response(
4268 * response="401",
4269 * ref="#/components/responses/unauthorized"
4270 * ),
4271 * security={{"openemr_auth":{}}}
4274 "GET /api/patient/:pid/medication" => function ($pid) {
4275 RestConfig::authorization_check("patients", "med");
4276 $return = (new ListRestController())->getAll($pid, "medication");
4277 RestConfig::apiLog($return);
4278 return $return;
4282 * Schema for the medication request
4284 * @OA\Schema(
4285 * schema="api_medication_request",
4286 * @OA\Property(
4287 * property="title",
4288 * description="The title of medication.",
4289 * type="string"
4290 * ),
4291 * @OA\Property(
4292 * property="begdate",
4293 * description="The beginning date of medication.",
4294 * type="string"
4295 * ),
4296 * @OA\Property(
4297 * property="enddate",
4298 * description="The end date of medication.",
4299 * type="string"
4300 * ),
4301 * @OA\Property(
4302 * property="diagnosis",
4303 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4304 * type="string"
4305 * ),
4306 * required={"title", "begdate"},
4307 * example={
4308 * "title": "Norvasc",
4309 * "begdate": "2013-04-13",
4310 * "enddate": null
4315 * @OA\Post(
4316 * path="/api/patient/{pid}/medication",
4317 * description="Submits a new medication",
4318 * tags={"standard"},
4319 * @OA\Parameter(
4320 * name="pid",
4321 * in="path",
4322 * description="The pid for the patient.",
4323 * required=true,
4324 * @OA\Schema(
4325 * type="string"
4327 * ),
4328 * @OA\RequestBody(
4329 * required=true,
4330 * @OA\MediaType(
4331 * mediaType="application/json",
4332 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4334 * ),
4335 * @OA\Response(
4336 * response="200",
4337 * ref="#/components/responses/standard"
4338 * ),
4339 * @OA\Response(
4340 * response="400",
4341 * ref="#/components/responses/badrequest"
4342 * ),
4343 * @OA\Response(
4344 * response="401",
4345 * ref="#/components/responses/unauthorized"
4346 * ),
4347 * security={{"openemr_auth":{}}}
4350 "POST /api/patient/:pid/medication" => function ($pid) {
4351 RestConfig::authorization_check("patients", "med");
4352 $data = (array) (json_decode(file_get_contents("php://input")));
4353 $return = (new ListRestController())->post($pid, "medication", $data);
4354 RestConfig::apiLog($return, $data);
4355 return $return;
4359 * @OA\Put(
4360 * path="/api/patient/{pid}/medication/{mid}",
4361 * description="Edit a medication",
4362 * tags={"standard"},
4363 * @OA\Parameter(
4364 * name="pid",
4365 * in="path",
4366 * description="The pid for the patient.",
4367 * required=true,
4368 * @OA\Schema(
4369 * type="string"
4371 * ),
4372 * @OA\Parameter(
4373 * name="mid",
4374 * in="path",
4375 * description="The id for the medication.",
4376 * required=true,
4377 * @OA\Schema(
4378 * type="string"
4380 * ),
4381 * @OA\RequestBody(
4382 * required=true,
4383 * @OA\MediaType(
4384 * mediaType="application/json",
4385 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4387 * ),
4388 * @OA\Response(
4389 * response="200",
4390 * ref="#/components/responses/standard"
4391 * ),
4392 * @OA\Response(
4393 * response="400",
4394 * ref="#/components/responses/badrequest"
4395 * ),
4396 * @OA\Response(
4397 * response="401",
4398 * ref="#/components/responses/unauthorized"
4399 * ),
4400 * security={{"openemr_auth":{}}}
4403 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4404 RestConfig::authorization_check("patients", "med");
4405 $data = (array) (json_decode(file_get_contents("php://input")));
4406 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4407 RestConfig::apiLog($return, $data);
4408 return $return;
4412 * @OA\Get(
4413 * path="/api/patient/{pid}/medication/{mid}",
4414 * description="Retrieves a medication for a patient",
4415 * tags={"standard"},
4416 * @OA\Parameter(
4417 * name="pid",
4418 * in="path",
4419 * description="The id for the patient.",
4420 * required=true,
4421 * @OA\Schema(
4422 * type="string"
4424 * ),
4425 * @OA\Parameter(
4426 * name="mid",
4427 * in="path",
4428 * description="The id for the medication.",
4429 * required=true,
4430 * @OA\Schema(
4431 * type="string"
4433 * ),
4434 * @OA\Response(
4435 * response="200",
4436 * ref="#/components/responses/standard"
4437 * ),
4438 * @OA\Response(
4439 * response="400",
4440 * ref="#/components/responses/badrequest"
4441 * ),
4442 * @OA\Response(
4443 * response="401",
4444 * ref="#/components/responses/unauthorized"
4445 * ),
4446 * security={{"openemr_auth":{}}}
4449 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4450 RestConfig::authorization_check("patients", "med");
4451 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4452 RestConfig::apiLog($return);
4453 return $return;
4457 * @OA\Delete(
4458 * path="/api/patient/{pid}/medication/{mid}",
4459 * description="Delete a medication",
4460 * tags={"standard"},
4461 * @OA\Parameter(
4462 * name="pid",
4463 * in="path",
4464 * description="The id for the patient.",
4465 * required=true,
4466 * @OA\Schema(
4467 * type="string"
4469 * ),
4470 * @OA\Parameter(
4471 * name="mid",
4472 * in="path",
4473 * description="The id for the medication.",
4474 * required=true,
4475 * @OA\Schema(
4476 * type="string"
4478 * ),
4479 * @OA\Response(
4480 * response="200",
4481 * ref="#/components/responses/standard"
4482 * ),
4483 * @OA\Response(
4484 * response="400",
4485 * ref="#/components/responses/badrequest"
4486 * ),
4487 * @OA\Response(
4488 * response="401",
4489 * ref="#/components/responses/unauthorized"
4490 * ),
4491 * security={{"openemr_auth":{}}}
4494 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4495 RestConfig::authorization_check("patients", "med");
4496 $return = (new ListRestController())->delete($pid, $mid, "medication");
4497 RestConfig::apiLog($return);
4498 return $return;
4502 * @OA\Get(
4503 * path="/api/patient/{pid}/surgery",
4504 * description="Retrieves all surgeries for a patient",
4505 * tags={"standard"},
4506 * @OA\Parameter(
4507 * name="pid",
4508 * in="path",
4509 * description="The pid for the patient.",
4510 * required=true,
4511 * @OA\Schema(
4512 * type="string"
4514 * ),
4515 * @OA\Response(
4516 * response="200",
4517 * ref="#/components/responses/standard"
4518 * ),
4519 * @OA\Response(
4520 * response="400",
4521 * ref="#/components/responses/badrequest"
4522 * ),
4523 * @OA\Response(
4524 * response="401",
4525 * ref="#/components/responses/unauthorized"
4526 * ),
4527 * security={{"openemr_auth":{}}}
4530 "GET /api/patient/:pid/surgery" => function ($pid) {
4531 RestConfig::authorization_check("patients", "med");
4532 $return = (new ListRestController())->getAll($pid, "surgery");
4533 RestConfig::apiLog($return);
4534 return $return;
4538 * @OA\Get(
4539 * path="/api/patient/{pid}/surgery/{sid}",
4540 * description="Retrieves a surgery for a patient",
4541 * tags={"standard"},
4542 * @OA\Parameter(
4543 * name="pid",
4544 * in="path",
4545 * description="The id for the patient.",
4546 * required=true,
4547 * @OA\Schema(
4548 * type="string"
4550 * ),
4551 * @OA\Parameter(
4552 * name="sid",
4553 * in="path",
4554 * description="The id for the surgery.",
4555 * required=true,
4556 * @OA\Schema(
4557 * type="string"
4559 * ),
4560 * @OA\Response(
4561 * response="200",
4562 * ref="#/components/responses/standard"
4563 * ),
4564 * @OA\Response(
4565 * response="400",
4566 * ref="#/components/responses/badrequest"
4567 * ),
4568 * @OA\Response(
4569 * response="401",
4570 * ref="#/components/responses/unauthorized"
4571 * ),
4572 * security={{"openemr_auth":{}}}
4575 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4576 RestConfig::authorization_check("patients", "med");
4577 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4578 RestConfig::apiLog($return);
4579 return $return;
4583 * @OA\Delete(
4584 * path="/api/patient/{pid}/surgery/{sid}",
4585 * description="Delete a surgery",
4586 * tags={"standard"},
4587 * @OA\Parameter(
4588 * name="pid",
4589 * in="path",
4590 * description="The id for the patient.",
4591 * required=true,
4592 * @OA\Schema(
4593 * type="string"
4595 * ),
4596 * @OA\Parameter(
4597 * name="sid",
4598 * in="path",
4599 * description="The id for the surgery.",
4600 * required=true,
4601 * @OA\Schema(
4602 * type="string"
4604 * ),
4605 * @OA\Response(
4606 * response="200",
4607 * ref="#/components/responses/standard"
4608 * ),
4609 * @OA\Response(
4610 * response="400",
4611 * ref="#/components/responses/badrequest"
4612 * ),
4613 * @OA\Response(
4614 * response="401",
4615 * ref="#/components/responses/unauthorized"
4616 * ),
4617 * security={{"openemr_auth":{}}}
4620 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4621 RestConfig::authorization_check("patients", "med");
4622 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4623 RestConfig::apiLog($return);
4624 return $return;
4628 * Schema for the surgery request
4630 * @OA\Schema(
4631 * schema="api_surgery_request",
4632 * @OA\Property(
4633 * property="title",
4634 * description="The title of surgery.",
4635 * type="string"
4636 * ),
4637 * @OA\Property(
4638 * property="begdate",
4639 * description="The beginning date of surgery.",
4640 * type="string"
4641 * ),
4642 * @OA\Property(
4643 * property="enddate",
4644 * description="The end date of surgery.",
4645 * type="string"
4646 * ),
4647 * @OA\Property(
4648 * property="diagnosis",
4649 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4650 * type="string"
4651 * ),
4652 * required={"title", "begdate"},
4653 * example={
4654 * "title": "Blepharoplasty",
4655 * "begdate": "2013-10-14",
4656 * "enddate": null,
4657 * "diagnosis": "CPT4:15823-50"
4662 * @OA\Post(
4663 * path="/api/patient/{pid}/surgery",
4664 * description="Submits a new surgery",
4665 * tags={"standard"},
4666 * @OA\Parameter(
4667 * name="pid",
4668 * in="path",
4669 * description="The pid for the patient.",
4670 * required=true,
4671 * @OA\Schema(
4672 * type="string"
4674 * ),
4675 * @OA\RequestBody(
4676 * required=true,
4677 * @OA\MediaType(
4678 * mediaType="application/json",
4679 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4681 * ),
4682 * @OA\Response(
4683 * response="200",
4684 * ref="#/components/responses/standard"
4685 * ),
4686 * @OA\Response(
4687 * response="400",
4688 * ref="#/components/responses/badrequest"
4689 * ),
4690 * @OA\Response(
4691 * response="401",
4692 * ref="#/components/responses/unauthorized"
4693 * ),
4694 * security={{"openemr_auth":{}}}
4697 "POST /api/patient/:pid/surgery" => function ($pid) {
4698 RestConfig::authorization_check("patients", "med");
4699 $data = (array) (json_decode(file_get_contents("php://input")));
4700 $return = (new ListRestController())->post($pid, "surgery", $data);
4701 RestConfig::apiLog($return, $data);
4702 return $return;
4706 * @OA\Put(
4707 * path="/api/patient/{pid}/surgery/{sid}",
4708 * description="Edit a surgery",
4709 * tags={"standard"},
4710 * @OA\Parameter(
4711 * name="pid",
4712 * in="path",
4713 * description="The pid for the patient.",
4714 * required=true,
4715 * @OA\Schema(
4716 * type="string"
4718 * ),
4719 * @OA\Parameter(
4720 * name="sid",
4721 * in="path",
4722 * description="The id for the surgery.",
4723 * required=true,
4724 * @OA\Schema(
4725 * type="string"
4727 * ),
4728 * @OA\RequestBody(
4729 * required=true,
4730 * @OA\MediaType(
4731 * mediaType="application/json",
4732 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4734 * ),
4735 * @OA\Response(
4736 * response="200",
4737 * ref="#/components/responses/standard"
4738 * ),
4739 * @OA\Response(
4740 * response="400",
4741 * ref="#/components/responses/badrequest"
4742 * ),
4743 * @OA\Response(
4744 * response="401",
4745 * ref="#/components/responses/unauthorized"
4746 * ),
4747 * security={{"openemr_auth":{}}}
4750 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4751 RestConfig::authorization_check("patients", "med");
4752 $data = (array) (json_decode(file_get_contents("php://input")));
4753 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4754 RestConfig::apiLog($return, $data);
4755 return $return;
4759 * @OA\Get(
4760 * path="/api/patient/{pid}/dental_issue",
4761 * description="Retrieves all dental issues for a patient",
4762 * tags={"standard"},
4763 * @OA\Parameter(
4764 * name="pid",
4765 * in="path",
4766 * description="The pid for the patient.",
4767 * required=true,
4768 * @OA\Schema(
4769 * type="string"
4771 * ),
4772 * @OA\Response(
4773 * response="200",
4774 * ref="#/components/responses/standard"
4775 * ),
4776 * @OA\Response(
4777 * response="400",
4778 * ref="#/components/responses/badrequest"
4779 * ),
4780 * @OA\Response(
4781 * response="401",
4782 * ref="#/components/responses/unauthorized"
4783 * ),
4784 * security={{"openemr_auth":{}}}
4787 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4788 RestConfig::authorization_check("patients", "med");
4789 $return = (new ListRestController())->getAll($pid, "dental");
4790 RestConfig::apiLog($return);
4791 return $return;
4795 * @OA\Get(
4796 * path="/api/patient/{pid}/dental_issue/{did}",
4797 * description="Retrieves a dental issue for a patient",
4798 * tags={"standard"},
4799 * @OA\Parameter(
4800 * name="pid",
4801 * in="path",
4802 * description="The id for the patient.",
4803 * required=true,
4804 * @OA\Schema(
4805 * type="string"
4807 * ),
4808 * @OA\Parameter(
4809 * name="did",
4810 * in="path",
4811 * description="The id for the dental issue.",
4812 * required=true,
4813 * @OA\Schema(
4814 * type="string"
4816 * ),
4817 * @OA\Response(
4818 * response="200",
4819 * ref="#/components/responses/standard"
4820 * ),
4821 * @OA\Response(
4822 * response="400",
4823 * ref="#/components/responses/badrequest"
4824 * ),
4825 * @OA\Response(
4826 * response="401",
4827 * ref="#/components/responses/unauthorized"
4828 * ),
4829 * security={{"openemr_auth":{}}}
4832 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4833 RestConfig::authorization_check("patients", "med");
4834 $return = (new ListRestController())->getOne($pid, "dental", $did);
4835 RestConfig::apiLog($return);
4836 return $return;
4840 * @OA\Delete(
4841 * path="/api/patient/{pid}/dental_issue/{did}",
4842 * description="Delete a dental issue",
4843 * tags={"standard"},
4844 * @OA\Parameter(
4845 * name="pid",
4846 * in="path",
4847 * description="The id for the patient.",
4848 * required=true,
4849 * @OA\Schema(
4850 * type="string"
4852 * ),
4853 * @OA\Parameter(
4854 * name="did",
4855 * in="path",
4856 * description="The id for the dental issue.",
4857 * required=true,
4858 * @OA\Schema(
4859 * type="string"
4861 * ),
4862 * @OA\Response(
4863 * response="200",
4864 * ref="#/components/responses/standard"
4865 * ),
4866 * @OA\Response(
4867 * response="400",
4868 * ref="#/components/responses/badrequest"
4869 * ),
4870 * @OA\Response(
4871 * response="401",
4872 * ref="#/components/responses/unauthorized"
4873 * ),
4874 * security={{"openemr_auth":{}}}
4877 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4878 RestConfig::authorization_check("patients", "med");
4879 $return = (new ListRestController())->delete($pid, $did, "dental");
4880 RestConfig::apiLog($return);
4881 return $return;
4885 * Schema for the dental_issue request
4887 * @OA\Schema(
4888 * schema="api_dental_issue_request",
4889 * @OA\Property(
4890 * property="title",
4891 * description="The title of dental issue.",
4892 * type="string"
4893 * ),
4894 * @OA\Property(
4895 * property="begdate",
4896 * description="The beginning date of dental issue.",
4897 * type="string"
4898 * ),
4899 * @OA\Property(
4900 * property="enddate",
4901 * description="The end date of dental issue.",
4902 * type="string"
4903 * ),
4904 * @OA\Property(
4905 * property="diagnosis",
4906 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4907 * type="string"
4908 * ),
4909 * required={"title", "begdate"},
4910 * example={
4911 * "title": "Halitosis",
4912 * "begdate": "2015-03-17",
4913 * "enddate": null,
4918 * @OA\Post(
4919 * path="/api/patient/{pid}/dental_issue",
4920 * description="Submits a new dental issue",
4921 * tags={"standard"},
4922 * @OA\Parameter(
4923 * name="pid",
4924 * in="path",
4925 * description="The pid for the patient.",
4926 * required=true,
4927 * @OA\Schema(
4928 * type="string"
4930 * ),
4931 * @OA\RequestBody(
4932 * required=true,
4933 * @OA\MediaType(
4934 * mediaType="application/json",
4935 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4937 * ),
4938 * @OA\Response(
4939 * response="200",
4940 * ref="#/components/responses/standard"
4941 * ),
4942 * @OA\Response(
4943 * response="400",
4944 * ref="#/components/responses/badrequest"
4945 * ),
4946 * @OA\Response(
4947 * response="401",
4948 * ref="#/components/responses/unauthorized"
4949 * ),
4950 * security={{"openemr_auth":{}}}
4953 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4954 RestConfig::authorization_check("patients", "med");
4955 $data = (array) (json_decode(file_get_contents("php://input")));
4956 $return = (new ListRestController())->post($pid, "dental", $data);
4957 RestConfig::apiLog($return, $data);
4958 return $return;
4962 * @OA\Put(
4963 * path="/api/patient/{pid}/dental_issue/{did}",
4964 * description="Edit a dental issue",
4965 * tags={"standard"},
4966 * @OA\Parameter(
4967 * name="pid",
4968 * in="path",
4969 * description="The pid for the patient.",
4970 * required=true,
4971 * @OA\Schema(
4972 * type="string"
4974 * ),
4975 * @OA\Parameter(
4976 * name="did",
4977 * in="path",
4978 * description="The id for the dental issue.",
4979 * required=true,
4980 * @OA\Schema(
4981 * type="string"
4983 * ),
4984 * @OA\RequestBody(
4985 * required=true,
4986 * @OA\MediaType(
4987 * mediaType="application/json",
4988 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4990 * ),
4991 * @OA\Response(
4992 * response="200",
4993 * ref="#/components/responses/standard"
4994 * ),
4995 * @OA\Response(
4996 * response="400",
4997 * ref="#/components/responses/badrequest"
4998 * ),
4999 * @OA\Response(
5000 * response="401",
5001 * ref="#/components/responses/unauthorized"
5002 * ),
5003 * security={{"openemr_auth":{}}}
5006 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5007 RestConfig::authorization_check("patients", "med");
5008 $data = (array) (json_decode(file_get_contents("php://input")));
5009 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5010 RestConfig::apiLog($return, $data);
5011 return $return;
5015 * @OA\Get(
5016 * path="/api/patient/{pid}/appointment",
5017 * description="Retrieves all appointments for a patient",
5018 * tags={"standard"},
5019 * @OA\Parameter(
5020 * name="pid",
5021 * in="path",
5022 * description="The pid for the patient.",
5023 * required=true,
5024 * @OA\Schema(
5025 * type="string"
5027 * ),
5028 * @OA\Response(
5029 * response="200",
5030 * ref="#/components/responses/standard"
5031 * ),
5032 * @OA\Response(
5033 * response="400",
5034 * ref="#/components/responses/badrequest"
5035 * ),
5036 * @OA\Response(
5037 * response="401",
5038 * ref="#/components/responses/unauthorized"
5039 * ),
5040 * security={{"openemr_auth":{}}}
5043 "GET /api/patient/:pid/appointment" => function ($pid) {
5044 RestConfig::authorization_check("patients", "appt");
5045 $return = (new AppointmentRestController())->getAllForPatient($pid);
5046 RestConfig::apiLog($return);
5047 return $return;
5051 * @OA\Post(
5052 * path="/api/patient/{pid}/appointment",
5053 * description="Submits a new appointment",
5054 * tags={"standard"},
5055 * @OA\Parameter(
5056 * name="pid",
5057 * in="path",
5058 * description="The id for the patient.",
5059 * required=true,
5060 * @OA\Schema(
5061 * type="string"
5063 * ),
5064 * @OA\RequestBody(
5065 * required=true,
5066 * @OA\MediaType(
5067 * mediaType="application/json",
5068 * @OA\Schema(
5069 * @OA\Property(
5070 * property="pc_catid",
5071 * description="The category of the appointment.",
5072 * type="string"
5073 * ),
5074 * @OA\Property(
5075 * property="pc_title",
5076 * description="The title of the appointment.",
5077 * type="string"
5078 * ),
5079 * @OA\Property(
5080 * property="pc_duration",
5081 * description="The duration of the appointment.",
5082 * type="string"
5083 * ),
5084 * @OA\Property(
5085 * property="pc_hometext",
5086 * description="Comments for the appointment.",
5087 * type="string"
5088 * ),
5089 * @OA\Property(
5090 * property="pc_apptstatus",
5091 * description="use an option from resource=/api/list/apptstat",
5092 * type="string"
5093 * ),
5094 * @OA\Property(
5095 * property="pc_eventDate",
5096 * description="The date of the appointment.",
5097 * type="string"
5098 * ),
5099 * @OA\Property(
5100 * property="pc_startTime",
5101 * description="The time of the appointment.",
5102 * type="string"
5103 * ),
5104 * @OA\Property(
5105 * property="pc_facility",
5106 * description="The facility id of the appointment.",
5107 * type="string"
5108 * ),
5109 * @OA\Property(
5110 * property="pc_billing_location",
5111 * description="The billinag location id of the appointment.",
5112 * type="string"
5113 * ),
5114 * @OA\Property(
5115 * property="pc_aid",
5116 * description="The provider id for the appointment.",
5117 * type="string"
5118 * ),
5119 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5120 * example={
5121 * "pc_catid": "5",
5122 * "pc_title": "Office Visit",
5123 * "pc_duration": "900",
5124 * "pc_hometext": "Test",
5125 * "pc_apptstatus": "-",
5126 * "pc_eventDate": "2018-10-19",
5127 * "pc_startTime": "09:00",
5128 * "pc_facility": "9",
5129 * "pc_billing_location": "10",
5130 * "pc_aid": "1"
5134 * ),
5135 * @OA\Response(
5136 * response="200",
5137 * ref="#/components/responses/standard"
5138 * ),
5139 * @OA\Response(
5140 * response="400",
5141 * ref="#/components/responses/badrequest"
5142 * ),
5143 * @OA\Response(
5144 * response="401",
5145 * ref="#/components/responses/unauthorized"
5146 * ),
5147 * security={{"openemr_auth":{}}}
5150 "POST /api/patient/:pid/appointment" => function ($pid) {
5151 RestConfig::authorization_check("patients", "appt");
5152 $data = (array) (json_decode(file_get_contents("php://input")));
5153 $return = (new AppointmentRestController())->post($pid, $data);
5154 RestConfig::apiLog($return, $data);
5155 return $return;
5159 * @OA\Get(
5160 * path="/api/appointment",
5161 * description="Retrieves all appointments",
5162 * tags={"standard"},
5163 * @OA\Response(
5164 * response="200",
5165 * ref="#/components/responses/standard"
5166 * ),
5167 * @OA\Response(
5168 * response="400",
5169 * ref="#/components/responses/badrequest"
5170 * ),
5171 * @OA\Response(
5172 * response="401",
5173 * ref="#/components/responses/unauthorized"
5174 * ),
5175 * security={{"openemr_auth":{}}}
5178 "GET /api/appointment" => function () {
5179 RestConfig::authorization_check("patients", "appt");
5180 $return = (new AppointmentRestController())->getAll();
5181 RestConfig::apiLog($return);
5182 return $return;
5186 * @OA\Get(
5187 * path="/api/appointment/{eid}",
5188 * description="Retrieves an appointment",
5189 * tags={"standard"},
5190 * @OA\Parameter(
5191 * name="eid",
5192 * in="path",
5193 * description="The eid for the appointment.",
5194 * required=true,
5195 * @OA\Schema(
5196 * type="string"
5198 * ),
5199 * @OA\Response(
5200 * response="200",
5201 * ref="#/components/responses/standard"
5202 * ),
5203 * @OA\Response(
5204 * response="400",
5205 * ref="#/components/responses/badrequest"
5206 * ),
5207 * @OA\Response(
5208 * response="401",
5209 * ref="#/components/responses/unauthorized"
5210 * ),
5211 * security={{"openemr_auth":{}}}
5214 "GET /api/appointment/:eid" => function ($eid) {
5215 RestConfig::authorization_check("patients", "appt");
5216 $return = (new AppointmentRestController())->getOne($eid);
5217 RestConfig::apiLog($return);
5218 return $return;
5222 * @OA\Delete(
5223 * path="/api/patient/{pid}/appointment/{eid}",
5224 * description="Delete a appointment",
5225 * tags={"standard"},
5226 * @OA\Parameter(
5227 * name="pid",
5228 * in="path",
5229 * description="The id for the patient.",
5230 * required=true,
5231 * @OA\Schema(
5232 * type="string"
5234 * ),
5235 * @OA\Parameter(
5236 * name="eid",
5237 * in="path",
5238 * description="The eid for the appointment.",
5239 * required=true,
5240 * @OA\Schema(
5241 * type="string"
5243 * ),
5244 * @OA\Response(
5245 * response="200",
5246 * ref="#/components/responses/standard"
5247 * ),
5248 * @OA\Response(
5249 * response="400",
5250 * ref="#/components/responses/badrequest"
5251 * ),
5252 * @OA\Response(
5253 * response="401",
5254 * ref="#/components/responses/unauthorized"
5255 * ),
5256 * security={{"openemr_auth":{}}}
5259 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5260 RestConfig::authorization_check("patients", "appt");
5261 $return = (new AppointmentRestController())->delete($eid);
5262 RestConfig::apiLog($return);
5263 return $return;
5267 * @OA\Get(
5268 * path="/api/patient/{pid}/appointment/{eid}",
5269 * description="Retrieves a appointment for a patient",
5270 * tags={"standard"},
5271 * @OA\Parameter(
5272 * name="pid",
5273 * in="path",
5274 * description="The id for the patient.",
5275 * required=true,
5276 * @OA\Schema(
5277 * type="string"
5279 * ),
5280 * @OA\Parameter(
5281 * name="eid",
5282 * in="path",
5283 * description="The eid for the appointment.",
5284 * required=true,
5285 * @OA\Schema(
5286 * type="string"
5288 * ),
5289 * @OA\Response(
5290 * response="200",
5291 * ref="#/components/responses/standard"
5292 * ),
5293 * @OA\Response(
5294 * response="400",
5295 * ref="#/components/responses/badrequest"
5296 * ),
5297 * @OA\Response(
5298 * response="401",
5299 * ref="#/components/responses/unauthorized"
5300 * ),
5301 * security={{"openemr_auth":{}}}
5304 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5305 RestConfig::authorization_check("patients", "appt");
5306 $return = (new AppointmentRestController())->getOne($eid);
5307 RestConfig::apiLog($return);
5308 return $return;
5312 * @OA\Get(
5313 * path="/api/list/{list_name}",
5314 * description="Retrieves a list",
5315 * tags={"standard"},
5316 * @OA\Parameter(
5317 * name="list_name",
5318 * in="path",
5319 * description="The list_id of the list.",
5320 * required=true,
5321 * @OA\Schema(
5322 * type="string"
5324 * ),
5325 * @OA\Response(
5326 * response="200",
5327 * ref="#/components/responses/standard"
5328 * ),
5329 * @OA\Response(
5330 * response="400",
5331 * ref="#/components/responses/badrequest"
5332 * ),
5333 * @OA\Response(
5334 * response="401",
5335 * ref="#/components/responses/unauthorized"
5336 * ),
5337 * security={{"openemr_auth":{}}}
5340 "GET /api/list/:list_name" => function ($list_name) {
5341 RestConfig::authorization_check("lists", "default");
5342 $return = (new ListRestController())->getOptions($list_name);
5343 RestConfig::apiLog($return);
5344 return $return;
5348 * @OA\Get(
5349 * path="/api/version",
5350 * description="Retrieves the OpenEMR version information",
5351 * tags={"standard"},
5352 * @OA\Response(
5353 * response="200",
5354 * ref="#/components/responses/standard"
5355 * ),
5356 * @OA\Response(
5357 * response="400",
5358 * ref="#/components/responses/badrequest"
5359 * ),
5360 * @OA\Response(
5361 * response="401",
5362 * ref="#/components/responses/unauthorized"
5363 * ),
5364 * security={{"openemr_auth":{}}}
5367 "GET /api/version" => function () {
5368 $return = (new VersionRestController())->getOne();
5369 RestConfig::apiLog($return);
5370 return $return;
5374 * @OA\Get(
5375 * path="/api/product",
5376 * description="Retrieves the OpenEMR product registration information",
5377 * tags={"standard"},
5378 * @OA\Response(
5379 * response="200",
5380 * ref="#/components/responses/standard"
5381 * ),
5382 * @OA\Response(
5383 * response="400",
5384 * ref="#/components/responses/badrequest"
5385 * ),
5386 * @OA\Response(
5387 * response="401",
5388 * ref="#/components/responses/unauthorized"
5389 * ),
5390 * security={{"openemr_auth":{}}}
5393 "GET /api/product" => function () {
5394 $return = (new ProductRegistrationRestController())->getOne();
5395 RestConfig::apiLog($return);
5396 return $return;
5400 * @OA\Get(
5401 * path="/api/insurance_company",
5402 * description="Retrieves all insurance companies",
5403 * tags={"standard"},
5404 * @OA\Response(
5405 * response="200",
5406 * ref="#/components/responses/standard"
5407 * ),
5408 * @OA\Response(
5409 * response="400",
5410 * ref="#/components/responses/badrequest"
5411 * ),
5412 * @OA\Response(
5413 * response="401",
5414 * ref="#/components/responses/unauthorized"
5415 * ),
5416 * security={{"openemr_auth":{}}}
5419 "GET /api/insurance_company" => function () {
5420 $return = (new InsuranceCompanyRestController())->getAll();
5421 RestConfig::apiLog($return);
5422 return $return;
5426 * @OA\Get(
5427 * path="/api/insurance_company/{iid}",
5428 * description="Retrieves insurance company",
5429 * tags={"standard"},
5430 * @OA\Parameter(
5431 * name="iid",
5432 * in="path",
5433 * description="The id of the insurance company.",
5434 * required=true,
5435 * @OA\Schema(
5436 * type="string"
5438 * ),
5439 * @OA\Response(
5440 * response="200",
5441 * ref="#/components/responses/standard"
5442 * ),
5443 * @OA\Response(
5444 * response="400",
5445 * ref="#/components/responses/badrequest"
5446 * ),
5447 * @OA\Response(
5448 * response="401",
5449 * ref="#/components/responses/unauthorized"
5450 * ),
5451 * security={{"openemr_auth":{}}}
5454 "GET /api/insurance_company/:iid" => function ($iid) {
5455 $return = (new InsuranceCompanyRestController())->getOne($iid);
5456 RestConfig::apiLog($return);
5457 return $return;
5461 * @OA\Get(
5462 * path="/api/insurance_type",
5463 * description="Retrieves all insurance types",
5464 * tags={"standard"},
5465 * @OA\Response(
5466 * response="200",
5467 * ref="#/components/responses/standard"
5468 * ),
5469 * @OA\Response(
5470 * response="400",
5471 * ref="#/components/responses/badrequest"
5472 * ),
5473 * @OA\Response(
5474 * response="401",
5475 * ref="#/components/responses/unauthorized"
5476 * ),
5477 * security={{"openemr_auth":{}}}
5480 "GET /api/insurance_type" => function () {
5481 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5482 RestConfig::apiLog($return);
5483 return $return;
5487 * Schema for the insurance_company request
5489 * @OA\Schema(
5490 * schema="api_insurance_company_request",
5491 * @OA\Property(
5492 * property="name",
5493 * description="The name of insurance company.",
5494 * type="string"
5495 * ),
5496 * @OA\Property(
5497 * property="attn",
5498 * description="The attn of insurance company.",
5499 * type="string"
5500 * ),
5501 * @OA\Property(
5502 * property="cms_id",
5503 * description="The cms id of insurance company.",
5504 * type="string"
5505 * ),
5506 * @OA\Property(
5507 * property="ins_type_code",
5508 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5509 * type="string"
5510 * ),
5511 * @OA\Property(
5512 * property="x12_receiver_id",
5513 * description="The x12 receiver id of insurance company.",
5514 * type="string"
5515 * ),
5516 * @OA\Property(
5517 * property="x12_default_partner_id",
5518 * description="The x12 default partner id of insurance company.",
5519 * type="string"
5520 * ),
5521 * @OA\Property(
5522 * property="alt_cms_id",
5523 * description="The alternate cms id of insurance company.",
5524 * type="string"
5525 * ),
5526 * @OA\Property(
5527 * property="line1",
5528 * description="The line1 address of insurance company.",
5529 * type="string"
5530 * ),
5531 * @OA\Property(
5532 * property="line2",
5533 * description="The line2 address of insurance company.",
5534 * type="string"
5535 * ),
5536 * @OA\Property(
5537 * property="city",
5538 * description="The city of insurance company.",
5539 * type="string"
5540 * ),
5541 * @OA\Property(
5542 * property="state",
5543 * description="The state of insurance company.",
5544 * type="string"
5545 * ),
5546 * @OA\Property(
5547 * property="zip",
5548 * description="The zip of insurance company.",
5549 * type="string"
5550 * ),
5551 * @OA\Property(
5552 * property="country",
5553 * description="The country of insurance company.",
5554 * type="string"
5555 * ),
5556 * required={"name"},
5557 * example={
5558 * "name": "Cool Insurance Company",
5559 * "attn": null,
5560 * "cms_id": null,
5561 * "ins_type_code": "2",
5562 * "x12_receiver_id": null,
5563 * "x12_default_partner_id": null,
5564 * "alt_cms_id": "",
5565 * "line1": "123 Cool Lane",
5566 * "line2": "Suite 123",
5567 * "city": "Cooltown",
5568 * "state": "CA",
5569 * "zip": "12245",
5570 * "country": "USA"
5575 * @OA\Post(
5576 * path="/api/insurance_company",
5577 * description="Submits a new insurance company",
5578 * tags={"standard"},
5579 * @OA\RequestBody(
5580 * required=true,
5581 * @OA\MediaType(
5582 * mediaType="application/json",
5583 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5585 * ),
5586 * @OA\Response(
5587 * response="200",
5588 * ref="#/components/responses/standard"
5589 * ),
5590 * @OA\Response(
5591 * response="400",
5592 * ref="#/components/responses/badrequest"
5593 * ),
5594 * @OA\Response(
5595 * response="401",
5596 * ref="#/components/responses/unauthorized"
5597 * ),
5598 * security={{"openemr_auth":{}}}
5601 "POST /api/insurance_company" => function () {
5602 $data = (array) (json_decode(file_get_contents("php://input")));
5603 $return = (new InsuranceCompanyRestController())->post($data);
5604 RestConfig::apiLog($return, $data);
5605 return $return;
5609 * @OA\Put(
5610 * path="/api/insurance_company/{iid}",
5611 * description="Edit a insurance company",
5612 * tags={"standard"},
5613 * @OA\Parameter(
5614 * name="iid",
5615 * in="path",
5616 * description="The id for the insurance company.",
5617 * required=true,
5618 * @OA\Schema(
5619 * type="string"
5621 * ),
5622 * @OA\RequestBody(
5623 * required=true,
5624 * @OA\MediaType(
5625 * mediaType="application/json",
5626 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5628 * ),
5629 * @OA\Response(
5630 * response="200",
5631 * ref="#/components/responses/standard"
5632 * ),
5633 * @OA\Response(
5634 * response="400",
5635 * ref="#/components/responses/badrequest"
5636 * ),
5637 * @OA\Response(
5638 * response="401",
5639 * ref="#/components/responses/unauthorized"
5640 * ),
5641 * security={{"openemr_auth":{}}}
5644 "PUT /api/insurance_company/:iid" => function ($iid) {
5645 $data = (array) (json_decode(file_get_contents("php://input")));
5646 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5647 RestConfig::apiLog($return, $data);
5648 return $return;
5652 * @OA\Post(
5653 * path="/api/patient/{pid}/document",
5654 * description="Submits a new patient document",
5655 * tags={"standard"},
5656 * @OA\Parameter(
5657 * name="pid",
5658 * in="path",
5659 * description="The pid for the patient.",
5660 * required=true,
5661 * @OA\Schema(
5662 * type="string"
5664 * ),
5665 * @OA\Parameter(
5666 * name="path",
5667 * in="query",
5668 * description="The category of the document.",
5669 * required=true,
5670 * @OA\Schema(
5671 * type="string"
5673 * ),
5674 * @OA\RequestBody(
5675 * required=true,
5676 * @OA\MediaType(
5677 * mediaType="multipart/form-data",
5678 * @OA\Schema(
5679 * @OA\Property(
5680 * property="document",
5681 * description="document",
5682 * type="string",
5683 * format="binary"
5684 * ),
5685 * ),
5686 * ),
5687 * ),
5688 * @OA\Response(
5689 * response="200",
5690 * ref="#/components/responses/standard"
5691 * ),
5692 * @OA\Response(
5693 * response="400",
5694 * ref="#/components/responses/badrequest"
5695 * ),
5696 * @OA\Response(
5697 * response="401",
5698 * ref="#/components/responses/unauthorized"
5699 * ),
5700 * security={{"openemr_auth":{}}}
5703 "POST /api/patient/:pid/document" => function ($pid) {
5704 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5705 RestConfig::apiLog($return);
5706 return $return;
5710 * @OA\Get(
5711 * path="/api/patient/{pid}/document",
5712 * description="Retrieves all file information of documents from a category for a patient",
5713 * tags={"standard"},
5714 * @OA\Parameter(
5715 * name="pid",
5716 * in="path",
5717 * description="The pid for the patient.",
5718 * required=true,
5719 * @OA\Schema(
5720 * type="string"
5722 * ),
5723 * @OA\Parameter(
5724 * name="path",
5725 * in="query",
5726 * description="The category of the documents.",
5727 * required=true,
5728 * @OA\Schema(
5729 * type="string"
5731 * ),
5732 * @OA\Response(
5733 * response="200",
5734 * ref="#/components/responses/standard"
5735 * ),
5736 * @OA\Response(
5737 * response="400",
5738 * ref="#/components/responses/badrequest"
5739 * ),
5740 * @OA\Response(
5741 * response="401",
5742 * ref="#/components/responses/unauthorized"
5743 * ),
5744 * security={{"openemr_auth":{}}}
5747 "GET /api/patient/:pid/document" => function ($pid) {
5748 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5749 RestConfig::apiLog($return);
5750 return $return;
5754 * @OA\Get(
5755 * path="/api/patient/{pid}/document/{did}",
5756 * description="Retrieves a document for a patient",
5757 * tags={"standard"},
5758 * @OA\Parameter(
5759 * name="pid",
5760 * in="path",
5761 * description="The pid for the patient.",
5762 * required=true,
5763 * @OA\Schema(
5764 * type="string"
5766 * ),
5767 * @OA\Parameter(
5768 * name="did",
5769 * in="path",
5770 * description="The id for the patient document.",
5771 * required=true,
5772 * @OA\Schema(
5773 * type="string"
5775 * ),
5776 * @OA\Response(
5777 * response="200",
5778 * ref="#/components/responses/standard"
5779 * ),
5780 * @OA\Response(
5781 * response="400",
5782 * ref="#/components/responses/badrequest"
5783 * ),
5784 * @OA\Response(
5785 * response="401",
5786 * ref="#/components/responses/unauthorized"
5787 * ),
5788 * security={{"openemr_auth":{}}}
5791 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5792 $return = (new DocumentRestController())->downloadFile($pid, $did);
5793 RestConfig::apiLog($return);
5794 return $return;
5798 * @OA\Get(
5799 * path="/api/patient/{pid}/insurance",
5800 * description="Retrieves all insurances for a patient",
5801 * tags={"standard"},
5802 * @OA\Parameter(
5803 * name="pid",
5804 * in="path",
5805 * description="The pid for the patient.",
5806 * required=true,
5807 * @OA\Schema(
5808 * type="string"
5810 * ),
5811 * @OA\Response(
5812 * response="200",
5813 * ref="#/components/responses/standard"
5814 * ),
5815 * @OA\Response(
5816 * response="400",
5817 * ref="#/components/responses/badrequest"
5818 * ),
5819 * @OA\Response(
5820 * response="401",
5821 * ref="#/components/responses/unauthorized"
5822 * ),
5823 * security={{"openemr_auth":{}}}
5826 "GET /api/patient/:pid/insurance" => function ($pid) {
5827 $return = (new InsuranceRestController())->getAll($pid);
5828 RestConfig::apiLog($return);
5829 return $return;
5833 * @OA\Get(
5834 * path="/api/patient/{pid}/insurance/{type}",
5835 * description="Retrieves a insurance (by type) for a patient",
5836 * tags={"standard"},
5837 * @OA\Parameter(
5838 * name="pid",
5839 * in="path",
5840 * description="The pid for the patient.",
5841 * required=true,
5842 * @OA\Schema(
5843 * type="string"
5845 * ),
5846 * @OA\Parameter(
5847 * name="type",
5848 * in="path",
5849 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5850 * required=true,
5851 * @OA\Schema(
5852 * type="string"
5854 * ),
5855 * @OA\Response(
5856 * response="200",
5857 * ref="#/components/responses/standard"
5858 * ),
5859 * @OA\Response(
5860 * response="400",
5861 * ref="#/components/responses/badrequest"
5862 * ),
5863 * @OA\Response(
5864 * response="401",
5865 * ref="#/components/responses/unauthorized"
5866 * ),
5867 * security={{"openemr_auth":{}}}
5870 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5871 $return = (new InsuranceRestController())->getOne($pid, $type);
5872 RestConfig::apiLog($return);
5873 return $return;
5877 * Schema for the insurance request
5879 * @OA\Schema(
5880 * schema="api_insurance_request",
5881 * @OA\Property(
5882 * property="provider",
5883 * description="The insurance company id.",
5884 * type="string"
5885 * ),
5886 * @OA\Property(
5887 * property="plan_name",
5888 * description="The plan name of insurance.",
5889 * type="string"
5890 * ),
5891 * @OA\Property(
5892 * property="policy_number",
5893 * description="The policy number of insurance.",
5894 * type="string"
5895 * ),
5896 * @OA\Property(
5897 * property="group_number",
5898 * description="The group number of insurance.",
5899 * type="string"
5900 * ),
5901 * @OA\Property(
5902 * property="subscriber_lname",
5903 * description="The subscriber last name of insurance.",
5904 * type="string"
5905 * ),
5906 * @OA\Property(
5907 * property="subscriber_mname",
5908 * description="The subscriber middle name of insurance.",
5909 * type="string"
5910 * ),
5911 * @OA\Property(
5912 * property="subscriber_fname",
5913 * description="The subscriber first name of insurance.",
5914 * type="string"
5915 * ),
5916 * @OA\Property(
5917 * property="subscriber_relationship",
5918 * description="The subscriber relationship of insurance.",
5919 * type="string"
5920 * ),
5921 * @OA\Property(
5922 * property="subscriber_ss",
5923 * description="The subscriber ss number of insurance.",
5924 * type="string"
5925 * ),
5926 * @OA\Property(
5927 * property="subscriber_DOB",
5928 * description="The subscriber DOB of insurance.",
5929 * type="string"
5930 * ),
5931 * @OA\Property(
5932 * property="subscriber_street",
5933 * description="The subscriber street address of insurance.",
5934 * type="string"
5935 * ),
5936 * @OA\Property(
5937 * property="subscriber_postal_code",
5938 * description="The subscriber postal code of insurance.",
5939 * type="string"
5940 * ),
5941 * @OA\Property(
5942 * property="subscriber_city",
5943 * description="The subscriber city of insurance.",
5944 * type="string"
5945 * ),
5946 * @OA\Property(
5947 * property="subscriber_state",
5948 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5949 * type="string"
5950 * ),
5951 * @OA\Property(
5952 * property="subscriber_country",
5953 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5954 * type="string"
5955 * ),
5956 * @OA\Property(
5957 * property="subscriber_phone",
5958 * description="The subscriber phone of insurance.",
5959 * type="string"
5960 * ),
5961 * @OA\Property(
5962 * property="subscriber_employer",
5963 * description="The subscriber employer of insurance.",
5964 * type="string"
5965 * ),
5966 * @OA\Property(
5967 * property="subscriber_employer_street",
5968 * description="The subscriber employer street of insurance.",
5969 * type="string"
5970 * ),
5971 * @OA\Property(
5972 * property="subscriber_employer_postal_code",
5973 * description="The subscriber employer postal code of insurance.",
5974 * type="string"
5975 * ),
5976 * @OA\Property(
5977 * property="subscriber_employer_state",
5978 * description="The subscriber employer state of insurance.",
5979 * type="string"
5980 * ),
5981 * @OA\Property(
5982 * property="subscriber_employer_country",
5983 * description="The subscriber employer country of insurance.",
5984 * type="string"
5985 * ),
5986 * @OA\Property(
5987 * property="subscriber_employer_city",
5988 * description="The subscriber employer city of insurance.",
5989 * type="string"
5990 * ),
5991 * @OA\Property(
5992 * property="copay",
5993 * description="The copay of insurance.",
5994 * type="string"
5995 * ),
5996 * @OA\Property(
5997 * property="date",
5998 * description="The date of insurance.",
5999 * type="string"
6000 * ),
6001 * @OA\Property(
6002 * property="subscriber_sex",
6003 * description="The subscriber sex of insurance.",
6004 * type="string"
6005 * ),
6006 * @OA\Property(
6007 * property="accept_assignment",
6008 * description="The accept_assignment of insurance.",
6009 * type="string"
6010 * ),
6011 * @OA\Property(
6012 * property="policy_type",
6013 * description="The policy_type of insurance.",
6014 * type="string"
6015 * ),
6016 * 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"},
6017 * example={
6018 * "provider": "33",
6019 * "plan_name": "Some Plan",
6020 * "policy_number": "12345",
6021 * "group_number": "252412",
6022 * "subscriber_lname": "Tester",
6023 * "subscriber_mname": "Xi",
6024 * "subscriber_fname": "Foo",
6025 * "subscriber_relationship": "other",
6026 * "subscriber_ss": "234231234",
6027 * "subscriber_DOB": "2018-10-03",
6028 * "subscriber_street": "183 Cool St",
6029 * "subscriber_postal_code": "23418",
6030 * "subscriber_city": "Cooltown",
6031 * "subscriber_state": "AZ",
6032 * "subscriber_country": "USA",
6033 * "subscriber_phone": "234-598-2123",
6034 * "subscriber_employer": "Some Employer",
6035 * "subscriber_employer_street": "123 Heather Lane",
6036 * "subscriber_employer_postal_code": "23415",
6037 * "subscriber_employer_state": "AZ",
6038 * "subscriber_employer_country": "USA",
6039 * "subscriber_employer_city": "Cooltown",
6040 * "copay": "35",
6041 * "date": "2018-10-15",
6042 * "subscriber_sex": "Female",
6043 * "accept_assignment": "TRUE",
6044 * "policy_type": "a"
6049 * @OA\Post(
6050 * path="/api/patient/{pid}/insurance/{type}",
6051 * description="Submits a new patient insurance (with type)",
6052 * tags={"standard"},
6053 * @OA\Parameter(
6054 * name="pid",
6055 * in="path",
6056 * description="The pid for the patient.",
6057 * required=true,
6058 * @OA\Schema(
6059 * type="string"
6061 * ),
6062 * @OA\Parameter(
6063 * name="type",
6064 * in="path",
6065 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6066 * required=true,
6067 * @OA\Schema(
6068 * type="string"
6070 * ),
6071 * @OA\RequestBody(
6072 * required=true,
6073 * @OA\MediaType(
6074 * mediaType="application/json",
6075 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6077 * ),
6078 * @OA\Response(
6079 * response="200",
6080 * ref="#/components/responses/standard"
6081 * ),
6082 * @OA\Response(
6083 * response="400",
6084 * ref="#/components/responses/badrequest"
6085 * ),
6086 * @OA\Response(
6087 * response="401",
6088 * ref="#/components/responses/unauthorized"
6089 * ),
6090 * security={{"openemr_auth":{}}}
6093 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6094 $data = (array) (json_decode(file_get_contents("php://input")));
6095 $return = (new InsuranceRestController())->post($pid, $type, $data);
6096 RestConfig::apiLog($return, $data);
6097 return $return;
6101 * @OA\Put(
6102 * path="/api/patient/{pid}/insurance/{type}",
6103 * description="Edit a patient insurance (by type)",
6104 * tags={"standard"},
6105 * @OA\Parameter(
6106 * name="pid",
6107 * in="path",
6108 * description="The pid for the patient.",
6109 * required=true,
6110 * @OA\Schema(
6111 * type="string"
6113 * ),
6114 * @OA\Parameter(
6115 * name="type",
6116 * in="path",
6117 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6118 * required=true,
6119 * @OA\Schema(
6120 * type="string"
6122 * ),
6123 * @OA\RequestBody(
6124 * required=true,
6125 * @OA\MediaType(
6126 * mediaType="application/json",
6127 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6129 * ),
6130 * @OA\Response(
6131 * response="200",
6132 * ref="#/components/responses/standard"
6133 * ),
6134 * @OA\Response(
6135 * response="400",
6136 * ref="#/components/responses/badrequest"
6137 * ),
6138 * @OA\Response(
6139 * response="401",
6140 * ref="#/components/responses/unauthorized"
6141 * ),
6142 * security={{"openemr_auth":{}}}
6145 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6146 $data = (array) (json_decode(file_get_contents("php://input")));
6147 $return = (new InsuranceRestController())->put($pid, $type, $data);
6148 RestConfig::apiLog($return, $data);
6149 return $return;
6153 * Schema for the message request
6155 * @OA\Schema(
6156 * schema="api_message_request",
6157 * @OA\Property(
6158 * property="body",
6159 * description="The body of message.",
6160 * type="string"
6161 * ),
6162 * @OA\Property(
6163 * property="groupname",
6164 * description="The group name (usually is 'Default').",
6165 * type="string"
6166 * ),
6167 * @OA\Property(
6168 * property="from",
6169 * description="The sender of the message.",
6170 * type="string"
6171 * ),
6172 * @OA\Property(
6173 * property="to",
6174 * description="The recipient of the message.",
6175 * type="string"
6176 * ),
6177 * @OA\Property(
6178 * property="title",
6179 * description="use an option from resource=/api/list/note_type",
6180 * type="string"
6181 * ),
6182 * @OA\Property(
6183 * property="message_status",
6184 * description="use an option from resource=/api/list/message_status",
6185 * type="string"
6186 * ),
6187 * required={"body", "groupname", "from", "to", "title", "message_status"},
6188 * example={
6189 * "body": "Test 456",
6190 * "groupname": "Default",
6191 * "from": "Matthew",
6192 * "to": "admin",
6193 * "title": "Other",
6194 * "message_status": "New"
6199 * @OA\Post(
6200 * path="/api/patient/{pid}/message",
6201 * description="Submits a pnote message",
6202 * tags={"standard"},
6203 * @OA\Parameter(
6204 * name="pid",
6205 * in="path",
6206 * description="The id for the patient.",
6207 * required=true,
6208 * @OA\Schema(
6209 * type="string"
6211 * ),
6212 * @OA\RequestBody(
6213 * required=true,
6214 * @OA\MediaType(
6215 * mediaType="application/json",
6216 * @OA\Schema(ref="#/components/schemas/api_message_request")
6218 * ),
6219 * @OA\Response(
6220 * response="200",
6221 * ref="#/components/responses/standard"
6222 * ),
6223 * @OA\Response(
6224 * response="400",
6225 * ref="#/components/responses/badrequest"
6226 * ),
6227 * @OA\Response(
6228 * response="401",
6229 * ref="#/components/responses/unauthorized"
6230 * ),
6231 * security={{"openemr_auth":{}}}
6234 "POST /api/patient/:pid/message" => function ($pid) {
6235 RestConfig::authorization_check("patients", "notes");
6236 $data = (array) (json_decode(file_get_contents("php://input")));
6237 $return = (new MessageRestController())->post($pid, $data);
6238 RestConfig::apiLog($return, $data);
6239 return $return;
6243 * @OA\Get(
6244 * path="/api/patient/{pid}/transaction",
6245 * description="Get Transactions for a patient",
6246 * tags={"standard"},
6247 * @OA\Parameter(
6248 * name="pid",
6249 * in="path",
6250 * description="The pid for the patient",
6251 * required=true,
6252 * @OA\Schema(
6253 * type="string"
6255 * ),
6256 * @OA\Response(
6257 * response="200",
6258 * ref="#/components/responses/standard"
6259 * ),
6260 * @OA\Response(
6261 * response="400",
6262 * ref="#/components/responses/badrequest"
6263 * ),
6264 * @OA\Response(
6265 * response="401",
6266 * ref="#/components/responses/unauthorized"
6267 * ),
6268 * security={{"openemr_auth":{}}}
6272 "GET /api/patient/:pid/transaction" => function ($pid) {
6273 RestConfig::authorization_check("patients", "trans");
6274 $cont = new TransactionRestController();
6275 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6276 RestConfig::apiLog($return);
6277 return $return;
6281 * Schema for the transaction request
6283 * @OA\Schema(
6284 * schema="api_transaction_request",
6285 * @OA\Property(
6286 * property="message",
6287 * description="The message of the transaction.",
6288 * type="string"
6289 * ),
6290 * @OA\Property(
6291 * property="type",
6292 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6293 * type="string"
6294 * ),
6295 * @OA\Property(
6296 * property="groupname",
6297 * description="The group name (usually is 'Default').",
6298 * type="string"
6299 * ),
6300 * @OA\Property(
6301 * property="referByNpi",
6302 * description="NPI of the person creating the referral.",
6303 * type="string"
6304 * ),
6305 * @OA\Property(
6306 * property="referToNpi",
6307 * description="NPI of the person getting the referral.",
6308 * type="string"
6309 * ),
6310 * @OA\Property(
6311 * property="referDiagnosis",
6312 * description="The referral diagnosis.",
6313 * type="string"
6314 * ),
6315 * @OA\Property(
6316 * property="riskLevel",
6317 * description="The risk level. (Low, Medium, High)",
6318 * type="string"
6319 * ),
6320 * @OA\Property(
6321 * property="includeVitals",
6322 * description="Are vitals included (0,1)",
6323 * type="string"
6324 * ),
6325 * @OA\Property(
6326 * property="referralDate",
6327 * description="The date of the referral",
6328 * type="string"
6329 * ),
6330 * @OA\Property(
6331 * property="authorization",
6332 * description="The authorization for the referral",
6333 * type="string"
6334 * ),
6335 * @OA\Property(
6336 * property="visits",
6337 * description="The number of vists for the referral",
6338 * type="string"
6339 * ),
6340 * @OA\Property(
6341 * property="validFrom",
6342 * description="The date the referral is valid from",
6343 * type="string"
6344 * ),
6345 * @OA\Property(
6346 * property="validThrough",
6347 * description="The date the referral is valid through",
6348 * type="string"
6349 * ),
6350 * required={"message", "groupname", "title"},
6351 * example={
6352 * "message": "Message",
6353 * "type": "LBTref",
6354 * "groupname": "Default",
6355 * "referByNpi":"9999999999",
6356 * "referToNpi":"9999999999",
6357 * "referDiagnosis":"Diag 1",
6358 * "riskLevel":"Low",
6359 * "includeVitals":"1",
6360 * "referralDate":"2022-01-01",
6361 * "authorization":"Auth_123",
6362 * "visits": "1",
6363 * "validFrom": "2022-01-02",
6364 * "validThrough": "2022-01-03",
6365 * "body": "Reason 1"
6370 * @OA\Post(
6371 * path="/api/patient/{pid}/transaction",
6372 * description="Submits a transaction",
6373 * tags={"standard"},
6374 * @OA\Parameter(
6375 * name="pid",
6376 * in="path",
6377 * description="The pid for the patient.",
6378 * required=true,
6379 * @OA\Schema(
6380 * type="string"
6382 * ),
6383 * @OA\RequestBody(
6384 * required=true,
6385 * @OA\MediaType(
6386 * mediaType="application/json",
6387 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6389 * ),
6390 * @OA\Response(
6391 * response="200",
6392 * ref="#/components/responses/standard"
6393 * ),
6394 * @OA\Response(
6395 * response="400",
6396 * ref="#/components/responses/badrequest"
6397 * ),
6398 * @OA\Response(
6399 * response="401",
6400 * ref="#/components/responses/unauthorized"
6401 * ),
6402 * security={{"openemr_auth":{}}}
6405 "POST /api/patient/:pid/transaction" => function ($pid) {
6406 RestConfig::authorization_check("patients", "trans");
6407 $data = (array) (json_decode(file_get_contents("php://input")));
6408 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6409 RestConfig::apiLog($return, $data);
6410 return $return;
6414 * @OA\PUT(
6415 * path="/api/transaction/{tid}",
6416 * description="Updates a transaction",
6417 * tags={"standard"},
6418 * @OA\Parameter(
6419 * name="tid",
6420 * in="path",
6421 * description="The id for the transaction.",
6422 * required=true,
6423 * @OA\Schema(
6424 * type="string"
6426 * ),
6427 * @OA\RequestBody(
6428 * required=true,
6429 * @OA\MediaType(
6430 * mediaType="application/json",
6431 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6433 * ),
6434 * @OA\Response(
6435 * response="200",
6436 * ref="#/components/responses/standard"
6437 * ),
6438 * @OA\Response(
6439 * response="400",
6440 * ref="#/components/responses/badrequest"
6441 * ),
6442 * @OA\Response(
6443 * response="401",
6444 * ref="#/components/responses/unauthorized"
6445 * ),
6446 * security={{"openemr_auth":{}}}
6449 "PUT /api/transaction/:tid" => function ($tid) {
6450 RestConfig::authorization_check("patients", "trans");
6451 $data = (array) (json_decode(file_get_contents("php://input")));
6452 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6453 RestConfig::apiLog($return, $data);
6454 return $return;
6458 * @OA\Put(
6459 * path="/api/patient/{pid}/message/{mid}",
6460 * description="Edit a pnote message",
6461 * tags={"standard"},
6462 * @OA\Parameter(
6463 * name="pid",
6464 * in="path",
6465 * description="The id for the patient.",
6466 * required=true,
6467 * @OA\Schema(
6468 * type="string"
6470 * ),
6471 * @OA\Parameter(
6472 * name="mid",
6473 * in="path",
6474 * description="The id for the pnote message.",
6475 * required=true,
6476 * @OA\Schema(
6477 * type="string"
6479 * ),
6480 * @OA\RequestBody(
6481 * required=true,
6482 * @OA\MediaType(
6483 * mediaType="application/json",
6484 * @OA\Schema(ref="#/components/schemas/api_message_request")
6486 * ),
6487 * @OA\Response(
6488 * response="200",
6489 * ref="#/components/responses/standard"
6490 * ),
6491 * @OA\Response(
6492 * response="400",
6493 * ref="#/components/responses/badrequest"
6494 * ),
6495 * @OA\Response(
6496 * response="401",
6497 * ref="#/components/responses/unauthorized"
6498 * ),
6499 * security={{"openemr_auth":{}}}
6502 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6503 RestConfig::authorization_check("patients", "notes");
6504 $data = (array) (json_decode(file_get_contents("php://input")));
6505 $return = (new MessageRestController())->put($pid, $mid, $data);
6506 RestConfig::apiLog($return, $data);
6507 return $return;
6511 * @OA\Delete(
6512 * path="/api/patient/{pid}/message/{mid}",
6513 * description="Delete a pnote message",
6514 * tags={"standard"},
6515 * @OA\Parameter(
6516 * name="pid",
6517 * in="path",
6518 * description="The id for the patient.",
6519 * required=true,
6520 * @OA\Schema(
6521 * type="string"
6523 * ),
6524 * @OA\Parameter(
6525 * name="eid",
6526 * in="path",
6527 * description="The id for the pnote message.",
6528 * required=true,
6529 * @OA\Schema(
6530 * type="string"
6532 * ),
6533 * @OA\Response(
6534 * response="200",
6535 * ref="#/components/responses/standard"
6536 * ),
6537 * @OA\Response(
6538 * response="400",
6539 * ref="#/components/responses/badrequest"
6540 * ),
6541 * @OA\Response(
6542 * response="401",
6543 * ref="#/components/responses/unauthorized"
6544 * ),
6545 * security={{"openemr_auth":{}}}
6548 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6549 RestConfig::authorization_check("patients", "notes");
6550 $return = (new MessageRestController())->delete($pid, $mid);
6551 RestConfig::apiLog($return);
6552 return $return;
6556 * @OA\Get(
6557 * path="/api/immunization",
6558 * description="Retrieves a list of immunizations",
6559 * tags={"standard"},
6560 * @OA\Parameter(
6561 * name="patient_id",
6562 * in="query",
6563 * description="The pid for the patient.",
6564 * required=false,
6565 * @OA\Schema(
6566 * type="string"
6568 * ),
6569 * @OA\Parameter(
6570 * name="id",
6571 * in="query",
6572 * description="The id for the immunization.",
6573 * required=false,
6574 * @OA\Schema(
6575 * type="string"
6577 * ),
6578 * @OA\Parameter(
6579 * name="uuid",
6580 * in="query",
6581 * description="The uuid for the immunization.",
6582 * required=false,
6583 * @OA\Schema(
6584 * type="string"
6586 * ),
6587 * @OA\Parameter(
6588 * name="administered_date",
6589 * in="query",
6590 * description="The administered date for the immunization.",
6591 * required=false,
6592 * @OA\Schema(
6593 * type="string"
6595 * ),
6596 * @OA\Parameter(
6597 * name="immunization_id",
6598 * in="query",
6599 * description="The immunization list_id for the immunization.",
6600 * required=false,
6601 * @OA\Schema(
6602 * type="string"
6604 * ),
6605 * @OA\Parameter(
6606 * name="cvx_code",
6607 * in="query",
6608 * description="The cvx code for the immunization.",
6609 * required=false,
6610 * @OA\Schema(
6611 * type="string"
6613 * ),
6614 * @OA\Parameter(
6615 * name="manufacturer",
6616 * in="query",
6617 * description="The manufacturer for the immunization.",
6618 * required=false,
6619 * @OA\Schema(
6620 * type="string"
6622 * ),
6623 * @OA\Parameter(
6624 * name="lot_number",
6625 * in="query",
6626 * description="The lot number for the immunization.",
6627 * required=false,
6628 * @OA\Schema(
6629 * type="string"
6631 * ),
6632 * @OA\Parameter(
6633 * name="administered_by_id",
6634 * in="query",
6635 * description="The administered by id for the immunization.",
6636 * required=false,
6637 * @OA\Schema(
6638 * type="string"
6640 * ),
6641 * @OA\Parameter(
6642 * name="administered_by",
6643 * in="query",
6644 * description="The administered by for the immunization.",
6645 * required=false,
6646 * @OA\Schema(
6647 * type="string"
6649 * ),
6650 * @OA\Parameter(
6651 * name="education_date",
6652 * in="query",
6653 * description="The education date for the immunization.",
6654 * required=false,
6655 * @OA\Schema(
6656 * type="string"
6658 * ),
6659 * @OA\Parameter(
6660 * name="vis_date",
6661 * in="query",
6662 * description="The vis date for the immunization.",
6663 * required=false,
6664 * @OA\Schema(
6665 * type="string"
6667 * ),
6668 * @OA\Parameter(
6669 * name="note",
6670 * in="query",
6671 * description="The note for the immunization.",
6672 * required=false,
6673 * @OA\Schema(
6674 * type="string"
6676 * ),
6677 * @OA\Parameter(
6678 * name="create_date",
6679 * in="query",
6680 * description="The create date for the immunization.",
6681 * required=false,
6682 * @OA\Schema(
6683 * type="string"
6685 * ),
6686 * @OA\Parameter(
6687 * name="update_date",
6688 * in="query",
6689 * description="The update date for the immunization.",
6690 * required=false,
6691 * @OA\Schema(
6692 * type="string"
6694 * ),
6695 * @OA\Parameter(
6696 * name="created_by",
6697 * in="query",
6698 * description="The created_by for the immunization.",
6699 * required=false,
6700 * @OA\Schema(
6701 * type="string"
6703 * ),
6704 * @OA\Parameter(
6705 * name="updated_by",
6706 * in="query",
6707 * description="The updated_by for the immunization.",
6708 * required=false,
6709 * @OA\Schema(
6710 * type="string"
6712 * ),
6713 * @OA\Parameter(
6714 * name="amount_administered",
6715 * in="query",
6716 * description="The amount administered for the immunization.",
6717 * required=false,
6718 * @OA\Schema(
6719 * type="string"
6721 * ),
6722 * @OA\Parameter(
6723 * name="amount_administered_unit",
6724 * in="query",
6725 * description="The amount administered unit for the immunization.",
6726 * required=false,
6727 * @OA\Schema(
6728 * type="string"
6730 * ),
6731 * @OA\Parameter(
6732 * name="expiration_date",
6733 * in="query",
6734 * description="The expiration date for the immunization.",
6735 * required=false,
6736 * @OA\Schema(
6737 * type="string"
6739 * ),
6740 * @OA\Parameter(
6741 * name="route",
6742 * in="query",
6743 * description="The route for the immunization.",
6744 * required=false,
6745 * @OA\Schema(
6746 * type="string"
6748 * ),
6749 * @OA\Parameter(
6750 * name="administration_site",
6751 * in="query",
6752 * description="The administration site for the immunization.",
6753 * required=false,
6754 * @OA\Schema(
6755 * type="string"
6757 * ),
6758 * @OA\Parameter(
6759 * name="added_erroneously",
6760 * in="query",
6761 * description="The added_erroneously for the immunization.",
6762 * required=false,
6763 * @OA\Schema(
6764 * type="string"
6766 * ),
6767 * @OA\Parameter(
6768 * name="external_id",
6769 * in="query",
6770 * description="The external_id for the immunization.",
6771 * required=false,
6772 * @OA\Schema(
6773 * type="string"
6775 * ),
6776 * @OA\Parameter(
6777 * name="completion_status",
6778 * in="query",
6779 * description="The completion status for the immunization.",
6780 * required=false,
6781 * @OA\Schema(
6782 * type="string"
6784 * ),
6785 * @OA\Parameter(
6786 * name="information_source",
6787 * in="query",
6788 * description="The information source for the immunization.",
6789 * required=false,
6790 * @OA\Schema(
6791 * type="string"
6793 * ),
6794 * @OA\Parameter(
6795 * name="refusal_reason",
6796 * in="query",
6797 * description="The refusal reason for the immunization.",
6798 * required=false,
6799 * @OA\Schema(
6800 * type="string"
6802 * ),
6803 * @OA\Parameter(
6804 * name="ordering_provider",
6805 * in="query",
6806 * description="The ordering provider for the immunization.",
6807 * required=false,
6808 * @OA\Schema(
6809 * type="string"
6811 * ),
6812 * @OA\Response(
6813 * response="200",
6814 * ref="#/components/responses/standard"
6815 * ),
6816 * @OA\Response(
6817 * response="400",
6818 * ref="#/components/responses/badrequest"
6819 * ),
6820 * @OA\Response(
6821 * response="401",
6822 * ref="#/components/responses/unauthorized"
6823 * ),
6824 * security={{"openemr_auth":{}}}
6827 "GET /api/immunization" => function () {
6828 RestConfig::authorization_check("patients", "med");
6829 $return = (new ImmunizationRestController())->getAll($_GET);
6830 RestConfig::apiLog($return);
6831 return $return;
6835 * @OA\Get(
6836 * path="/api/immunization/{uuid}",
6837 * description="Retrieves a immunization",
6838 * tags={"standard"},
6839 * @OA\Parameter(
6840 * name="uuid",
6841 * in="path",
6842 * description="The uuid for the immunization.",
6843 * required=true,
6844 * @OA\Schema(
6845 * type="string"
6847 * ),
6848 * @OA\Response(
6849 * response="200",
6850 * ref="#/components/responses/standard"
6851 * ),
6852 * @OA\Response(
6853 * response="400",
6854 * ref="#/components/responses/badrequest"
6855 * ),
6856 * @OA\Response(
6857 * response="401",
6858 * ref="#/components/responses/unauthorized"
6859 * ),
6860 * security={{"openemr_auth":{}}}
6863 "GET /api/immunization/:uuid" => function ($uuid) {
6864 RestConfig::authorization_check("patients", "med");
6865 $return = (new ImmunizationRestController())->getOne($uuid);
6866 RestConfig::apiLog($return);
6867 return $return;
6871 * @OA\Get(
6872 * path="/api/procedure",
6873 * description="Retrieves a list of all procedures",
6874 * tags={"standard"},
6875 * @OA\Response(
6876 * response="200",
6877 * ref="#/components/responses/standard"
6878 * ),
6879 * @OA\Response(
6880 * response="400",
6881 * ref="#/components/responses/badrequest"
6882 * ),
6883 * @OA\Response(
6884 * response="401",
6885 * ref="#/components/responses/unauthorized"
6886 * ),
6887 * security={{"openemr_auth":{}}}
6890 "GET /api/procedure" => function () {
6891 RestConfig::authorization_check("patients", "med");
6892 $return = (new ProcedureRestController())->getAll();
6893 RestConfig::apiLog($return);
6894 return $return;
6898 * @OA\Get(
6899 * path="/api/procedure/{uuid}",
6900 * description="Retrieves a procedure",
6901 * tags={"standard"},
6902 * @OA\Parameter(
6903 * name="uuid",
6904 * in="path",
6905 * description="The uuid for the procedure.",
6906 * required=true,
6907 * @OA\Schema(
6908 * type="string"
6910 * ),
6911 * @OA\Response(
6912 * response="200",
6913 * ref="#/components/responses/standard"
6914 * ),
6915 * @OA\Response(
6916 * response="400",
6917 * ref="#/components/responses/badrequest"
6918 * ),
6919 * @OA\Response(
6920 * response="401",
6921 * ref="#/components/responses/unauthorized"
6922 * ),
6923 * security={{"openemr_auth":{}}}
6926 "GET /api/procedure/:uuid" => function ($uuid) {
6927 RestConfig::authorization_check("patients", "med");
6928 $return = (new ProcedureRestController())->getOne($uuid);
6929 RestConfig::apiLog($return);
6930 return $return;
6934 * @OA\Get(
6935 * path="/api/drug",
6936 * description="Retrieves a list of all drugs",
6937 * tags={"standard"},
6938 * @OA\Response(
6939 * response="200",
6940 * ref="#/components/responses/standard"
6941 * ),
6942 * @OA\Response(
6943 * response="400",
6944 * ref="#/components/responses/badrequest"
6945 * ),
6946 * @OA\Response(
6947 * response="401",
6948 * ref="#/components/responses/unauthorized"
6949 * ),
6950 * security={{"openemr_auth":{}}}
6953 "GET /api/drug" => function () {
6954 RestConfig::authorization_check("patients", "med");
6955 $return = (new DrugRestController())->getAll();
6956 RestConfig::apiLog($return);
6957 return $return;
6961 * @OA\Get(
6962 * path="/api/drug/{uuid}",
6963 * description="Retrieves a drug",
6964 * tags={"standard"},
6965 * @OA\Parameter(
6966 * name="uuid",
6967 * in="path",
6968 * description="The uuid for the drug.",
6969 * required=true,
6970 * @OA\Schema(
6971 * type="string"
6973 * ),
6974 * @OA\Response(
6975 * response="200",
6976 * ref="#/components/responses/standard"
6977 * ),
6978 * @OA\Response(
6979 * response="400",
6980 * ref="#/components/responses/badrequest"
6981 * ),
6982 * @OA\Response(
6983 * response="401",
6984 * ref="#/components/responses/unauthorized"
6985 * ),
6986 * security={{"openemr_auth":{}}}
6989 "GET /api/drug/:uuid" => function ($uuid) {
6990 RestConfig::authorization_check("patients", "med");
6991 $return = (new DrugRestController())->getOne($uuid);
6992 RestConfig::apiLog($return);
6993 return $return;
6997 * @OA\Get(
6998 * path="/api/prescription",
6999 * description="Retrieves a list of all prescriptions",
7000 * tags={"standard"},
7001 * @OA\Response(
7002 * response="200",
7003 * ref="#/components/responses/standard"
7004 * ),
7005 * @OA\Response(
7006 * response="400",
7007 * ref="#/components/responses/badrequest"
7008 * ),
7009 * @OA\Response(
7010 * response="401",
7011 * ref="#/components/responses/unauthorized"
7012 * ),
7013 * security={{"openemr_auth":{}}}
7016 "GET /api/prescription" => function () {
7017 RestConfig::authorization_check("patients", "med");
7018 $return = (new PrescriptionRestController())->getAll();
7019 RestConfig::apiLog($return);
7020 return $return;
7024 * @OA\Get(
7025 * path="/api/prescription/{uuid}",
7026 * description="Retrieves a prescription",
7027 * tags={"standard"},
7028 * @OA\Parameter(
7029 * name="uuid",
7030 * in="path",
7031 * description="The uuid for the prescription.",
7032 * required=true,
7033 * @OA\Schema(
7034 * type="string"
7036 * ),
7037 * @OA\Response(
7038 * response="200",
7039 * ref="#/components/responses/standard"
7040 * ),
7041 * @OA\Response(
7042 * response="400",
7043 * ref="#/components/responses/badrequest"
7044 * ),
7045 * @OA\Response(
7046 * response="401",
7047 * ref="#/components/responses/unauthorized"
7048 * ),
7049 * security={{"openemr_auth":{}}}
7052 "GET /api/prescription/:uuid" => function ($uuid) {
7053 RestConfig::authorization_check("patients", "med");
7054 $return = (new PrescriptionRestController())->getOne($uuid);
7055 RestConfig::apiLog($return);
7056 return $return;
7060 use OpenEMR\Common\Http\StatusCode;
7061 use OpenEMR\Common\Http\Psr17Factory;
7062 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7063 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7064 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7065 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7066 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7067 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7068 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7069 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7070 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7071 use OpenEMR\RestControllers\FHIR\FhirExportRestController;
7072 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7073 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7074 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7075 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7076 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7077 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7078 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7079 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7080 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7081 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7082 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7083 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7084 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7085 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7086 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7088 // Note that the fhir route includes both user role and patient role
7089 // (there is a mechanism in place to ensure patient role is binded
7090 // to only see the data of the one patient)
7091 RestConfig::$FHIR_ROUTE_MAP = array(
7093 * @OA\Get(
7094 * path="/fhir/AllergyIntolerance",
7095 * description="Returns a list of AllergyIntolerance resources.",
7096 * tags={"fhir"},
7097 * @OA\Parameter(
7098 * name="_id",
7099 * in="query",
7100 * description="The uuid for the AllergyIntolerance resource.",
7101 * required=false,
7102 * @OA\Schema(
7103 * type="string"
7105 * ),
7106 * @OA\Parameter(
7107 * name="patient",
7108 * in="query",
7109 * description="The uuid for the patient.",
7110 * required=false,
7111 * @OA\Schema(
7112 * type="string"
7114 * ),
7115 * @OA\Response(
7116 * response="200",
7117 * description="Standard Response",
7118 * @OA\MediaType(
7119 * mediaType="application/json",
7120 * @OA\Schema(
7121 * @OA\Property(
7122 * property="json object",
7123 * description="FHIR Json object.",
7124 * type="object"
7125 * ),
7126 * example={
7127 * "meta": {
7128 * "lastUpdated": "2021-09-14T09:13:51"
7129 * },
7130 * "resourceType": "Bundle",
7131 * "type": "collection",
7132 * "total": 0,
7133 * "link": {
7135 * "relation": "self",
7136 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7142 * ),
7143 * @OA\Response(
7144 * response="400",
7145 * ref="#/components/responses/badrequest"
7146 * ),
7147 * @OA\Response(
7148 * response="401",
7149 * ref="#/components/responses/unauthorized"
7150 * ),
7151 * security={{"openemr_auth":{}}}
7154 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7155 $getParams = $request->getQueryParams();
7156 if ($request->isPatientRequest()) {
7157 // only allow access to data of binded patient
7158 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7159 } else {
7160 RestConfig::authorization_check("patients", "med");
7161 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7163 RestConfig::apiLog($return);
7164 return $return;
7168 * @OA\Get(
7169 * path="/fhir/AllergyIntolerance/{uuid}",
7170 * description="Returns a single AllergyIntolerance resource.",
7171 * tags={"fhir"},
7172 * @OA\Parameter(
7173 * name="uuid",
7174 * in="path",
7175 * description="The uuid for the AllergyIntolerance resource.",
7176 * required=true,
7177 * @OA\Schema(
7178 * type="string"
7180 * ),
7181 * @OA\Response(
7182 * response="200",
7183 * description="Standard Response",
7184 * @OA\MediaType(
7185 * mediaType="application/json",
7186 * @OA\Schema(
7187 * @OA\Property(
7188 * property="json object",
7189 * description="FHIR Json object.",
7190 * type="object"
7191 * ),
7192 * example={
7193 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7194 * "meta": {
7195 * "versionId": "1",
7196 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7197 * },
7198 * "resourceType": "AllergyIntolerance",
7199 * "text": {
7200 * "status": "additional",
7201 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7202 * },
7203 * "clinicalStatus": {
7204 * "coding": {
7206 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7207 * "code": "active",
7208 * "display": "Active"
7211 * },
7212 * "verificationStatus": {
7213 * "coding": {
7215 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7216 * "code": "confirmed",
7217 * "display": "Confirmed"
7220 * },
7221 * "category": {
7222 * "medication"
7223 * },
7224 * "criticality": "low",
7225 * "code": {
7226 * "coding": {
7228 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7229 * "code": "unknown",
7230 * "display": "Unknown"
7233 * },
7234 * "patient": {
7235 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7236 * },
7237 * "reaction": {
7239 * "manifestation": {
7241 * "coding": {
7243 * "system": "http://snomed.info/sct",
7244 * "code": "422587007",
7245 * "display": "Nausea"
7247 * },
7248 * "text": "Nausea"
7256 * ),
7257 * @OA\Response(
7258 * response="400",
7259 * ref="#/components/responses/badrequest"
7260 * ),
7261 * @OA\Response(
7262 * response="401",
7263 * ref="#/components/responses/unauthorized"
7264 * ),
7265 * @OA\Response(
7266 * response="404",
7267 * ref="#/components/responses/uuidnotfound"
7268 * ),
7269 * security={{"openemr_auth":{}}}
7272 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7273 if ($request->isPatientRequest()) {
7274 // only allow access to data of binded patient
7275 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7276 } else {
7277 RestConfig::authorization_check("patients", "med");
7278 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7280 RestConfig::apiLog($return);
7281 return $return;
7285 * @OA\Get(
7286 * path="/fhir/CarePlan",
7287 * description="Returns a list of CarePlan resources.",
7288 * tags={"fhir"},
7289 * @OA\Parameter(
7290 * name="_id",
7291 * in="query",
7292 * description="The uuid for the CarePlan resource.",
7293 * required=false,
7294 * @OA\Schema(
7295 * type="string"
7297 * ),
7298 * @OA\Parameter(
7299 * name="patient",
7300 * in="query",
7301 * description="The uuid for the patient.",
7302 * required=false,
7303 * @OA\Schema(
7304 * type="string"
7306 * ),
7307 * @OA\Parameter(
7308 * name="category",
7309 * in="query",
7310 * description="The category of the CarePlan resource.",
7311 * required=false,
7312 * @OA\Schema(
7313 * type="string"
7315 * ),
7316 * @OA\Response(
7317 * response="200",
7318 * description="Standard Response",
7319 * @OA\MediaType(
7320 * mediaType="application/json",
7321 * @OA\Schema(
7322 * @OA\Property(
7323 * property="json object",
7324 * description="FHIR Json object.",
7325 * type="object"
7326 * ),
7327 * example={
7328 * "meta": {
7329 * "lastUpdated": "2021-09-14T09:13:51"
7330 * },
7331 * "resourceType": "Bundle",
7332 * "type": "collection",
7333 * "total": 0,
7334 * "link": {
7336 * "relation": "self",
7337 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7343 * ),
7344 * @OA\Response(
7345 * response="400",
7346 * ref="#/components/responses/badrequest"
7347 * ),
7348 * @OA\Response(
7349 * response="401",
7350 * ref="#/components/responses/unauthorized"
7351 * ),
7352 * security={{"openemr_auth":{}}}
7355 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7356 $getParams = $request->getQueryParams();
7357 if ($request->isPatientRequest()) {
7358 // only allow access to data of binded patient
7359 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7360 } else {
7361 RestConfig::authorization_check("patients", "med");
7362 $return = (new FhirCarePlanRestController())->getAll($getParams);
7364 RestConfig::apiLog($return);
7365 return $return;
7369 * @OA\Get(
7370 * path="/fhir/CarePlan/{uuid}",
7371 * description="Returns a single CarePlan resource.",
7372 * tags={"fhir"},
7373 * @OA\Parameter(
7374 * name="uuid",
7375 * in="path",
7376 * description="The uuid for the CarePlan resource.",
7377 * required=true,
7378 * @OA\Schema(
7379 * type="string"
7381 * ),
7382 * @OA\Response(
7383 * response="200",
7384 * description="Standard Response",
7385 * @OA\MediaType(
7386 * mediaType="application/json",
7387 * @OA\Schema(
7388 * @OA\Property(
7389 * property="json object",
7390 * description="FHIR Json object.",
7391 * type="object"
7392 * ),
7393 * example={
7394 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7395 * "meta": {
7396 * "versionId": "1",
7397 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7398 * },
7399 * "resourceType": "CarePlan",
7400 * "text": {
7401 * "status": "generated",
7402 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7403 * },
7404 * "status": "active",
7405 * "intent": "plan",
7406 * "category": {
7408 * "coding": {
7410 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7411 * "code": "assess-plan"
7415 * },
7416 * "description": "Treat flu.",
7417 * "subject": {
7418 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7419 * "type": "Patient"
7424 * ),
7425 * @OA\Response(
7426 * response="400",
7427 * ref="#/components/responses/badrequest"
7428 * ),
7429 * @OA\Response(
7430 * response="401",
7431 * ref="#/components/responses/unauthorized"
7432 * ),
7433 * @OA\Response(
7434 * response="404",
7435 * ref="#/components/responses/uuidnotfound"
7436 * ),
7437 * security={{"openemr_auth":{}}}
7440 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7441 if ($request->isPatientRequest()) {
7442 // only allow access to data of binded patient
7443 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7444 } else {
7445 RestConfig::authorization_check("patients", "med");
7446 $return = (new FhirCarePlanRestController())->getOne($uuid);
7448 RestConfig::apiLog($return);
7449 return $return;
7453 * @OA\Get(
7454 * path="/fhir/CareTeam",
7455 * description="Returns a list of CareTeam resources.",
7456 * tags={"fhir"},
7457 * @OA\Parameter(
7458 * name="_id",
7459 * in="query",
7460 * description="The uuid for the CareTeam resource.",
7461 * required=false,
7462 * @OA\Schema(
7463 * type="string"
7465 * ),
7466 * @OA\Parameter(
7467 * name="patient",
7468 * in="query",
7469 * description="The uuid for the patient.",
7470 * required=false,
7471 * @OA\Schema(
7472 * type="string"
7474 * ),
7475 * @OA\Parameter(
7476 * name="status",
7477 * in="query",
7478 * description="The status of the CarePlan resource.",
7479 * required=false,
7480 * @OA\Schema(
7481 * type="string"
7483 * ),
7484 * @OA\Response(
7485 * response="200",
7486 * description="Standard Response",
7487 * @OA\MediaType(
7488 * mediaType="application/json",
7489 * @OA\Schema(
7490 * @OA\Property(
7491 * property="json object",
7492 * description="FHIR Json object.",
7493 * type="object"
7494 * ),
7495 * example={
7496 * "meta": {
7497 * "lastUpdated": "2021-09-14T09:13:51"
7498 * },
7499 * "resourceType": "Bundle",
7500 * "type": "collection",
7501 * "total": 0,
7502 * "link": {
7504 * "relation": "self",
7505 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7511 * ),
7512 * @OA\Response(
7513 * response="400",
7514 * ref="#/components/responses/badrequest"
7515 * ),
7516 * @OA\Response(
7517 * response="401",
7518 * ref="#/components/responses/unauthorized"
7519 * ),
7520 * security={{"openemr_auth":{}}}
7523 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
7524 $getParams = $request->getQueryParams();
7525 if ($request->isPatientRequest()) {
7526 // only allow access to data of binded patient
7527 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7528 } else {
7529 RestConfig::authorization_check("patients", "med");
7530 $return = (new FhirCareTeamRestController())->getAll($getParams);
7532 RestConfig::apiLog($return);
7533 return $return;
7537 * @OA\Get(
7538 * path="/fhir/CareTeam/{uuid}",
7539 * description="Returns a single CareTeam resource.",
7540 * tags={"fhir"},
7541 * @OA\Parameter(
7542 * name="uuid",
7543 * in="path",
7544 * description="The uuid for the CareTeam resource.",
7545 * required=true,
7546 * @OA\Schema(
7547 * type="string"
7549 * ),
7550 * @OA\Response(
7551 * response="200",
7552 * description="Standard Response",
7553 * @OA\MediaType(
7554 * mediaType="application/json",
7555 * @OA\Schema(
7556 * @OA\Property(
7557 * property="json object",
7558 * description="FHIR Json object.",
7559 * type="object"
7560 * ),
7561 * example={
7562 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7563 * "meta": {
7564 * "versionId": "1",
7565 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7566 * },
7567 * "resourceType": "CareTeam",
7568 * "status": "active",
7569 * "subject": {
7570 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7571 * "type": "Patient"
7572 * },
7573 * "participant": {
7575 * "role": {
7577 * "coding": {
7579 * "system": "http://nucc.org/provider-taxonomy",
7580 * "code": "102L00000X",
7581 * "display": "Psychoanalyst"
7585 * },
7586 * "member": {
7587 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7588 * "type": "Practitioner"
7589 * },
7590 * "onBehalfOf": {
7591 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7592 * "type": "Organization"
7594 * },
7596 * "role": {
7598 * "coding": {
7600 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7601 * "code": "unknown",
7602 * "display": "Unknown"
7606 * },
7607 * "member": {
7608 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7609 * "type": "Organization"
7616 * ),
7617 * @OA\Response(
7618 * response="400",
7619 * ref="#/components/responses/badrequest"
7620 * ),
7621 * @OA\Response(
7622 * response="401",
7623 * ref="#/components/responses/unauthorized"
7624 * ),
7625 * @OA\Response(
7626 * response="404",
7627 * ref="#/components/responses/uuidnotfound"
7628 * ),
7629 * security={{"openemr_auth":{}}}
7632 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
7633 if ($request->isPatientRequest()) {
7634 // only allow access to data of binded patient
7635 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7636 } else {
7637 RestConfig::authorization_check("patients", "med");
7638 $return = (new FhirCareTeamRestController())->getOne($uuid);
7640 RestConfig::apiLog($return);
7641 return $return;
7645 * @OA\Get(
7646 * path="/fhir/Condition",
7647 * description="Returns a list of Condition resources.",
7648 * tags={"fhir"},
7649 * @OA\Parameter(
7650 * name="_id",
7651 * in="query",
7652 * description="The uuid for the Condition resource.",
7653 * required=false,
7654 * @OA\Schema(
7655 * type="string"
7657 * ),
7658 * @OA\Parameter(
7659 * name="patient",
7660 * in="query",
7661 * description="The uuid for the patient.",
7662 * required=false,
7663 * @OA\Schema(
7664 * type="string"
7666 * ),
7667 * @OA\Response(
7668 * response="200",
7669 * description="Standard Response",
7670 * @OA\MediaType(
7671 * mediaType="application/json",
7672 * @OA\Schema(
7673 * @OA\Property(
7674 * property="json object",
7675 * description="FHIR Json object.",
7676 * type="object"
7677 * ),
7678 * example={
7679 * "meta": {
7680 * "lastUpdated": "2021-09-14T09:13:51"
7681 * },
7682 * "resourceType": "Bundle",
7683 * "type": "collection",
7684 * "total": 0,
7685 * "link": {
7687 * "relation": "self",
7688 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7694 * ),
7695 * @OA\Response(
7696 * response="400",
7697 * ref="#/components/responses/badrequest"
7698 * ),
7699 * @OA\Response(
7700 * response="401",
7701 * ref="#/components/responses/unauthorized"
7702 * ),
7703 * security={{"openemr_auth":{}}}
7706 "GET /fhir/Condition" => function (HttpRestRequest $request) {
7707 $getParams = $request->getQueryParams();
7708 if ($request->isPatientRequest()) {
7709 // only allow access to data of binded patient
7710 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7711 } else {
7712 RestConfig::authorization_check("patients", "med");
7713 $return = (new FhirConditionRestController())->getAll($getParams);
7715 RestConfig::apiLog($return);
7716 return $return;
7720 * @OA\Get(
7721 * path="/fhir/Condition/{uuid}",
7722 * description="Returns a single Condition resource.",
7723 * tags={"fhir"},
7724 * @OA\Parameter(
7725 * name="uuid",
7726 * in="path",
7727 * description="The uuid for the Condition resource.",
7728 * required=true,
7729 * @OA\Schema(
7730 * type="string"
7732 * ),
7733 * @OA\Response(
7734 * response="200",
7735 * description="Standard Response",
7736 * @OA\MediaType(
7737 * mediaType="application/json",
7738 * @OA\Schema(
7739 * @OA\Property(
7740 * property="json object",
7741 * description="FHIR Json object.",
7742 * type="object"
7743 * ),
7744 * example={
7745 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7746 * "meta": {
7747 * "versionId": "1",
7748 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7749 * },
7750 * "resourceType": "Condition",
7751 * "clinicalStatus": {
7752 * "coding": {
7754 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7755 * "code": "inactive",
7756 * "display": "Inactive"
7759 * },
7760 * "verificationStatus": {
7761 * "coding": {
7763 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7764 * "code": "unconfirmed",
7765 * "display": "Unconfirmed"
7768 * },
7769 * "category": {
7771 * "coding": {
7773 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7774 * "code": "problem-list-item",
7775 * "display": "Problem List Item"
7779 * },
7780 * "code": {
7781 * "coding": {
7783 * "system": "http://snomed.info/sct",
7784 * "code": "444814009",
7785 * "display": ""
7788 * },
7789 * "subject": {
7790 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7795 * ),
7796 * @OA\Response(
7797 * response="400",
7798 * ref="#/components/responses/badrequest"
7799 * ),
7800 * @OA\Response(
7801 * response="401",
7802 * ref="#/components/responses/unauthorized"
7803 * ),
7804 * @OA\Response(
7805 * response="404",
7806 * ref="#/components/responses/uuidnotfound"
7807 * ),
7808 * security={{"openemr_auth":{}}}
7811 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
7812 if ($request->isPatientRequest()) {
7813 // only allow access to data of binded patient
7814 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7815 } else {
7816 RestConfig::authorization_check("patients", "med");
7817 $return = (new FhirConditionRestController())->getOne($uuid);
7819 RestConfig::apiLog($return);
7820 return $return;
7824 * @OA\Get(
7825 * path="/fhir/Coverage",
7826 * description="Returns a list of Coverage resources.",
7827 * tags={"fhir"},
7828 * @OA\Parameter(
7829 * name="_id",
7830 * in="query",
7831 * description="The uuid for the Coverage resource.",
7832 * required=false,
7833 * @OA\Schema(
7834 * type="string"
7836 * ),
7837 * @OA\Parameter(
7838 * name="patient",
7839 * in="query",
7840 * description="The uuid for the patient.",
7841 * required=false,
7842 * @OA\Schema(
7843 * type="string"
7845 * ),
7846 * @OA\Parameter(
7847 * name="payor",
7848 * in="query",
7849 * description="The payor of the Coverage resource.",
7850 * required=false,
7851 * @OA\Schema(
7852 * type="string"
7854 * ),
7855 * @OA\Response(
7856 * response="200",
7857 * description="Standard Response",
7858 * @OA\MediaType(
7859 * mediaType="application/json",
7860 * @OA\Schema(
7861 * @OA\Property(
7862 * property="json object",
7863 * description="FHIR Json object.",
7864 * type="object"
7865 * ),
7866 * example={
7867 * "meta": {
7868 * "lastUpdated": "2021-09-14T09:13:51"
7869 * },
7870 * "resourceType": "Bundle",
7871 * "type": "collection",
7872 * "total": 0,
7873 * "link": {
7875 * "relation": "self",
7876 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7882 * ),
7883 * @OA\Response(
7884 * response="400",
7885 * ref="#/components/responses/badrequest"
7886 * ),
7887 * @OA\Response(
7888 * response="401",
7889 * ref="#/components/responses/unauthorized"
7890 * ),
7891 * security={{"openemr_auth":{}}}
7894 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
7895 if ($request->isPatientRequest()) {
7896 // only allow access to data of binded patient
7897 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7898 } else {
7899 RestConfig::authorization_check("admin", "super");
7900 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7902 RestConfig::apiLog($return);
7903 return $return;
7907 * @OA\Get(
7908 * path="/fhir/Coverage/{uuid}",
7909 * description="Returns a single Coverage resource.",
7910 * tags={"fhir"},
7911 * @OA\Parameter(
7912 * name="uuid",
7913 * in="path",
7914 * description="The uuid for the Coverage resource.",
7915 * required=true,
7916 * @OA\Schema(
7917 * type="string"
7919 * ),
7920 * @OA\Response(
7921 * response="200",
7922 * description="Standard Response",
7923 * @OA\MediaType(
7924 * mediaType="application/json",
7925 * @OA\Schema(
7926 * @OA\Property(
7927 * property="json object",
7928 * description="FHIR Json object.",
7929 * type="object"
7930 * ),
7931 * example={
7932 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
7933 * "meta": {
7934 * "versionId": "1",
7935 * "lastUpdated": "2022-04-14T07:58:45+00:00"
7936 * },
7937 * "resourceType": "Coverage",
7938 * "status": "active",
7939 * "beneficiary": {
7940 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
7941 * },
7942 * "relationship": {
7943 * "coding": {
7945 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
7946 * "code": ""
7953 * ),
7954 * @OA\Response(
7955 * response="400",
7956 * ref="#/components/responses/badrequest"
7957 * ),
7958 * @OA\Response(
7959 * response="401",
7960 * ref="#/components/responses/unauthorized"
7961 * ),
7962 * @OA\Response(
7963 * response="404",
7964 * ref="#/components/responses/uuidnotfound"
7965 * ),
7966 * security={{"openemr_auth":{}}}
7969 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
7970 if ($request->isPatientRequest()) {
7971 // only allow access to data of binded patient
7972 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
7973 } else {
7974 RestConfig::authorization_check("admin", "super");
7975 $return = (new FhirCoverageRestController())->getOne($uuid);
7977 RestConfig::apiLog($return);
7978 return $return;
7982 * @OA\Get(
7983 * path="/fhir/Device",
7984 * description="Returns a list of Device resources.",
7985 * tags={"fhir"},
7986 * @OA\Parameter(
7987 * name="_id",
7988 * in="query",
7989 * description="The uuid for the Device resource.",
7990 * required=false,
7991 * @OA\Schema(
7992 * type="string"
7994 * ),
7995 * @OA\Parameter(
7996 * name="patient",
7997 * in="query",
7998 * description="The uuid for the patient.",
7999 * required=false,
8000 * @OA\Schema(
8001 * type="string"
8003 * ),
8004 * @OA\Response(
8005 * response="200",
8006 * description="Standard Response",
8007 * @OA\MediaType(
8008 * mediaType="application/json",
8009 * @OA\Schema(
8010 * @OA\Property(
8011 * property="json object",
8012 * description="FHIR Json object.",
8013 * type="object"
8014 * ),
8015 * example={
8016 * "meta": {
8017 * "lastUpdated": "2021-09-14T09:13:51"
8018 * },
8019 * "resourceType": "Bundle",
8020 * "type": "collection",
8021 * "total": 0,
8022 * "link": {
8024 * "relation": "self",
8025 * "url": "https://localhost:9300/apis/default/fhir/Device"
8031 * ),
8032 * @OA\Response(
8033 * response="400",
8034 * ref="#/components/responses/badrequest"
8035 * ),
8036 * @OA\Response(
8037 * response="401",
8038 * ref="#/components/responses/unauthorized"
8039 * ),
8040 * security={{"openemr_auth":{}}}
8043 "GET /fhir/Device" => function (HttpRestRequest $request) {
8044 if ($request->isPatientRequest()) {
8045 // only allow access to data of binded patient
8046 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8047 } else {
8048 RestConfig::authorization_check("admin", "super");
8049 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8051 RestConfig::apiLog($return);
8052 return $return;
8056 * @OA\Get(
8057 * path="/fhir/Device/{uuid}",
8058 * description="Returns a single Device resource.",
8059 * tags={"fhir"},
8060 * @OA\Parameter(
8061 * name="uuid",
8062 * in="path",
8063 * description="The uuid for the Device resource.",
8064 * required=true,
8065 * @OA\Schema(
8066 * type="string"
8068 * ),
8069 * @OA\Response(
8070 * response="200",
8071 * description="Standard Response",
8072 * @OA\MediaType(
8073 * mediaType="application/json",
8074 * @OA\Schema(
8075 * @OA\Property(
8076 * property="json object",
8077 * description="FHIR Json object.",
8078 * type="object"
8079 * ),
8080 * example={
8081 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8082 * "meta": {
8083 * "versionId": "1",
8084 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8085 * },
8086 * "resourceType": "Device",
8087 * "udiCarrier": {
8089 * "deviceIdentifier": "08717648200274",
8090 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8092 * },
8093 * "distinctIdentifier": "A99971312345600",
8094 * "manufactureDate": "2013-02-01",
8095 * "expirationDate": "2014-02-01",
8096 * "lotNumber": "000000000000XYZ123",
8097 * "serialNumber": "000025",
8098 * "type": {
8099 * "extension": {
8101 * "valueCode": "unknown",
8102 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8105 * },
8106 * "patient": {
8107 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8108 * "type": "Patient"
8113 * ),
8114 * @OA\Response(
8115 * response="400",
8116 * ref="#/components/responses/badrequest"
8117 * ),
8118 * @OA\Response(
8119 * response="401",
8120 * ref="#/components/responses/unauthorized"
8121 * ),
8122 * @OA\Response(
8123 * response="404",
8124 * ref="#/components/responses/uuidnotfound"
8125 * ),
8126 * security={{"openemr_auth":{}}}
8129 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8130 if ($request->isPatientRequest()) {
8131 // only allow access to data of binded patient
8132 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8133 } else {
8134 RestConfig::authorization_check("admin", "super");
8135 $return = (new FhirDeviceRestController())->getOne($uuid);
8137 RestConfig::apiLog($return);
8138 return $return;
8142 * @OA\Get(
8143 * path="/fhir/DiagnosticReport",
8144 * description="Returns a list of DiagnosticReport resources.",
8145 * tags={"fhir"},
8146 * @OA\Parameter(
8147 * name="_id",
8148 * in="query",
8149 * description="The uuid for the DiagnosticReport resource.",
8150 * required=false,
8151 * @OA\Schema(
8152 * type="string"
8154 * ),
8155 * @OA\Parameter(
8156 * name="patient",
8157 * in="query",
8158 * description="The uuid for the patient.",
8159 * required=false,
8160 * @OA\Schema(
8161 * type="string"
8163 * ),
8164 * @OA\Parameter(
8165 * name="code",
8166 * in="query",
8167 * description="The code of the DiagnosticReport resource.",
8168 * required=false,
8169 * @OA\Schema(
8170 * type="string"
8172 * ),
8173 * @OA\Parameter(
8174 * name="category",
8175 * in="query",
8176 * description="The category of the DiagnosticReport resource.",
8177 * required=false,
8178 * @OA\Schema(
8179 * type="string"
8181 * ),
8182 * @OA\Parameter(
8183 * name="date",
8184 * in="query",
8185 * description="The datetime of the DiagnosticReport resource.",
8186 * required=false,
8187 * @OA\Schema(
8188 * type="string"
8190 * ),
8191 * @OA\Response(
8192 * response="200",
8193 * description="Standard Response",
8194 * @OA\MediaType(
8195 * mediaType="application/json",
8196 * @OA\Schema(
8197 * @OA\Property(
8198 * property="json object",
8199 * description="FHIR Json object.",
8200 * type="object"
8201 * ),
8202 * example={
8203 * "meta": {
8204 * "lastUpdated": "2021-09-14T09:13:51"
8205 * },
8206 * "resourceType": "Bundle",
8207 * "type": "collection",
8208 * "total": 0,
8209 * "link": {
8211 * "relation": "self",
8212 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8218 * ),
8219 * @OA\Response(
8220 * response="400",
8221 * ref="#/components/responses/badrequest"
8222 * ),
8223 * @OA\Response(
8224 * response="401",
8225 * ref="#/components/responses/unauthorized"
8226 * ),
8227 * security={{"openemr_auth":{}}}
8230 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8231 $getParams = $request->getQueryParams();
8232 if ($request->isPatientRequest()) {
8233 // only allow access to data of binded patient
8234 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8235 } else {
8236 RestConfig::authorization_check("admin", "super");
8237 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8239 RestConfig::apiLog($return);
8240 return $return;
8244 * @OA\Get(
8245 * path="/fhir/DiagnosticReport/{uuid}",
8246 * description="Returns a single DiagnosticReport resource.",
8247 * tags={"fhir"},
8248 * @OA\Parameter(
8249 * name="uuid",
8250 * in="path",
8251 * description="The uuid for the DiagnosticReport resource.",
8252 * required=true,
8253 * @OA\Schema(
8254 * type="string"
8256 * ),
8257 * @OA\Response(
8258 * response="200",
8259 * description="Standard Response",
8260 * @OA\MediaType(
8261 * mediaType="application/json",
8262 * @OA\Schema(
8263 * @OA\Property(
8264 * property="json object",
8265 * description="FHIR Json object.",
8266 * type="object"
8267 * ),
8268 * example={
8269 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8270 * "meta": {
8271 * "versionId": "1",
8272 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8273 * },
8274 * "resourceType": "DiagnosticReport",
8275 * "status": "final",
8276 * "category": {
8278 * "coding": {
8280 * "system": "http://loinc.org",
8281 * "code": "LP7839-6",
8282 * "display": "Pathology"
8286 * },
8287 * "code": {
8288 * "coding": {
8290 * "system": "http://loinc.org",
8291 * "code": "11502-2",
8292 * "display": "Laboratory report"
8295 * },
8296 * "subject": {
8297 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8298 * "type": "Patient"
8299 * },
8300 * "encounter": {
8301 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8302 * "type": "Encounter"
8303 * },
8304 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8305 * "issued": "2015-06-22T00:00:00+00:00",
8306 * "performer": {
8308 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8309 * "type": "Organization"
8311 * },
8312 * "presentedForm": {
8314 * "contentType": "text/plain",
8315 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8321 * ),
8322 * @OA\Response(
8323 * response="400",
8324 * ref="#/components/responses/badrequest"
8325 * ),
8326 * @OA\Response(
8327 * response="401",
8328 * ref="#/components/responses/unauthorized"
8329 * ),
8330 * @OA\Response(
8331 * response="404",
8332 * ref="#/components/responses/uuidnotfound"
8333 * ),
8334 * security={{"openemr_auth":{}}}
8337 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8338 $getParams = $request->getQueryParams();
8339 if ($request->isPatientRequest()) {
8340 // only allow access to data of binded patient
8341 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8342 } else {
8343 RestConfig::authorization_check("admin", "super");
8344 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8346 RestConfig::apiLog($return);
8347 return $return;
8351 * @OA\Get(
8352 * path="/fhir/DocumentReference",
8353 * description="Returns a list of DocumentReference resources.",
8354 * tags={"fhir"},
8355 * @OA\Parameter(
8356 * name="_id",
8357 * in="query",
8358 * description="The uuid for the DocumentReference resource.",
8359 * required=false,
8360 * @OA\Schema(
8361 * type="string"
8363 * ),
8364 * @OA\Parameter(
8365 * name="patient",
8366 * in="query",
8367 * description="The uuid for the patient.",
8368 * required=false,
8369 * @OA\Schema(
8370 * type="string"
8372 * ),
8373 * @OA\Parameter(
8374 * name="type",
8375 * in="query",
8376 * description="The type of the DocumentReference resource.",
8377 * required=false,
8378 * @OA\Schema(
8379 * type="string"
8381 * ),
8382 * @OA\Parameter(
8383 * name="category",
8384 * in="query",
8385 * description="The category of the DocumentReference resource.",
8386 * required=false,
8387 * @OA\Schema(
8388 * type="string"
8390 * ),
8391 * @OA\Parameter(
8392 * name="date",
8393 * in="query",
8394 * description="The datetime of the DocumentReference resource.",
8395 * required=false,
8396 * @OA\Schema(
8397 * type="string"
8399 * ),
8400 * @OA\Response(
8401 * response="200",
8402 * description="Standard Response",
8403 * @OA\MediaType(
8404 * mediaType="application/json",
8405 * @OA\Schema(
8406 * @OA\Property(
8407 * property="json object",
8408 * description="FHIR Json object.",
8409 * type="object"
8410 * ),
8411 * example={
8412 * "meta": {
8413 * "lastUpdated": "2021-09-14T09:13:51"
8414 * },
8415 * "resourceType": "Bundle",
8416 * "type": "collection",
8417 * "total": 0,
8418 * "link": {
8420 * "relation": "self",
8421 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8427 * ),
8428 * @OA\Response(
8429 * response="400",
8430 * ref="#/components/responses/badrequest"
8431 * ),
8432 * @OA\Response(
8433 * response="401",
8434 * ref="#/components/responses/unauthorized"
8435 * ),
8436 * security={{"openemr_auth":{}}}
8439 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8440 $getParams = $request->getQueryParams();
8441 if ($request->isPatientRequest()) {
8442 // only allow access to data of binded patient
8443 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8444 } else {
8445 RestConfig::authorization_check("admin", "super");
8446 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8448 RestConfig::apiLog($return);
8449 return $return;
8453 * @OA\Get(
8454 * path="/fhir/DocumentReference/{uuid}",
8455 * description="Returns a single DocumentReference resource.",
8456 * tags={"fhir"},
8457 * @OA\Parameter(
8458 * name="uuid",
8459 * in="path",
8460 * description="The uuid for the DocumentReference resource.",
8461 * required=true,
8462 * @OA\Schema(
8463 * type="string"
8465 * ),
8466 * @OA\Response(
8467 * response="200",
8468 * description="Standard Response",
8469 * @OA\MediaType(
8470 * mediaType="application/json",
8471 * @OA\Schema(
8472 * @OA\Property(
8473 * property="json object",
8474 * description="FHIR Json object.",
8475 * type="object"
8476 * ),
8477 * example={
8478 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8479 * "meta": {
8480 * "versionId": "1",
8481 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8482 * },
8483 * "resourceType": "DocumentReference",
8484 * "identifier": {
8486 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8488 * },
8489 * "status": "current",
8490 * "type": {
8491 * "coding": {
8493 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8494 * "code": "UNK",
8495 * "display": "unknown"
8498 * },
8499 * "category": {
8501 * "coding": {
8503 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8504 * "code": "openemr-document",
8505 * "display": "OpenEMR Document"
8509 * },
8510 * "subject": {
8511 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8512 * "type": "Patient"
8513 * },
8514 * "date": "2021-09-19T03:15:56+00:00",
8515 * "author": {
8516 * null
8517 * },
8518 * "content": {
8520 * "attachment": {
8521 * "contentType": "image/gif",
8522 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8523 * },
8524 * "format": {
8525 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8526 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8527 * "display": "mimeType Sufficient"
8534 * ),
8535 * @OA\Response(
8536 * response="400",
8537 * ref="#/components/responses/badrequest"
8538 * ),
8539 * @OA\Response(
8540 * response="401",
8541 * ref="#/components/responses/unauthorized"
8542 * ),
8543 * @OA\Response(
8544 * response="404",
8545 * ref="#/components/responses/uuidnotfound"
8546 * ),
8547 * security={{"openemr_auth":{}}}
8550 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
8551 $getParams = $request->getQueryParams();
8552 if ($request->isPatientRequest()) {
8553 // only allow access to data of binded patient
8554 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8555 } else {
8556 RestConfig::authorization_check("admin", "super");
8557 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8559 RestConfig::apiLog($return);
8560 return $return;
8564 * @OA\Get(
8565 * path="/fhir/Document/{id}/Binary",
8566 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
8567 * tags={"fhir"},
8568 * @OA\Parameter(
8569 * name="id",
8570 * in="path",
8571 * description="The id for the Document.",
8572 * required=true,
8573 * @OA\Schema(
8574 * type="string"
8576 * ),
8577 * @OA\Response(
8578 * response="200",
8579 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
8580 * ),
8581 * @OA\Response(
8582 * response="400",
8583 * ref="#/components/responses/badrequest"
8584 * ),
8585 * @OA\Response(
8586 * response="401",
8587 * ref="#/components/responses/unauthorized"
8588 * ),
8589 * security={{"openemr_auth":{}}}
8592 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest $request) {
8593 // currently only allow users with the same permissions as export to take a file out
8594 // this could be relaxed to allow other types of files ie such as patient access etc.
8595 RestConfig::authorization_check("admin", "users");
8597 // Grab the document id
8598 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
8599 $response = $docController->downloadDocument($documentId, $request->getRequestUserId());
8600 return $response;
8604 * @OA\Get(
8605 * path="/fhir/Encounter",
8606 * description="Returns a list of Encounter resources.",
8607 * tags={"fhir"},
8608 * @OA\Parameter(
8609 * name="_id",
8610 * in="query",
8611 * description="The uuid for the Encounter resource.",
8612 * required=false,
8613 * @OA\Schema(
8614 * type="string"
8616 * ),
8617 * @OA\Parameter(
8618 * name="patient",
8619 * in="query",
8620 * description="The uuid for the patient.",
8621 * required=false,
8622 * @OA\Schema(
8623 * type="string"
8625 * ),
8626 * @OA\Parameter(
8627 * name="date",
8628 * in="query",
8629 * description="The datetime of the Encounter resource.",
8630 * required=false,
8631 * @OA\Schema(
8632 * type="string"
8634 * ),
8635 * @OA\Response(
8636 * response="200",
8637 * description="Standard Response",
8638 * @OA\MediaType(
8639 * mediaType="application/json",
8640 * @OA\Schema(
8641 * @OA\Property(
8642 * property="json object",
8643 * description="FHIR Json object.",
8644 * type="object"
8645 * ),
8646 * example={
8647 * "meta": {
8648 * "lastUpdated": "2021-09-14T09:13:51"
8649 * },
8650 * "resourceType": "Bundle",
8651 * "type": "collection",
8652 * "total": 0,
8653 * "link": {
8655 * "relation": "self",
8656 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8662 * ),
8663 * @OA\Response(
8664 * response="400",
8665 * ref="#/components/responses/badrequest"
8666 * ),
8667 * @OA\Response(
8668 * response="401",
8669 * ref="#/components/responses/unauthorized"
8670 * ),
8671 * security={{"openemr_auth":{}}}
8674 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
8675 $getParams = $request->getQueryParams();
8676 if ($request->isPatientRequest()) {
8677 // only allow access to data of binded patient
8678 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8679 } else {
8680 RestConfig::authorization_check("encounters", "auth_a");
8681 $return = (new FhirEncounterRestController())->getAll($getParams);
8683 RestConfig::apiLog($return);
8684 return $return;
8688 * @OA\Get(
8689 * path="/fhir/Encounter/{uuid}",
8690 * description="Returns a single Encounter resource.",
8691 * tags={"fhir"},
8692 * @OA\Parameter(
8693 * name="uuid",
8694 * in="path",
8695 * description="The uuid for the Encounter resource.",
8696 * required=true,
8697 * @OA\Schema(
8698 * type="string"
8700 * ),
8701 * @OA\Response(
8702 * response="200",
8703 * description="Standard Response",
8704 * @OA\MediaType(
8705 * mediaType="application/json",
8706 * @OA\Schema(
8707 * @OA\Property(
8708 * property="json object",
8709 * description="FHIR Json object.",
8710 * type="object"
8711 * ),
8712 * example={
8713 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8714 * "meta": {
8715 * "versionId": "1",
8716 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8717 * },
8718 * "resourceType": "Encounter",
8719 * "identifier": {
8721 * "system": "urn:ietf:rfc:3986",
8722 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8724 * },
8725 * "status": "finished",
8726 * "class": {
8727 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8728 * "code": "AMB",
8729 * "display": "ambulatory"
8730 * },
8731 * "type": {
8733 * "coding": {
8735 * "system": "http://snomed.info/sct",
8736 * "code": "185349003",
8737 * "display": "Encounter for check up (procedure)"
8741 * },
8742 * "subject": {
8743 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8744 * "type": "Patient"
8745 * },
8746 * "participant": {
8748 * "type": {
8750 * "coding": {
8752 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8753 * "code": "PPRF",
8754 * "display": "Primary Performer"
8758 * },
8759 * "period": {
8760 * "start": "2012-08-13T00:00:00+00:00"
8761 * },
8762 * "individual": {
8763 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8764 * "type": "Practitioner"
8767 * },
8768 * "period": {
8769 * "start": "2012-08-13T00:00:00+00:00"
8774 * ),
8775 * @OA\Response(
8776 * response="400",
8777 * ref="#/components/responses/badrequest"
8778 * ),
8779 * @OA\Response(
8780 * response="401",
8781 * ref="#/components/responses/unauthorized"
8782 * ),
8783 * @OA\Response(
8784 * response="404",
8785 * ref="#/components/responses/uuidnotfound"
8786 * ),
8787 * security={{"openemr_auth":{}}}
8790 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
8791 if ($request->isPatientRequest()) {
8792 // only allow access to data of binded patient
8793 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8794 } else {
8795 RestConfig::authorization_check("admin", "super");
8796 $return = (new FhirEncounterRestController())->getOne($uuid);
8798 RestConfig::apiLog($return);
8799 return $return;
8803 * @OA\Get(
8804 * path="/fhir/Goal",
8805 * description="Returns a list of Condition resources.",
8806 * tags={"fhir"},
8807 * @OA\Parameter(
8808 * name="_id",
8809 * in="query",
8810 * description="The uuid for the Goal resource.",
8811 * required=false,
8812 * @OA\Schema(
8813 * type="string"
8815 * ),
8816 * @OA\Parameter(
8817 * name="patient",
8818 * in="query",
8819 * description="The uuid for the patient.",
8820 * required=false,
8821 * @OA\Schema(
8822 * type="string"
8824 * ),
8825 * @OA\Response(
8826 * response="200",
8827 * description="Standard Response",
8828 * @OA\MediaType(
8829 * mediaType="application/json",
8830 * @OA\Schema(
8831 * @OA\Property(
8832 * property="json object",
8833 * description="FHIR Json object.",
8834 * type="object"
8835 * ),
8836 * example={
8837 * "meta": {
8838 * "lastUpdated": "2021-09-14T09:13:51"
8839 * },
8840 * "resourceType": "Bundle",
8841 * "type": "collection",
8842 * "total": 0,
8843 * "link": {
8845 * "relation": "self",
8846 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8852 * ),
8853 * @OA\Response(
8854 * response="400",
8855 * ref="#/components/responses/badrequest"
8856 * ),
8857 * @OA\Response(
8858 * response="401",
8859 * ref="#/components/responses/unauthorized"
8860 * ),
8861 * security={{"openemr_auth":{}}}
8864 "GET /fhir/Goal" => function (HttpRestRequest $request) {
8865 $getParams = $request->getQueryParams();
8866 if ($request->isPatientRequest()) {
8867 // only allow access to data of binded patient
8868 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8869 } else {
8870 RestConfig::authorization_check("admin", "super");
8871 $return = (new FhirGoalRestController())->getAll($getParams);
8873 RestConfig::apiLog($return);
8874 return $return;
8878 * @OA\Get(
8879 * path="/fhir/Goal/{uuid}",
8880 * description="Returns a single Goal resource.",
8881 * tags={"fhir"},
8882 * @OA\Parameter(
8883 * name="uuid",
8884 * in="path",
8885 * description="The uuid for the Goal resource.",
8886 * required=true,
8887 * @OA\Schema(
8888 * type="string"
8890 * ),
8891 * @OA\Response(
8892 * response="200",
8893 * description="Standard Response",
8894 * @OA\MediaType(
8895 * mediaType="application/json",
8896 * @OA\Schema(
8897 * @OA\Property(
8898 * property="json object",
8899 * description="FHIR Json object.",
8900 * type="object"
8901 * ),
8902 * example={
8903 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8904 * "meta": {
8905 * "versionId": "1",
8906 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8907 * },
8908 * "resourceType": "Goal",
8909 * "lifecycleStatus": "active",
8910 * "description": {
8911 * "text": "Eating more vegetables."
8912 * },
8913 * "subject": {
8914 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8915 * "type": "Patient"
8916 * },
8917 * "target": {
8919 * "measure": {
8920 * "extension": {
8922 * "valueCode": "unknown",
8923 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8926 * },
8927 * "detailString": "Eating more vegetables.",
8928 * "dueDate": "2021-09-09"
8934 * ),
8935 * @OA\Response(
8936 * response="400",
8937 * ref="#/components/responses/badrequest"
8938 * ),
8939 * @OA\Response(
8940 * response="401",
8941 * ref="#/components/responses/unauthorized"
8942 * ),
8943 * @OA\Response(
8944 * response="404",
8945 * ref="#/components/responses/uuidnotfound"
8946 * ),
8947 * security={{"openemr_auth":{}}}
8950 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
8951 if ($request->isPatientRequest()) {
8952 // only allow access to data of binded patient
8953 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
8954 } else {
8955 RestConfig::authorization_check("admin", "super");
8956 $return = (new FhirGoalRestController())->getOne($uuid);
8958 RestConfig::apiLog($return);
8959 return $return;
8963 * @OA\Get(
8964 * path="/fhir/Group",
8965 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
8966 * tags={"fhir"},
8967 * @OA\Parameter(
8968 * name="_id",
8969 * in="query",
8970 * description="The uuid for the Group resource.",
8971 * required=false,
8972 * @OA\Schema(
8973 * type="string"
8975 * ),
8976 * @OA\Parameter(
8977 * name="patient",
8978 * in="query",
8979 * description="The uuid for the patient.",
8980 * required=false,
8981 * @OA\Schema(
8982 * type="string"
8984 * ),
8985 * @OA\Response(
8986 * response="200",
8987 * description="Standard Response",
8988 * @OA\MediaType(
8989 * mediaType="application/json",
8990 * @OA\Schema(
8991 * @OA\Property(
8992 * property="json object",
8993 * description="FHIR Json object.",
8994 * type="object"
8995 * ),
8996 * example={
8997 * "meta": {
8998 * "lastUpdated": "2021-09-14T09:13:51"
8999 * },
9000 * "resourceType": "Bundle",
9001 * "type": "collection",
9002 * "total": 0,
9003 * "link": {
9005 * "relation": "self",
9006 * "url": "https://localhost:9300/apis/default/fhir/Group"
9012 * ),
9013 * @OA\Response(
9014 * response="400",
9015 * ref="#/components/responses/badrequest"
9016 * ),
9017 * @OA\Response(
9018 * response="401",
9019 * ref="#/components/responses/unauthorized"
9020 * ),
9021 * security={{"openemr_auth":{}}}
9024 'GET /fhir/Group' => function (HttpRestRequest $request) {
9025 RestConfig::authorization_check("admin", "users");
9026 $getParams = $request->getQueryParams();
9027 if ($request->isPatientRequest()) {
9028 // only allow access to data of binded patient
9029 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9030 } else {
9031 $return = (new FhirGroupRestController())->getAll($getParams);
9033 RestConfig::apiLog($return);
9034 return $return;
9038 * @OA\Get(
9039 * path="/fhir/Group/{uuid}",
9040 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9041 * tags={"fhir"},
9042 * @OA\Parameter(
9043 * name="uuid",
9044 * in="path",
9045 * description="The uuid for the Group resource.",
9046 * required=true,
9047 * @OA\Schema(
9048 * type="string"
9050 * ),
9051 * @OA\Response(
9052 * response="200",
9053 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9054 * ),
9055 * @OA\Response(
9056 * response="400",
9057 * ref="#/components/responses/badrequest"
9058 * ),
9059 * @OA\Response(
9060 * response="401",
9061 * ref="#/components/responses/unauthorized"
9062 * ),
9063 * @OA\Response(
9064 * response="404",
9065 * ref="#/components/responses/uuidnotfound"
9066 * ),
9067 * security={{"openemr_auth":{}}}
9070 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9071 RestConfig::authorization_check("admin", "users");
9072 if ($request->isPatientRequest()) {
9073 // only allow access to data of binded patient
9074 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9075 } else {
9076 $return = (new FhirGroupRestController())->getOne($uuid);
9078 RestConfig::apiLog($return);
9079 return $return;
9083 * @OA\Get(
9084 * path="/fhir/Group/{id}/$export",
9085 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9086 * tags={"fhir"},
9087 * @OA\Response(
9088 * response="200",
9089 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9090 * ),
9091 * @OA\Response(
9092 * response="400",
9093 * ref="#/components/responses/badrequest"
9094 * ),
9095 * @OA\Response(
9096 * response="401",
9097 * ref="#/components/responses/unauthorized"
9098 * ),
9099 * security={{"openemr_auth":{}}}
9102 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9103 RestConfig::authorization_check("admin", "users");
9104 $fhirExportService = new FhirExportRestController($request);
9105 $exportParams = $request->getQueryParams();
9106 $exportParams['groupId'] = $groupId;
9107 $return = $fhirExportService->processExport(
9108 $exportParams,
9109 'Group',
9110 $request->getHeader('Accept'),
9111 $request->getHeader('Prefer')
9113 RestConfig::apiLog($return);
9114 return $return;
9118 * @OA\Get(
9119 * path="/fhir/Immunization",
9120 * description="Returns a list of Immunization resources.",
9121 * tags={"fhir"},
9122 * @OA\Parameter(
9123 * name="_id",
9124 * in="query",
9125 * description="The uuid for the Immunization resource.",
9126 * required=false,
9127 * @OA\Schema(
9128 * type="string"
9130 * ),
9131 * @OA\Parameter(
9132 * name="patient",
9133 * in="query",
9134 * description="The uuid for the patient.",
9135 * required=false,
9136 * @OA\Schema(
9137 * type="string"
9139 * ),
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/Immunization"
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/Immunization" => function (HttpRestRequest $request) {
9180 $getParams = $request->getQueryParams();
9181 if ($request->isPatientRequest()) {
9182 // only allow access to data of binded patient
9183 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9184 } else {
9185 RestConfig::authorization_check("patients", "med");
9186 $return = (new FhirImmunizationRestController())->getAll($getParams);
9188 RestConfig::apiLog($return);
9189 return $return;
9193 * @OA\Get(
9194 * path="/fhir/Immunization/{uuid}",
9195 * description="Returns a single Immunization resource.",
9196 * tags={"fhir"},
9197 * @OA\Parameter(
9198 * name="uuid",
9199 * in="path",
9200 * description="The uuid for the Immunization resource.",
9201 * required=true,
9202 * @OA\Schema(
9203 * type="string"
9205 * ),
9206 * @OA\Response(
9207 * response="200",
9208 * description="Standard Response",
9209 * @OA\MediaType(
9210 * mediaType="application/json",
9211 * @OA\Schema(
9212 * @OA\Property(
9213 * property="json object",
9214 * description="FHIR Json object.",
9215 * type="object"
9216 * ),
9217 * example={
9218 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9219 * "meta": {
9220 * "versionId": "1",
9221 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9222 * },
9223 * "resourceType": "Immunization",
9224 * "status": "completed",
9225 * "vaccineCode": {
9226 * "coding": {
9228 * "system": "http://hl7.org/fhir/sid/cvx",
9229 * "code": "207",
9230 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9233 * },
9234 * "patient": {
9235 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9236 * },
9237 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9238 * "recorded": "2022-03-26T05:42:26+00:00",
9239 * "primarySource": false
9243 * ),
9244 * @OA\Response(
9245 * response="400",
9246 * ref="#/components/responses/badrequest"
9247 * ),
9248 * @OA\Response(
9249 * response="401",
9250 * ref="#/components/responses/unauthorized"
9251 * ),
9252 * @OA\Response(
9253 * response="404",
9254 * ref="#/components/responses/uuidnotfound"
9255 * ),
9256 * security={{"openemr_auth":{}}}
9259 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9260 if ($request->isPatientRequest()) {
9261 // only allow access to data of binded patient
9262 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9263 } else {
9264 RestConfig::authorization_check("patients", "med");
9265 $return = (new FhirImmunizationRestController())->getOne($uuid);
9267 RestConfig::apiLog($return);
9268 return $return;
9272 * @OA\Get(
9273 * path="/fhir/Location",
9274 * description="Returns a list of Location resources.",
9275 * tags={"fhir"},
9276 * @OA\Parameter(
9277 * name="_id",
9278 * in="query",
9279 * description="The uuid for the Location resource.",
9280 * required=false,
9281 * @OA\Schema(
9282 * type="string"
9284 * ),
9285 * @OA\Response(
9286 * response="200",
9287 * description="Standard Response",
9288 * @OA\MediaType(
9289 * mediaType="application/json",
9290 * @OA\Schema(
9291 * @OA\Property(
9292 * property="json object",
9293 * description="FHIR Json object.",
9294 * type="object"
9295 * ),
9296 * example={
9297 * "meta": {
9298 * "lastUpdated": "2021-09-14T09:13:51"
9299 * },
9300 * "resourceType": "Bundle",
9301 * "type": "collection",
9302 * "total": 0,
9303 * "link": {
9305 * "relation": "self",
9306 * "url": "https://localhost:9300/apis/default/fhir/Location"
9312 * ),
9313 * @OA\Response(
9314 * response="400",
9315 * ref="#/components/responses/badrequest"
9316 * ),
9317 * @OA\Response(
9318 * response="401",
9319 * ref="#/components/responses/unauthorized"
9320 * ),
9321 * security={{"openemr_auth":{}}}
9324 "GET /fhir/Location" => function (HttpRestRequest $request) {
9325 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9326 RestConfig::apiLog($return);
9327 return $return;
9331 * @OA\Get(
9332 * path="/fhir/Location/{uuid}",
9333 * description="Returns a single Location resource.",
9334 * tags={"fhir"},
9335 * @OA\Parameter(
9336 * name="uuid",
9337 * in="path",
9338 * description="The uuid for the Location resource.",
9339 * required=true,
9340 * @OA\Schema(
9341 * type="string"
9343 * ),
9344 * @OA\Response(
9345 * response="200",
9346 * description="Standard Response",
9347 * @OA\MediaType(
9348 * mediaType="application/json",
9349 * @OA\Schema(
9350 * @OA\Property(
9351 * property="json object",
9352 * description="FHIR Json object.",
9353 * type="object"
9354 * ),
9355 * example={
9356 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9357 * "meta": {
9358 * "versionId": "1",
9359 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9360 * },
9361 * "resourceType": "Location",
9362 * "status": "active",
9363 * "name": "Your Clinic Name Here",
9364 * "telecom": {
9366 * "system": "phone",
9367 * "value": "000-000-0000"
9368 * },
9370 * "system": "fax",
9371 * "value": "000-000-0000"
9377 * ),
9378 * @OA\Response(
9379 * response="400",
9380 * ref="#/components/responses/badrequest"
9381 * ),
9382 * @OA\Response(
9383 * response="401",
9384 * ref="#/components/responses/unauthorized"
9385 * ),
9386 * @OA\Response(
9387 * response="404",
9388 * ref="#/components/responses/uuidnotfound"
9389 * ),
9390 * security={{"openemr_auth":{}}}
9393 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9394 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9395 RestConfig::apiLog($return);
9396 return $return;
9400 * @OA\Get(
9401 * path="/fhir/Medication",
9402 * description="Returns a list of Medication resources.",
9403 * tags={"fhir"},
9404 * @OA\Response(
9405 * response="200",
9406 * description="Standard Response",
9407 * @OA\MediaType(
9408 * mediaType="application/json",
9409 * @OA\Schema(
9410 * @OA\Property(
9411 * property="json object",
9412 * description="FHIR Json object.",
9413 * type="object"
9414 * ),
9415 * example={
9416 * "meta": {
9417 * "lastUpdated": "2021-09-14T09:13:51"
9418 * },
9419 * "resourceType": "Bundle",
9420 * "type": "collection",
9421 * "total": 0,
9422 * "link": {
9424 * "relation": "self",
9425 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9431 * ),
9432 * @OA\Response(
9433 * response="400",
9434 * ref="#/components/responses/badrequest"
9435 * ),
9436 * @OA\Response(
9437 * response="401",
9438 * ref="#/components/responses/unauthorized"
9439 * ),
9440 * security={{"openemr_auth":{}}}
9443 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9444 RestConfig::authorization_check("patients", "med");
9445 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9446 RestConfig::apiLog($return);
9447 return $return;
9451 * @OA\Get(
9452 * path="/fhir/Medication/{uuid}",
9453 * description="Returns a single Medication resource.",
9454 * tags={"fhir"},
9455 * @OA\Parameter(
9456 * name="uuid",
9457 * in="path",
9458 * description="The uuid for the Medication resource.",
9459 * required=true,
9460 * @OA\Schema(
9461 * type="string"
9463 * ),
9464 * @OA\Response(
9465 * response="200",
9466 * description="Standard Response",
9467 * @OA\MediaType(
9468 * mediaType="application/json",
9469 * @OA\Schema(
9470 * @OA\Property(
9471 * property="json object",
9472 * description="FHIR Json object.",
9473 * type="object"
9474 * ),
9475 * example={
9476 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
9477 * "meta": {
9478 * "versionId": "1",
9479 * "lastUpdated": "2022-04-19T23:42:14+00:00"
9480 * },
9481 * "resourceType": "Medication",
9482 * "code": {
9483 * "coding": {
9485 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9486 * "code": 153165
9489 * },
9490 * "status": "active",
9491 * "batch": {
9492 * "lotNumber": "132",
9493 * "expirationDate": "0000-00-00"
9498 * ),
9499 * @OA\Response(
9500 * response="400",
9501 * ref="#/components/responses/badrequest"
9502 * ),
9503 * @OA\Response(
9504 * response="401",
9505 * ref="#/components/responses/unauthorized"
9506 * ),
9507 * @OA\Response(
9508 * response="404",
9509 * ref="#/components/responses/uuidnotfound"
9510 * ),
9511 * security={{"openemr_auth":{}}}
9514 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
9515 if ($request->isPatientRequest()) {
9516 // only allow access to data of binded patient
9517 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
9518 } else {
9519 RestConfig::authorization_check("patients", "med");
9520 $return = (new FhirMedicationRestController())->getOne($uuid);
9522 RestConfig::apiLog($return);
9523 return $return;
9527 * @OA\Get(
9528 * path="/fhir/MedicationRequest",
9529 * description="Returns a list of MedicationRequest resources.",
9530 * tags={"fhir"},
9531 * @OA\Parameter(
9532 * name="_id",
9533 * in="query",
9534 * description="The uuid for the MedicationRequest resource.",
9535 * required=false,
9536 * @OA\Schema(
9537 * type="string"
9539 * ),
9540 * @OA\Parameter(
9541 * name="patient",
9542 * in="query",
9543 * description="The uuid for the patient.",
9544 * required=false,
9545 * @OA\Schema(
9546 * type="string"
9548 * ),
9549 * @OA\Parameter(
9550 * name="intent",
9551 * in="query",
9552 * description="The intent of the MedicationRequest resource.",
9553 * required=false,
9554 * @OA\Schema(
9555 * type="string"
9557 * ),
9558 * @OA\Parameter(
9559 * name="status",
9560 * in="query",
9561 * description="The status of the MedicationRequest resource.",
9562 * required=false,
9563 * @OA\Schema(
9564 * type="string"
9566 * ),
9567 * @OA\Response(
9568 * response="200",
9569 * description="Standard Response",
9570 * @OA\MediaType(
9571 * mediaType="application/json",
9572 * @OA\Schema(
9573 * @OA\Property(
9574 * property="json object",
9575 * description="FHIR Json object.",
9576 * type="object"
9577 * ),
9578 * example={
9579 * "meta": {
9580 * "lastUpdated": "2021-09-14T09:13:51"
9581 * },
9582 * "resourceType": "Bundle",
9583 * "type": "collection",
9584 * "total": 0,
9585 * "link": {
9587 * "relation": "self",
9588 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9594 * ),
9595 * @OA\Response(
9596 * response="400",
9597 * ref="#/components/responses/badrequest"
9598 * ),
9599 * @OA\Response(
9600 * response="401",
9601 * ref="#/components/responses/unauthorized"
9602 * ),
9603 * security={{"openemr_auth":{}}}
9606 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
9607 $getParams = $request->getQueryParams();
9608 if ($request->isPatientRequest()) {
9609 // only allow access to data of binded patient
9610 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9611 } else {
9612 RestConfig::authorization_check("patients", "med");
9613 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9615 RestConfig::apiLog($return);
9616 return $return;
9620 * @OA\Get(
9621 * path="/fhir/MedicationRequest/{uuid}",
9622 * description="Returns a single MedicationRequest resource.",
9623 * tags={"fhir"},
9624 * @OA\Parameter(
9625 * name="uuid",
9626 * in="path",
9627 * description="The uuid for the MedicationRequest resource.",
9628 * required=true,
9629 * @OA\Schema(
9630 * type="string"
9632 * ),
9633 * @OA\Response(
9634 * response="200",
9635 * description="Standard Response",
9636 * @OA\MediaType(
9637 * mediaType="application/json",
9638 * @OA\Schema(
9639 * @OA\Property(
9640 * property="json object",
9641 * description="FHIR Json object.",
9642 * type="object"
9643 * ),
9644 * example={
9645 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9646 * "meta": {
9647 * "versionId": "1",
9648 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9649 * },
9650 * "resourceType": "MedicationRequest",
9651 * "status": "active",
9652 * "intent": "order",
9653 * "category": {
9655 * "coding": {
9657 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9658 * "code": "community",
9659 * "display": "Home/Community"
9663 * },
9664 * "reportedBoolean": false,
9665 * "medicationCodeableConcept": {
9666 * "coding": {
9668 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9669 * "code": "1738139",
9670 * "display": "Acetaminophen 325 MG Oral Tablet"
9673 * },
9674 * "subject": {
9675 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9676 * "type": "Patient"
9677 * },
9678 * "authoredOn": "2021-09-18T00:00:00+00:00",
9679 * "requester": {
9680 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9681 * "type": "Practitioner"
9686 * ),
9687 * @OA\Response(
9688 * response="400",
9689 * ref="#/components/responses/badrequest"
9690 * ),
9691 * @OA\Response(
9692 * response="401",
9693 * ref="#/components/responses/unauthorized"
9694 * ),
9695 * @OA\Response(
9696 * response="404",
9697 * ref="#/components/responses/uuidnotfound"
9698 * ),
9699 * security={{"openemr_auth":{}}}
9702 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
9703 if ($request->isPatientRequest()) {
9704 // only allow access to data of binded patient
9705 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9706 } else {
9707 RestConfig::authorization_check("patients", "med");
9708 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9710 RestConfig::apiLog($return);
9711 return $return;
9715 * @OA\Get(
9716 * path="/fhir/Observation",
9717 * description="Returns a list of Observation resources.",
9718 * tags={"fhir"},
9719 * @OA\Parameter(
9720 * name="_id",
9721 * in="query",
9722 * description="The uuid for the Observation resource.",
9723 * required=false,
9724 * @OA\Schema(
9725 * type="string"
9727 * ),
9728 * @OA\Parameter(
9729 * name="patient",
9730 * in="query",
9731 * description="The uuid for the patient.",
9732 * required=false,
9733 * @OA\Schema(
9734 * type="string"
9736 * ),
9737 * @OA\Parameter(
9738 * name="code",
9739 * in="query",
9740 * description="The code of the Observation resource.",
9741 * required=false,
9742 * @OA\Schema(
9743 * type="string"
9745 * ),
9746 * @OA\Parameter(
9747 * name="category",
9748 * in="query",
9749 * description="The category of the Observation resource.",
9750 * required=false,
9751 * @OA\Schema(
9752 * type="string"
9754 * ),
9755 * @OA\Parameter(
9756 * name="date",
9757 * in="query",
9758 * description="The datetime of the Observation resource.",
9759 * required=false,
9760 * @OA\Schema(
9761 * type="string"
9763 * ),
9764 * @OA\Response(
9765 * response="200",
9766 * description="Standard Response",
9767 * @OA\MediaType(
9768 * mediaType="application/json",
9769 * @OA\Schema(
9770 * @OA\Property(
9771 * property="json object",
9772 * description="FHIR Json object.",
9773 * type="object"
9774 * ),
9775 * example={
9776 * "meta": {
9777 * "lastUpdated": "2021-09-14T09:13:51"
9778 * },
9779 * "resourceType": "Bundle",
9780 * "type": "collection",
9781 * "total": 0,
9782 * "link": {
9784 * "relation": "self",
9785 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9791 * ),
9792 * @OA\Response(
9793 * response="400",
9794 * ref="#/components/responses/badrequest"
9795 * ),
9796 * @OA\Response(
9797 * response="401",
9798 * ref="#/components/responses/unauthorized"
9799 * ),
9800 * security={{"openemr_auth":{}}}
9803 "GET /fhir/Observation" => function (HttpRestRequest $request) {
9804 $getParams = $request->getQueryParams();
9805 if ($request->isPatientRequest()) {
9806 // only allow access to data of binded patient
9807 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9808 } else {
9809 RestConfig::authorization_check("patients", "med");
9810 $return = (new FhirObservationRestController())->getAll($getParams);
9812 RestConfig::apiLog($return);
9813 return $return;
9817 * @OA\Get(
9818 * path="/fhir/Observation/{uuid}",
9819 * description="Returns a single Observation resource.",
9820 * tags={"fhir"},
9821 * @OA\Parameter(
9822 * name="uuid",
9823 * in="path",
9824 * description="The uuid for the Observation resource.",
9825 * required=true,
9826 * @OA\Schema(
9827 * type="string"
9829 * ),
9830 * @OA\Response(
9831 * response="200",
9832 * description="Standard Response",
9833 * @OA\MediaType(
9834 * mediaType="application/json",
9835 * @OA\Schema(
9836 * @OA\Property(
9837 * property="json object",
9838 * description="FHIR Json object.",
9839 * type="object"
9840 * ),
9841 * example={
9842 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9843 * "meta": {
9844 * "versionId": "1",
9845 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9846 * },
9847 * "resourceType": "Observation",
9848 * "status": "final",
9849 * "category": {
9851 * "coding": {
9853 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9854 * "code": "vital-signs"
9858 * },
9859 * "code": {
9860 * "coding": {
9862 * "system": "http://loinc.org",
9863 * "code": "85354-9",
9864 * "display": "Blood pressure systolic and diastolic"
9867 * },
9868 * "subject": {
9869 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9870 * "type": "Patient"
9871 * },
9872 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9873 * "component": {
9875 * "code": {
9876 * "coding": {
9878 * "system": "http://loinc.org",
9879 * "code": "8480-6",
9880 * "display": "Systolic blood pressure"
9883 * },
9884 * "valueQuantity": {
9885 * "value": 122,
9886 * "unit": "mm[Hg]",
9887 * "system": "http://unitsofmeasure.org",
9888 * "code": "mm[Hg]"
9890 * },
9892 * "code": {
9893 * "coding": {
9895 * "system": "http://loinc.org",
9896 * "code": "8462-4",
9897 * "display": "Diastolic blood pressure"
9900 * },
9901 * "valueQuantity": {
9902 * "value": 77,
9903 * "unit": "mm[Hg]",
9904 * "system": "http://unitsofmeasure.org",
9905 * "code": "mm[Hg]"
9912 * ),
9913 * @OA\Response(
9914 * response="400",
9915 * ref="#/components/responses/badrequest"
9916 * ),
9917 * @OA\Response(
9918 * response="401",
9919 * ref="#/components/responses/unauthorized"
9920 * ),
9921 * @OA\Response(
9922 * response="404",
9923 * ref="#/components/responses/uuidnotfound"
9924 * ),
9925 * security={{"openemr_auth":{}}}
9928 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
9929 if ($request->isPatientRequest()) {
9930 // only allow access to data of binded patient
9931 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
9932 } else {
9933 RestConfig::authorization_check("patients", "med");
9934 $return = (new FhirObservationRestController())->getOne($uuid);
9936 RestConfig::apiLog($return);
9937 return $return;
9941 * @OA\Get(
9942 * path="/fhir/Organization",
9943 * description="Returns a list of Organization resources.",
9944 * tags={"fhir"},
9945 * @OA\Parameter(
9946 * name="_id",
9947 * in="query",
9948 * description="The uuid for the Organization resource.",
9949 * required=false,
9950 * @OA\Schema(
9951 * type="string"
9953 * ),
9954 * @OA\Parameter(
9955 * name="name",
9956 * in="query",
9957 * description="The name of the Organization resource.",
9958 * required=false,
9959 * @OA\Schema(
9960 * type="string"
9962 * ),
9963 * @OA\Parameter(
9964 * name="email",
9965 * in="query",
9966 * description="The email of the Organization resource.",
9967 * required=false,
9968 * @OA\Schema(
9969 * type="string"
9971 * ),
9972 * @OA\Parameter(
9973 * name="phone",
9974 * in="query",
9975 * description="The phone of the Organization resource.",
9976 * required=false,
9977 * @OA\Schema(
9978 * type="string"
9980 * ),
9981 * @OA\Parameter(
9982 * name="telecom",
9983 * in="query",
9984 * description="The telecom of the Organization resource.",
9985 * required=false,
9986 * @OA\Schema(
9987 * type="string"
9989 * ),
9990 * @OA\Parameter(
9991 * name="address",
9992 * in="query",
9993 * description="The address of the Organization resource.",
9994 * required=false,
9995 * @OA\Schema(
9996 * type="string"
9998 * ),
9999 * @OA\Parameter(
10000 * name="address-city",
10001 * in="query",
10002 * description="The address-city of the Organization resource.",
10003 * required=false,
10004 * @OA\Schema(
10005 * type="string"
10007 * ),
10008 * @OA\Parameter(
10009 * name="address-postalcode",
10010 * in="query",
10011 * description="The address-postalcode of the Organization resource.",
10012 * required=false,
10013 * @OA\Schema(
10014 * type="string"
10016 * ),
10017 * @OA\Parameter(
10018 * name="address-state",
10019 * in="query",
10020 * description="The address-state of the Organization resource.",
10021 * required=false,
10022 * @OA\Schema(
10023 * type="string"
10025 * ),
10026 * @OA\Response(
10027 * response="200",
10028 * description="Standard Response",
10029 * @OA\MediaType(
10030 * mediaType="application/json",
10031 * @OA\Schema(
10032 * @OA\Property(
10033 * property="json object",
10034 * description="FHIR Json object.",
10035 * type="object"
10036 * ),
10037 * example={
10038 * "meta": {
10039 * "lastUpdated": "2021-09-14T09:13:51"
10040 * },
10041 * "resourceType": "Bundle",
10042 * "type": "collection",
10043 * "total": 0,
10044 * "link": {
10046 * "relation": "self",
10047 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10053 * ),
10054 * @OA\Response(
10055 * response="400",
10056 * ref="#/components/responses/badrequest"
10057 * ),
10058 * @OA\Response(
10059 * response="401",
10060 * ref="#/components/responses/unauthorized"
10061 * ),
10062 * security={{"openemr_auth":{}}}
10065 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10066 if (!$request->isPatientRequest()) {
10067 RestConfig::authorization_check("admin", "users");
10069 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10070 RestConfig::apiLog($return);
10071 return $return;
10075 * @OA\Get(
10076 * path="/fhir/Organization/{uuid}",
10077 * description="Returns a single Organization resource.",
10078 * tags={"fhir"},
10079 * @OA\Parameter(
10080 * name="uuid",
10081 * in="path",
10082 * description="The uuid for the Organization resource.",
10083 * required=true,
10084 * @OA\Schema(
10085 * type="string"
10087 * ),
10088 * @OA\Response(
10089 * response="200",
10090 * description="Standard Response",
10091 * @OA\MediaType(
10092 * mediaType="application/json",
10093 * @OA\Schema(
10094 * @OA\Property(
10095 * property="json object",
10096 * description="FHIR Json object.",
10097 * type="object"
10098 * ),
10099 * example={
10100 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10101 * "meta": {
10102 * "versionId": "1",
10103 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10104 * },
10105 * "resourceType": "Organization",
10106 * "text": {
10107 * "status": "generated",
10108 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10109 * },
10110 * "identifier": {
10112 * "system": "http://hl7.org/fhir/sid/us-npi",
10113 * "value": "1234567890"
10115 * },
10116 * "active": true,
10117 * "type": {
10119 * "coding": {
10121 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10122 * "code": "prov",
10123 * "display": "Healthcare Provider"
10127 * },
10128 * "name": "Your Clinic Name Here",
10129 * "telecom": {
10131 * "system": "phone",
10132 * "value": "000-000-0000",
10133 * "use": "work"
10134 * },
10136 * "system": "fax",
10137 * "value": "000-000-0000",
10138 * "use": "work"
10140 * },
10141 * "address": {
10142 * null
10147 * ),
10148 * @OA\Response(
10149 * response="400",
10150 * ref="#/components/responses/badrequest"
10151 * ),
10152 * @OA\Response(
10153 * response="401",
10154 * ref="#/components/responses/unauthorized"
10155 * ),
10156 * @OA\Response(
10157 * response="404",
10158 * ref="#/components/responses/uuidnotfound"
10159 * ),
10160 * security={{"openemr_auth":{}}}
10163 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10164 $patientUUID = null;
10165 if (!$request->isPatientRequest()) {
10166 RestConfig::authorization_check("admin", "users");
10167 } else {
10168 $patientUUID = $request->getPatientUUIDString();
10170 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10172 RestConfig::apiLog($return);
10173 return $return;
10177 * @OA\Post(
10178 * path="/fhir/Organization",
10179 * description="Adds a Organization resource.",
10180 * tags={"fhir"},
10181 * @OA\RequestBody(
10182 * required=true,
10183 * @OA\MediaType(
10184 * mediaType="application/json",
10185 * @OA\Schema(
10186 * description="The json object for the Organization resource.",
10187 * type="object"
10188 * ),
10189 * example={
10190 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10191 * "meta": {
10192 * "versionId": "1",
10193 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10194 * },
10195 * "resourceType": "Organization",
10196 * "text": {
10197 * "status": "generated",
10198 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10199 * },
10200 * "identifier": {
10202 * "system": "http://hl7.org/fhir/sid/us-npi",
10203 * "value": "1234567890"
10205 * },
10206 * "active": true,
10207 * "type": {
10209 * "coding": {
10211 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10212 * "code": "prov",
10213 * "display": "Healthcare Provider"
10217 * },
10218 * "name": "Your Clinic Name Here Hey",
10219 * "telecom": {
10221 * "system": "phone",
10222 * "value": "000-000-0000",
10223 * "use": "work"
10224 * },
10226 * "system": "fax",
10227 * "value": "000-000-0000",
10228 * "use": "work"
10230 * },
10231 * "address": {
10232 * null
10236 * ),
10237 * @OA\Response(
10238 * response="200",
10239 * description="Standard Response",
10240 * @OA\MediaType(
10241 * mediaType="application/json",
10242 * @OA\Schema(
10243 * @OA\Property(
10244 * property="json object",
10245 * description="FHIR Json object.",
10246 * type="object"
10247 * ),
10248 * example={
10249 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10250 * "meta": {
10251 * "versionId": "1",
10252 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10253 * },
10254 * "resourceType": "Organization",
10255 * "text": {
10256 * "status": "generated",
10257 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10258 * },
10259 * "identifier": {
10261 * "system": "http://hl7.org/fhir/sid/us-npi",
10262 * "value": "1234567890"
10264 * },
10265 * "active": true,
10266 * "type": {
10268 * "coding": {
10270 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10271 * "code": "prov",
10272 * "display": "Healthcare Provider"
10276 * },
10277 * "name": "Your Clinic Name Here Now",
10278 * "telecom": {
10280 * "system": "phone",
10281 * "value": "000-000-0000",
10282 * "use": "work"
10283 * },
10285 * "system": "fax",
10286 * "value": "000-000-0000",
10287 * "use": "work"
10289 * },
10290 * "address": {
10291 * null
10296 * ),
10297 * @OA\Response(
10298 * response="400",
10299 * ref="#/components/responses/badrequest"
10300 * ),
10301 * @OA\Response(
10302 * response="401",
10303 * ref="#/components/responses/unauthorized"
10304 * ),
10305 * security={{"openemr_auth":{}}}
10308 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10309 RestConfig::authorization_check("admin", "super");
10310 $data = (array) (json_decode(file_get_contents("php://input"), true));
10311 $return = (new FhirOrganizationRestController())->post($data);
10312 RestConfig::apiLog($return, $data);
10313 return $return;
10317 * @OA\Put(
10318 * path="/fhir/Organization/{uuid}",
10319 * description="Modifies a Organization resource.",
10320 * tags={"fhir"},
10321 * @OA\Parameter(
10322 * name="uuid",
10323 * in="path",
10324 * description="The uuid for the organization.",
10325 * required=true,
10326 * @OA\Schema(
10327 * type="string"
10329 * ),
10330 * @OA\RequestBody(
10331 * required=true,
10332 * @OA\MediaType(
10333 * mediaType="application/json",
10334 * @OA\Schema(
10335 * description="The json object for the Organization resource.",
10336 * type="object"
10337 * ),
10338 * example={
10339 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10340 * "meta": {
10341 * "versionId": "1",
10342 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10343 * },
10344 * "resourceType": "Organization",
10345 * "text": {
10346 * "status": "generated",
10347 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10348 * },
10349 * "identifier": {
10351 * "system": "http://hl7.org/fhir/sid/us-npi",
10352 * "value": "1234567890"
10354 * },
10355 * "active": true,
10356 * "type": {
10358 * "coding": {
10360 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10361 * "code": "prov",
10362 * "display": "Healthcare Provider"
10366 * },
10367 * "name": "Your Clinic Name Here",
10368 * "telecom": {
10370 * "system": "phone",
10371 * "value": "000-000-0000",
10372 * "use": "work"
10373 * },
10375 * "system": "fax",
10376 * "value": "000-000-0000",
10377 * "use": "work"
10379 * },
10380 * "address": {
10381 * null
10385 * ),
10386 * @OA\Response(
10387 * response="201",
10388 * description="Standard Response",
10389 * @OA\MediaType(
10390 * mediaType="application/json",
10391 * @OA\Schema(
10392 * example={
10393 * "id": 14,
10394 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
10398 * ),
10399 * @OA\Response(
10400 * response="400",
10401 * ref="#/components/responses/badrequest"
10402 * ),
10403 * @OA\Response(
10404 * response="401",
10405 * ref="#/components/responses/unauthorized"
10406 * ),
10407 * security={{"openemr_auth":{}}}
10410 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10411 RestConfig::authorization_check("admin", "super");
10412 $data = (array) (json_decode(file_get_contents("php://input"), true));
10413 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
10414 RestConfig::apiLog($return, $data);
10415 return $return;
10419 * @OA\Post(
10420 * path="/fhir/Patient",
10421 * description="Adds a Patient resource.",
10422 * tags={"fhir"},
10423 * @OA\RequestBody(
10424 * required=true,
10425 * @OA\MediaType(
10426 * mediaType="application/json",
10427 * @OA\Schema(
10428 * description="The json object for the Patient resource.",
10429 * type="object"
10430 * ),
10431 * example={
10432 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10433 * "meta": {
10434 * "versionId": "1",
10435 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10436 * },
10437 * "resourceType": "Patient",
10438 * "text": {
10439 * "status": "generated",
10440 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10441 * },
10442 * "extension": {
10444 * "valueCode": "F",
10445 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10446 * },
10448 * "extension": {
10450 * "valueCoding": {
10451 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10452 * "code": "UNK",
10453 * "display": "Unknown"
10454 * },
10455 * "url": "ombCategory"
10456 * },
10458 * "valueString": "Unknown",
10459 * "url": "text"
10461 * },
10462 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10464 * },
10465 * "identifier": {
10467 * "use": "official",
10468 * "type": {
10469 * "coding": {
10471 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10472 * "code": "PT"
10475 * },
10476 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10477 * "value": "1"
10479 * },
10480 * "active": true,
10481 * "name": {
10483 * "use": "official",
10484 * "family": "Smith",
10485 * "given": {
10486 * "Brenda"
10489 * },
10490 * "gender": "female",
10491 * "birthDate": "2017-03-10",
10492 * "communication": {
10494 * "language": {
10495 * "coding": {
10497 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10498 * "code": "unknown",
10499 * "display": "Unknown"
10507 * ),
10508 * @OA\Response(
10509 * response="200",
10510 * description="Standard Response",
10511 * @OA\MediaType(
10512 * mediaType="application/json",
10513 * @OA\Schema(
10514 * @OA\Property(
10515 * property="json object",
10516 * description="FHIR Json object.",
10517 * type="object"
10518 * ),
10519 * example={
10520 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10521 * "meta": {
10522 * "versionId": "1",
10523 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10524 * },
10525 * "resourceType": "Patient",
10526 * "text": {
10527 * "status": "generated",
10528 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10529 * },
10530 * "extension": {
10532 * "valueCode": "F",
10533 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10534 * },
10536 * "extension": {
10538 * "valueCoding": {
10539 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10540 * "code": "UNK",
10541 * "display": "Unknown"
10542 * },
10543 * "url": "ombCategory"
10544 * },
10546 * "valueString": "Unknown",
10547 * "url": "text"
10549 * },
10550 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10552 * },
10553 * "identifier": {
10555 * "use": "official",
10556 * "type": {
10557 * "coding": {
10559 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10560 * "code": "PT"
10563 * },
10564 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10565 * "value": "1"
10567 * },
10568 * "active": true,
10569 * "name": {
10571 * "use": "official",
10572 * "family": "Smith",
10573 * "given": {
10574 * "Brenda"
10577 * },
10578 * "gender": "female",
10579 * "birthDate": "2017-03-10",
10580 * "communication": {
10582 * "language": {
10583 * "coding": {
10585 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10586 * "code": "unknown",
10587 * "display": "Unknown"
10596 * ),
10597 * @OA\Response(
10598 * response="400",
10599 * ref="#/components/responses/badrequest"
10600 * ),
10601 * @OA\Response(
10602 * response="401",
10603 * ref="#/components/responses/unauthorized"
10604 * ),
10605 * security={{"openemr_auth":{}}}
10608 "POST /fhir/Patient" => function (HttpRestRequest $request) {
10609 RestConfig::authorization_check("patients", "demo");
10610 $data = (array) (json_decode(file_get_contents("php://input"), true));
10611 $return = (new FhirPatientRestController())->post($data);
10612 RestConfig::apiLog($return, $data);
10613 return $return;
10617 * @OA\Put(
10618 * path="/fhir/Patient/{uuid}",
10619 * description="Modifies a Patient resource.",
10620 * tags={"fhir"},
10621 * @OA\Parameter(
10622 * name="uuid",
10623 * in="path",
10624 * description="The uuid for the Patient resource.",
10625 * required=true,
10626 * @OA\Schema(
10627 * type="string"
10629 * ),
10630 * @OA\RequestBody(
10631 * required=true,
10632 * @OA\MediaType(
10633 * mediaType="application/json",
10634 * @OA\Schema(
10635 * description="The json object for the Patient resource.",
10636 * type="object"
10637 * ),
10638 * example={
10639 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10640 * "meta": {
10641 * "versionId": "1",
10642 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10643 * },
10644 * "resourceType": "Patient",
10645 * "text": {
10646 * "status": "generated",
10647 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10648 * },
10649 * "extension": {
10651 * "valueCode": "F",
10652 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10653 * },
10655 * "extension": {
10657 * "valueCoding": {
10658 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10659 * "code": "UNK",
10660 * "display": "Unknown"
10661 * },
10662 * "url": "ombCategory"
10663 * },
10665 * "valueString": "Unknown",
10666 * "url": "text"
10668 * },
10669 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10671 * },
10672 * "identifier": {
10674 * "use": "official",
10675 * "type": {
10676 * "coding": {
10678 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10679 * "code": "PT"
10682 * },
10683 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10684 * "value": "1"
10686 * },
10687 * "active": true,
10688 * "name": {
10690 * "use": "official",
10691 * "family": "Smith",
10692 * "given": {
10693 * "Brenda"
10696 * },
10697 * "gender": "female",
10698 * "birthDate": "2017-03-10",
10699 * "communication": {
10701 * "language": {
10702 * "coding": {
10704 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10705 * "code": "unknown",
10706 * "display": "Unknown"
10714 * ),
10715 * @OA\Response(
10716 * response="201",
10717 * description="Standard Response",
10718 * @OA\MediaType(
10719 * mediaType="application/json",
10720 * @OA\Schema(
10721 * example={
10722 * "id": 2,
10723 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
10727 * ),
10728 * @OA\Response(
10729 * response="400",
10730 * ref="#/components/responses/badrequest"
10731 * ),
10732 * @OA\Response(
10733 * response="401",
10734 * ref="#/components/responses/unauthorized"
10735 * ),
10736 * security={{"openemr_auth":{}}}
10739 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10740 RestConfig::authorization_check("patients", "demo");
10741 $data = (array) (json_decode(file_get_contents("php://input"), true));
10742 $return = (new FhirPatientRestController())->put($uuid, $data);
10743 RestConfig::apiLog($return, $data);
10744 return $return;
10748 * @OA\Get(
10749 * path="/fhir/Patient",
10750 * description="Returns a list of Patient resources.",
10751 * tags={"fhir"},
10752 * @OA\Parameter(
10753 * name="_id",
10754 * in="query",
10755 * description="The uuid for the Patient resource.",
10756 * required=false,
10757 * @OA\Schema(
10758 * type="string"
10760 * ),
10761 * @OA\Parameter(
10762 * name="identifier",
10763 * in="query",
10764 * description="The identifier of the Patient resource.",
10765 * required=false,
10766 * @OA\Schema(
10767 * type="string"
10769 * ),
10770 * @OA\Parameter(
10771 * name="name",
10772 * in="query",
10773 * description="The name of the Patient resource.",
10774 * required=false,
10775 * @OA\Schema(
10776 * type="string"
10778 * ),
10779 * @OA\Parameter(
10780 * name="birthdate",
10781 * in="query",
10782 * description="The birthdate of the Patient resource.",
10783 * required=false,
10784 * @OA\Schema(
10785 * type="string"
10787 * ),
10788 * @OA\Parameter(
10789 * name="gender",
10790 * in="query",
10791 * description="The gender of the Patient resource.",
10792 * required=false,
10793 * @OA\Schema(
10794 * type="string"
10796 * ),
10797 * @OA\Parameter(
10798 * name="address",
10799 * in="query",
10800 * description="The address of the Patient resource.",
10801 * required=false,
10802 * @OA\Schema(
10803 * type="string"
10805 * ),
10806 * @OA\Parameter(
10807 * name="address-city",
10808 * in="query",
10809 * description="The address-city of the Patient resource.",
10810 * required=false,
10811 * @OA\Schema(
10812 * type="string"
10814 * ),
10815 * @OA\Parameter(
10816 * name="address-postalcode",
10817 * in="query",
10818 * description="The address-postalcode of the Patient resource.",
10819 * required=false,
10820 * @OA\Schema(
10821 * type="string"
10823 * ),
10824 * @OA\Parameter(
10825 * name="address-state",
10826 * in="query",
10827 * description="The address-state of the Patient resource.",
10828 * required=false,
10829 * @OA\Schema(
10830 * type="string"
10832 * ),
10833 * @OA\Parameter(
10834 * name="email",
10835 * in="query",
10836 * description="The email of the Patient resource.",
10837 * required=false,
10838 * @OA\Schema(
10839 * type="string"
10841 * ),
10842 * @OA\Parameter(
10843 * name="family",
10844 * in="query",
10845 * description="The family name of the Patient resource.",
10846 * required=false,
10847 * @OA\Schema(
10848 * type="string"
10850 * ),
10851 * @OA\Parameter(
10852 * name="given",
10853 * in="query",
10854 * description="The given name of the Patient resource.",
10855 * required=false,
10856 * @OA\Schema(
10857 * type="string"
10859 * ),
10860 * @OA\Parameter(
10861 * name="phone",
10862 * in="query",
10863 * description="The phone number of the Patient resource.",
10864 * required=false,
10865 * @OA\Schema(
10866 * type="string"
10868 * ),
10869 * @OA\Parameter(
10870 * name="telecom",
10871 * in="query",
10872 * description="The fax number of the Patient resource.",
10873 * required=false,
10874 * @OA\Schema(
10875 * type="string"
10877 * ),
10878 * @OA\Response(
10879 * response="200",
10880 * description="Standard Response",
10881 * @OA\MediaType(
10882 * mediaType="application/json",
10883 * @OA\Schema(
10884 * @OA\Property(
10885 * property="json object",
10886 * description="FHIR Json object.",
10887 * type="object"
10888 * ),
10889 * example={
10890 * "meta": {
10891 * "lastUpdated": "2021-09-14T09:13:51"
10892 * },
10893 * "resourceType": "Bundle",
10894 * "type": "collection",
10895 * "total": 0,
10896 * "link": {
10898 * "relation": "self",
10899 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10905 * ),
10906 * @OA\Response(
10907 * response="400",
10908 * ref="#/components/responses/badrequest"
10909 * ),
10910 * @OA\Response(
10911 * response="401",
10912 * ref="#/components/responses/unauthorized"
10913 * ),
10914 * security={{"openemr_auth":{}}}
10917 "GET /fhir/Patient" => function (HttpRestRequest $request) {
10918 $params = $request->getQueryParams();
10919 if ($request->isPatientRequest()) {
10920 // only allow access to data of binded patient
10921 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
10922 // need to use getAll rather than getOne)
10923 $params['_id'] = $request->getPatientUUIDString();
10924 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
10925 } else {
10926 RestConfig::authorization_check("patients", "demo");
10927 $return = (new FhirPatientRestController())->getAll($params);
10929 RestConfig::apiLog($return);
10930 return $return;
10934 * @OA\Get(
10935 * path="/fhir/Patient/$export",
10936 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
10937 * tags={"fhir"},
10938 * @OA\Response(
10939 * response="200",
10940 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
10941 * ),
10942 * @OA\Response(
10943 * response="400",
10944 * ref="#/components/responses/badrequest"
10945 * ),
10946 * @OA\Response(
10947 * response="401",
10948 * ref="#/components/responses/unauthorized"
10949 * ),
10950 * security={{"openemr_auth":{}}}
10953 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
10954 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
10955 RestConfig::authorization_check("admin", "users");
10956 $fhirExportService = new FhirExportRestController($request);
10957 $return = $fhirExportService->processExport(
10958 $request->getQueryParams(),
10959 'Patient',
10960 $request->getHeader('Accept'),
10961 $request->getHeader('Prefer')
10963 RestConfig::apiLog($return);
10964 return $return;
10968 * @OA\Get(
10969 * path="/fhir/Patient/{uuid}",
10970 * description="Returns a single Patient resource.",
10971 * tags={"fhir"},
10972 * @OA\Parameter(
10973 * name="uuid",
10974 * in="path",
10975 * description="The uuid for the Patient resource.",
10976 * required=true,
10977 * @OA\Schema(
10978 * type="string"
10980 * ),
10981 * @OA\Response(
10982 * response="200",
10983 * description="Standard Response",
10984 * @OA\MediaType(
10985 * mediaType="application/json",
10986 * @OA\Schema(
10987 * @OA\Property(
10988 * property="json object",
10989 * description="FHIR Json object.",
10990 * type="object"
10991 * ),
10992 * example={
10993 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
10994 * "meta": {
10995 * "versionId": "1",
10996 * "lastUpdated": "2021-09-21T17:08:03+00:00"
10997 * },
10998 * "resourceType": "Patient",
10999 * "text": {
11000 * "status": "generated",
11001 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11002 * },
11003 * "extension": {
11005 * "valueCode": "F",
11006 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11007 * },
11009 * "extension": {
11011 * "valueCoding": {
11012 * "system": "urn:oid:2.16.840.1.113883.6.238",
11013 * "code": "1006-6",
11014 * "display": "Abenaki"
11015 * },
11016 * "url": "ombCategory"
11017 * },
11019 * "valueString": "Abenaki",
11020 * "url": "text"
11022 * },
11023 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11024 * },
11026 * "extension": {
11028 * "valueString": "Declined To Specify",
11029 * "url": "text"
11031 * },
11032 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11034 * },
11035 * "identifier": {
11037 * "use": "official",
11038 * "type": {
11039 * "coding": {
11041 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11042 * "code": "PT"
11045 * },
11046 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11047 * "value": "1"
11049 * },
11050 * "active": true,
11051 * "name": {
11053 * "use": "official",
11054 * "family": "Von197",
11055 * "given": {
11056 * "Aurore252"
11059 * },
11060 * "gender": "female",
11061 * "birthDate": "1970-07-03",
11062 * "address": {
11064 * "line": {
11065 * "245 Crona Wall"
11066 * },
11067 * "city": "Boston",
11068 * "state": "Massachusetts",
11069 * "postalCode": "02215",
11070 * "period": {
11071 * "start": "2020-09-21T17:08:03.532+00:00"
11074 * },
11075 * "communication": {
11077 * "language": {
11078 * "coding": {
11080 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11081 * "code": "unknown",
11082 * "display": "Unknown"
11091 * ),
11092 * @OA\Response(
11093 * response="400",
11094 * ref="#/components/responses/badrequest"
11095 * ),
11096 * @OA\Response(
11097 * response="401",
11098 * ref="#/components/responses/unauthorized"
11099 * ),
11100 * @OA\Response(
11101 * response="404",
11102 * ref="#/components/responses/uuidnotfound"
11103 * ),
11104 * security={{"openemr_auth":{}}}
11107 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11108 if ($request->isPatientRequest()) {
11109 // only allow access to data of binded patient
11110 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11111 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11113 $uuid = $request->getPatientUUIDString();
11114 } else {
11115 RestConfig::authorization_check("patients", "demo");
11117 $return = (new FhirPatientRestController())->getOne($uuid);
11118 RestConfig::apiLog($return);
11119 return $return;
11123 * @OA\Get(
11124 * path="/fhir/Person",
11125 * description="Returns a list of Person resources.",
11126 * tags={"fhir"},
11127 * @OA\Parameter(
11128 * name="name",
11129 * in="query",
11130 * description="The name of the Person resource.",
11131 * required=false,
11132 * @OA\Schema(
11133 * type="string"
11135 * ),
11136 * @OA\Parameter(
11137 * name="active",
11138 * in="query",
11139 * description="The active status of the Person resource.",
11140 * required=false,
11141 * @OA\Schema(
11142 * type="string"
11144 * ),
11145 * @OA\Parameter(
11146 * name="address",
11147 * in="query",
11148 * description="The address of the Person resource.",
11149 * required=false,
11150 * @OA\Schema(
11151 * type="string"
11153 * ),
11154 * @OA\Parameter(
11155 * name="address-city",
11156 * in="query",
11157 * description="The address-city of the Person resource.",
11158 * required=false,
11159 * @OA\Schema(
11160 * type="string"
11162 * ),
11163 * @OA\Parameter(
11164 * name="address-postalcode",
11165 * in="query",
11166 * description="The address-postalcode of the Person resource.",
11167 * required=false,
11168 * @OA\Schema(
11169 * type="string"
11171 * ),
11172 * @OA\Parameter(
11173 * name="address-state",
11174 * in="query",
11175 * description="The address-state of the Person resource.",
11176 * required=false,
11177 * @OA\Schema(
11178 * type="string"
11180 * ),
11181 * @OA\Parameter(
11182 * name="email",
11183 * in="query",
11184 * description="The email of the Person resource.",
11185 * required=false,
11186 * @OA\Schema(
11187 * type="string"
11189 * ),
11190 * @OA\Parameter(
11191 * name="family",
11192 * in="query",
11193 * description="The family name of the Person resource.",
11194 * required=false,
11195 * @OA\Schema(
11196 * type="string"
11198 * ),
11199 * @OA\Parameter(
11200 * name="given",
11201 * in="query",
11202 * description="The given name of the Person resource.",
11203 * required=false,
11204 * @OA\Schema(
11205 * type="string"
11207 * ),
11208 * @OA\Parameter(
11209 * name="phone",
11210 * in="query",
11211 * description="The phone number of the Person resource.",
11212 * required=false,
11213 * @OA\Schema(
11214 * type="string"
11216 * ),
11217 * @OA\Parameter(
11218 * name="telecom",
11219 * in="query",
11220 * description="The fax number of the Person resource.",
11221 * required=false,
11222 * @OA\Schema(
11223 * type="string"
11225 * ),
11226 * @OA\Response(
11227 * response="200",
11228 * description="Standard Response",
11229 * @OA\MediaType(
11230 * mediaType="application/json",
11231 * @OA\Schema(
11232 * @OA\Property(
11233 * property="json object",
11234 * description="FHIR Json object.",
11235 * type="object"
11236 * ),
11237 * example={
11238 * "meta": {
11239 * "lastUpdated": "2021-09-14T09:13:51"
11240 * },
11241 * "resourceType": "Bundle",
11242 * "type": "collection",
11243 * "total": 0,
11244 * "link": {
11246 * "relation": "self",
11247 * "url": "https://localhost:9300/apis/default/fhir/Person"
11253 * ),
11254 * @OA\Response(
11255 * response="400",
11256 * ref="#/components/responses/badrequest"
11257 * ),
11258 * @OA\Response(
11259 * response="401",
11260 * ref="#/components/responses/unauthorized"
11261 * ),
11262 * security={{"openemr_auth":{}}}
11265 "GET /fhir/Person" => function (HttpRestRequest $request) {
11266 RestConfig::authorization_check("admin", "users");
11267 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11268 RestConfig::apiLog($return);
11269 return $return;
11273 * @OA\Get(
11274 * path="/fhir/Person/{uuid}",
11275 * description="Returns a single Person resource.",
11276 * tags={"fhir"},
11277 * @OA\Parameter(
11278 * name="uuid",
11279 * in="path",
11280 * description="The uuid for the Person resource.",
11281 * required=true,
11282 * @OA\Schema(
11283 * type="string"
11285 * ),
11286 * @OA\Response(
11287 * response="200",
11288 * description="Standard Response",
11289 * @OA\MediaType(
11290 * mediaType="application/json",
11291 * @OA\Schema(
11292 * @OA\Property(
11293 * property="json object",
11294 * description="FHIR Json object.",
11295 * type="object"
11296 * ),
11297 * example={
11298 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11299 * "meta": {
11300 * "versionId": "1",
11301 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11302 * },
11303 * "resourceType": "Person",
11304 * "text": {
11305 * "status": "generated",
11306 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11307 * },
11308 * "name": {
11310 * "use": "official",
11311 * "family": "Administrator",
11312 * "given": {
11313 * "Administrator",
11314 * "Larry"
11317 * },
11318 * "telecom": {
11320 * "system": "phone",
11321 * "value": "1234567890",
11322 * "use": "home"
11323 * },
11325 * "system": "phone",
11326 * "value": "1234567890",
11327 * "use": "work"
11328 * },
11330 * "system": "phone",
11331 * "value": "1234567890",
11332 * "use": "mobile"
11333 * },
11335 * "system": "email",
11336 * "value": "hey@hey.com",
11337 * "use": "home"
11339 * },
11340 * "address": {
11342 * "line": {
11343 * "123 Lane Street"
11344 * },
11345 * "city": "Bellevue",
11346 * "state": "WA",
11347 * "period": {
11348 * "start": "2021-04-13T08:57:32.146+00:00"
11351 * },
11352 * "active": true
11356 * ),
11357 * @OA\Response(
11358 * response="400",
11359 * ref="#/components/responses/badrequest"
11360 * ),
11361 * @OA\Response(
11362 * response="401",
11363 * ref="#/components/responses/unauthorized"
11364 * ),
11365 * @OA\Response(
11366 * response="404",
11367 * ref="#/components/responses/uuidnotfound"
11368 * ),
11369 * security={{"openemr_auth":{}}}
11372 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11373 RestConfig::authorization_check("admin", "users");
11374 $return = (new FhirPersonRestController())->getOne($uuid);
11375 RestConfig::apiLog($return);
11376 return $return;
11380 * @OA\Get(
11381 * path="/fhir/Practitioner",
11382 * description="Returns a list of Practitioner resources.",
11383 * tags={"fhir"},
11384 * @OA\Parameter(
11385 * name="_id",
11386 * in="query",
11387 * description="The uuid for the Practitioner resource.",
11388 * required=false,
11389 * @OA\Schema(
11390 * type="string"
11392 * ),
11393 * @OA\Parameter(
11394 * name="name",
11395 * in="query",
11396 * description="The name of the Practitioner resource.",
11397 * required=false,
11398 * @OA\Schema(
11399 * type="string"
11401 * ),
11402 * @OA\Parameter(
11403 * name="active",
11404 * in="query",
11405 * description="The active status of the Practitioner resource.",
11406 * required=false,
11407 * @OA\Schema(
11408 * type="string"
11410 * ),
11411 * @OA\Parameter(
11412 * name="address",
11413 * in="query",
11414 * description="The address of the Practitioner resource.",
11415 * required=false,
11416 * @OA\Schema(
11417 * type="string"
11419 * ),
11420 * @OA\Parameter(
11421 * name="address-city",
11422 * in="query",
11423 * description="The address-city of the Practitioner resource.",
11424 * required=false,
11425 * @OA\Schema(
11426 * type="string"
11428 * ),
11429 * @OA\Parameter(
11430 * name="address-postalcode",
11431 * in="query",
11432 * description="The address-postalcode of the Practitioner resource.",
11433 * required=false,
11434 * @OA\Schema(
11435 * type="string"
11437 * ),
11438 * @OA\Parameter(
11439 * name="address-state",
11440 * in="query",
11441 * description="The address-state of the Practitioner resource.",
11442 * required=false,
11443 * @OA\Schema(
11444 * type="string"
11446 * ),
11447 * @OA\Parameter(
11448 * name="email",
11449 * in="query",
11450 * description="The email of the Practitioner resource.",
11451 * required=false,
11452 * @OA\Schema(
11453 * type="string"
11455 * ),
11456 * @OA\Parameter(
11457 * name="family",
11458 * in="query",
11459 * description="The family name of the Practitioner resource.",
11460 * required=false,
11461 * @OA\Schema(
11462 * type="string"
11464 * ),
11465 * @OA\Parameter(
11466 * name="given",
11467 * in="query",
11468 * description="The given name of the Practitioner resource.",
11469 * required=false,
11470 * @OA\Schema(
11471 * type="string"
11473 * ),
11474 * @OA\Parameter(
11475 * name="phone",
11476 * in="query",
11477 * description="The phone number of the Practitioner resource.",
11478 * required=false,
11479 * @OA\Schema(
11480 * type="string"
11482 * ),
11483 * @OA\Parameter(
11484 * name="telecom",
11485 * in="query",
11486 * description="The fax number of the Practitioner resource.",
11487 * required=false,
11488 * @OA\Schema(
11489 * type="string"
11491 * ),
11492 * @OA\Response(
11493 * response="200",
11494 * description="Standard Response",
11495 * @OA\MediaType(
11496 * mediaType="application/json",
11497 * @OA\Schema(
11498 * @OA\Property(
11499 * property="json object",
11500 * description="FHIR Json object.",
11501 * type="object"
11502 * ),
11503 * example={
11504 * "meta": {
11505 * "lastUpdated": "2021-09-14T09:13:51"
11506 * },
11507 * "resourceType": "Bundle",
11508 * "type": "collection",
11509 * "total": 0,
11510 * "link": {
11512 * "relation": "self",
11513 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
11519 * ),
11520 * @OA\Response(
11521 * response="400",
11522 * ref="#/components/responses/badrequest"
11523 * ),
11524 * @OA\Response(
11525 * response="401",
11526 * ref="#/components/responses/unauthorized"
11527 * ),
11528 * security={{"openemr_auth":{}}}
11531 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
11533 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11534 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11535 // I don't believe patients are assigned to a particular practitioner
11536 // should we allow just open api access to admin information? Should we restrict particular pieces
11537 // of data in the practitioner side (phone number, address information) based on a permission set?
11538 if (!$request->isPatientRequest()) {
11539 RestConfig::authorization_check("admin", "users");
11541 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
11542 RestConfig::apiLog($return);
11543 return $return;
11547 * @OA\Get(
11548 * path="/fhir/Practitioner/{uuid}",
11549 * description="Returns a single Practitioner resource.",
11550 * tags={"fhir"},
11551 * @OA\Parameter(
11552 * name="uuid",
11553 * in="path",
11554 * description="The uuid for the Practitioner resource.",
11555 * required=true,
11556 * @OA\Schema(
11557 * type="string"
11559 * ),
11560 * @OA\Response(
11561 * response="200",
11562 * description="Standard Response",
11563 * @OA\MediaType(
11564 * mediaType="application/json",
11565 * @OA\Schema(
11566 * @OA\Property(
11567 * property="json object",
11568 * description="FHIR Json object.",
11569 * type="object"
11570 * ),
11571 * example={
11572 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11573 * "meta": {
11574 * "versionId": "1",
11575 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11576 * },
11577 * "resourceType": "Practitioner",
11578 * "text": {
11579 * "status": "generated",
11580 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11581 * },
11582 * "identifier": {
11584 * "system": "http://hl7.org/fhir/sid/us-npi",
11585 * "value": "11223344554543"
11587 * },
11588 * "active": true,
11589 * "name": {
11591 * "use": "official",
11592 * "family": "Smith",
11593 * "given": {
11594 * "Billy"
11601 * ),
11602 * @OA\Response(
11603 * response="400",
11604 * ref="#/components/responses/badrequest"
11605 * ),
11606 * @OA\Response(
11607 * response="401",
11608 * ref="#/components/responses/unauthorized"
11609 * ),
11610 * @OA\Response(
11611 * response="404",
11612 * ref="#/components/responses/uuidnotfound"
11613 * ),
11614 * security={{"openemr_auth":{}}}
11617 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
11618 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11619 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11620 // I don't believe patients are assigned to a particular practitioner
11621 // should we allow just open api access to admin information? Should we restrict particular pieces
11622 // of data in the practitioner side (phone number, address information) based on a permission set?
11623 if (!$request->isPatientRequest()) {
11624 RestConfig::authorization_check("admin", "users");
11626 $return = (new FhirPractitionerRestController())->getOne($uuid);
11627 RestConfig::apiLog($return);
11628 return $return;
11632 * @OA\Post(
11633 * path="/fhir/Practitioner",
11634 * description="Adds a Practitioner resources.",
11635 * tags={"fhir"},
11636 * @OA\RequestBody(
11637 * required=true,
11638 * @OA\MediaType(
11639 * mediaType="application/json",
11640 * @OA\Schema(
11641 * description="The json object for the Practitioner resource.",
11642 * type="object"
11643 * ),
11644 * example={
11645 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11646 * "meta": {
11647 * "versionId": "1",
11648 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11649 * },
11650 * "resourceType": "Practitioner",
11651 * "text": {
11652 * "status": "generated",
11653 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11654 * },
11655 * "identifier": {
11657 * "system": "http://hl7.org/fhir/sid/us-npi",
11658 * "value": "11223344554543"
11660 * },
11661 * "active": true,
11662 * "name": {
11664 * "use": "official",
11665 * "family": "Smith",
11666 * "given": {
11667 * "Danny"
11673 * ),
11674 * @OA\Response(
11675 * response="200",
11676 * description="Standard Response",
11677 * @OA\MediaType(
11678 * mediaType="application/json",
11679 * @OA\Schema(
11680 * @OA\Property(
11681 * property="json object",
11682 * description="FHIR Json object.",
11683 * type="object"
11684 * ),
11685 * example={
11686 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11687 * "meta": {
11688 * "versionId": "1",
11689 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11690 * },
11691 * "resourceType": "Practitioner",
11692 * "text": {
11693 * "status": "generated",
11694 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11695 * },
11696 * "identifier": {
11698 * "system": "http://hl7.org/fhir/sid/us-npi",
11699 * "value": "11223344554543"
11701 * },
11702 * "active": true,
11703 * "name": {
11705 * "use": "official",
11706 * "family": "Smith",
11707 * "given": {
11708 * "Danny"
11715 * ),
11716 * @OA\Response(
11717 * response="400",
11718 * ref="#/components/responses/badrequest"
11719 * ),
11720 * @OA\Response(
11721 * response="401",
11722 * ref="#/components/responses/unauthorized"
11723 * ),
11724 * security={{"openemr_auth":{}}}
11727 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
11728 RestConfig::authorization_check("admin", "users");
11729 $data = (array) (json_decode(file_get_contents("php://input"), true));
11730 $return = (new FhirPractitionerRestController())->post($data);
11731 RestConfig::apiLog($return, $data);
11732 return $return;
11736 * @OA\Put(
11737 * path="/fhir/Practitioner/{uuid}",
11738 * description="Modify a Practitioner resource.",
11739 * tags={"fhir"},
11740 * @OA\Parameter(
11741 * name="uuid",
11742 * in="path",
11743 * description="The uuid for the Practitioner resource.",
11744 * required=true,
11745 * @OA\Schema(
11746 * type="string"
11748 * ),
11749 * @OA\RequestBody(
11750 * required=true,
11751 * @OA\MediaType(
11752 * mediaType="application/json",
11753 * @OA\Schema(
11754 * description="The json object for the Practitioner resource.",
11755 * type="object"
11756 * ),
11757 * example={
11758 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11759 * "meta": {
11760 * "versionId": "1",
11761 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11762 * },
11763 * "resourceType": "Practitioner",
11764 * "text": {
11765 * "status": "generated",
11766 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11767 * },
11768 * "identifier": {
11770 * "system": "http://hl7.org/fhir/sid/us-npi",
11771 * "value": "11223344554543"
11773 * },
11774 * "active": true,
11775 * "name": {
11777 * "use": "official",
11778 * "family": "Smith",
11779 * "given": {
11780 * "Billy"
11786 * ),
11787 * @OA\Response(
11788 * response="201",
11789 * description="Standard Response",
11790 * @OA\MediaType(
11791 * mediaType="application/json",
11792 * @OA\Schema(
11793 * example={
11794 * "id": 5,
11795 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
11799 * ),
11800 * @OA\Response(
11801 * response="400",
11802 * ref="#/components/responses/badrequest"
11803 * ),
11804 * @OA\Response(
11805 * response="401",
11806 * ref="#/components/responses/unauthorized"
11807 * ),
11808 * security={{"openemr_auth":{}}}
11811 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
11812 RestConfig::authorization_check("admin", "users");
11813 $data = (array) (json_decode(file_get_contents("php://input"), true));
11814 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
11815 RestConfig::apiLog($return, $data);
11816 return $return;
11820 * @OA\Get(
11821 * path="/fhir/PractitionerRole",
11822 * description="Returns a list of PractitionerRole resources.",
11823 * tags={"fhir"},
11824 * @OA\Parameter(
11825 * name="specialty",
11826 * in="query",
11827 * description="The specialty of the PractitionerRole resource.",
11828 * required=false,
11829 * @OA\Schema(
11830 * type="string"
11832 * ),
11833 * @OA\Parameter(
11834 * name="practitioner",
11835 * in="query",
11836 * description="The practitioner of the PractitionerRole resource.",
11837 * required=false,
11838 * @OA\Schema(
11839 * type="string"
11841 * ),
11842 * @OA\Response(
11843 * response="200",
11844 * description="Standard Response",
11845 * @OA\MediaType(
11846 * mediaType="application/json",
11847 * @OA\Schema(
11848 * @OA\Property(
11849 * property="json object",
11850 * description="FHIR Json object.",
11851 * type="object"
11852 * ),
11853 * example={
11854 * "meta": {
11855 * "lastUpdated": "2021-09-14T09:13:51"
11856 * },
11857 * "resourceType": "Bundle",
11858 * "type": "collection",
11859 * "total": 0,
11860 * "link": {
11862 * "relation": "self",
11863 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11869 * ),
11870 * @OA\Response(
11871 * response="400",
11872 * ref="#/components/responses/badrequest"
11873 * ),
11874 * @OA\Response(
11875 * response="401",
11876 * ref="#/components/responses/unauthorized"
11877 * ),
11878 * security={{"openemr_auth":{}}}
11881 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
11882 RestConfig::authorization_check("admin", "users");
11883 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11884 RestConfig::apiLog($return);
11885 return $return;
11889 * @OA\Get(
11890 * path="/fhir/PractitionerRole/{uuid}",
11891 * description="Returns a single PractitionerRole resource.",
11892 * tags={"fhir"},
11893 * @OA\Parameter(
11894 * name="uuid",
11895 * in="path",
11896 * description="The uuid for the PractitionerRole resource.",
11897 * required=true,
11898 * @OA\Schema(
11899 * type="string"
11901 * ),
11902 * @OA\Response(
11903 * response="200",
11904 * description="Standard Response",
11905 * @OA\MediaType(
11906 * mediaType="application/json",
11907 * @OA\Schema(
11908 * @OA\Property(
11909 * property="json object",
11910 * description="FHIR Json object.",
11911 * type="object"
11912 * ),
11913 * example={
11914 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
11915 * "meta": {
11916 * "versionId": "1",
11917 * "lastUpdated": "2022-04-13T06:18:17+00:00"
11918 * },
11919 * "resourceType": "PractitionerRole",
11920 * "practitioner": {
11921 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
11922 * "display": "Administrator Administrator"
11923 * },
11924 * "organization": {
11925 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
11926 * "display": "Your Clinic Name Here"
11927 * },
11928 * "code": {
11930 * "coding": {
11931 * "102L00000X"
11932 * },
11933 * "text": "Psychoanalyst"
11934 * },
11936 * "coding": {
11937 * "101Y00000X"
11938 * },
11939 * "text": "Counselor"
11945 * ),
11946 * @OA\Response(
11947 * response="400",
11948 * ref="#/components/responses/badrequest"
11949 * ),
11950 * @OA\Response(
11951 * response="401",
11952 * ref="#/components/responses/unauthorized"
11953 * ),
11954 * @OA\Response(
11955 * response="404",
11956 * ref="#/components/responses/uuidnotfound"
11957 * ),
11958 * security={{"openemr_auth":{}}}
11961 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
11962 RestConfig::authorization_check("admin", "users");
11963 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
11964 RestConfig::apiLog($return);
11965 return $return;
11969 * @OA\Get(
11970 * path="/fhir/Procedure",
11971 * description="Returns a list of Procedure resources.",
11972 * tags={"fhir"},
11973 * @OA\Parameter(
11974 * name="_id",
11975 * in="query",
11976 * description="The uuid for the Procedure resource.",
11977 * required=false,
11978 * @OA\Schema(
11979 * type="string"
11981 * ),
11982 * @OA\Parameter(
11983 * name="patient",
11984 * in="query",
11985 * description="The uuid for the patient.",
11986 * required=false,
11987 * @OA\Schema(
11988 * type="string"
11990 * ),
11991 * @OA\Parameter(
11992 * name="date",
11993 * in="query",
11994 * description="The datetime of the Procedure resource.",
11995 * required=false,
11996 * @OA\Schema(
11997 * type="string"
11999 * ),
12000 * @OA\Response(
12001 * response="200",
12002 * description="Standard Response",
12003 * @OA\MediaType(
12004 * mediaType="application/json",
12005 * @OA\Schema(
12006 * @OA\Property(
12007 * property="json object",
12008 * description="FHIR Json object.",
12009 * type="object"
12010 * ),
12011 * example={
12012 * "meta": {
12013 * "lastUpdated": "2021-09-14T09:13:51"
12014 * },
12015 * "resourceType": "Bundle",
12016 * "type": "collection",
12017 * "total": 0,
12018 * "link": {
12020 * "relation": "self",
12021 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12027 * ),
12028 * @OA\Response(
12029 * response="400",
12030 * ref="#/components/responses/badrequest"
12031 * ),
12032 * @OA\Response(
12033 * response="401",
12034 * ref="#/components/responses/unauthorized"
12035 * ),
12036 * security={{"openemr_auth":{}}}
12039 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12040 if ($request->isPatientRequest()) {
12041 // only allow access to data of binded patient
12042 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12043 } else {
12044 RestConfig::authorization_check("patients", "med");
12045 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12047 RestConfig::apiLog($return);
12048 return $return;
12052 * @OA\Get(
12053 * path="/fhir/Procedure/{uuid}",
12054 * description="Returns a single Procedure resource.",
12055 * tags={"fhir"},
12056 * @OA\Parameter(
12057 * name="uuid",
12058 * in="path",
12059 * description="The uuid for the Procedure resource.",
12060 * required=true,
12061 * @OA\Schema(
12062 * type="string"
12064 * ),
12065 * @OA\Response(
12066 * response="200",
12067 * description="Standard Response",
12068 * @OA\MediaType(
12069 * mediaType="application/json",
12070 * @OA\Schema(
12071 * @OA\Property(
12072 * property="json object",
12073 * description="FHIR Json object.",
12074 * type="object"
12075 * ),
12076 * example={
12077 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12078 * "meta": {
12079 * "versionId": "1",
12080 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12081 * },
12082 * "resourceType": "Procedure",
12083 * "status": "in-progress",
12084 * "subject": {
12085 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12086 * "type": "Patient"
12091 * ),
12092 * @OA\Response(
12093 * response="400",
12094 * ref="#/components/responses/badrequest"
12095 * ),
12096 * @OA\Response(
12097 * response="401",
12098 * ref="#/components/responses/unauthorized"
12099 * ),
12100 * @OA\Response(
12101 * response="404",
12102 * ref="#/components/responses/uuidnotfound"
12103 * ),
12104 * security={{"openemr_auth":{}}}
12107 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12108 if ($request->isPatientRequest()) {
12109 // only allow access to data of binded patient
12110 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12111 } else {
12112 RestConfig::authorization_check("patients", "med");
12113 $return = (new FhirProcedureRestController())->getOne($uuid);
12115 RestConfig::apiLog($return);
12116 return $return;
12120 * @OA\Get(
12121 * path="/fhir/Provenance/{uuid}",
12122 * description="Returns a single Provenance resource.",
12123 * tags={"fhir"},
12124 * @OA\Parameter(
12125 * name="uuid",
12126 * in="path",
12127 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12128 * required=true,
12129 * @OA\Schema(
12130 * type="string"
12132 * ),
12133 * @OA\Response(
12134 * response="200",
12135 * description="Standard Response",
12136 * @OA\MediaType(
12137 * mediaType="application/json",
12138 * @OA\Schema(
12139 * @OA\Property(
12140 * property="json object",
12141 * description="FHIR Json object.",
12142 * type="object"
12143 * ),
12144 * example={
12145 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12146 * "resourceType": "Provenance",
12147 * "target": {
12149 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12150 * "type": "AllergyIntolerance"
12152 * },
12153 * "recorded": "2022-03-26T22:43:30+00:00",
12154 * "agent": {
12156 * "type": {
12157 * "coding": {
12159 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12160 * "code": "author",
12161 * "display": "Author"
12164 * },
12165 * "who": {
12166 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12167 * "type": "Organization"
12168 * },
12169 * "onBehalfOf": {
12170 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12171 * "type": "Organization"
12173 * },
12175 * "type": {
12176 * "coding": {
12178 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12179 * "code": "transmitter",
12180 * "display": "Transmitter"
12184 * },
12185 * "who": {
12186 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12187 * "type": "Organization"
12188 * },
12189 * "onBehalfOf": {
12190 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12191 * "type": "Organization"
12197 * ),
12198 * @OA\Response(
12199 * response="400",
12200 * ref="#/components/responses/badrequest"
12201 * ),
12202 * @OA\Response(
12203 * response="401",
12204 * ref="#/components/responses/unauthorized"
12205 * ),
12206 * @OA\Response(
12207 * response="404",
12208 * ref="#/components/responses/uuidnotfound"
12209 * ),
12210 * security={{"openemr_auth":{}}}
12213 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12214 if ($request->isPatientRequest()) {
12215 // only allow access to data of binded patient
12216 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12217 } else {
12218 RestConfig::authorization_check("admin", "super");
12219 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12221 RestConfig::apiLog($return);
12222 return $return;
12226 * @OA\Get(
12227 * path="/fhir/Provenance",
12228 * description="Returns a list of Provenance resources.",
12229 * tags={"fhir"},
12230 * @OA\Parameter(
12231 * name="_id",
12232 * in="query",
12233 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12234 * required=false,
12235 * @OA\Schema(
12236 * type="string"
12238 * ),
12239 * @OA\Response(
12240 * response="200",
12241 * description="Standard Response",
12242 * @OA\MediaType(
12243 * mediaType="application/json",
12244 * @OA\Schema(
12245 * @OA\Property(
12246 * property="json object",
12247 * description="FHIR Json object.",
12248 * type="object"
12249 * ),
12250 * example={
12251 * "meta": {
12252 * "lastUpdated": "2021-09-14T09:13:51"
12253 * },
12254 * "resourceType": "Bundle",
12255 * "type": "collection",
12256 * "total": 0,
12257 * "link": {
12259 * "relation": "self",
12260 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12266 * ),
12267 * @OA\Response(
12268 * response="400",
12269 * ref="#/components/responses/badrequest"
12270 * ),
12271 * @OA\Response(
12272 * response="401",
12273 * ref="#/components/responses/unauthorized"
12274 * ),
12275 * security={{"openemr_auth":{}}}
12278 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12279 // property to support which is why this endpoint exists.
12280 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12281 if ($request->isPatientRequest()) {
12282 // only allow access to data of binded patient
12283 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12284 } else {
12285 // TODO: it seems like regular users should be able to grab authorship / provenance information
12286 RestConfig::authorization_check("admin", "super");
12287 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12289 RestConfig::apiLog($return);
12290 return $return;
12293 // other endpoints
12296 * @OA\Get(
12297 * path="/fhir/metadata",
12298 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12299 * tags={"fhir"},
12300 * @OA\Response(
12301 * response="200",
12302 * description="Return CapabilityStatement resource of the fhir server"
12306 "GET /fhir/metadata" => function () {
12307 $return = (new FhirMetaDataRestController())->getMetaData();
12308 RestConfig::apiLog($return);
12309 return $return;
12313 * @OA\Get(
12314 * path="/fhir/.well-known/smart-configuration",
12315 * description="Returns smart configuration of the fhir server.",
12316 * tags={"fhir"},
12317 * @OA\Response(
12318 * response="200",
12319 * description="Return smart configuration of the fhir server"
12323 "GET /fhir/.well-known/smart-configuration" => function () {
12324 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12325 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12326 RestConfig::apiLog($return);
12327 return $return;
12330 // FHIR root level operations
12333 * @OA\Get(
12334 * path="/fhir/$export",
12335 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12336 * tags={"fhir"},
12337 * @OA\Response(
12338 * response="200",
12339 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12340 * ),
12341 * @OA\Response(
12342 * response="400",
12343 * ref="#/components/responses/badrequest"
12344 * ),
12345 * @OA\Response(
12346 * response="401",
12347 * ref="#/components/responses/unauthorized"
12348 * ),
12349 * security={{"openemr_auth":{}}}
12352 'GET /fhir/$export' => function (HttpRestRequest $request) {
12353 RestConfig::authorization_check("admin", "users");
12354 $fhirExportService = new FhirExportRestController($request);
12355 $return = $fhirExportService->processExport(
12356 $request->getQueryParams(),
12357 'System',
12358 $request->getHeader('Accept'),
12359 $request->getHeader('Prefer')
12361 RestConfig::apiLog($return);
12362 return $return;
12365 // these two operations are adopted based on the documentation used in the IBM FHIR Server
12366 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
12367 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
12370 * @OA\Get(
12371 * path="/fhir/$bulkdata-status",
12372 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12373 * tags={"fhir"},
12374 * @OA\Response(
12375 * response="200",
12376 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12377 * ),
12378 * @OA\Response(
12379 * response="400",
12380 * ref="#/components/responses/badrequest"
12381 * ),
12382 * @OA\Response(
12383 * response="401",
12384 * ref="#/components/responses/unauthorized"
12385 * ),
12386 * security={{"openemr_auth":{}}}
12389 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12390 RestConfig::authorization_check("admin", "users");
12391 $jobUuidString = $request->getQueryParam('job');
12392 // if we were truly async we would return 202 here to say we are in progress with a JSON response
12393 // since OpenEMR data is so small we just return the JSON from the database
12394 $fhirExportService = new FhirExportRestController($request);
12395 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
12396 RestConfig::apiLog($return);
12397 return $return;
12401 * @OA\Delete(
12402 * path="/fhir/$bulkdata-status",
12403 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12404 * tags={"fhir"},
12405 * @OA\Response(
12406 * response="200",
12407 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12408 * ),
12409 * @OA\Response(
12410 * response="400",
12411 * ref="#/components/responses/badrequest"
12412 * ),
12413 * @OA\Response(
12414 * response="401",
12415 * ref="#/components/responses/unauthorized"
12416 * ),
12417 * security={{"openemr_auth":{}}}
12420 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12421 RestConfig::authorization_check("admin", "users");
12422 $job = $request->getQueryParam('job');
12423 $fhirExportService = new FhirExportRestController($request);
12424 $return = $fhirExportService->processDeleteExportForJob($job);
12425 RestConfig::apiLog($return);
12426 return $return;
12430 // Note that the portal (api) route is only for patient role
12431 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
12432 RestConfig::$PORTAL_ROUTE_MAP = array(
12434 * @OA\Get(
12435 * path="/portal/patient",
12436 * description="Returns the patient.",
12437 * tags={"standard-patient"},
12438 * @OA\Response(
12439 * response="200",
12440 * description="Standard response",
12441 * @OA\MediaType(
12442 * mediaType="application/json",
12443 * @OA\Schema(ref="#/components/schemas/api_patient_response")
12445 * ),
12446 * @OA\Response(
12447 * response="401",
12448 * ref="#/components/responses/unauthorized"
12449 * ),
12450 * security={{"openemr_auth":{}}}
12453 "GET /portal/patient" => function (HttpRestRequest $request) {
12454 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
12455 RestConfig::apiLog($return);
12456 return $return;
12460 * @OA\Get(
12461 * path="/portal/patient/encounter",
12462 * description="Returns encounters for the patient.",
12463 * tags={"standard-patient"},
12464 * @OA\Response(
12465 * response="200",
12466 * ref="#/components/responses/standard"
12467 * ),
12468 * @OA\Response(
12469 * response="400",
12470 * ref="#/components/responses/badrequest"
12471 * ),
12472 * @OA\Response(
12473 * response="401",
12474 * ref="#/components/responses/unauthorized"
12475 * ),
12476 * security={{"openemr_auth":{}}}
12479 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
12480 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
12481 RestConfig::apiLog($return);
12482 return $return;
12486 * @OA\Get(
12487 * path="/portal/patient/encounter/{euuid}",
12488 * description="Returns a selected encounter by its uuid.",
12489 * tags={"standard-patient"},
12490 * @OA\Parameter(
12491 * name="euuid",
12492 * in="path",
12493 * description="The uuid for the encounter.",
12494 * required=true,
12495 * @OA\Schema(
12496 * type="string"
12498 * ),
12499 * @OA\Response(
12500 * response="200",
12501 * ref="#/components/responses/standard"
12502 * ),
12503 * @OA\Response(
12504 * response="400",
12505 * ref="#/components/responses/badrequest"
12506 * ),
12507 * @OA\Response(
12508 * response="401",
12509 * ref="#/components/responses/unauthorized"
12510 * ),
12511 * security={{"openemr_auth":{}}}
12514 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
12515 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
12516 RestConfig::apiLog($return);
12517 return $return;