php8.1 fixes (#5676)
[openemr.git] / _rest_routes.inc.php
blob49998ee0e49aa7c4fe2e8865ef8b564e3dee15cf
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 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
35 * "api:fhir": "FHIR R4 API",
36 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
37 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
38 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
39 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
40 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
41 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
42 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
43 * "patient/Document.read": "Read document resources for the current patient (api:fhir)",
44 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
46 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
47 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
48 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
49 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
50 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
51 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
52 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
53 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
54 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
55 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
56 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
57 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
58 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
59 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
60 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
61 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
62 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
63 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
64 * "system/Device.read": "Read all device resources in the system (api:fhir)",
65 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
66 * "system/Document.read": "Read all document resources in the system (api:fhir)",
67 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
68 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
69 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
70 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
71 * "system/Group.read": "Read all group resources in the system (api:fhir)",
72 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
73 * "system/Location.read": "Read all location resources in the system (api:fhir)",
74 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
75 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
76 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
77 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
78 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
79 * "system/Person.read": "Read all person resources in the system (api:fhir)",
80 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
81 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
82 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
83 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
84 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
85 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
86 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
87 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
88 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
89 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
90 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
91 * "user/Document.read" : "Read all documents the user has access to (api:fhir)",
92 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
93 * "user/DocumentReference.$docref" : "Generate a document for any patient the user has access to or returns the most current Clinical Summary of Care Document (CCD) (api:fhir)",
94 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
95 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
96 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
97 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
98 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
99 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
100 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
101 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
102 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
103 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
104 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
105 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
106 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
107 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
108 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
109 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
110 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
111 * "api:oemr": "Standard OpenEMR API",
112 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
113 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
114 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
115 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
116 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
117 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
118 * "user/document.read": "Read documents the user has access to (api:oemr)",
119 * "user/document.write": "Write documents the user has access to (api:oemr)",
120 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
121 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
122 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
123 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
124 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
125 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
126 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
127 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
128 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
129 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
130 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
131 * "user/list.read": "Read lists the user has access to (api:oemr)",
132 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
133 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
134 * "user/medication.read": "Read medications the user has access to (api:oemr)",
135 * "user/medication.write": "Write medications the user has access to (api:oemr)",
136 * "user/message.write": "Read messages the user has access to (api:oemr)",
137 * "user/patient.read": "Read patients the user has access to (api:oemr)",
138 * "user/patient.write": "Write patients the user has access to (api:oemr)",
139 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
140 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
141 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
142 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
143 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
144 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
145 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
146 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
147 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
148 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
149 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
150 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
151 * "api:port": "Standard Patient Portal OpenEMR API",
152 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
153 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
157 * @OA\Tag(
158 * name="fhir",
159 * description="FHIR R4 API"
161 * @OA\Tag(
162 * name="standard",
163 * description="Standard OpenEMR API"
165 * @OA\Tag(
166 * name="standard-patient",
167 * description="Standard Patient Portal OpenEMR API"
169 * @OA\Response(
170 * response="standard",
171 * description="Standard Response",
172 * @OA\MediaType(
173 * mediaType="application/json",
174 * @OA\Schema(
175 * @OA\Property(
176 * property="validationErrors",
177 * description="Validation errors.",
178 * type="array",
179 * @OA\Items(
180 * type="object",
181 * ),
182 * ),
183 * @OA\Property(
184 * property="internalErrors",
185 * description="Internal errors.",
186 * type="array",
187 * @OA\Items(
188 * type="object",
189 * ),
190 * ),
191 * @OA\Property(
192 * property="data",
193 * description="Returned data.",
194 * type="array",
195 * @OA\Items(
196 * type="object",
197 * ),
198 * ),
199 * example={
200 * "validationErrors": {},
201 * "error_description": {},
202 * "data": {}
207 * @OA\Response(
208 * response="badrequest",
209 * description="Bad Request",
210 * @OA\MediaType(
211 * mediaType="application/json",
212 * @OA\Schema(
213 * @OA\Property(
214 * property="validationErrors",
215 * description="Validation errors.",
216 * type="object"
217 * ),
218 * example={
219 * "validationErrors":
221 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
227 * @OA\Response(
228 * response="unauthorized",
229 * description="Unauthorized",
230 * @OA\MediaType(
231 * mediaType="application/json",
232 * @OA\Schema(
233 * @OA\Property(
234 * property="error",
235 * description="The error.",
236 * type="string"
237 * ),
238 * @OA\Property(
239 * property="error_description",
240 * description="The description of the error.",
241 * type="string"
242 * ),
243 * @OA\Property(
244 * property="hint",
245 * description="More specific information on the error.",
246 * type="string"
247 * ),
248 * @OA\Property(
249 * property="message",
250 * description="Message regarding the error.",
251 * type="string"
252 * ),
253 * example={
254 * "error": "access_denied",
255 * "error_description": "The resource owner or authorization server denied the request.",
256 * "hint": "Missing ""Authorization"" header",
257 * "message": "The resource owner or authorization server denied the request."
262 * @OA\Response(
263 * response="uuidnotfound",
264 * description="Not Found",
265 * @OA\MediaType(
266 * mediaType="application/json",
267 * @OA\Schema(
268 * @OA\Property(
269 * property="empty",
270 * description="empty",
271 * type="object"
272 * ),
273 * example={}
279 // Lets keep our controller classes with the routes.
281 use OpenEMR\Common\Acl\AccessDeniedException;
282 use OpenEMR\Common\Http\HttpRestRequest;
283 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
284 use OpenEMR\RestControllers\FacilityRestController;
285 use OpenEMR\RestControllers\VersionRestController;
286 use OpenEMR\RestControllers\ProductRegistrationRestController;
287 use OpenEMR\RestControllers\PatientRestController;
288 use OpenEMR\RestControllers\EncounterRestController;
289 use OpenEMR\RestControllers\PractitionerRestController;
290 use OpenEMR\RestControllers\ListRestController;
291 use OpenEMR\RestControllers\InsuranceCompanyRestController;
292 use OpenEMR\RestControllers\AppointmentRestController;
293 use OpenEMR\RestControllers\ConditionRestController;
294 use OpenEMR\RestControllers\ONoteRestController;
295 use OpenEMR\RestControllers\DocumentRestController;
296 use OpenEMR\RestControllers\DrugRestController;
297 use OpenEMR\RestControllers\ImmunizationRestController;
298 use OpenEMR\RestControllers\InsuranceRestController;
299 use OpenEMR\RestControllers\MessageRestController;
300 use OpenEMR\RestControllers\PrescriptionRestController;
301 use OpenEMR\RestControllers\ProcedureRestController;
302 use OpenEMR\RestControllers\TransactionRestController;
304 // Note some Http clients may not send auth as json so a function
305 // is implemented to determine and parse encoding on auth route's.
307 // Note that the api route is only for users role
308 // (there is a mechanism in place to ensure only user role can access the api route)
309 RestConfig::$ROUTE_MAP = array(
311 * @OA\Get(
312 * path="/api/facility",
313 * description="Returns a single facility.",
314 * tags={"standard"},
315 * @OA\Parameter(
316 * name="name",
317 * in="query",
318 * description="The name for the facility.",
319 * required=false,
320 * @OA\Schema(
321 * type="string"
323 * ),
324 * @OA\Parameter(
325 * name="facility_npi",
326 * in="query",
327 * description="The facility_npi for the facility.",
328 * required=false,
329 * @OA\Schema(
330 * type="string"
332 * ),
333 * @OA\Parameter(
334 * name="phone",
335 * in="query",
336 * description="The phone for the facility.",
337 * required=false,
338 * @OA\Schema(
339 * type="string"
341 * ),
342 * @OA\Parameter(
343 * name="fax",
344 * in="query",
345 * description="The fax for the facility.",
346 * required=false,
347 * @OA\Schema(
348 * type="string"
350 * ),
351 * @OA\Parameter(
352 * name="street",
353 * in="query",
354 * description="The street for the facility.",
355 * required=false,
356 * @OA\Schema(
357 * type="string"
359 * ),
360 * @OA\Parameter(
361 * name="city",
362 * in="query",
363 * description="The city for the facility.",
364 * required=false,
365 * @OA\Schema(
366 * type="string"
368 * ),
369 * @OA\Parameter(
370 * name="state",
371 * in="query",
372 * description="The state for the facility.",
373 * required=false,
374 * @OA\Schema(
375 * type="string"
377 * ),
378 * @OA\Parameter(
379 * name="postal_code",
380 * in="query",
381 * description="The postal_code for the facility.",
382 * required=false,
383 * @OA\Schema(
384 * type="string"
386 * ),
387 * @OA\Parameter(
388 * name="country_code",
389 * in="query",
390 * description="The country_code for the facility.",
391 * required=false,
392 * @OA\Schema(
393 * type="string"
395 * ),
396 * @OA\Parameter(
397 * name="federal_ein",
398 * in="query",
399 * description="The federal_ein for the facility.",
400 * required=false,
401 * @OA\Schema(
402 * type="string"
404 * ),
405 * @OA\Parameter(
406 * name="website",
407 * in="query",
408 * description="The website for the facility.",
409 * required=false,
410 * @OA\Schema(
411 * type="string"
413 * ),
414 * @OA\Parameter(
415 * name="email",
416 * in="query",
417 * description="The email for the facility.",
418 * required=false,
419 * @OA\Schema(
420 * type="string"
422 * ),
423 * @OA\Parameter(
424 * name="domain_identifier",
425 * in="query",
426 * description="The domain_identifier for the facility.",
427 * required=false,
428 * @OA\Schema(
429 * type="string"
431 * ),
432 * @OA\Parameter(
433 * name="facility_taxonomy",
434 * in="query",
435 * description="The facility_taxonomy for the facility.",
436 * required=false,
437 * @OA\Schema(
438 * type="string"
440 * ),
441 * @OA\Parameter(
442 * name="facility_code",
443 * in="query",
444 * description="The facility_code for the facility.",
445 * required=false,
446 * @OA\Schema(
447 * type="string"
449 * ),
450 * @OA\Parameter(
451 * name="billing_location",
452 * in="query",
453 * description="The billing_location setting for the facility.",
454 * required=false,
455 * @OA\Schema(
456 * type="string"
458 * ),
459 * @OA\Parameter(
460 * name="accepts_assignment",
461 * in="query",
462 * description="The accepts_assignment setting for the facility.",
463 * required=false,
464 * @OA\Schema(
465 * type="string"
467 * ),
468 * @OA\Parameter(
469 * name="oid",
470 * in="query",
471 * description="The oid for the facility.",
472 * required=false,
473 * @OA\Schema(
474 * type="string"
476 * ),
477 * @OA\Parameter(
478 * name="service_location",
479 * in="query",
480 * description="The service_location setting for the facility.",
481 * required=false,
482 * @OA\Schema(
483 * type="string"
485 * ),
486 * @OA\Response(
487 * response="200",
488 * ref="#/components/responses/standard"
489 * ),
490 * @OA\Response(
491 * response="400",
492 * ref="#/components/responses/badrequest"
493 * ),
494 * @OA\Response(
495 * response="401",
496 * ref="#/components/responses/unauthorized"
497 * ),
498 * security={{"openemr_auth":{}}}
501 "GET /api/facility" => function () {
502 RestConfig::authorization_check("admin", "users");
503 $return = (new FacilityRestController())->getAll($_GET);
504 RestConfig::apiLog($return);
505 return $return;
509 * @OA\Get(
510 * path="/api/facility/{fuuid}",
511 * description="Returns a single facility.",
512 * tags={"standard"},
513 * @OA\Parameter(
514 * name="fuuid",
515 * in="path",
516 * description="The uuid for the facility.",
517 * required=true,
518 * @OA\Schema(
519 * type="string"
521 * ),
522 * @OA\Response(
523 * response="200",
524 * ref="#/components/responses/standard"
525 * ),
526 * @OA\Response(
527 * response="400",
528 * ref="#/components/responses/badrequest"
529 * ),
530 * @OA\Response(
531 * response="401",
532 * ref="#/components/responses/unauthorized"
533 * ),
534 * security={{"openemr_auth":{}}}
537 "GET /api/facility/:fuuid" => function ($fuuid) {
538 RestConfig::authorization_check("admin", "users");
539 $return = (new FacilityRestController())->getOne($fuuid);
540 RestConfig::apiLog($return);
541 return $return;
545 * @OA\Post(
546 * path="/api/facility",
547 * description="Creates a facility in the system",
548 * tags={"standard"},
549 * @OA\RequestBody(
550 * required=true,
551 * @OA\MediaType(
552 * mediaType="application/json",
553 * @OA\Schema(
554 * @OA\Property(
555 * property="name",
556 * description="The name for the facility.",
557 * type="string"
558 * ),
559 * @OA\Property(
560 * property="facility_npi",
561 * description="The facility_npi for the facility.",
562 * type="string"
563 * ),
564 * @OA\Property(
565 * property="phone",
566 * description="The phone for the facility.",
567 * type="string"
568 * ),
569 * @OA\Property(
570 * property="fax",
571 * description="The fax for the facility.",
572 * type="string"
573 * ),
574 * @OA\Property(
575 * property="street",
576 * description="The street for the facility.",
577 * type="string"
578 * ),
579 * @OA\Property(
580 * property="city",
581 * description="The city for the facility.",
582 * type="string"
583 * ),
584 * @OA\Property(
585 * property="state",
586 * description="The state for the facility.",
587 * type="string"
588 * ),
589 * @OA\Property(
590 * property="postal_code",
591 * description="The postal_code for the facility.",
592 * type="string"
593 * ),
594 * @OA\Property(
595 * property="country_code",
596 * description="The country_code for the facility.",
597 * type="string"
598 * ),
599 * @OA\Property(
600 * property="federal_ein",
601 * description="The federal_ein for the facility.",
602 * type="string"
603 * ),
604 * @OA\Property(
605 * property="website",
606 * description="The website for the facility.",
607 * type="string"
608 * ),
609 * @OA\Property(
610 * property="email",
611 * description="The email for the facility.",
612 * type="string"
613 * ),
614 * @OA\Property(
615 * property="domain_identifier",
616 * description="The domain_identifier for the facility.",
617 * type="string"
618 * ),
619 * @OA\Property(
620 * property="facility_taxonomy",
621 * description="The facility_taxonomy for the facility.",
622 * type="string"
623 * ),
624 * @OA\Property(
625 * property="facility_code",
626 * description="The facility_code for the facility.",
627 * type="string"
628 * ),
629 * @OA\Property(
630 * property="billing_location",
631 * description="The billing_location setting for the facility.",
632 * type="string"
633 * ),
634 * @OA\Property(
635 * property="accepts_assignment",
636 * description="The accepts_assignment setting for the facility.",
637 * type="string"
638 * ),
639 * @OA\Property(
640 * property="oid",
641 * description="The oid for the facility.",
642 * type="string"
643 * ),
644 * @OA\Property(
645 * property="service_location",
646 * description="The service_location setting for the facility.",
647 * type="string"
648 * ),
649 * required={"name", "facility_npi"},
650 * example={
651 * "name": "Aquaria",
652 * "facility_npi": "123456789123",
653 * "phone": "808-606-3030",
654 * "fax": "808-606-3031",
655 * "street": "1337 Bit Shifter Ln",
656 * "city": "San Lorenzo",
657 * "state": "ZZ",
658 * "postal_code": "54321",
659 * "country_code": "US",
660 * "federal_ein": "4343434",
661 * "website": "https://example.com",
662 * "email": "foo@bar.com",
663 * "domain_identifier": "",
664 * "facility_taxonomy": "",
665 * "facility_code": "",
666 * "billing_location": "1",
667 * "accepts_assignment": "1",
668 * "oid": "",
669 * "service_location": "1"
673 * ),
674 * @OA\Response(
675 * response="200",
676 * ref="#/components/responses/standard"
677 * ),
678 * @OA\Response(
679 * response="400",
680 * ref="#/components/responses/badrequest"
681 * ),
682 * @OA\Response(
683 * response="401",
684 * ref="#/components/responses/unauthorized"
685 * ),
686 * security={{"openemr_auth":{}}}
689 "POST /api/facility" => function () {
690 RestConfig::authorization_check("admin", "super");
691 $data = (array) (json_decode(file_get_contents("php://input")));
692 $return = (new FacilityRestController())->post($data);
693 RestConfig::apiLog($return, $data);
694 return $return;
698 * @OA\Put(
699 * path="/api/facility/{fuuid}",
700 * description="Updates a facility in the system",
701 * tags={"standard"},
702 * @OA\Parameter(
703 * name="fuuid",
704 * in="path",
705 * description="The uuid for the facility.",
706 * required=true,
707 * @OA\Schema(
708 * type="string"
710 * ),
711 * @OA\RequestBody(
712 * required=true,
713 * @OA\MediaType(
714 * mediaType="application/json",
715 * @OA\Schema(
716 * @OA\Property(
717 * property="name",
718 * description="The name for the facility.",
719 * type="string"
720 * ),
721 * @OA\Property(
722 * property="facility_npi",
723 * description="The facility_npi for the facility.",
724 * type="string"
725 * ),
726 * @OA\Property(
727 * property="phone",
728 * description="The phone for the facility.",
729 * type="string"
730 * ),
731 * @OA\Property(
732 * property="fax",
733 * description="The fax for the facility.",
734 * type="string"
735 * ),
736 * @OA\Property(
737 * property="street",
738 * description="The street for the facility.",
739 * type="string"
740 * ),
741 * @OA\Property(
742 * property="city",
743 * description="The city for the facility.",
744 * type="string"
745 * ),
746 * @OA\Property(
747 * property="state",
748 * description="The state for the facility.",
749 * type="string"
750 * ),
751 * @OA\Property(
752 * property="postal_code",
753 * description="The postal_code for the facility.",
754 * type="string"
755 * ),
756 * @OA\Property(
757 * property="country_code",
758 * description="The country_code for the facility.",
759 * type="string"
760 * ),
761 * @OA\Property(
762 * property="federal_ein",
763 * description="The federal_ein for the facility.",
764 * type="string"
765 * ),
766 * @OA\Property(
767 * property="website",
768 * description="The website for the facility.",
769 * type="string"
770 * ),
771 * @OA\Property(
772 * property="email",
773 * description="The email for the facility.",
774 * type="string"
775 * ),
776 * @OA\Property(
777 * property="domain_identifier",
778 * description="The domain_identifier for the facility.",
779 * type="string"
780 * ),
781 * @OA\Property(
782 * property="facility_taxonomy",
783 * description="The facility_taxonomy for the facility.",
784 * type="string"
785 * ),
786 * @OA\Property(
787 * property="facility_code",
788 * description="The facility_code for the facility.",
789 * type="string"
790 * ),
791 * @OA\Property(
792 * property="billing_location",
793 * description="The billing_location setting for the facility.",
794 * type="string"
795 * ),
796 * @OA\Property(
797 * property="accepts_assignment",
798 * description="The accepts_assignment setting for the facility.",
799 * type="string"
800 * ),
801 * @OA\Property(
802 * property="oid",
803 * description="The oid for the facility.",
804 * type="string"
805 * ),
806 * @OA\Property(
807 * property="service_location",
808 * description="The service_location setting for the facility.",
809 * type="string"
810 * ),
811 * example={
812 * "name": "Aquaria",
813 * "facility_npi": "123456789123",
814 * "phone": "808-606-3030",
815 * "fax": "808-606-3031",
816 * "street": "1337 Bit Shifter Ln",
817 * "city": "San Lorenzo",
818 * "state": "ZZ",
819 * "postal_code": "54321",
820 * "country_code": "US",
821 * "federal_ein": "4343434",
822 * "website": "https://example.com",
823 * "email": "foo@bar.com",
824 * "domain_identifier": "",
825 * "facility_taxonomy": "",
826 * "facility_code": "",
827 * "billing_location": "1",
828 * "accepts_assignment": "1",
829 * "oid": "",
830 * "service_location": "1"
834 * ),
835 * @OA\Response(
836 * response="200",
837 * ref="#/components/responses/standard"
838 * ),
839 * @OA\Response(
840 * response="400",
841 * ref="#/components/responses/badrequest"
842 * ),
843 * @OA\Response(
844 * response="401",
845 * ref="#/components/responses/unauthorized"
846 * ),
847 * security={{"openemr_auth":{}}}
850 "PUT /api/facility/:fuuid" => function ($fuuid) {
851 RestConfig::authorization_check("admin", "super");
852 $data = (array) (json_decode(file_get_contents("php://input")));
853 $return = (new FacilityRestController())->patch($fuuid, $data);
854 RestConfig::apiLog($return, $data);
855 return $return;
859 * @OA\Get(
860 * path="/api/patient",
861 * description="Retrieves a list of patients",
862 * tags={"standard"},
863 * @OA\Parameter(
864 * name="fname",
865 * in="query",
866 * description="The first name for the patient.",
867 * required=false,
868 * @OA\Schema(
869 * type="string"
871 * ),
872 * @OA\Parameter(
873 * name="lname",
874 * in="query",
875 * description="The last name for the patient.",
876 * required=false,
877 * @OA\Schema(
878 * type="string"
880 * ),
881 * @OA\Parameter(
882 * name="ss",
883 * in="query",
884 * description="The social security number for the patient.",
885 * required=false,
886 * @OA\Schema(
887 * type="string"
889 * ),
890 * @OA\Parameter(
891 * name="street",
892 * in="query",
893 * description="The street for the patient.",
894 * required=false,
895 * @OA\Schema(
896 * type="string"
898 * ),
899 * @OA\Parameter(
900 * name="postal_code",
901 * in="query",
902 * description="The postal code for the patient.",
903 * required=false,
904 * @OA\Schema(
905 * type="string"
907 * ),
908 * @OA\Parameter(
909 * name="city",
910 * in="query",
911 * description="The city for the patient.",
912 * required=false,
913 * @OA\Schema(
914 * type="string"
916 * ),
917 * @OA\Parameter(
918 * name="state",
919 * in="query",
920 * description="The state for the patient.",
921 * required=false,
922 * @OA\Schema(
923 * type="string"
925 * ),
926 * @OA\Parameter(
927 * name="phone_home",
928 * in="query",
929 * description="The home phone for the patient.",
930 * required=false,
931 * @OA\Schema(
932 * type="string"
934 * ),
935 * @OA\Parameter(
936 * name="phone_biz",
937 * in="query",
938 * description="The business phone for the patient.",
939 * required=false,
940 * @OA\Schema(
941 * type="string"
943 * ),
944 * @OA\Parameter(
945 * name="phone_cell",
946 * in="query",
947 * description="The cell phone for the patient.",
948 * required=false,
949 * @OA\Schema(
950 * type="string"
952 * ),
953 * @OA\Parameter(
954 * name="postal_contact",
955 * in="query",
956 * description="The postal_contact for the patient.",
957 * required=false,
958 * @OA\Schema(
959 * type="string"
961 * ),
962 * @OA\Parameter(
963 * name="sex",
964 * in="query",
965 * description="The gender for the patient.",
966 * required=false,
967 * @OA\Schema(
968 * type="string"
970 * ),
971 * @OA\Parameter(
972 * name="country_code",
973 * in="query",
974 * description="The country code for the patient.",
975 * required=false,
976 * @OA\Schema(
977 * type="string"
979 * ),
980 * @OA\Parameter(
981 * name="email",
982 * in="query",
983 * description="The email for the patient.",
984 * required=false,
985 * @OA\Schema(
986 * type="string"
988 * ),
989 * @OA\Parameter(
990 * name="DOB",
991 * in="query",
992 * description="The DOB for the patient.",
993 * required=false,
994 * @OA\Schema(
995 * type="string"
997 * ),
998 * @OA\Response(
999 * response="200",
1000 * ref="#/components/responses/standard"
1001 * ),
1002 * @OA\Response(
1003 * response="400",
1004 * ref="#/components/responses/badrequest"
1005 * ),
1006 * @OA\Response(
1007 * response="401",
1008 * ref="#/components/responses/unauthorized"
1009 * ),
1010 * security={{"openemr_auth":{}}}
1013 "GET /api/patient" => function () {
1014 RestConfig::authorization_check("patients", "demo");
1015 $return = (new PatientRestController())->getAll($_GET);
1016 RestConfig::apiLog($return);
1017 return $return;
1021 * Schema for the patient request
1023 * @OA\Schema(
1024 * schema="api_patient_request",
1025 * @OA\Property(
1026 * property="title",
1027 * description="The title of patient.",
1028 * type="string"
1029 * ),
1030 * @OA\Property(
1031 * property="fname",
1032 * description="The fname of patient.",
1033 * type="string"
1034 * ),
1035 * @OA\Property(
1036 * property="mname",
1037 * description="The mname of patient.",
1038 * type="string"
1039 * ),
1040 * @OA\Property(
1041 * property="lname",
1042 * description="The lname of patient.",
1043 * type="string"
1044 * ),
1045 * @OA\Property(
1046 * property="street",
1047 * description="The street address of patient.",
1048 * type="string"
1049 * ),
1050 * @OA\Property(
1051 * property="postal_code",
1052 * description="The postal code of patient.",
1053 * type="string"
1054 * ),
1055 * @OA\Property(
1056 * property="city",
1057 * description="The city of patient.",
1058 * type="string"
1059 * ),
1060 * @OA\Property(
1061 * property="state",
1062 * description="The state of patient.",
1063 * type="string"
1064 * ),
1065 * @OA\Property(
1066 * property="country_code",
1067 * description="The country code of patient.",
1068 * type="string"
1069 * ),
1070 * @OA\Property(
1071 * property="phone_contact",
1072 * description="The phone contact of patient.",
1073 * type="string"
1074 * ),
1075 * @OA\Property(
1076 * property="DOB",
1077 * description="The DOB of patient.",
1078 * type="string"
1079 * ),
1080 * @OA\Property(
1081 * property="sex",
1082 * description="The lname of patient.",
1083 * type="string"
1084 * ),
1085 * @OA\Property(
1086 * property="race",
1087 * description="The race of patient.",
1088 * type="string"
1089 * ),
1090 * @OA\Property(
1091 * property="ethnicity",
1092 * description="The ethnicity of patient.",
1093 * type="string"
1094 * ),
1095 * required={"fname", "lname", "DOB", "sex"},
1096 * example={
1097 * "title": "Mr",
1098 * "fname": "Foo",
1099 * "mname": "",
1100 * "lname": "Bar",
1101 * "street": "456 Tree Lane",
1102 * "postal_code": "08642",
1103 * "city": "FooTown",
1104 * "state": "FL",
1105 * "country_code": "US",
1106 * "phone_contact": "123-456-7890",
1107 * "DOB": "1992-02-02",
1108 * "sex": "Male",
1109 * "race": "",
1110 * "ethnicity": ""
1115 * @OA\Post(
1116 * path="/api/patient",
1117 * description="Creates a new patient",
1118 * tags={"standard"},
1119 * @OA\RequestBody(
1120 * required=true,
1121 * @OA\MediaType(
1122 * mediaType="application/json",
1123 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1125 * ),
1126 * @OA\Response(
1127 * response="200",
1128 * description="Standard response",
1129 * @OA\MediaType(
1130 * mediaType="application/json",
1131 * @OA\Schema(
1132 * @OA\Property(
1133 * property="validationErrors",
1134 * description="Validation errors.",
1135 * type="array",
1136 * @OA\Items(
1137 * type="object",
1138 * ),
1139 * ),
1140 * @OA\Property(
1141 * property="internalErrors",
1142 * description="Internal errors.",
1143 * type="array",
1144 * @OA\Items(
1145 * type="object",
1146 * ),
1147 * ),
1148 * @OA\Property(
1149 * property="data",
1150 * description="Returned data.",
1151 * type="array",
1152 * @OA\Items(
1153 * @OA\Property(
1154 * property="pid",
1155 * description="patient pid",
1156 * type="integer",
1158 * ),
1159 * ),
1160 * example={
1161 * "validationErrors": {},
1162 * "error_description": {},
1163 * "data": {
1164 * "pid": 1
1169 * ),
1170 * @OA\Response(
1171 * response="401",
1172 * ref="#/components/responses/unauthorized"
1173 * ),
1174 * security={{"openemr_auth":{}}}
1177 "POST /api/patient" => function () {
1178 RestConfig::authorization_check("patients", "demo");
1179 $data = (array) (json_decode(file_get_contents("php://input")));
1180 $return = (new PatientRestController())->post($data);
1181 RestConfig::apiLog($return, $data);
1182 return $return;
1186 * Schema for the patient response
1188 * @OA\Schema(
1189 * schema="api_patient_response",
1190 * @OA\Property(
1191 * property="validationErrors",
1192 * description="Validation errors.",
1193 * type="array",
1194 * @OA\Items(
1195 * type="object",
1196 * ),
1197 * ),
1198 * @OA\Property(
1199 * property="internalErrors",
1200 * description="Internal errors.",
1201 * type="array",
1202 * @OA\Items(
1203 * type="object",
1204 * ),
1205 * ),
1206 * @OA\Property(
1207 * property="data",
1208 * description="Returned data.",
1209 * type="array",
1210 * @OA\Items(
1211 * @OA\Property(
1212 * property="id",
1213 * description="patient id",
1214 * type="string",
1215 * ),
1216 * @OA\Property(
1217 * property="pid",
1218 * description="patient pid",
1219 * type="string",
1220 * ),
1221 * @OA\Property(
1222 * property="pubpid",
1223 * description="patient public id",
1224 * type="string",
1225 * ),
1226 * @OA\Property(
1227 * property="title",
1228 * description="patient title",
1229 * type="string",
1230 * ),
1231 * @OA\Property(
1232 * property="fname",
1233 * description="patient first name",
1234 * type="string",
1235 * ),
1236 * @OA\Property(
1237 * property="mname",
1238 * description="patient middle name",
1239 * type="string",
1240 * ),
1241 * @OA\Property(
1242 * property="lname",
1243 * description="patient last name",
1244 * type="string",
1245 * ),
1246 * @OA\Property(
1247 * property="ss",
1248 * description="patient social security number",
1249 * type="string",
1250 * ),
1251 * @OA\Property(
1252 * property="street",
1253 * description="patient street address",
1254 * type="string",
1255 * ),
1256 * @OA\Property(
1257 * property="postal_code",
1258 * description="patient postal code",
1259 * type="string",
1260 * ),
1261 * @OA\Property(
1262 * property="city",
1263 * description="patient city",
1264 * type="string",
1265 * ),
1266 * @OA\Property(
1267 * property="state",
1268 * description="patient state",
1269 * type="string",
1270 * ),
1271 * @OA\Property(
1272 * property="county",
1273 * description="patient county",
1274 * type="string",
1275 * ),
1276 * @OA\Property(
1277 * property="country_code",
1278 * description="patient country code",
1279 * type="string",
1280 * ),
1281 * @OA\Property(
1282 * property="drivers_license",
1283 * description="patient drivers license id",
1284 * type="string",
1285 * ),
1286 * @OA\Property(
1287 * property="contact_relationship",
1288 * description="patient contact relationship",
1289 * type="string",
1290 * ),
1291 * @OA\Property(
1292 * property="phone_contact",
1293 * description="patient phone contact",
1294 * type="string",
1295 * ),
1296 * @OA\Property(
1297 * property="phone_home",
1298 * description="patient home phone",
1299 * type="string",
1300 * ),
1301 * @OA\Property(
1302 * property="phone_biz",
1303 * description="patient work phone",
1304 * type="string",
1305 * ),
1306 * @OA\Property(
1307 * property="phone_cell",
1308 * description="patient mobile phone",
1309 * type="string",
1310 * ),
1311 * @OA\Property(
1312 * property="email",
1313 * description="patient email",
1314 * type="string",
1315 * ),
1316 * @OA\Property(
1317 * property="DOB",
1318 * description="patient DOB",
1319 * type="string",
1320 * ),
1321 * @OA\Property(
1322 * property="sex",
1323 * description="patient sex (gender)",
1324 * type="string",
1325 * ),
1326 * @OA\Property(
1327 * property="race",
1328 * description="patient race",
1329 * type="string",
1330 * ),
1331 * @OA\Property(
1332 * property="ethnicity",
1333 * description="patient ethnicity",
1334 * type="string",
1335 * ),
1336 * @OA\Property(
1337 * property="status",
1338 * description="patient status",
1339 * type="string",
1340 * ),
1341 * ),
1342 * ),
1343 * example={
1344 * "validationErrors": {},
1345 * "error_description": {},
1346 * "data": {
1347 * "id": "193",
1348 * "pid": "1",
1349 * "pubpid": "",
1350 * "title": "Mr",
1351 * "fname": "Baz",
1352 * "mname": "",
1353 * "lname": "Bop",
1354 * "ss": "",
1355 * "street": "456 Tree Lane",
1356 * "postal_code": "08642",
1357 * "city": "FooTown",
1358 * "state": "FL",
1359 * "county": "",
1360 * "country_code": "US",
1361 * "drivers_license": "",
1362 * "contact_relationship": "",
1363 * "phone_contact": "123-456-7890",
1364 * "phone_home": "",
1365 * "phone_biz": "",
1366 * "phone_cell": "",
1367 * "email": "",
1368 * "DOB": "1992-02-03",
1369 * "sex": "Male",
1370 * "race": "",
1371 * "ethnicity": "",
1372 * "status": ""
1378 * @OA\Put(
1379 * path="/api/patient/{puuid}",
1380 * description="Updates a patient",
1381 * tags={"standard"},
1382 * @OA\Parameter(
1383 * name="puuid",
1384 * in="path",
1385 * description="The uuid for the patient.",
1386 * required=true,
1387 * @OA\Schema(
1388 * type="string"
1390 * ),
1391 * @OA\RequestBody(
1392 * required=true,
1393 * @OA\MediaType(
1394 * mediaType="application/json",
1395 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1397 * ),
1398 * @OA\Response(
1399 * response="200",
1400 * description="Standard response",
1401 * @OA\MediaType(
1402 * mediaType="application/json",
1403 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1405 * ),
1406 * @OA\Response(
1407 * response="401",
1408 * ref="#/components/responses/unauthorized"
1409 * ),
1410 * security={{"openemr_auth":{}}}
1413 "PUT /api/patient/:puuid" => function ($puuid) {
1414 RestConfig::authorization_check("patients", "demo");
1415 $data = (array) (json_decode(file_get_contents("php://input")));
1416 $return = (new PatientRestController())->put($puuid, $data);
1417 RestConfig::apiLog($return, $data);
1418 return $return;
1422 * @OA\Get(
1423 * path="/api/patient/{puuid}",
1424 * description="Retrieves a single patient by their uuid",
1425 * tags={"standard"},
1426 * @OA\Parameter(
1427 * name="puuid",
1428 * in="path",
1429 * description="The uuid for the patient.",
1430 * required=true,
1431 * @OA\Schema(
1432 * type="string"
1434 * ),
1435 * @OA\Response(
1436 * response="200",
1437 * description="Standard response",
1438 * @OA\MediaType(
1439 * mediaType="application/json",
1440 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1442 * ),
1443 * @OA\Response(
1444 * response="401",
1445 * ref="#/components/responses/unauthorized"
1446 * ),
1447 * security={{"openemr_auth":{}}}
1450 "GET /api/patient/:puuid" => function ($puuid) {
1451 RestConfig::authorization_check("patients", "demo");
1452 $return = (new PatientRestController())->getOne($puuid);
1453 RestConfig::apiLog($return);
1454 return $return;
1458 * @OA\Get(
1459 * path="/api/patient/{puuid}/encounter",
1460 * description="Retrieves a list of encounters for a single patient",
1461 * tags={"standard"},
1462 * @OA\Parameter(
1463 * name="puuid",
1464 * in="path",
1465 * description="The uuid for the patient.",
1466 * required=true,
1467 * @OA\Schema(
1468 * type="string"
1470 * ),
1471 * @OA\Response(
1472 * response="200",
1473 * ref="#/components/responses/standard"
1474 * ),
1475 * @OA\Response(
1476 * response="400",
1477 * ref="#/components/responses/badrequest"
1478 * ),
1479 * @OA\Response(
1480 * response="401",
1481 * ref="#/components/responses/unauthorized"
1482 * ),
1483 * security={{"openemr_auth":{}}}
1486 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1487 RestConfig::authorization_check("encounters", "auth_a");
1488 $return = (new EncounterRestController())->getAll($puuid);
1489 RestConfig::apiLog($return);
1490 return $return;
1494 * Schema for the encounter request
1496 * @OA\Schema(
1497 * schema="api_encounter_request",
1498 * @OA\Property(
1499 * property="date",
1500 * description="The date of encounter.",
1501 * type="string"
1502 * ),
1503 * @OA\Property(
1504 * property="onset_date",
1505 * description="The onset date of encounter.",
1506 * type="string"
1507 * ),
1508 * @OA\Property(
1509 * property="reason",
1510 * description="The reason of encounter.",
1511 * type="string"
1512 * ),
1513 * @OA\Property(
1514 * property="facility",
1515 * description="The facility of encounter.",
1516 * type="string"
1517 * ),
1518 * @OA\Property(
1519 * property="pc_catid",
1520 * description="The pc_catid of encounter.",
1521 * type="string"
1522 * ),
1523 * @OA\Property(
1524 * property="facility_id",
1525 * description="The facility id of encounter.",
1526 * type="string"
1527 * ),
1528 * @OA\Property(
1529 * property="billing_facility",
1530 * description="The billing facility id of encounter.",
1531 * type="string"
1532 * ),
1533 * @OA\Property(
1534 * property="sensitivity",
1535 * description="The sensitivity of encounter.",
1536 * type="string"
1537 * ),
1538 * @OA\Property(
1539 * property="referral_source",
1540 * description="The referral source of encounter.",
1541 * type="string"
1542 * ),
1543 * @OA\Property(
1544 * property="pos_code",
1545 * description="The pos_code of encounter.",
1546 * type="string"
1547 * ),
1548 * @OA\Property(
1549 * property="external_id",
1550 * description="The external id of encounter.",
1551 * type="string"
1552 * ),
1553 * @OA\Property(
1554 * property="provider_id",
1555 * description="The provider id of encounter.",
1556 * type="string"
1557 * ),
1558 * @OA\Property(
1559 * property="class_code",
1560 * description="The class_code of encounter.",
1561 * type="string"
1562 * ),
1563 * required={"pc_catid", "class_code"},
1564 * example={
1565 * "date":"2020-11-10",
1566 * "onset_date": "",
1567 * "reason": "Pregnancy Test",
1568 * "facility": "Owerri General Hospital",
1569 * "pc_catid": "5",
1570 * "facility_id": "3",
1571 * "billing_facility": "3",
1572 * "sensitivity": "normal",
1573 * "referral_source": "",
1574 * "pos_code": "0",
1575 * "external_id": "",
1576 * "provider_id": "1",
1577 * "class_code" : "AMB"
1582 * @OA\Post(
1583 * path="/api/patient/{puuid}/encounter",
1584 * description="Creates a new encounter",
1585 * tags={"standard"},
1586 * @OA\Parameter(
1587 * name="puuid",
1588 * in="path",
1589 * description="The uuid for the patient.",
1590 * required=true,
1591 * @OA\Schema(
1592 * type="string"
1594 * ),
1595 * @OA\RequestBody(
1596 * required=true,
1597 * @OA\MediaType(
1598 * mediaType="application/json",
1599 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1601 * ),
1602 * @OA\Response(
1603 * response="200",
1604 * description="Standard response",
1605 * @OA\MediaType(
1606 * mediaType="application/json",
1607 * @OA\Schema(
1608 * @OA\Property(
1609 * property="validationErrors",
1610 * description="Validation errors.",
1611 * type="array",
1612 * @OA\Items(
1613 * type="object",
1614 * ),
1615 * ),
1616 * @OA\Property(
1617 * property="internalErrors",
1618 * description="Internal errors.",
1619 * type="array",
1620 * @OA\Items(
1621 * type="object",
1622 * ),
1623 * ),
1624 * @OA\Property(
1625 * property="data",
1626 * description="Returned data.",
1627 * type="array",
1628 * @OA\Items(
1629 * @OA\Property(
1630 * property="encounter",
1631 * description="encounter id",
1632 * type="integer",
1633 * ),
1634 * @OA\Property(
1635 * property="uuid",
1636 * description="encounter uuid",
1637 * type="string",
1639 * ),
1640 * ),
1641 * example={
1642 * "validationErrors": {},
1643 * "error_description": {},
1644 * "data": {
1645 * "encounter": 1,
1646 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1651 * ),
1652 * @OA\Response(
1653 * response="401",
1654 * ref="#/components/responses/unauthorized"
1655 * ),
1656 * security={{"openemr_auth":{}}}
1659 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1660 RestConfig::authorization_check("encounters", "auth_a");
1661 $data = (array) (json_decode(file_get_contents("php://input")));
1662 $return = (new EncounterRestController())->post($puuid, $data);
1663 RestConfig::apiLog($return, $data);
1664 return $return;
1668 * Schema for the encounter response
1670 * @OA\Schema(
1671 * schema="api_encounter_response",
1672 * @OA\Property(
1673 * property="validationErrors",
1674 * description="Validation errors.",
1675 * type="array",
1676 * @OA\Items(
1677 * type="object",
1678 * ),
1679 * ),
1680 * @OA\Property(
1681 * property="internalErrors",
1682 * description="Internal errors.",
1683 * type="array",
1684 * @OA\Items(
1685 * type="object",
1686 * ),
1687 * ),
1688 * @OA\Property(
1689 * property="data",
1690 * description="Returned data.",
1691 * type="array",
1692 * @OA\Items(
1693 * @OA\Property(
1694 * property="id",
1695 * description="encounter id",
1696 * type="string",
1697 * ),
1698 * @OA\Property(
1699 * property="uuid",
1700 * description="encounter uuid",
1701 * type="string",
1702 * ),
1703 * @OA\Property(
1704 * property="date",
1705 * description="encounter date",
1706 * type="string",
1707 * ),
1708 * @OA\Property(
1709 * property="reason",
1710 * description="encounter reason",
1711 * type="string",
1712 * ),
1713 * @OA\Property(
1714 * property="facility",
1715 * description="encounter facility name",
1716 * type="string",
1717 * ),
1718 * @OA\Property(
1719 * property="facility_id",
1720 * description="encounter facility id name",
1721 * type="string",
1722 * ),
1723 * @OA\Property(
1724 * property="pid",
1725 * description="encounter for patient pid",
1726 * type="string",
1727 * ),
1728 * @OA\Property(
1729 * property="onset_date",
1730 * description="encounter onset date",
1731 * type="string",
1732 * ),
1733 * @OA\Property(
1734 * property="sensitivity",
1735 * description="encounter sensitivity",
1736 * type="string",
1737 * ),
1738 * @OA\Property(
1739 * property="billing_note",
1740 * description="encounter billing note",
1741 * type="string",
1742 * ),
1743 * @OA\Property(
1744 * property="pc_catid",
1745 * description="encounter pc_catid",
1746 * type="string",
1747 * ),
1748 * @OA\Property(
1749 * property="last_level_billed",
1750 * description="encounter last_level_billed",
1751 * type="string",
1752 * ),
1753 * @OA\Property(
1754 * property="last_level_closed",
1755 * description="encounter last_level_closed",
1756 * type="string",
1757 * ),
1758 * @OA\Property(
1759 * property="last_stmt_date",
1760 * description="encounter last_stmt_date",
1761 * type="string",
1762 * ),
1763 * @OA\Property(
1764 * property="stmt_count",
1765 * description="encounter stmt_count",
1766 * type="string",
1767 * ),
1768 * @OA\Property(
1769 * property="provider_id",
1770 * description="provider id",
1771 * type="string",
1772 * ),
1773 * @OA\Property(
1774 * property="supervisor_id",
1775 * description="encounter supervisor id",
1776 * type="string",
1777 * ),
1778 * @OA\Property(
1779 * property="invoice_refno",
1780 * description="encounter invoice_refno",
1781 * type="string",
1782 * ),
1783 * @OA\Property(
1784 * property="referral_source",
1785 * description="encounter referral source",
1786 * type="string",
1787 * ),
1788 * @OA\Property(
1789 * property="billing_facility",
1790 * description="encounter billing facility id",
1791 * type="string",
1792 * ),
1793 * @OA\Property(
1794 * property="external_id",
1795 * description="encounter external id",
1796 * type="string",
1797 * ),
1798 * @OA\Property(
1799 * property="pos_code",
1800 * description="encounter pos_code",
1801 * type="string",
1802 * ),
1803 * @OA\Property(
1804 * property="class_code",
1805 * description="encounter class_code",
1806 * type="string",
1807 * ),
1808 * @OA\Property(
1809 * property="class_title",
1810 * description="encounter class_title",
1811 * type="string",
1812 * ),
1813 * @OA\Property(
1814 * property="pc_catname",
1815 * description="encounter pc_catname",
1816 * type="string",
1817 * ),
1818 * @OA\Property(
1819 * property="billing_facility_name",
1820 * description="encounter billing facility name",
1821 * type="string",
1822 * ),
1823 * ),
1824 * ),
1825 * example={
1826 * "validationErrors": {},
1827 * "error_description": {},
1828 * "data": {
1829 * "id": "1",
1830 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1831 * "date": "2019-09-14 00:00:00",
1832 * "reason": "Pregnancy Test",
1833 * "facility": "Owerri General Hospital",
1834 * "facility_id": "3",
1835 * "pid": "1",
1836 * "onset_date": "2019-04-20 00:00:00",
1837 * "sensitivity": "normal",
1838 * "billing_note": null,
1839 * "pc_catid": "5",
1840 * "last_level_billed": "0",
1841 * "last_level_closed": "0",
1842 * "last_stmt_date": null,
1843 * "stmt_count": "0",
1844 * "provider_id": "1",
1845 * "supervisor_id": "0",
1846 * "invoice_refno": "",
1847 * "referral_source": "",
1848 * "billing_facility": "3",
1849 * "external_id": "",
1850 * "pos_code": "0",
1851 * "class_code": "AMB",
1852 * "class_title": "ambulatory",
1853 * "pc_catname": "Office Visit",
1854 * "billing_facility_name": "Owerri General Hospital"
1860 * @OA\Put(
1861 * path="/api/patient/{puuid}/encounter/{euuid}",
1862 * description="Modify a encounter",
1863 * tags={"standard"},
1864 * @OA\Parameter(
1865 * name="puuid",
1866 * in="path",
1867 * description="The uuid for the patient.",
1868 * required=true,
1869 * @OA\Schema(
1870 * type="string"
1872 * ),
1873 * @OA\Parameter(
1874 * name="euuid",
1875 * in="path",
1876 * description="The uuid for the encounter.",
1877 * required=true,
1878 * @OA\Schema(
1879 * type="string"
1881 * ),
1882 * @OA\RequestBody(
1883 * required=true,
1884 * @OA\MediaType(
1885 * mediaType="application/json",
1886 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1888 * ),
1889 * @OA\Response(
1890 * response="200",
1891 * description="Standard response",
1892 * @OA\MediaType(
1893 * mediaType="application/json",
1894 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1896 * ),
1897 * @OA\Response(
1898 * response="401",
1899 * ref="#/components/responses/unauthorized"
1900 * ),
1901 * security={{"openemr_auth":{}}}
1904 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1905 RestConfig::authorization_check("encounters", "auth_a");
1906 $data = (array) (json_decode(file_get_contents("php://input")));
1907 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1908 RestConfig::apiLog($return, $data);
1909 return $return;
1913 * @OA\Get(
1914 * path="/api/patient/{puuid}/encounter/{euuid}",
1915 * description="Retrieves a single encounter for a patient",
1916 * tags={"standard"},
1917 * @OA\Parameter(
1918 * name="puuid",
1919 * in="path",
1920 * description="The uuid for the patient.",
1921 * required=true,
1922 * @OA\Schema(
1923 * type="string"
1925 * ),
1926 * @OA\Parameter(
1927 * name="euuid",
1928 * in="path",
1929 * description="The uuid for the encounter.",
1930 * required=true,
1931 * @OA\Schema(
1932 * type="string"
1934 * ),
1935 * @OA\Response(
1936 * response="200",
1937 * description="Standard response",
1938 * @OA\MediaType(
1939 * mediaType="application/json",
1940 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1942 * ),
1943 * @OA\Response(
1944 * response="401",
1945 * ref="#/components/responses/unauthorized"
1946 * ),
1947 * security={{"openemr_auth":{}}}
1950 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1951 RestConfig::authorization_check("encounters", "auth_a");
1952 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1953 RestConfig::apiLog($return);
1954 return $return;
1958 * @OA\Get(
1959 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1960 * description="Retrieves soap notes from an encounter for a patient",
1961 * tags={"standard"},
1962 * @OA\Parameter(
1963 * name="pid",
1964 * in="path",
1965 * description="The pid for the patient.",
1966 * required=true,
1967 * @OA\Schema(
1968 * type="string"
1970 * ),
1971 * @OA\Parameter(
1972 * name="eid",
1973 * in="path",
1974 * description="The id for the encounter.",
1975 * required=true,
1976 * @OA\Schema(
1977 * type="string"
1979 * ),
1980 * @OA\Response(
1981 * response="200",
1982 * ref="#/components/responses/standard"
1983 * ),
1984 * @OA\Response(
1985 * response="400",
1986 * ref="#/components/responses/badrequest"
1987 * ),
1988 * @OA\Response(
1989 * response="401",
1990 * ref="#/components/responses/unauthorized"
1991 * ),
1992 * security={{"openemr_auth":{}}}
1995 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1996 RestConfig::authorization_check("encounters", "notes");
1997 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1998 RestConfig::apiLog($return);
1999 return $return;
2003 * Schema for the vital request
2005 * @OA\Schema(
2006 * schema="api_vital_request",
2007 * @OA\Property(
2008 * property="bps",
2009 * description="The bps of vitals.",
2010 * type="string"
2011 * ),
2012 * @OA\Property(
2013 * property="bpd",
2014 * description="The bpd of vitals.",
2015 * type="string"
2016 * ),
2017 * @OA\Property(
2018 * property="weight",
2019 * description="The weight of vitals. (unit is lb)",
2020 * type="string"
2021 * ),
2022 * @OA\Property(
2023 * property="height",
2024 * description="The height of vitals. (unit is inches)",
2025 * type="string"
2026 * ),
2027 * @OA\Property(
2028 * property="temperature",
2029 * description="The temperature of temperature. (unit is F)",
2030 * type="string"
2031 * ),
2032 * @OA\Property(
2033 * property="temp_method",
2034 * description="The temp_method of vitals.",
2035 * type="string"
2036 * ),
2037 * @OA\Property(
2038 * property="pulse",
2039 * description="The pulse of vitals.",
2040 * type="string"
2041 * ),
2042 * @OA\Property(
2043 * property="respiration",
2044 * description="The respiration of vitals.",
2045 * type="string"
2046 * ),
2047 * @OA\Property(
2048 * property="note",
2049 * description="The note (ie. comments) of vitals.",
2050 * type="string"
2051 * ),
2052 * @OA\Property(
2053 * property="waist_circ",
2054 * description="The waist circumference of vitals. (unit is inches)",
2055 * type="string"
2056 * ),
2057 * @OA\Property(
2058 * property="head_circ",
2059 * description="The head circumference of vitals. (unit is inches)",
2060 * type="string"
2061 * ),
2062 * @OA\Property(
2063 * property="oxygen_saturation",
2064 * description="The oxygen_saturation of vitals.",
2065 * type="string"
2066 * ),
2067 * example={
2068 * "bps": "130",
2069 * "bpd": "80",
2070 * "weight": "220",
2071 * "height": "70",
2072 * "temperature": "98",
2073 * "temp_method": "Oral",
2074 * "pulse": "60",
2075 * "respiration": "20",
2076 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2077 * "waist_circ": "37",
2078 * "head_circ": "22.2",
2079 * "oxygen_saturation": "96"
2084 * @OA\Post(
2085 * path="/api/patient/{pid}/encounter/{eid}/vital",
2086 * description="Submits a new vitals form",
2087 * tags={"standard"},
2088 * @OA\Parameter(
2089 * name="pid",
2090 * in="path",
2091 * description="The id for the patient.",
2092 * required=true,
2093 * @OA\Schema(
2094 * type="string"
2096 * ),
2097 * @OA\Parameter(
2098 * name="eid",
2099 * in="path",
2100 * description="The id for the encounter.",
2101 * required=true,
2102 * @OA\Schema(
2103 * type="string"
2105 * ),
2106 * @OA\RequestBody(
2107 * required=true,
2108 * @OA\MediaType(
2109 * mediaType="application/json",
2110 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2112 * ),
2113 * @OA\Response(
2114 * response="200",
2115 * ref="#/components/responses/standard"
2116 * ),
2117 * @OA\Response(
2118 * response="400",
2119 * ref="#/components/responses/badrequest"
2120 * ),
2121 * @OA\Response(
2122 * response="401",
2123 * ref="#/components/responses/unauthorized"
2124 * ),
2125 * security={{"openemr_auth":{}}}
2128 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2129 RestConfig::authorization_check("encounters", "notes");
2130 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2131 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2132 RestConfig::apiLog($return, $data);
2133 return $return;
2137 * @OA\Put(
2138 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2139 * description="Edit a vitals form",
2140 * tags={"standard"},
2141 * @OA\Parameter(
2142 * name="pid",
2143 * in="path",
2144 * description="The id for the patient.",
2145 * required=true,
2146 * @OA\Schema(
2147 * type="string"
2149 * ),
2150 * @OA\Parameter(
2151 * name="eid",
2152 * in="path",
2153 * description="The id for the encounter.",
2154 * required=true,
2155 * @OA\Schema(
2156 * type="string"
2158 * ),
2159 * @OA\Parameter(
2160 * name="vid",
2161 * in="path",
2162 * description="The id for the vitalss form.",
2163 * required=true,
2164 * @OA\Schema(
2165 * type="string"
2167 * ),
2168 * @OA\RequestBody(
2169 * required=true,
2170 * @OA\MediaType(
2171 * mediaType="application/json",
2172 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2174 * ),
2175 * @OA\Response(
2176 * response="200",
2177 * ref="#/components/responses/standard"
2178 * ),
2179 * @OA\Response(
2180 * response="400",
2181 * ref="#/components/responses/badrequest"
2182 * ),
2183 * @OA\Response(
2184 * response="401",
2185 * ref="#/components/responses/unauthorized"
2186 * ),
2187 * security={{"openemr_auth":{}}}
2190 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2191 RestConfig::authorization_check("encounters", "notes");
2192 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2193 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2194 RestConfig::apiLog($return, $data);
2195 return $return;
2199 * @OA\Get(
2200 * path="/api/patient/{pid}/encounter/{eid}/vital",
2201 * description="Retrieves all vitals from an encounter for a patient",
2202 * tags={"standard"},
2203 * @OA\Parameter(
2204 * name="pid",
2205 * in="path",
2206 * description="The pid for the patient.",
2207 * required=true,
2208 * @OA\Schema(
2209 * type="string"
2211 * ),
2212 * @OA\Parameter(
2213 * name="eid",
2214 * in="path",
2215 * description="The id for the encounter.",
2216 * required=true,
2217 * @OA\Schema(
2218 * type="string"
2220 * ),
2221 * @OA\Response(
2222 * response="200",
2223 * ref="#/components/responses/standard"
2224 * ),
2225 * @OA\Response(
2226 * response="400",
2227 * ref="#/components/responses/badrequest"
2228 * ),
2229 * @OA\Response(
2230 * response="401",
2231 * ref="#/components/responses/unauthorized"
2232 * ),
2233 * security={{"openemr_auth":{}}}
2236 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2237 RestConfig::authorization_check("encounters", "notes");
2238 $return = (new EncounterRestController())->getVitals($pid, $eid);
2239 RestConfig::apiLog($return);
2240 return $return;
2244 * @OA\Get(
2245 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2246 * description="Retrieves a vitals form from an encounter for a patient",
2247 * tags={"standard"},
2248 * @OA\Parameter(
2249 * name="pid",
2250 * in="path",
2251 * description="The pid for the patient.",
2252 * required=true,
2253 * @OA\Schema(
2254 * type="string"
2256 * ),
2257 * @OA\Parameter(
2258 * name="eid",
2259 * in="path",
2260 * description="The id for the encounter.",
2261 * required=true,
2262 * @OA\Schema(
2263 * type="string"
2265 * ),
2266 * @OA\Parameter(
2267 * name="vid",
2268 * in="path",
2269 * description="The id for the vitals form.",
2270 * required=true,
2271 * @OA\Schema(
2272 * type="string"
2274 * ),
2275 * @OA\Response(
2276 * response="200",
2277 * ref="#/components/responses/standard"
2278 * ),
2279 * @OA\Response(
2280 * response="400",
2281 * ref="#/components/responses/badrequest"
2282 * ),
2283 * @OA\Response(
2284 * response="401",
2285 * ref="#/components/responses/unauthorized"
2286 * ),
2287 * security={{"openemr_auth":{}}}
2290 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2291 RestConfig::authorization_check("encounters", "notes");
2292 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2293 RestConfig::apiLog($return);
2294 return $return;
2298 * @OA\Get(
2299 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2300 * description="Retrieves a soap note from an encounter for a patient",
2301 * tags={"standard"},
2302 * @OA\Parameter(
2303 * name="pid",
2304 * in="path",
2305 * description="The pid for the patient.",
2306 * required=true,
2307 * @OA\Schema(
2308 * type="string"
2310 * ),
2311 * @OA\Parameter(
2312 * name="eid",
2313 * in="path",
2314 * description="The id for the encounter.",
2315 * required=true,
2316 * @OA\Schema(
2317 * type="string"
2319 * ),
2320 * @OA\Parameter(
2321 * name="sid",
2322 * in="path",
2323 * description="The id for the soap note.",
2324 * required=true,
2325 * @OA\Schema(
2326 * type="string"
2328 * ),
2329 * @OA\Response(
2330 * response="200",
2331 * ref="#/components/responses/standard"
2332 * ),
2333 * @OA\Response(
2334 * response="400",
2335 * ref="#/components/responses/badrequest"
2336 * ),
2337 * @OA\Response(
2338 * response="401",
2339 * ref="#/components/responses/unauthorized"
2340 * ),
2341 * security={{"openemr_auth":{}}}
2344 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2345 RestConfig::authorization_check("encounters", "notes");
2346 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2347 RestConfig::apiLog($return);
2348 return $return;
2352 * Schema for the soap_note request
2354 * @OA\Schema(
2355 * schema="api_soap_note_request",
2356 * @OA\Property(
2357 * property="subjective",
2358 * description="The subjective of soap note.",
2359 * type="string"
2360 * ),
2361 * @OA\Property(
2362 * property="objective",
2363 * description="The objective of soap note.",
2364 * type="string"
2365 * ),
2366 * @OA\Property(
2367 * property="assessment",
2368 * description="The assessment of soap note.",
2369 * type="string"
2370 * ),
2371 * @OA\Property(
2372 * property="plan",
2373 * description="The plan of soap note.",
2374 * type="string"
2375 * ),
2376 * example={
2377 * "subjective": "The patient with mechanical fall and cut finger.",
2378 * "objective": "The patient with finger laceration on exam.",
2379 * "assessment": "The patient with finger laceration requiring sutures.",
2380 * "plan": "Sutured finger laceration."
2385 * @OA\Post(
2386 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2387 * description="Submits a new soap note",
2388 * tags={"standard"},
2389 * @OA\Parameter(
2390 * name="pid",
2391 * in="path",
2392 * description="The id for the patient.",
2393 * required=true,
2394 * @OA\Schema(
2395 * type="string"
2397 * ),
2398 * @OA\Parameter(
2399 * name="eid",
2400 * in="path",
2401 * description="The id for the encounter.",
2402 * required=true,
2403 * @OA\Schema(
2404 * type="string"
2406 * ),
2407 * @OA\RequestBody(
2408 * required=true,
2409 * @OA\MediaType(
2410 * mediaType="application/json",
2411 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2413 * ),
2414 * @OA\Response(
2415 * response="200",
2416 * ref="#/components/responses/standard"
2417 * ),
2418 * @OA\Response(
2419 * response="400",
2420 * ref="#/components/responses/badrequest"
2421 * ),
2422 * @OA\Response(
2423 * response="401",
2424 * ref="#/components/responses/unauthorized"
2425 * ),
2426 * security={{"openemr_auth":{}}}
2429 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2430 RestConfig::authorization_check("encounters", "notes");
2431 $data = (array) (json_decode(file_get_contents("php://input")));
2432 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2433 RestConfig::apiLog($return, $data);
2434 return $return;
2438 * @OA\Put(
2439 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2440 * description="Edit a soap note",
2441 * tags={"standard"},
2442 * @OA\Parameter(
2443 * name="pid",
2444 * in="path",
2445 * description="The id for the patient.",
2446 * required=true,
2447 * @OA\Schema(
2448 * type="string"
2450 * ),
2451 * @OA\Parameter(
2452 * name="eid",
2453 * in="path",
2454 * description="The id for the encounter.",
2455 * required=true,
2456 * @OA\Schema(
2457 * type="string"
2459 * ),
2460 * @OA\Parameter(
2461 * name="sid",
2462 * in="path",
2463 * description="The id for the soap noted.",
2464 * required=true,
2465 * @OA\Schema(
2466 * type="string"
2468 * ),
2469 * @OA\RequestBody(
2470 * required=true,
2471 * @OA\MediaType(
2472 * mediaType="application/json",
2473 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2475 * ),
2476 * @OA\Response(
2477 * response="200",
2478 * ref="#/components/responses/standard"
2479 * ),
2480 * @OA\Response(
2481 * response="400",
2482 * ref="#/components/responses/badrequest"
2483 * ),
2484 * @OA\Response(
2485 * response="401",
2486 * ref="#/components/responses/unauthorized"
2487 * ),
2488 * security={{"openemr_auth":{}}}
2491 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2492 RestConfig::authorization_check("encounters", "notes");
2493 $data = (array) (json_decode(file_get_contents("php://input")));
2494 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2495 RestConfig::apiLog($return, $data);
2496 return $return;
2501 * @OA\Get(
2502 * path="/api/practitioner",
2503 * description="Retrieves a list of practitioners",
2504 * tags={"standard"},
2505 * @OA\Parameter(
2506 * name="title",
2507 * in="query",
2508 * description="The title for the practitioner.",
2509 * required=false,
2510 * @OA\Schema(
2511 * type="string"
2513 * ),
2514 * @OA\Parameter(
2515 * name="fname",
2516 * in="query",
2517 * description="The first name for the practitioner.",
2518 * required=false,
2519 * @OA\Schema(
2520 * type="string"
2522 * ),
2523 * @OA\Parameter(
2524 * name="lname",
2525 * in="query",
2526 * description="The last name for the practitioner.",
2527 * required=false,
2528 * @OA\Schema(
2529 * type="string"
2531 * ),
2532 * @OA\Parameter(
2533 * name="mname",
2534 * in="query",
2535 * description="The middle name for the practitioner.",
2536 * required=false,
2537 * @OA\Schema(
2538 * type="string"
2540 * ),
2541 * @OA\Parameter(
2542 * name="federaltaxid",
2543 * in="query",
2544 * description="The federal tax id for the practitioner.",
2545 * required=false,
2546 * @OA\Schema(
2547 * type="string"
2549 * ),
2550 * @OA\Parameter(
2551 * name="federaldrugid",
2552 * in="query",
2553 * description="The federal drug id for the practitioner.",
2554 * required=false,
2555 * @OA\Schema(
2556 * type="string"
2558 * ),
2559 * @OA\Parameter(
2560 * name="upin",
2561 * in="query",
2562 * description="The upin for the practitioner.",
2563 * required=false,
2564 * @OA\Schema(
2565 * type="string"
2567 * ),
2568 * @OA\Parameter(
2569 * name="facility_id",
2570 * in="query",
2571 * description="The facility id for the practitioner.",
2572 * required=false,
2573 * @OA\Schema(
2574 * type="string"
2576 * ),
2577 * @OA\Parameter(
2578 * name="facility",
2579 * in="query",
2580 * description="The facility for the practitioner.",
2581 * required=false,
2582 * @OA\Schema(
2583 * type="string"
2585 * ),
2586 * @OA\Parameter(
2587 * name="npi",
2588 * in="query",
2589 * description="The npi for the practitioner.",
2590 * required=false,
2591 * @OA\Schema(
2592 * type="string"
2594 * ),
2595 * @OA\Parameter(
2596 * name="email",
2597 * in="query",
2598 * description="The email for the practitioner.",
2599 * required=false,
2600 * @OA\Schema(
2601 * type="string"
2603 * ),
2604 * @OA\Parameter(
2605 * name="specialty",
2606 * in="query",
2607 * description="The specialty for the practitioner.",
2608 * required=false,
2609 * @OA\Schema(
2610 * type="string"
2612 * ),
2613 * @OA\Parameter(
2614 * name="billname",
2615 * in="query",
2616 * description="The billname for the practitioner.",
2617 * required=false,
2618 * @OA\Schema(
2619 * type="string"
2621 * ),
2622 * @OA\Parameter(
2623 * name="url",
2624 * in="query",
2625 * description="The url for the practitioner.",
2626 * required=false,
2627 * @OA\Schema(
2628 * type="string"
2630 * ),
2631 * @OA\Parameter(
2632 * name="assistant",
2633 * in="query",
2634 * description="The assistant for the practitioner.",
2635 * required=false,
2636 * @OA\Schema(
2637 * type="string"
2639 * ),
2640 * @OA\Parameter(
2641 * name="organization",
2642 * in="query",
2643 * description="The organization for the practitioner.",
2644 * required=false,
2645 * @OA\Schema(
2646 * type="string"
2648 * ),
2649 * @OA\Parameter(
2650 * name="valedictory",
2651 * in="query",
2652 * description="The valedictory for the practitioner.",
2653 * required=false,
2654 * @OA\Schema(
2655 * type="string"
2657 * ),
2658 * @OA\Parameter(
2659 * name="street",
2660 * in="query",
2661 * description="The street for the practitioner.",
2662 * required=false,
2663 * @OA\Schema(
2664 * type="string"
2666 * ),
2667 * @OA\Parameter(
2668 * name="streetb",
2669 * in="query",
2670 * description="The street (line 2) for the practitioner.",
2671 * required=false,
2672 * @OA\Schema(
2673 * type="string"
2675 * ),
2676 * @OA\Parameter(
2677 * name="city",
2678 * in="query",
2679 * description="The city for the practitioner.",
2680 * required=false,
2681 * @OA\Schema(
2682 * type="string"
2684 * ),
2685 * @OA\Parameter(
2686 * name="state",
2687 * in="query",
2688 * description="The state for the practitioner.",
2689 * required=false,
2690 * @OA\Schema(
2691 * type="string"
2693 * ),
2694 * @OA\Parameter(
2695 * name="zip",
2696 * in="query",
2697 * description="The zip for the practitioner.",
2698 * required=false,
2699 * @OA\Schema(
2700 * type="string"
2702 * ),
2703 * @OA\Parameter(
2704 * name="phone",
2705 * in="query",
2706 * description="The phone for the practitioner.",
2707 * required=false,
2708 * @OA\Schema(
2709 * type="string"
2711 * ),
2712 * @OA\Parameter(
2713 * name="fax",
2714 * in="query",
2715 * description="The fax for the practitioner.",
2716 * required=false,
2717 * @OA\Schema(
2718 * type="string"
2720 * ),
2721 * @OA\Parameter(
2722 * name="phonew1",
2723 * in="query",
2724 * description="The phonew1 for the practitioner.",
2725 * required=false,
2726 * @OA\Schema(
2727 * type="string"
2729 * ),
2730 * @OA\Parameter(
2731 * name="phonecell",
2732 * in="query",
2733 * description="The phonecell for the practitioner.",
2734 * required=false,
2735 * @OA\Schema(
2736 * type="string"
2738 * ),
2739 * @OA\Parameter(
2740 * name="notes",
2741 * in="query",
2742 * description="The notes for the practitioner.",
2743 * required=false,
2744 * @OA\Schema(
2745 * type="string"
2747 * ),
2748 * @OA\Parameter(
2749 * name="state_license_number2",
2750 * in="query",
2751 * description="The state license number for the practitioner.",
2752 * required=false,
2753 * @OA\Schema(
2754 * type="string"
2756 * ),
2757 * @OA\Parameter(
2758 * name="username",
2759 * in="query",
2760 * description="The username for the practitioner.",
2761 * required=false,
2762 * @OA\Schema(
2763 * type="string"
2765 * ),
2766 * @OA\Response(
2767 * response="200",
2768 * ref="#/components/responses/standard"
2769 * ),
2770 * @OA\Response(
2771 * response="400",
2772 * ref="#/components/responses/badrequest"
2773 * ),
2774 * @OA\Response(
2775 * response="401",
2776 * ref="#/components/responses/unauthorized"
2777 * ),
2778 * security={{"openemr_auth":{}}}
2781 "GET /api/practitioner" => function () {
2782 RestConfig::authorization_check("admin", "users");
2783 $return = (new PractitionerRestController())->getAll($_GET);
2784 RestConfig::apiLog($return);
2785 return $return;
2789 * @OA\Get(
2790 * path="/api/practitioner/{pruuid}",
2791 * description="Retrieves a single practitioner by their uuid",
2792 * tags={"standard"},
2793 * @OA\Parameter(
2794 * name="pruuid",
2795 * in="path",
2796 * description="The uuid for the practitioner.",
2797 * required=true,
2798 * @OA\Schema(
2799 * type="string"
2801 * ),
2802 * @OA\Response(
2803 * response="200",
2804 * ref="#/components/responses/standard"
2805 * ),
2806 * @OA\Response(
2807 * response="400",
2808 * ref="#/components/responses/badrequest"
2809 * ),
2810 * @OA\Response(
2811 * response="401",
2812 * ref="#/components/responses/unauthorized"
2813 * ),
2814 * security={{"openemr_auth":{}}}
2817 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2818 RestConfig::authorization_check("admin", "users");
2819 $return = (new PractitionerRestController())->getOne($pruuid);
2820 RestConfig::apiLog($return);
2821 return $return;
2825 * @OA\Post(
2826 * path="/api/practitioner",
2827 * description="Submits a new practitioner",
2828 * tags={"standard"},
2829 * @OA\RequestBody(
2830 * required=true,
2831 * @OA\MediaType(
2832 * mediaType="application/json",
2833 * @OA\Schema(
2834 * @OA\Property(
2835 * property="title",
2836 * description="The title for the practitioner.",
2837 * type="string"
2838 * ),
2839 * @OA\Property(
2840 * property="fname",
2841 * description="The first name for the practitioner.",
2842 * type="string"
2843 * ),
2844 * @OA\Property(
2845 * property="mname",
2846 * description="The middle name for the practitioner.",
2847 * type="string"
2848 * ),
2849 * @OA\Property(
2850 * property="lname",
2851 * description="The last name for the practitioner.",
2852 * type="string"
2853 * ),
2854 * @OA\Property(
2855 * property="federaltaxid",
2856 * description="The federal tax id for the practitioner.",
2857 * type="string"
2858 * ),
2859 * @OA\Property(
2860 * property="federaldrugid",
2861 * description="The federal drug id for the practitioner.",
2862 * type="string"
2863 * ),
2864 * @OA\Property(
2865 * property="upin",
2866 * description="The upin for the practitioner.",
2867 * type="string"
2868 * ),
2869 * @OA\Property(
2870 * property="facility_id",
2871 * description="The facility_id for the practitioner.",
2872 * type="string"
2873 * ),
2874 * @OA\Property(
2875 * property="facility",
2876 * description="The facility name for the practitioner.",
2877 * type="string"
2878 * ),
2879 * @OA\Property(
2880 * property="npi",
2881 * description="The npi for the practitioner.",
2882 * type="string"
2883 * ),
2884 * @OA\Property(
2885 * property="email",
2886 * description="The email for the practitioner.",
2887 * type="string"
2888 * ),
2889 * @OA\Property(
2890 * property="specialty",
2891 * description="The specialty for the practitioner.",
2892 * type="string"
2893 * ),
2894 * @OA\Property(
2895 * property="billname",
2896 * description="The billname for the practitioner.",
2897 * type="string"
2898 * ),
2899 * @OA\Property(
2900 * property="url",
2901 * description="The url for the practitioner.",
2902 * type="string"
2903 * ),
2904 * @OA\Property(
2905 * property="assistant",
2906 * description="The assistant for the practitioner.",
2907 * type="string"
2908 * ),
2909 * @OA\Property(
2910 * property="valedictory",
2911 * description="The valedictory for the practitioner.",
2912 * type="string"
2913 * ),
2914 * @OA\Property(
2915 * property="street",
2916 * description="The street address for the practitioner.",
2917 * type="string"
2918 * ),
2919 * @OA\Property(
2920 * property="streetb",
2921 * description="The streetb address for the practitioner.",
2922 * type="string"
2923 * ),
2924 * @OA\Property(
2925 * property="city",
2926 * description="The city for the practitioner.",
2927 * type="string"
2928 * ),
2929 * @OA\Property(
2930 * property="state",
2931 * description="The state for the practitioner.",
2932 * type="string"
2933 * ),
2934 * @OA\Property(
2935 * property="zip",
2936 * description="The zip for the practitioner.",
2937 * type="string"
2938 * ),
2939 * @OA\Property(
2940 * property="phone",
2941 * description="The phone for the practitioner.",
2942 * type="string"
2943 * ),
2944 * @OA\Property(
2945 * property="fax",
2946 * description="The fax for the practitioner.",
2947 * type="string"
2948 * ),
2949 * @OA\Property(
2950 * property="phonew1",
2951 * description="The phonew1 for the practitioner.",
2952 * type="string"
2953 * ),
2954 * @OA\Property(
2955 * property="phonecell",
2956 * description="The phonecell for the practitioner.",
2957 * type="string"
2958 * ),
2959 * @OA\Property(
2960 * property="notes",
2961 * description="The notes for the practitioner.",
2962 * type="string"
2963 * ),
2964 * @OA\Property(
2965 * property="state_license_number",
2966 * description="The state license number for the practitioner.",
2967 * type="string"
2968 * ),
2969 * @OA\Property(
2970 * property="username",
2971 * description="The username for the practitioner.",
2972 * type="string"
2973 * ),
2974 * required={"fname", "lname", "npi"},
2975 * example={
2976 * "title": "Mrs.",
2977 * "fname": "Eduardo",
2978 * "mname": "Kathy",
2979 * "lname": "Perez",
2980 * "federaltaxid": "",
2981 * "federaldrugid": "",
2982 * "upin": "",
2983 * "facility_id": "3",
2984 * "facility": "Your Clinic Name Here",
2985 * "npi": "12345678901",
2986 * "email": "info@pennfirm.com",
2987 * "specialty": "",
2988 * "billname": null,
2989 * "url": null,
2990 * "assistant": null,
2991 * "organization": null,
2992 * "valedictory": null,
2993 * "street": "789 Third Avenue",
2994 * "streetb": "123 Cannaut Street",
2995 * "city": "San Diego",
2996 * "state": "CA",
2997 * "zip": "90210",
2998 * "phone": "(619) 555-9827",
2999 * "fax": null,
3000 * "phonew1": "(619) 555-7822",
3001 * "phonecell": "(619) 555-7821",
3002 * "notes": null,
3003 * "state_license_number": "123456",
3004 * "username": "eduardoperez"
3008 * ),
3009 * @OA\Response(
3010 * response="200",
3011 * description="Standard response",
3012 * @OA\MediaType(
3013 * mediaType="application/json",
3014 * @OA\Schema(
3015 * @OA\Property(
3016 * property="validationErrors",
3017 * description="Validation errors.",
3018 * type="array",
3019 * @OA\Items(
3020 * type="object",
3021 * ),
3022 * ),
3023 * @OA\Property(
3024 * property="internalErrors",
3025 * description="Internal errors.",
3026 * type="array",
3027 * @OA\Items(
3028 * type="object",
3029 * ),
3030 * ),
3031 * @OA\Property(
3032 * property="data",
3033 * description="Returned data.",
3034 * type="array",
3035 * @OA\Items(
3036 * @OA\Property(
3037 * property="id",
3038 * description="practitioner id",
3039 * type="integer",
3040 * ),
3041 * @OA\Property(
3042 * property="uuid",
3043 * description="practitioner uuid",
3044 * type="string",
3045 * ),
3046 * ),
3047 * ),
3048 * example={
3049 * "validationErrors": {},
3050 * "error_description": {},
3051 * "data": {
3052 * "id": 7,
3053 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3058 * ),
3059 * @OA\Response(
3060 * response="401",
3061 * ref="#/components/responses/unauthorized"
3062 * ),
3063 * security={{"openemr_auth":{}}}
3066 "POST /api/practitioner" => function () {
3067 RestConfig::authorization_check("admin", "users");
3068 $data = (array) (json_decode(file_get_contents("php://input")));
3069 $return = (new PractitionerRestController())->post($data);
3070 RestConfig::apiLog($return, $data);
3071 return $return;
3075 * @OA\Put(
3076 * path="/api/practitioner/{pruuid}",
3077 * description="Edit a practitioner",
3078 * tags={"standard"},
3079 * @OA\Parameter(
3080 * name="pruuid",
3081 * in="path",
3082 * description="The uuid for the practitioner.",
3083 * required=true,
3084 * @OA\Schema(
3085 * type="string"
3087 * ),
3088 * @OA\RequestBody(
3089 * required=true,
3090 * @OA\MediaType(
3091 * mediaType="application/json",
3092 * @OA\Schema(
3093 * @OA\Property(
3094 * property="title",
3095 * description="The title for the practitioner.",
3096 * type="string"
3097 * ),
3098 * @OA\Property(
3099 * property="fname",
3100 * description="The first name for the practitioner.",
3101 * type="string"
3102 * ),
3103 * @OA\Property(
3104 * property="mname",
3105 * description="The middle name for the practitioner.",
3106 * type="string"
3107 * ),
3108 * @OA\Property(
3109 * property="lname",
3110 * description="The last name for the practitioner.",
3111 * type="string"
3112 * ),
3113 * @OA\Property(
3114 * property="federaltaxid",
3115 * description="The federal tax id for the practitioner.",
3116 * type="string"
3117 * ),
3118 * @OA\Property(
3119 * property="federaldrugid",
3120 * description="The federal drug id for the practitioner.",
3121 * type="string"
3122 * ),
3123 * @OA\Property(
3124 * property="upin",
3125 * description="The upin for the practitioner.",
3126 * type="string"
3127 * ),
3128 * @OA\Property(
3129 * property="facility_id",
3130 * description="The facility_id for the practitioner.",
3131 * type="string"
3132 * ),
3133 * @OA\Property(
3134 * property="facility",
3135 * description="The facility name for the practitioner.",
3136 * type="string"
3137 * ),
3138 * @OA\Property(
3139 * property="npi",
3140 * description="The npi for the practitioner.",
3141 * type="string"
3142 * ),
3143 * @OA\Property(
3144 * property="email",
3145 * description="The email for the practitioner.",
3146 * type="string"
3147 * ),
3148 * @OA\Property(
3149 * property="specialty",
3150 * description="The specialty for the practitioner.",
3151 * type="string"
3152 * ),
3153 * @OA\Property(
3154 * property="billname",
3155 * description="The billname for the practitioner.",
3156 * type="string"
3157 * ),
3158 * @OA\Property(
3159 * property="url",
3160 * description="The url for the practitioner.",
3161 * type="string"
3162 * ),
3163 * @OA\Property(
3164 * property="assistant",
3165 * description="The assistant for the practitioner.",
3166 * type="string"
3167 * ),
3168 * @OA\Property(
3169 * property="valedictory",
3170 * description="The valedictory for the practitioner.",
3171 * type="string"
3172 * ),
3173 * @OA\Property(
3174 * property="street",
3175 * description="The street address for the practitioner.",
3176 * type="string"
3177 * ),
3178 * @OA\Property(
3179 * property="streetb",
3180 * description="The streetb address for the practitioner.",
3181 * type="string"
3182 * ),
3183 * @OA\Property(
3184 * property="city",
3185 * description="The city for the practitioner.",
3186 * type="string"
3187 * ),
3188 * @OA\Property(
3189 * property="state",
3190 * description="The state for the practitioner.",
3191 * type="string"
3192 * ),
3193 * @OA\Property(
3194 * property="zip",
3195 * description="The zip for the practitioner.",
3196 * type="string"
3197 * ),
3198 * @OA\Property(
3199 * property="phone",
3200 * description="The phone for the practitioner.",
3201 * type="string"
3202 * ),
3203 * @OA\Property(
3204 * property="fax",
3205 * description="The fax for the practitioner.",
3206 * type="string"
3207 * ),
3208 * @OA\Property(
3209 * property="phonew1",
3210 * description="The phonew1 for the practitioner.",
3211 * type="string"
3212 * ),
3213 * @OA\Property(
3214 * property="phonecell",
3215 * description="The phonecell for the practitioner.",
3216 * type="string"
3217 * ),
3218 * @OA\Property(
3219 * property="notes",
3220 * description="The notes for the practitioner.",
3221 * type="string"
3222 * ),
3223 * @OA\Property(
3224 * property="state_license_number",
3225 * description="The state license number for the practitioner.",
3226 * type="string"
3227 * ),
3228 * @OA\Property(
3229 * property="username",
3230 * description="The username for the practitioner.",
3231 * type="string"
3232 * ),
3233 * example={
3234 * "title": "Mr",
3235 * "fname": "Baz",
3236 * "mname": "",
3237 * "lname": "Bop",
3238 * "street": "456 Tree Lane",
3239 * "zip": "08642",
3240 * "city": "FooTown",
3241 * "state": "FL",
3242 * "phone": "123-456-7890"
3246 * ),
3247 * @OA\Response(
3248 * response="200",
3249 * description="Standard response",
3250 * @OA\MediaType(
3251 * mediaType="application/json",
3252 * @OA\Schema(
3253 * @OA\Property(
3254 * property="validationErrors",
3255 * description="Validation errors.",
3256 * type="array",
3257 * @OA\Items(
3258 * type="object",
3259 * ),
3260 * ),
3261 * @OA\Property(
3262 * property="internalErrors",
3263 * description="Internal errors.",
3264 * type="array",
3265 * @OA\Items(
3266 * type="object",
3267 * ),
3268 * ),
3269 * @OA\Property(
3270 * property="data",
3271 * description="Returned data.",
3272 * type="array",
3273 * @OA\Items(
3274 * @OA\Property(
3275 * property="id",
3276 * description="practitioner id",
3277 * type="string",
3278 * ),
3279 * @OA\Property(
3280 * property="uuid",
3281 * description="practitioner uuid",
3282 * type="string",
3283 * ),
3284 * @OA\Property(
3285 * property="title",
3286 * description="practitioner title",
3287 * type="string",
3288 * ),
3289 * @OA\Property(
3290 * property="fname",
3291 * description="practitioner fname",
3292 * type="string",
3293 * ),
3294 * @OA\Property(
3295 * property="lname",
3296 * description="practitioner lname",
3297 * type="string",
3298 * ),
3299 * @OA\Property(
3300 * property="mname",
3301 * description="practitioner mname",
3302 * type="string",
3303 * ),
3304 * @OA\Property(
3305 * property="federaltaxid",
3306 * description="practitioner federaltaxid",
3307 * type="string",
3308 * ),
3309 * @OA\Property(
3310 * property="federaldrugid",
3311 * description="practitioner federaldrugid",
3312 * type="string",
3313 * ),
3314 * @OA\Property(
3315 * property="upin",
3316 * description="practitioner upin",
3317 * type="string",
3318 * ),
3319 * @OA\Property(
3320 * property="facility_id",
3321 * description="practitioner facility_id",
3322 * type="string",
3323 * ),
3324 * @OA\Property(
3325 * property="facility",
3326 * description="practitioner facility",
3327 * type="string",
3328 * ),
3329 * @OA\Property(
3330 * property="npi",
3331 * description="practitioner npi",
3332 * type="string",
3333 * ),
3334 * @OA\Property(
3335 * property="email",
3336 * description="practitioner email",
3337 * type="string",
3338 * ),
3339 * @OA\Property(
3340 * property="active",
3341 * description="practitioner active setting",
3342 * type="string",
3343 * ),
3344 * @OA\Property(
3345 * property="specialty",
3346 * description="practitioner specialty",
3347 * type="string",
3348 * ),
3349 * @OA\Property(
3350 * property="billname",
3351 * description="practitioner billname",
3352 * type="string",
3353 * ),
3354 * @OA\Property(
3355 * property="url",
3356 * description="practitioner url",
3357 * type="string",
3358 * ),
3359 * @OA\Property(
3360 * property="assistant",
3361 * description="practitioner assistant",
3362 * type="string",
3363 * ),
3364 * @OA\Property(
3365 * property="organization",
3366 * description="practitioner organization",
3367 * type="string",
3368 * ),
3369 * @OA\Property(
3370 * property="valedictory",
3371 * description="practitioner valedictory",
3372 * type="string",
3373 * ),
3374 * @OA\Property(
3375 * property="street",
3376 * description="practitioner street",
3377 * type="string",
3378 * ),
3379 * @OA\Property(
3380 * property="streetb",
3381 * description="practitioner streetb",
3382 * type="string",
3383 * ),
3384 * @OA\Property(
3385 * property="city",
3386 * description="practitioner city",
3387 * type="string",
3388 * ),
3389 * @OA\Property(
3390 * property="state",
3391 * description="practitioner state",
3392 * type="string",
3393 * ),
3394 * @OA\Property(
3395 * property="zip",
3396 * description="practitioner zip",
3397 * type="string",
3398 * ),
3399 * @OA\Property(
3400 * property="phone",
3401 * description="practitioner phone",
3402 * type="string",
3403 * ),
3404 * @OA\Property(
3405 * property="fax",
3406 * description="fax",
3407 * type="string",
3408 * ),
3409 * @OA\Property(
3410 * property="phonew1",
3411 * description="practitioner phonew1",
3412 * type="string",
3413 * ),
3414 * @OA\Property(
3415 * property="phonecell",
3416 * description="practitioner phonecell",
3417 * type="string",
3418 * ),
3419 * @OA\Property(
3420 * property="notes",
3421 * description="practitioner notes",
3422 * type="string",
3423 * ),
3424 * @OA\Property(
3425 * property="state_license_number",
3426 * description="practitioner state license number",
3427 * type="string",
3428 * ),
3429 * @OA\Property(
3430 * property="abook_title",
3431 * description="practitioner abook title",
3432 * type="string",
3433 * ),
3434 * @OA\Property(
3435 * property="physician_title",
3436 * description="practitioner physician title",
3437 * type="string",
3438 * ),
3439 * @OA\Property(
3440 * property="physician_code",
3441 * description="practitioner physician code",
3442 * type="string",
3444 * ),
3445 * ),
3446 * example={
3447 * "validationErrors": {},
3448 * "error_description": {},
3449 * "data": {
3450 * "id": 7,
3451 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3452 * "title": "Mr",
3453 * "fname": "Baz",
3454 * "lname": "Bop",
3455 * "mname": "",
3456 * "federaltaxid": "",
3457 * "federaldrugid": "",
3458 * "upin": "",
3459 * "facility_id": "3",
3460 * "facility": "Your Clinic Name Here",
3461 * "npi": "0123456789",
3462 * "email": "info@pennfirm.com",
3463 * "active": "1",
3464 * "specialty": "",
3465 * "billname": "",
3466 * "url": "",
3467 * "assistant": "",
3468 * "organization": "",
3469 * "valedictory": "",
3470 * "street": "456 Tree Lane",
3471 * "streetb": "123 Cannaut Street",
3472 * "city": "FooTown",
3473 * "state": "FL",
3474 * "zip": "08642",
3475 * "phone": "123-456-7890",
3476 * "fax": "",
3477 * "phonew1": "(619) 555-7822",
3478 * "phonecell": "(619) 555-7821",
3479 * "notes": "",
3480 * "state_license_number": "123456",
3481 * "abook_title": null,
3482 * "physician_title": null,
3483 * "physician_code": null
3488 * ),
3489 * @OA\Response(
3490 * response="401",
3491 * ref="#/components/responses/unauthorized"
3492 * ),
3493 * security={{"openemr_auth":{}}}
3496 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3497 RestConfig::authorization_check("admin", "users");
3498 $data = (array) (json_decode(file_get_contents("php://input")));
3499 $return = (new PractitionerRestController())->patch($pruuid, $data);
3500 RestConfig::apiLog($return, $data);
3501 return $return;
3505 * @OA\Get(
3506 * path="/api/medical_problem",
3507 * description="Retrieves a list of medical problems",
3508 * tags={"standard"},
3509 * @OA\Parameter(
3510 * name="puuid",
3511 * in="query",
3512 * description="The uuid for the patient.",
3513 * required=false,
3514 * @OA\Schema(
3515 * type="string"
3517 * ),
3518 * @OA\Parameter(
3519 * name="condition_uuid",
3520 * in="query",
3521 * description="The uuid for the medical problem.",
3522 * required=false,
3523 * @OA\Schema(
3524 * type="string"
3526 * ),
3527 * @OA\Parameter(
3528 * name="title",
3529 * in="query",
3530 * description="The title for the medical problem.",
3531 * required=false,
3532 * @OA\Schema(
3533 * type="string"
3535 * ),
3536 * @OA\Parameter(
3537 * name="begdate",
3538 * in="query",
3539 * description="The start date for the medical problem.",
3540 * required=false,
3541 * @OA\Schema(
3542 * type="string"
3544 * ),
3545 * @OA\Parameter(
3546 * name="enddate",
3547 * in="query",
3548 * description="The end date for the medical problem.",
3549 * required=false,
3550 * @OA\Schema(
3551 * type="string"
3553 * ),
3554 * @OA\Parameter(
3555 * name="diagnosis",
3556 * in="query",
3557 * description="The diagnosis for the medical problem.",
3558 * required=false,
3559 * @OA\Schema(
3560 * type="string"
3562 * ),
3563 * @OA\Response(
3564 * response="200",
3565 * ref="#/components/responses/standard"
3566 * ),
3567 * @OA\Response(
3568 * response="400",
3569 * ref="#/components/responses/badrequest"
3570 * ),
3571 * @OA\Response(
3572 * response="401",
3573 * ref="#/components/responses/unauthorized"
3574 * ),
3575 * security={{"openemr_auth":{}}}
3578 "GET /api/medical_problem" => function () {
3579 RestConfig::authorization_check("encounters", "notes");
3580 $return = (new ConditionRestController())->getAll();
3581 RestConfig::apiLog($return);
3582 return $return;
3586 * @OA\Get(
3587 * path="/api/medical_problem/{muuid}",
3588 * description="Retrieves a single medical problem by their uuid",
3589 * tags={"standard"},
3590 * @OA\Parameter(
3591 * name="muuid",
3592 * in="path",
3593 * description="The uuid for the medical problem.",
3594 * required=true,
3595 * @OA\Schema(
3596 * type="string"
3598 * ),
3599 * @OA\Response(
3600 * response="200",
3601 * ref="#/components/responses/standard"
3602 * ),
3603 * @OA\Response(
3604 * response="400",
3605 * ref="#/components/responses/badrequest"
3606 * ),
3607 * @OA\Response(
3608 * response="401",
3609 * ref="#/components/responses/unauthorized"
3610 * ),
3611 * security={{"openemr_auth":{}}}
3614 "GET /api/medical_problem/:muuid" => function ($muuid) {
3615 RestConfig::authorization_check("encounters", "notes");
3616 $return = (new ConditionRestController())->getOne($muuid);
3617 RestConfig::apiLog($return);
3618 return $return;
3622 * @OA\Get(
3623 * path="/api/patient/{puuid}/medical_problem",
3624 * description="Retrieves all medical problems for a patient",
3625 * tags={"standard"},
3626 * @OA\Parameter(
3627 * name="puuid",
3628 * in="path",
3629 * description="The uuid for the patient.",
3630 * required=true,
3631 * @OA\Schema(
3632 * type="string"
3634 * ),
3635 * @OA\Response(
3636 * response="200",
3637 * ref="#/components/responses/standard"
3638 * ),
3639 * @OA\Response(
3640 * response="400",
3641 * ref="#/components/responses/badrequest"
3642 * ),
3643 * @OA\Response(
3644 * response="401",
3645 * ref="#/components/responses/unauthorized"
3646 * ),
3647 * security={{"openemr_auth":{}}}
3650 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3651 RestConfig::authorization_check("encounters", "notes");
3652 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3653 RestConfig::apiLog($return);
3654 return $return;
3658 * @OA\Get(
3659 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3660 * description="Retrieves a medical problem for a patient",
3661 * tags={"standard"},
3662 * @OA\Parameter(
3663 * name="puuid",
3664 * in="path",
3665 * description="The uuid for the patient.",
3666 * required=true,
3667 * @OA\Schema(
3668 * type="string"
3670 * ),
3671 * @OA\Parameter(
3672 * name="muuid",
3673 * in="path",
3674 * description="The uuid for the medical problem.",
3675 * required=true,
3676 * @OA\Schema(
3677 * type="string"
3679 * ),
3680 * @OA\Response(
3681 * response="200",
3682 * ref="#/components/responses/standard"
3683 * ),
3684 * @OA\Response(
3685 * response="400",
3686 * ref="#/components/responses/badrequest"
3687 * ),
3688 * @OA\Response(
3689 * response="401",
3690 * ref="#/components/responses/unauthorized"
3691 * ),
3692 * security={{"openemr_auth":{}}}
3695 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3696 RestConfig::authorization_check("patients", "med");
3697 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3698 RestConfig::apiLog($return);
3699 return $return;
3703 * Schema for the medical_problem request
3705 * @OA\Schema(
3706 * schema="api_medical_problem_request",
3707 * @OA\Property(
3708 * property="title",
3709 * description="The title of medical problem.",
3710 * type="string"
3711 * ),
3712 * @OA\Property(
3713 * property="begdate",
3714 * description="The beginning date of medical problem.",
3715 * type="string"
3716 * ),
3717 * @OA\Property(
3718 * property="enddate",
3719 * description="The end date of medical problem.",
3720 * type="string"
3721 * ),
3722 * @OA\Property(
3723 * property="diagnosis",
3724 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3725 * type="string"
3726 * ),
3727 * required={"title", "begdate"},
3728 * example={
3729 * "title": "Dermatochalasis",
3730 * "begdate": "2010-10-13",
3731 * "enddate": null,
3732 * "diagnosis": "ICD10:H02.839"
3737 * @OA\Post(
3738 * path="/api/patient/{puuid}/medical_problem",
3739 * description="Submits a new medical problem",
3740 * tags={"standard"},
3741 * @OA\Parameter(
3742 * name="puuid",
3743 * in="path",
3744 * description="The uuid for the patient.",
3745 * required=true,
3746 * @OA\Schema(
3747 * type="string"
3749 * ),
3750 * @OA\RequestBody(
3751 * required=true,
3752 * @OA\MediaType(
3753 * mediaType="application/json",
3754 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3756 * ),
3757 * @OA\Response(
3758 * response="200",
3759 * ref="#/components/responses/standard"
3760 * ),
3761 * @OA\Response(
3762 * response="400",
3763 * ref="#/components/responses/badrequest"
3764 * ),
3765 * @OA\Response(
3766 * response="401",
3767 * ref="#/components/responses/unauthorized"
3768 * ),
3769 * security={{"openemr_auth":{}}}
3772 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3773 RestConfig::authorization_check("patients", "med");
3774 $data = (array) (json_decode(file_get_contents("php://input")));
3775 $return = (new ConditionRestController())->post($puuid, $data);
3776 RestConfig::apiLog($return, $data);
3777 return $return;
3781 * @OA\Put(
3782 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3783 * description="Edit a medical problem",
3784 * tags={"standard"},
3785 * @OA\Parameter(
3786 * name="puuid",
3787 * in="path",
3788 * description="The uuid for the patient.",
3789 * required=true,
3790 * @OA\Schema(
3791 * type="string"
3793 * ),
3794 * @OA\Parameter(
3795 * name="muuid",
3796 * in="path",
3797 * description="The uuid for the medical problem.",
3798 * required=true,
3799 * @OA\Schema(
3800 * type="string"
3802 * ),
3803 * @OA\RequestBody(
3804 * required=true,
3805 * @OA\MediaType(
3806 * mediaType="application/json",
3807 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3809 * ),
3810 * @OA\Response(
3811 * response="200",
3812 * ref="#/components/responses/standard"
3813 * ),
3814 * @OA\Response(
3815 * response="400",
3816 * ref="#/components/responses/badrequest"
3817 * ),
3818 * @OA\Response(
3819 * response="401",
3820 * ref="#/components/responses/unauthorized"
3821 * ),
3822 * security={{"openemr_auth":{}}}
3825 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3826 RestConfig::authorization_check("patients", "med");
3827 $data = (array) (json_decode(file_get_contents("php://input")));
3828 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3829 RestConfig::apiLog($return, $data);
3830 return $return;
3834 * @OA\Delete(
3835 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3836 * description="Delete a medical problem",
3837 * tags={"standard"},
3838 * @OA\Parameter(
3839 * name="puuid",
3840 * in="path",
3841 * description="The uuid for the patient.",
3842 * required=true,
3843 * @OA\Schema(
3844 * type="string"
3846 * ),
3847 * @OA\Parameter(
3848 * name="muuid",
3849 * in="path",
3850 * description="The uuid for the medical problem.",
3851 * required=true,
3852 * @OA\Schema(
3853 * type="string"
3855 * ),
3856 * @OA\Response(
3857 * response="200",
3858 * ref="#/components/responses/standard"
3859 * ),
3860 * @OA\Response(
3861 * response="400",
3862 * ref="#/components/responses/badrequest"
3863 * ),
3864 * @OA\Response(
3865 * response="401",
3866 * ref="#/components/responses/unauthorized"
3867 * ),
3868 * security={{"openemr_auth":{}}}
3871 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3872 RestConfig::authorization_check("patients", "med");
3873 $return = (new ConditionRestController())->delete($puuid, $muuid);
3874 RestConfig::apiLog($return);
3875 return $return;
3879 * @OA\Get(
3880 * path="/api/allergy",
3881 * description="Retrieves a list of allergies",
3882 * tags={"standard"},
3883 * @OA\Parameter(
3884 * name="lists.pid",
3885 * in="query",
3886 * description="The uuid for the patient.",
3887 * required=false,
3888 * @OA\Schema(
3889 * type="string"
3891 * ),
3892 * @OA\Parameter(
3893 * name="lists.id",
3894 * in="query",
3895 * description="The uuid for the allergy.",
3896 * required=false,
3897 * @OA\Schema(
3898 * type="string"
3900 * ),
3901 * @OA\Parameter(
3902 * name="title",
3903 * in="query",
3904 * description="The title for the allergy.",
3905 * required=false,
3906 * @OA\Schema(
3907 * type="string"
3909 * ),
3910 * @OA\Parameter(
3911 * name="begdate",
3912 * in="query",
3913 * description="The start date for the allergy.",
3914 * required=false,
3915 * @OA\Schema(
3916 * type="string"
3918 * ),
3919 * @OA\Parameter(
3920 * name="enddate",
3921 * in="query",
3922 * description="The end date for the allergy.",
3923 * required=false,
3924 * @OA\Schema(
3925 * type="string"
3927 * ),
3928 * @OA\Parameter(
3929 * name="diagnosis",
3930 * in="query",
3931 * description="The diagnosis for the allergy.",
3932 * required=false,
3933 * @OA\Schema(
3934 * type="string"
3936 * ),
3937 * @OA\Response(
3938 * response="200",
3939 * ref="#/components/responses/standard"
3940 * ),
3941 * @OA\Response(
3942 * response="400",
3943 * ref="#/components/responses/badrequest"
3944 * ),
3945 * @OA\Response(
3946 * response="401",
3947 * ref="#/components/responses/unauthorized"
3948 * ),
3949 * security={{"openemr_auth":{}}}
3952 "GET /api/allergy" => function () {
3953 RestConfig::authorization_check("patients", "med");
3954 $return = (new AllergyIntoleranceRestController())->getAll();
3955 RestConfig::apiLog($return);
3956 return $return;
3960 * @OA\Get(
3961 * path="/api/allergy/{auuid}",
3962 * description="Retrieves a single allergy by their uuid",
3963 * tags={"standard"},
3964 * @OA\Parameter(
3965 * name="auuid",
3966 * in="path",
3967 * description="The uuid for the allergy.",
3968 * required=true,
3969 * @OA\Schema(
3970 * type="string"
3972 * ),
3973 * @OA\Response(
3974 * response="200",
3975 * ref="#/components/responses/standard"
3976 * ),
3977 * @OA\Response(
3978 * response="400",
3979 * ref="#/components/responses/badrequest"
3980 * ),
3981 * @OA\Response(
3982 * response="401",
3983 * ref="#/components/responses/unauthorized"
3984 * ),
3985 * security={{"openemr_auth":{}}}
3988 "GET /api/allergy/:auuid" => function ($auuid) {
3989 RestConfig::authorization_check("patients", "med");
3990 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3991 RestConfig::apiLog($return);
3992 return $return;
3996 * @OA\Get(
3997 * path="/api/patient/{puuid}/allergy",
3998 * description="Retrieves all allergies for a patient",
3999 * tags={"standard"},
4000 * @OA\Parameter(
4001 * name="puuid",
4002 * in="path",
4003 * description="The uuid for the patient.",
4004 * required=true,
4005 * @OA\Schema(
4006 * type="string"
4008 * ),
4009 * @OA\Response(
4010 * response="200",
4011 * ref="#/components/responses/standard"
4012 * ),
4013 * @OA\Response(
4014 * response="400",
4015 * ref="#/components/responses/badrequest"
4016 * ),
4017 * @OA\Response(
4018 * response="401",
4019 * ref="#/components/responses/unauthorized"
4020 * ),
4021 * security={{"openemr_auth":{}}}
4024 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4025 RestConfig::authorization_check("patients", "med");
4026 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4027 RestConfig::apiLog($return);
4028 return $return;
4032 * @OA\Get(
4033 * path="/api/patient/{puuid}/allergy/{auuid}",
4034 * description="Retrieves a allergy for a patient",
4035 * tags={"standard"},
4036 * @OA\Parameter(
4037 * name="puuid",
4038 * in="path",
4039 * description="The uuid for the patient.",
4040 * required=true,
4041 * @OA\Schema(
4042 * type="string"
4044 * ),
4045 * @OA\Parameter(
4046 * name="auuid",
4047 * in="path",
4048 * description="The uuid for the allergy.",
4049 * required=true,
4050 * @OA\Schema(
4051 * type="string"
4053 * ),
4054 * @OA\Response(
4055 * response="200",
4056 * ref="#/components/responses/standard"
4057 * ),
4058 * @OA\Response(
4059 * response="400",
4060 * ref="#/components/responses/badrequest"
4061 * ),
4062 * @OA\Response(
4063 * response="401",
4064 * ref="#/components/responses/unauthorized"
4065 * ),
4066 * security={{"openemr_auth":{}}}
4069 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4070 RestConfig::authorization_check("patients", "med");
4071 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4072 RestConfig::apiLog($return);
4073 return $return;
4077 * Schema for the allergy request
4079 * @OA\Schema(
4080 * schema="api_allergy_request",
4081 * @OA\Property(
4082 * property="title",
4083 * description="The title of allergy.",
4084 * type="string"
4085 * ),
4086 * @OA\Property(
4087 * property="begdate",
4088 * description="The beginning date of allergy.",
4089 * type="string"
4090 * ),
4091 * @OA\Property(
4092 * property="enddate",
4093 * description="The end date of allergy.",
4094 * type="string"
4095 * ),
4096 * @OA\Property(
4097 * property="diagnosis",
4098 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4099 * type="string"
4100 * ),
4101 * required={"title", "begdate"},
4102 * example={
4103 * "title": "Iodine",
4104 * "begdate": "2010-10-13",
4105 * "enddate": null
4110 * @OA\Post(
4111 * path="/api/patient/{puuid}/allergy",
4112 * description="Submits a new allergy",
4113 * tags={"standard"},
4114 * @OA\Parameter(
4115 * name="puuid",
4116 * in="path",
4117 * description="The uuid for the patient.",
4118 * required=true,
4119 * @OA\Schema(
4120 * type="string"
4122 * ),
4123 * @OA\RequestBody(
4124 * required=true,
4125 * @OA\MediaType(
4126 * mediaType="application/json",
4127 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4129 * ),
4130 * @OA\Response(
4131 * response="200",
4132 * ref="#/components/responses/standard"
4133 * ),
4134 * @OA\Response(
4135 * response="400",
4136 * ref="#/components/responses/badrequest"
4137 * ),
4138 * @OA\Response(
4139 * response="401",
4140 * ref="#/components/responses/unauthorized"
4141 * ),
4142 * security={{"openemr_auth":{}}}
4145 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4146 RestConfig::authorization_check("patients", "med");
4147 $data = (array) (json_decode(file_get_contents("php://input")));
4148 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4149 RestConfig::apiLog($return, $data);
4150 return $return;
4154 * @OA\Put(
4155 * path="/api/patient/{puuid}/allergy/{auuid}",
4156 * description="Edit a allergy",
4157 * tags={"standard"},
4158 * @OA\Parameter(
4159 * name="puuid",
4160 * in="path",
4161 * description="The uuid for the patient.",
4162 * required=true,
4163 * @OA\Schema(
4164 * type="string"
4166 * ),
4167 * @OA\Parameter(
4168 * name="auuid",
4169 * in="path",
4170 * description="The uuid for the allergy.",
4171 * required=true,
4172 * @OA\Schema(
4173 * type="string"
4175 * ),
4176 * @OA\RequestBody(
4177 * required=true,
4178 * @OA\MediaType(
4179 * mediaType="application/json",
4180 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4182 * ),
4183 * @OA\Response(
4184 * response="200",
4185 * ref="#/components/responses/standard"
4186 * ),
4187 * @OA\Response(
4188 * response="400",
4189 * ref="#/components/responses/badrequest"
4190 * ),
4191 * @OA\Response(
4192 * response="401",
4193 * ref="#/components/responses/unauthorized"
4194 * ),
4195 * security={{"openemr_auth":{}}}
4198 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4199 RestConfig::authorization_check("patients", "med");
4200 $data = (array) (json_decode(file_get_contents("php://input")));
4201 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4202 RestConfig::apiLog($return, $data);
4203 return $return;
4207 * @OA\Delete(
4208 * path="/api/patient/{puuid}/allergy/{auuid}",
4209 * description="Delete a medical problem",
4210 * tags={"standard"},
4211 * @OA\Parameter(
4212 * name="puuid",
4213 * in="path",
4214 * description="The uuid for the patient.",
4215 * required=true,
4216 * @OA\Schema(
4217 * type="string"
4219 * ),
4220 * @OA\Parameter(
4221 * name="auuid",
4222 * in="path",
4223 * description="The uuid for the allergy.",
4224 * required=true,
4225 * @OA\Schema(
4226 * type="string"
4228 * ),
4229 * @OA\Response(
4230 * response="200",
4231 * ref="#/components/responses/standard"
4232 * ),
4233 * @OA\Response(
4234 * response="400",
4235 * ref="#/components/responses/badrequest"
4236 * ),
4237 * @OA\Response(
4238 * response="401",
4239 * ref="#/components/responses/unauthorized"
4240 * ),
4241 * security={{"openemr_auth":{}}}
4244 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4245 RestConfig::authorization_check("patients", "med");
4246 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4247 RestConfig::apiLog($return);
4248 return $return;
4252 * @OA\Get(
4253 * path="/api/patient/{pid}/medication",
4254 * description="Retrieves all medications for a patient",
4255 * tags={"standard"},
4256 * @OA\Parameter(
4257 * name="pid",
4258 * in="path",
4259 * description="The pid for the patient.",
4260 * required=true,
4261 * @OA\Schema(
4262 * type="string"
4264 * ),
4265 * @OA\Response(
4266 * response="200",
4267 * ref="#/components/responses/standard"
4268 * ),
4269 * @OA\Response(
4270 * response="400",
4271 * ref="#/components/responses/badrequest"
4272 * ),
4273 * @OA\Response(
4274 * response="401",
4275 * ref="#/components/responses/unauthorized"
4276 * ),
4277 * security={{"openemr_auth":{}}}
4280 "GET /api/patient/:pid/medication" => function ($pid) {
4281 RestConfig::authorization_check("patients", "med");
4282 $return = (new ListRestController())->getAll($pid, "medication");
4283 RestConfig::apiLog($return);
4284 return $return;
4288 * Schema for the medication request
4290 * @OA\Schema(
4291 * schema="api_medication_request",
4292 * @OA\Property(
4293 * property="title",
4294 * description="The title of medication.",
4295 * type="string"
4296 * ),
4297 * @OA\Property(
4298 * property="begdate",
4299 * description="The beginning date of medication.",
4300 * type="string"
4301 * ),
4302 * @OA\Property(
4303 * property="enddate",
4304 * description="The end date of medication.",
4305 * type="string"
4306 * ),
4307 * @OA\Property(
4308 * property="diagnosis",
4309 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4310 * type="string"
4311 * ),
4312 * required={"title", "begdate"},
4313 * example={
4314 * "title": "Norvasc",
4315 * "begdate": "2013-04-13",
4316 * "enddate": null
4321 * @OA\Post(
4322 * path="/api/patient/{pid}/medication",
4323 * description="Submits a new medication",
4324 * tags={"standard"},
4325 * @OA\Parameter(
4326 * name="pid",
4327 * in="path",
4328 * description="The pid for the patient.",
4329 * required=true,
4330 * @OA\Schema(
4331 * type="string"
4333 * ),
4334 * @OA\RequestBody(
4335 * required=true,
4336 * @OA\MediaType(
4337 * mediaType="application/json",
4338 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4340 * ),
4341 * @OA\Response(
4342 * response="200",
4343 * ref="#/components/responses/standard"
4344 * ),
4345 * @OA\Response(
4346 * response="400",
4347 * ref="#/components/responses/badrequest"
4348 * ),
4349 * @OA\Response(
4350 * response="401",
4351 * ref="#/components/responses/unauthorized"
4352 * ),
4353 * security={{"openemr_auth":{}}}
4356 "POST /api/patient/:pid/medication" => function ($pid) {
4357 RestConfig::authorization_check("patients", "med");
4358 $data = (array) (json_decode(file_get_contents("php://input")));
4359 $return = (new ListRestController())->post($pid, "medication", $data);
4360 RestConfig::apiLog($return, $data);
4361 return $return;
4365 * @OA\Put(
4366 * path="/api/patient/{pid}/medication/{mid}",
4367 * description="Edit a medication",
4368 * tags={"standard"},
4369 * @OA\Parameter(
4370 * name="pid",
4371 * in="path",
4372 * description="The pid for the patient.",
4373 * required=true,
4374 * @OA\Schema(
4375 * type="string"
4377 * ),
4378 * @OA\Parameter(
4379 * name="mid",
4380 * in="path",
4381 * description="The id for the medication.",
4382 * required=true,
4383 * @OA\Schema(
4384 * type="string"
4386 * ),
4387 * @OA\RequestBody(
4388 * required=true,
4389 * @OA\MediaType(
4390 * mediaType="application/json",
4391 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4393 * ),
4394 * @OA\Response(
4395 * response="200",
4396 * ref="#/components/responses/standard"
4397 * ),
4398 * @OA\Response(
4399 * response="400",
4400 * ref="#/components/responses/badrequest"
4401 * ),
4402 * @OA\Response(
4403 * response="401",
4404 * ref="#/components/responses/unauthorized"
4405 * ),
4406 * security={{"openemr_auth":{}}}
4409 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4410 RestConfig::authorization_check("patients", "med");
4411 $data = (array) (json_decode(file_get_contents("php://input")));
4412 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4413 RestConfig::apiLog($return, $data);
4414 return $return;
4418 * @OA\Get(
4419 * path="/api/patient/{pid}/medication/{mid}",
4420 * description="Retrieves a medication for a patient",
4421 * tags={"standard"},
4422 * @OA\Parameter(
4423 * name="pid",
4424 * in="path",
4425 * description="The id for the patient.",
4426 * required=true,
4427 * @OA\Schema(
4428 * type="string"
4430 * ),
4431 * @OA\Parameter(
4432 * name="mid",
4433 * in="path",
4434 * description="The id for the medication.",
4435 * required=true,
4436 * @OA\Schema(
4437 * type="string"
4439 * ),
4440 * @OA\Response(
4441 * response="200",
4442 * ref="#/components/responses/standard"
4443 * ),
4444 * @OA\Response(
4445 * response="400",
4446 * ref="#/components/responses/badrequest"
4447 * ),
4448 * @OA\Response(
4449 * response="401",
4450 * ref="#/components/responses/unauthorized"
4451 * ),
4452 * security={{"openemr_auth":{}}}
4455 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4456 RestConfig::authorization_check("patients", "med");
4457 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4458 RestConfig::apiLog($return);
4459 return $return;
4463 * @OA\Delete(
4464 * path="/api/patient/{pid}/medication/{mid}",
4465 * description="Delete a medication",
4466 * tags={"standard"},
4467 * @OA\Parameter(
4468 * name="pid",
4469 * in="path",
4470 * description="The id for the patient.",
4471 * required=true,
4472 * @OA\Schema(
4473 * type="string"
4475 * ),
4476 * @OA\Parameter(
4477 * name="mid",
4478 * in="path",
4479 * description="The id for the medication.",
4480 * required=true,
4481 * @OA\Schema(
4482 * type="string"
4484 * ),
4485 * @OA\Response(
4486 * response="200",
4487 * ref="#/components/responses/standard"
4488 * ),
4489 * @OA\Response(
4490 * response="400",
4491 * ref="#/components/responses/badrequest"
4492 * ),
4493 * @OA\Response(
4494 * response="401",
4495 * ref="#/components/responses/unauthorized"
4496 * ),
4497 * security={{"openemr_auth":{}}}
4500 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4501 RestConfig::authorization_check("patients", "med");
4502 $return = (new ListRestController())->delete($pid, $mid, "medication");
4503 RestConfig::apiLog($return);
4504 return $return;
4508 * @OA\Get(
4509 * path="/api/patient/{pid}/surgery",
4510 * description="Retrieves all surgeries for a patient",
4511 * tags={"standard"},
4512 * @OA\Parameter(
4513 * name="pid",
4514 * in="path",
4515 * description="The pid for the patient.",
4516 * required=true,
4517 * @OA\Schema(
4518 * type="string"
4520 * ),
4521 * @OA\Response(
4522 * response="200",
4523 * ref="#/components/responses/standard"
4524 * ),
4525 * @OA\Response(
4526 * response="400",
4527 * ref="#/components/responses/badrequest"
4528 * ),
4529 * @OA\Response(
4530 * response="401",
4531 * ref="#/components/responses/unauthorized"
4532 * ),
4533 * security={{"openemr_auth":{}}}
4536 "GET /api/patient/:pid/surgery" => function ($pid) {
4537 RestConfig::authorization_check("patients", "med");
4538 $return = (new ListRestController())->getAll($pid, "surgery");
4539 RestConfig::apiLog($return);
4540 return $return;
4544 * @OA\Get(
4545 * path="/api/patient/{pid}/surgery/{sid}",
4546 * description="Retrieves a surgery for a patient",
4547 * tags={"standard"},
4548 * @OA\Parameter(
4549 * name="pid",
4550 * in="path",
4551 * description="The id for the patient.",
4552 * required=true,
4553 * @OA\Schema(
4554 * type="string"
4556 * ),
4557 * @OA\Parameter(
4558 * name="sid",
4559 * in="path",
4560 * description="The id for the surgery.",
4561 * required=true,
4562 * @OA\Schema(
4563 * type="string"
4565 * ),
4566 * @OA\Response(
4567 * response="200",
4568 * ref="#/components/responses/standard"
4569 * ),
4570 * @OA\Response(
4571 * response="400",
4572 * ref="#/components/responses/badrequest"
4573 * ),
4574 * @OA\Response(
4575 * response="401",
4576 * ref="#/components/responses/unauthorized"
4577 * ),
4578 * security={{"openemr_auth":{}}}
4581 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4582 RestConfig::authorization_check("patients", "med");
4583 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4584 RestConfig::apiLog($return);
4585 return $return;
4589 * @OA\Delete(
4590 * path="/api/patient/{pid}/surgery/{sid}",
4591 * description="Delete a surgery",
4592 * tags={"standard"},
4593 * @OA\Parameter(
4594 * name="pid",
4595 * in="path",
4596 * description="The id for the patient.",
4597 * required=true,
4598 * @OA\Schema(
4599 * type="string"
4601 * ),
4602 * @OA\Parameter(
4603 * name="sid",
4604 * in="path",
4605 * description="The id for the surgery.",
4606 * required=true,
4607 * @OA\Schema(
4608 * type="string"
4610 * ),
4611 * @OA\Response(
4612 * response="200",
4613 * ref="#/components/responses/standard"
4614 * ),
4615 * @OA\Response(
4616 * response="400",
4617 * ref="#/components/responses/badrequest"
4618 * ),
4619 * @OA\Response(
4620 * response="401",
4621 * ref="#/components/responses/unauthorized"
4622 * ),
4623 * security={{"openemr_auth":{}}}
4626 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4627 RestConfig::authorization_check("patients", "med");
4628 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4629 RestConfig::apiLog($return);
4630 return $return;
4634 * Schema for the surgery request
4636 * @OA\Schema(
4637 * schema="api_surgery_request",
4638 * @OA\Property(
4639 * property="title",
4640 * description="The title of surgery.",
4641 * type="string"
4642 * ),
4643 * @OA\Property(
4644 * property="begdate",
4645 * description="The beginning date of surgery.",
4646 * type="string"
4647 * ),
4648 * @OA\Property(
4649 * property="enddate",
4650 * description="The end date of surgery.",
4651 * type="string"
4652 * ),
4653 * @OA\Property(
4654 * property="diagnosis",
4655 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4656 * type="string"
4657 * ),
4658 * required={"title", "begdate"},
4659 * example={
4660 * "title": "Blepharoplasty",
4661 * "begdate": "2013-10-14",
4662 * "enddate": null,
4663 * "diagnosis": "CPT4:15823-50"
4668 * @OA\Post(
4669 * path="/api/patient/{pid}/surgery",
4670 * description="Submits a new surgery",
4671 * tags={"standard"},
4672 * @OA\Parameter(
4673 * name="pid",
4674 * in="path",
4675 * description="The pid for the patient.",
4676 * required=true,
4677 * @OA\Schema(
4678 * type="string"
4680 * ),
4681 * @OA\RequestBody(
4682 * required=true,
4683 * @OA\MediaType(
4684 * mediaType="application/json",
4685 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4687 * ),
4688 * @OA\Response(
4689 * response="200",
4690 * ref="#/components/responses/standard"
4691 * ),
4692 * @OA\Response(
4693 * response="400",
4694 * ref="#/components/responses/badrequest"
4695 * ),
4696 * @OA\Response(
4697 * response="401",
4698 * ref="#/components/responses/unauthorized"
4699 * ),
4700 * security={{"openemr_auth":{}}}
4703 "POST /api/patient/:pid/surgery" => function ($pid) {
4704 RestConfig::authorization_check("patients", "med");
4705 $data = (array) (json_decode(file_get_contents("php://input")));
4706 $return = (new ListRestController())->post($pid, "surgery", $data);
4707 RestConfig::apiLog($return, $data);
4708 return $return;
4712 * @OA\Put(
4713 * path="/api/patient/{pid}/surgery/{sid}",
4714 * description="Edit a surgery",
4715 * tags={"standard"},
4716 * @OA\Parameter(
4717 * name="pid",
4718 * in="path",
4719 * description="The pid for the patient.",
4720 * required=true,
4721 * @OA\Schema(
4722 * type="string"
4724 * ),
4725 * @OA\Parameter(
4726 * name="sid",
4727 * in="path",
4728 * description="The id for the surgery.",
4729 * required=true,
4730 * @OA\Schema(
4731 * type="string"
4733 * ),
4734 * @OA\RequestBody(
4735 * required=true,
4736 * @OA\MediaType(
4737 * mediaType="application/json",
4738 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4740 * ),
4741 * @OA\Response(
4742 * response="200",
4743 * ref="#/components/responses/standard"
4744 * ),
4745 * @OA\Response(
4746 * response="400",
4747 * ref="#/components/responses/badrequest"
4748 * ),
4749 * @OA\Response(
4750 * response="401",
4751 * ref="#/components/responses/unauthorized"
4752 * ),
4753 * security={{"openemr_auth":{}}}
4756 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4757 RestConfig::authorization_check("patients", "med");
4758 $data = (array) (json_decode(file_get_contents("php://input")));
4759 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4760 RestConfig::apiLog($return, $data);
4761 return $return;
4765 * @OA\Get(
4766 * path="/api/patient/{pid}/dental_issue",
4767 * description="Retrieves all dental issues for a patient",
4768 * tags={"standard"},
4769 * @OA\Parameter(
4770 * name="pid",
4771 * in="path",
4772 * description="The pid for the patient.",
4773 * required=true,
4774 * @OA\Schema(
4775 * type="string"
4777 * ),
4778 * @OA\Response(
4779 * response="200",
4780 * ref="#/components/responses/standard"
4781 * ),
4782 * @OA\Response(
4783 * response="400",
4784 * ref="#/components/responses/badrequest"
4785 * ),
4786 * @OA\Response(
4787 * response="401",
4788 * ref="#/components/responses/unauthorized"
4789 * ),
4790 * security={{"openemr_auth":{}}}
4793 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4794 RestConfig::authorization_check("patients", "med");
4795 $return = (new ListRestController())->getAll($pid, "dental");
4796 RestConfig::apiLog($return);
4797 return $return;
4801 * @OA\Get(
4802 * path="/api/patient/{pid}/dental_issue/{did}",
4803 * description="Retrieves a dental issue for a patient",
4804 * tags={"standard"},
4805 * @OA\Parameter(
4806 * name="pid",
4807 * in="path",
4808 * description="The id for the patient.",
4809 * required=true,
4810 * @OA\Schema(
4811 * type="string"
4813 * ),
4814 * @OA\Parameter(
4815 * name="did",
4816 * in="path",
4817 * description="The id for the dental issue.",
4818 * required=true,
4819 * @OA\Schema(
4820 * type="string"
4822 * ),
4823 * @OA\Response(
4824 * response="200",
4825 * ref="#/components/responses/standard"
4826 * ),
4827 * @OA\Response(
4828 * response="400",
4829 * ref="#/components/responses/badrequest"
4830 * ),
4831 * @OA\Response(
4832 * response="401",
4833 * ref="#/components/responses/unauthorized"
4834 * ),
4835 * security={{"openemr_auth":{}}}
4838 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4839 RestConfig::authorization_check("patients", "med");
4840 $return = (new ListRestController())->getOne($pid, "dental", $did);
4841 RestConfig::apiLog($return);
4842 return $return;
4846 * @OA\Delete(
4847 * path="/api/patient/{pid}/dental_issue/{did}",
4848 * description="Delete a dental issue",
4849 * tags={"standard"},
4850 * @OA\Parameter(
4851 * name="pid",
4852 * in="path",
4853 * description="The id for the patient.",
4854 * required=true,
4855 * @OA\Schema(
4856 * type="string"
4858 * ),
4859 * @OA\Parameter(
4860 * name="did",
4861 * in="path",
4862 * description="The id for the dental issue.",
4863 * required=true,
4864 * @OA\Schema(
4865 * type="string"
4867 * ),
4868 * @OA\Response(
4869 * response="200",
4870 * ref="#/components/responses/standard"
4871 * ),
4872 * @OA\Response(
4873 * response="400",
4874 * ref="#/components/responses/badrequest"
4875 * ),
4876 * @OA\Response(
4877 * response="401",
4878 * ref="#/components/responses/unauthorized"
4879 * ),
4880 * security={{"openemr_auth":{}}}
4883 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4884 RestConfig::authorization_check("patients", "med");
4885 $return = (new ListRestController())->delete($pid, $did, "dental");
4886 RestConfig::apiLog($return);
4887 return $return;
4891 * Schema for the dental_issue request
4893 * @OA\Schema(
4894 * schema="api_dental_issue_request",
4895 * @OA\Property(
4896 * property="title",
4897 * description="The title of dental issue.",
4898 * type="string"
4899 * ),
4900 * @OA\Property(
4901 * property="begdate",
4902 * description="The beginning date of dental issue.",
4903 * type="string"
4904 * ),
4905 * @OA\Property(
4906 * property="enddate",
4907 * description="The end date of dental issue.",
4908 * type="string"
4909 * ),
4910 * @OA\Property(
4911 * property="diagnosis",
4912 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4913 * type="string"
4914 * ),
4915 * required={"title", "begdate"},
4916 * example={
4917 * "title": "Halitosis",
4918 * "begdate": "2015-03-17",
4919 * "enddate": null,
4924 * @OA\Post(
4925 * path="/api/patient/{pid}/dental_issue",
4926 * description="Submits a new dental issue",
4927 * tags={"standard"},
4928 * @OA\Parameter(
4929 * name="pid",
4930 * in="path",
4931 * description="The pid for the patient.",
4932 * required=true,
4933 * @OA\Schema(
4934 * type="string"
4936 * ),
4937 * @OA\RequestBody(
4938 * required=true,
4939 * @OA\MediaType(
4940 * mediaType="application/json",
4941 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4943 * ),
4944 * @OA\Response(
4945 * response="200",
4946 * ref="#/components/responses/standard"
4947 * ),
4948 * @OA\Response(
4949 * response="400",
4950 * ref="#/components/responses/badrequest"
4951 * ),
4952 * @OA\Response(
4953 * response="401",
4954 * ref="#/components/responses/unauthorized"
4955 * ),
4956 * security={{"openemr_auth":{}}}
4959 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4960 RestConfig::authorization_check("patients", "med");
4961 $data = (array) (json_decode(file_get_contents("php://input")));
4962 $return = (new ListRestController())->post($pid, "dental", $data);
4963 RestConfig::apiLog($return, $data);
4964 return $return;
4968 * @OA\Put(
4969 * path="/api/patient/{pid}/dental_issue/{did}",
4970 * description="Edit a dental issue",
4971 * tags={"standard"},
4972 * @OA\Parameter(
4973 * name="pid",
4974 * in="path",
4975 * description="The pid for the patient.",
4976 * required=true,
4977 * @OA\Schema(
4978 * type="string"
4980 * ),
4981 * @OA\Parameter(
4982 * name="did",
4983 * in="path",
4984 * description="The id for the dental issue.",
4985 * required=true,
4986 * @OA\Schema(
4987 * type="string"
4989 * ),
4990 * @OA\RequestBody(
4991 * required=true,
4992 * @OA\MediaType(
4993 * mediaType="application/json",
4994 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4996 * ),
4997 * @OA\Response(
4998 * response="200",
4999 * ref="#/components/responses/standard"
5000 * ),
5001 * @OA\Response(
5002 * response="400",
5003 * ref="#/components/responses/badrequest"
5004 * ),
5005 * @OA\Response(
5006 * response="401",
5007 * ref="#/components/responses/unauthorized"
5008 * ),
5009 * security={{"openemr_auth":{}}}
5012 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5013 RestConfig::authorization_check("patients", "med");
5014 $data = (array) (json_decode(file_get_contents("php://input")));
5015 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5016 RestConfig::apiLog($return, $data);
5017 return $return;
5021 * @OA\Get(
5022 * path="/api/patient/{pid}/appointment",
5023 * description="Retrieves all appointments for a patient",
5024 * tags={"standard"},
5025 * @OA\Parameter(
5026 * name="pid",
5027 * in="path",
5028 * description="The pid for the patient.",
5029 * required=true,
5030 * @OA\Schema(
5031 * type="string"
5033 * ),
5034 * @OA\Response(
5035 * response="200",
5036 * ref="#/components/responses/standard"
5037 * ),
5038 * @OA\Response(
5039 * response="400",
5040 * ref="#/components/responses/badrequest"
5041 * ),
5042 * @OA\Response(
5043 * response="401",
5044 * ref="#/components/responses/unauthorized"
5045 * ),
5046 * security={{"openemr_auth":{}}}
5049 "GET /api/patient/:pid/appointment" => function ($pid) {
5050 RestConfig::authorization_check("patients", "appt");
5051 $return = (new AppointmentRestController())->getAllForPatient($pid);
5052 RestConfig::apiLog($return);
5053 return $return;
5057 * @OA\Post(
5058 * path="/api/patient/{pid}/appointment",
5059 * description="Submits a new appointment",
5060 * tags={"standard"},
5061 * @OA\Parameter(
5062 * name="pid",
5063 * in="path",
5064 * description="The id for the patient.",
5065 * required=true,
5066 * @OA\Schema(
5067 * type="string"
5069 * ),
5070 * @OA\RequestBody(
5071 * required=true,
5072 * @OA\MediaType(
5073 * mediaType="application/json",
5074 * @OA\Schema(
5075 * @OA\Property(
5076 * property="pc_catid",
5077 * description="The category of the appointment.",
5078 * type="string"
5079 * ),
5080 * @OA\Property(
5081 * property="pc_title",
5082 * description="The title of the appointment.",
5083 * type="string"
5084 * ),
5085 * @OA\Property(
5086 * property="pc_duration",
5087 * description="The duration of the appointment.",
5088 * type="string"
5089 * ),
5090 * @OA\Property(
5091 * property="pc_hometext",
5092 * description="Comments for the appointment.",
5093 * type="string"
5094 * ),
5095 * @OA\Property(
5096 * property="pc_apptstatus",
5097 * description="use an option from resource=/api/list/apptstat",
5098 * type="string"
5099 * ),
5100 * @OA\Property(
5101 * property="pc_eventDate",
5102 * description="The date of the appointment.",
5103 * type="string"
5104 * ),
5105 * @OA\Property(
5106 * property="pc_startTime",
5107 * description="The time of the appointment.",
5108 * type="string"
5109 * ),
5110 * @OA\Property(
5111 * property="pc_facility",
5112 * description="The facility id of the appointment.",
5113 * type="string"
5114 * ),
5115 * @OA\Property(
5116 * property="pc_billing_location",
5117 * description="The billinag location id of the appointment.",
5118 * type="string"
5119 * ),
5120 * @OA\Property(
5121 * property="pc_aid",
5122 * description="The provider id for the appointment.",
5123 * type="string"
5124 * ),
5125 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5126 * example={
5127 * "pc_catid": "5",
5128 * "pc_title": "Office Visit",
5129 * "pc_duration": "900",
5130 * "pc_hometext": "Test",
5131 * "pc_apptstatus": "-",
5132 * "pc_eventDate": "2018-10-19",
5133 * "pc_startTime": "09:00",
5134 * "pc_facility": "9",
5135 * "pc_billing_location": "10",
5136 * "pc_aid": "1"
5140 * ),
5141 * @OA\Response(
5142 * response="200",
5143 * ref="#/components/responses/standard"
5144 * ),
5145 * @OA\Response(
5146 * response="400",
5147 * ref="#/components/responses/badrequest"
5148 * ),
5149 * @OA\Response(
5150 * response="401",
5151 * ref="#/components/responses/unauthorized"
5152 * ),
5153 * security={{"openemr_auth":{}}}
5156 "POST /api/patient/:pid/appointment" => function ($pid) {
5157 RestConfig::authorization_check("patients", "appt");
5158 $data = (array) (json_decode(file_get_contents("php://input")));
5159 $return = (new AppointmentRestController())->post($pid, $data);
5160 RestConfig::apiLog($return, $data);
5161 return $return;
5165 * @OA\Get(
5166 * path="/api/appointment",
5167 * description="Retrieves all appointments",
5168 * tags={"standard"},
5169 * @OA\Response(
5170 * response="200",
5171 * ref="#/components/responses/standard"
5172 * ),
5173 * @OA\Response(
5174 * response="400",
5175 * ref="#/components/responses/badrequest"
5176 * ),
5177 * @OA\Response(
5178 * response="401",
5179 * ref="#/components/responses/unauthorized"
5180 * ),
5181 * security={{"openemr_auth":{}}}
5184 "GET /api/appointment" => function () {
5185 RestConfig::authorization_check("patients", "appt");
5186 $return = (new AppointmentRestController())->getAll();
5187 RestConfig::apiLog($return);
5188 return $return;
5192 * @OA\Get(
5193 * path="/api/appointment/{eid}",
5194 * description="Retrieves an appointment",
5195 * tags={"standard"},
5196 * @OA\Parameter(
5197 * name="eid",
5198 * in="path",
5199 * description="The eid for the appointment.",
5200 * required=true,
5201 * @OA\Schema(
5202 * type="string"
5204 * ),
5205 * @OA\Response(
5206 * response="200",
5207 * ref="#/components/responses/standard"
5208 * ),
5209 * @OA\Response(
5210 * response="400",
5211 * ref="#/components/responses/badrequest"
5212 * ),
5213 * @OA\Response(
5214 * response="401",
5215 * ref="#/components/responses/unauthorized"
5216 * ),
5217 * security={{"openemr_auth":{}}}
5220 "GET /api/appointment/:eid" => function ($eid) {
5221 RestConfig::authorization_check("patients", "appt");
5222 $return = (new AppointmentRestController())->getOne($eid);
5223 RestConfig::apiLog($return);
5224 return $return;
5228 * @OA\Delete(
5229 * path="/api/patient/{pid}/appointment/{eid}",
5230 * description="Delete a appointment",
5231 * tags={"standard"},
5232 * @OA\Parameter(
5233 * name="pid",
5234 * in="path",
5235 * description="The id for the patient.",
5236 * required=true,
5237 * @OA\Schema(
5238 * type="string"
5240 * ),
5241 * @OA\Parameter(
5242 * name="eid",
5243 * in="path",
5244 * description="The eid for the appointment.",
5245 * required=true,
5246 * @OA\Schema(
5247 * type="string"
5249 * ),
5250 * @OA\Response(
5251 * response="200",
5252 * ref="#/components/responses/standard"
5253 * ),
5254 * @OA\Response(
5255 * response="400",
5256 * ref="#/components/responses/badrequest"
5257 * ),
5258 * @OA\Response(
5259 * response="401",
5260 * ref="#/components/responses/unauthorized"
5261 * ),
5262 * security={{"openemr_auth":{}}}
5265 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5266 RestConfig::authorization_check("patients", "appt");
5267 $return = (new AppointmentRestController())->delete($eid);
5268 RestConfig::apiLog($return);
5269 return $return;
5273 * @OA\Get(
5274 * path="/api/patient/{pid}/appointment/{eid}",
5275 * description="Retrieves a appointment for a patient",
5276 * tags={"standard"},
5277 * @OA\Parameter(
5278 * name="pid",
5279 * in="path",
5280 * description="The id for the patient.",
5281 * required=true,
5282 * @OA\Schema(
5283 * type="string"
5285 * ),
5286 * @OA\Parameter(
5287 * name="eid",
5288 * in="path",
5289 * description="The eid for the appointment.",
5290 * required=true,
5291 * @OA\Schema(
5292 * type="string"
5294 * ),
5295 * @OA\Response(
5296 * response="200",
5297 * ref="#/components/responses/standard"
5298 * ),
5299 * @OA\Response(
5300 * response="400",
5301 * ref="#/components/responses/badrequest"
5302 * ),
5303 * @OA\Response(
5304 * response="401",
5305 * ref="#/components/responses/unauthorized"
5306 * ),
5307 * security={{"openemr_auth":{}}}
5310 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5311 RestConfig::authorization_check("patients", "appt");
5312 $return = (new AppointmentRestController())->getOne($eid);
5313 RestConfig::apiLog($return);
5314 return $return;
5318 * @OA\Get(
5319 * path="/api/list/{list_name}",
5320 * description="Retrieves a list",
5321 * tags={"standard"},
5322 * @OA\Parameter(
5323 * name="list_name",
5324 * in="path",
5325 * description="The list_id of the list.",
5326 * required=true,
5327 * @OA\Schema(
5328 * type="string"
5330 * ),
5331 * @OA\Response(
5332 * response="200",
5333 * ref="#/components/responses/standard"
5334 * ),
5335 * @OA\Response(
5336 * response="400",
5337 * ref="#/components/responses/badrequest"
5338 * ),
5339 * @OA\Response(
5340 * response="401",
5341 * ref="#/components/responses/unauthorized"
5342 * ),
5343 * security={{"openemr_auth":{}}}
5346 "GET /api/list/:list_name" => function ($list_name) {
5347 RestConfig::authorization_check("lists", "default");
5348 $return = (new ListRestController())->getOptions($list_name);
5349 RestConfig::apiLog($return);
5350 return $return;
5354 * @OA\Get(
5355 * path="/api/version",
5356 * description="Retrieves the OpenEMR version information",
5357 * tags={"standard"},
5358 * @OA\Response(
5359 * response="200",
5360 * ref="#/components/responses/standard"
5361 * ),
5362 * @OA\Response(
5363 * response="400",
5364 * ref="#/components/responses/badrequest"
5365 * ),
5366 * @OA\Response(
5367 * response="401",
5368 * ref="#/components/responses/unauthorized"
5369 * ),
5370 * security={{"openemr_auth":{}}}
5373 "GET /api/version" => function () {
5374 $return = (new VersionRestController())->getOne();
5375 RestConfig::apiLog($return);
5376 return $return;
5380 * @OA\Get(
5381 * path="/api/product",
5382 * description="Retrieves the OpenEMR product registration information",
5383 * tags={"standard"},
5384 * @OA\Response(
5385 * response="200",
5386 * ref="#/components/responses/standard"
5387 * ),
5388 * @OA\Response(
5389 * response="400",
5390 * ref="#/components/responses/badrequest"
5391 * ),
5392 * @OA\Response(
5393 * response="401",
5394 * ref="#/components/responses/unauthorized"
5395 * ),
5396 * security={{"openemr_auth":{}}}
5399 "GET /api/product" => function () {
5400 $return = (new ProductRegistrationRestController())->getOne();
5401 RestConfig::apiLog($return);
5402 return $return;
5406 * @OA\Get(
5407 * path="/api/insurance_company",
5408 * description="Retrieves all insurance companies",
5409 * tags={"standard"},
5410 * @OA\Response(
5411 * response="200",
5412 * ref="#/components/responses/standard"
5413 * ),
5414 * @OA\Response(
5415 * response="400",
5416 * ref="#/components/responses/badrequest"
5417 * ),
5418 * @OA\Response(
5419 * response="401",
5420 * ref="#/components/responses/unauthorized"
5421 * ),
5422 * security={{"openemr_auth":{}}}
5425 "GET /api/insurance_company" => function () {
5426 $return = (new InsuranceCompanyRestController())->getAll();
5427 RestConfig::apiLog($return);
5428 return $return;
5432 * @OA\Get(
5433 * path="/api/insurance_company/{iid}",
5434 * description="Retrieves insurance company",
5435 * tags={"standard"},
5436 * @OA\Parameter(
5437 * name="iid",
5438 * in="path",
5439 * description="The id of the insurance company.",
5440 * required=true,
5441 * @OA\Schema(
5442 * type="string"
5444 * ),
5445 * @OA\Response(
5446 * response="200",
5447 * ref="#/components/responses/standard"
5448 * ),
5449 * @OA\Response(
5450 * response="400",
5451 * ref="#/components/responses/badrequest"
5452 * ),
5453 * @OA\Response(
5454 * response="401",
5455 * ref="#/components/responses/unauthorized"
5456 * ),
5457 * security={{"openemr_auth":{}}}
5460 "GET /api/insurance_company/:iid" => function ($iid) {
5461 $return = (new InsuranceCompanyRestController())->getOne($iid);
5462 RestConfig::apiLog($return);
5463 return $return;
5467 * @OA\Get(
5468 * path="/api/insurance_type",
5469 * description="Retrieves all insurance types",
5470 * tags={"standard"},
5471 * @OA\Response(
5472 * response="200",
5473 * ref="#/components/responses/standard"
5474 * ),
5475 * @OA\Response(
5476 * response="400",
5477 * ref="#/components/responses/badrequest"
5478 * ),
5479 * @OA\Response(
5480 * response="401",
5481 * ref="#/components/responses/unauthorized"
5482 * ),
5483 * security={{"openemr_auth":{}}}
5486 "GET /api/insurance_type" => function () {
5487 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5488 RestConfig::apiLog($return);
5489 return $return;
5493 * Schema for the insurance_company request
5495 * @OA\Schema(
5496 * schema="api_insurance_company_request",
5497 * @OA\Property(
5498 * property="name",
5499 * description="The name of insurance company.",
5500 * type="string"
5501 * ),
5502 * @OA\Property(
5503 * property="attn",
5504 * description="The attn of insurance company.",
5505 * type="string"
5506 * ),
5507 * @OA\Property(
5508 * property="cms_id",
5509 * description="The cms id of insurance company.",
5510 * type="string"
5511 * ),
5512 * @OA\Property(
5513 * property="ins_type_code",
5514 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5515 * type="string"
5516 * ),
5517 * @OA\Property(
5518 * property="x12_receiver_id",
5519 * description="The x12 receiver id of insurance company.",
5520 * type="string"
5521 * ),
5522 * @OA\Property(
5523 * property="x12_default_partner_id",
5524 * description="The x12 default partner id of insurance company.",
5525 * type="string"
5526 * ),
5527 * @OA\Property(
5528 * property="alt_cms_id",
5529 * description="The alternate cms id of insurance company.",
5530 * type="string"
5531 * ),
5532 * @OA\Property(
5533 * property="line1",
5534 * description="The line1 address of insurance company.",
5535 * type="string"
5536 * ),
5537 * @OA\Property(
5538 * property="line2",
5539 * description="The line2 address of insurance company.",
5540 * type="string"
5541 * ),
5542 * @OA\Property(
5543 * property="city",
5544 * description="The city of insurance company.",
5545 * type="string"
5546 * ),
5547 * @OA\Property(
5548 * property="state",
5549 * description="The state of insurance company.",
5550 * type="string"
5551 * ),
5552 * @OA\Property(
5553 * property="zip",
5554 * description="The zip of insurance company.",
5555 * type="string"
5556 * ),
5557 * @OA\Property(
5558 * property="country",
5559 * description="The country of insurance company.",
5560 * type="string"
5561 * ),
5562 * required={"name"},
5563 * example={
5564 * "name": "Cool Insurance Company",
5565 * "attn": null,
5566 * "cms_id": null,
5567 * "ins_type_code": "2",
5568 * "x12_receiver_id": null,
5569 * "x12_default_partner_id": null,
5570 * "alt_cms_id": "",
5571 * "line1": "123 Cool Lane",
5572 * "line2": "Suite 123",
5573 * "city": "Cooltown",
5574 * "state": "CA",
5575 * "zip": "12245",
5576 * "country": "USA"
5581 * @OA\Post(
5582 * path="/api/insurance_company",
5583 * description="Submits a new insurance company",
5584 * tags={"standard"},
5585 * @OA\RequestBody(
5586 * required=true,
5587 * @OA\MediaType(
5588 * mediaType="application/json",
5589 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5591 * ),
5592 * @OA\Response(
5593 * response="200",
5594 * ref="#/components/responses/standard"
5595 * ),
5596 * @OA\Response(
5597 * response="400",
5598 * ref="#/components/responses/badrequest"
5599 * ),
5600 * @OA\Response(
5601 * response="401",
5602 * ref="#/components/responses/unauthorized"
5603 * ),
5604 * security={{"openemr_auth":{}}}
5607 "POST /api/insurance_company" => function () {
5608 $data = (array) (json_decode(file_get_contents("php://input")));
5609 $return = (new InsuranceCompanyRestController())->post($data);
5610 RestConfig::apiLog($return, $data);
5611 return $return;
5615 * @OA\Put(
5616 * path="/api/insurance_company/{iid}",
5617 * description="Edit a insurance company",
5618 * tags={"standard"},
5619 * @OA\Parameter(
5620 * name="iid",
5621 * in="path",
5622 * description="The id for the insurance company.",
5623 * required=true,
5624 * @OA\Schema(
5625 * type="string"
5627 * ),
5628 * @OA\RequestBody(
5629 * required=true,
5630 * @OA\MediaType(
5631 * mediaType="application/json",
5632 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5634 * ),
5635 * @OA\Response(
5636 * response="200",
5637 * ref="#/components/responses/standard"
5638 * ),
5639 * @OA\Response(
5640 * response="400",
5641 * ref="#/components/responses/badrequest"
5642 * ),
5643 * @OA\Response(
5644 * response="401",
5645 * ref="#/components/responses/unauthorized"
5646 * ),
5647 * security={{"openemr_auth":{}}}
5650 "PUT /api/insurance_company/:iid" => function ($iid) {
5651 $data = (array) (json_decode(file_get_contents("php://input")));
5652 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5653 RestConfig::apiLog($return, $data);
5654 return $return;
5658 * @OA\Post(
5659 * path="/api/patient/{pid}/document",
5660 * description="Submits a new patient document",
5661 * tags={"standard"},
5662 * @OA\Parameter(
5663 * name="pid",
5664 * in="path",
5665 * description="The pid for the patient.",
5666 * required=true,
5667 * @OA\Schema(
5668 * type="string"
5670 * ),
5671 * @OA\Parameter(
5672 * name="path",
5673 * in="query",
5674 * description="The category of the document.",
5675 * required=true,
5676 * @OA\Schema(
5677 * type="string"
5679 * ),
5680 * @OA\RequestBody(
5681 * required=true,
5682 * @OA\MediaType(
5683 * mediaType="multipart/form-data",
5684 * @OA\Schema(
5685 * @OA\Property(
5686 * property="document",
5687 * description="document",
5688 * type="string",
5689 * format="binary"
5690 * ),
5691 * ),
5692 * ),
5693 * ),
5694 * @OA\Response(
5695 * response="200",
5696 * ref="#/components/responses/standard"
5697 * ),
5698 * @OA\Response(
5699 * response="400",
5700 * ref="#/components/responses/badrequest"
5701 * ),
5702 * @OA\Response(
5703 * response="401",
5704 * ref="#/components/responses/unauthorized"
5705 * ),
5706 * security={{"openemr_auth":{}}}
5709 "POST /api/patient/:pid/document" => function ($pid) {
5710 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5711 RestConfig::apiLog($return);
5712 return $return;
5716 * @OA\Get(
5717 * path="/api/patient/{pid}/document",
5718 * description="Retrieves all file information of documents from a category for a patient",
5719 * tags={"standard"},
5720 * @OA\Parameter(
5721 * name="pid",
5722 * in="path",
5723 * description="The pid for the patient.",
5724 * required=true,
5725 * @OA\Schema(
5726 * type="string"
5728 * ),
5729 * @OA\Parameter(
5730 * name="path",
5731 * in="query",
5732 * description="The category of the documents.",
5733 * required=true,
5734 * @OA\Schema(
5735 * type="string"
5737 * ),
5738 * @OA\Response(
5739 * response="200",
5740 * ref="#/components/responses/standard"
5741 * ),
5742 * @OA\Response(
5743 * response="400",
5744 * ref="#/components/responses/badrequest"
5745 * ),
5746 * @OA\Response(
5747 * response="401",
5748 * ref="#/components/responses/unauthorized"
5749 * ),
5750 * security={{"openemr_auth":{}}}
5753 "GET /api/patient/:pid/document" => function ($pid) {
5754 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5755 RestConfig::apiLog($return);
5756 return $return;
5760 * @OA\Get(
5761 * path="/api/patient/{pid}/document/{did}",
5762 * description="Retrieves a document for a patient",
5763 * tags={"standard"},
5764 * @OA\Parameter(
5765 * name="pid",
5766 * in="path",
5767 * description="The pid for the patient.",
5768 * required=true,
5769 * @OA\Schema(
5770 * type="string"
5772 * ),
5773 * @OA\Parameter(
5774 * name="did",
5775 * in="path",
5776 * description="The id for the patient document.",
5777 * required=true,
5778 * @OA\Schema(
5779 * type="string"
5781 * ),
5782 * @OA\Response(
5783 * response="200",
5784 * ref="#/components/responses/standard"
5785 * ),
5786 * @OA\Response(
5787 * response="400",
5788 * ref="#/components/responses/badrequest"
5789 * ),
5790 * @OA\Response(
5791 * response="401",
5792 * ref="#/components/responses/unauthorized"
5793 * ),
5794 * security={{"openemr_auth":{}}}
5797 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5798 $return = (new DocumentRestController())->downloadFile($pid, $did);
5799 RestConfig::apiLog($return);
5800 return $return;
5804 * @OA\Get(
5805 * path="/api/patient/{pid}/insurance",
5806 * description="Retrieves all insurances for a patient",
5807 * tags={"standard"},
5808 * @OA\Parameter(
5809 * name="pid",
5810 * in="path",
5811 * description="The pid for the patient.",
5812 * required=true,
5813 * @OA\Schema(
5814 * type="string"
5816 * ),
5817 * @OA\Response(
5818 * response="200",
5819 * ref="#/components/responses/standard"
5820 * ),
5821 * @OA\Response(
5822 * response="400",
5823 * ref="#/components/responses/badrequest"
5824 * ),
5825 * @OA\Response(
5826 * response="401",
5827 * ref="#/components/responses/unauthorized"
5828 * ),
5829 * security={{"openemr_auth":{}}}
5832 "GET /api/patient/:pid/insurance" => function ($pid) {
5833 $return = (new InsuranceRestController())->getAll($pid);
5834 RestConfig::apiLog($return);
5835 return $return;
5839 * @OA\Get(
5840 * path="/api/patient/{pid}/insurance/{type}",
5841 * description="Retrieves a insurance (by type) for a patient",
5842 * tags={"standard"},
5843 * @OA\Parameter(
5844 * name="pid",
5845 * in="path",
5846 * description="The pid for the patient.",
5847 * required=true,
5848 * @OA\Schema(
5849 * type="string"
5851 * ),
5852 * @OA\Parameter(
5853 * name="type",
5854 * in="path",
5855 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5856 * required=true,
5857 * @OA\Schema(
5858 * type="string"
5860 * ),
5861 * @OA\Response(
5862 * response="200",
5863 * ref="#/components/responses/standard"
5864 * ),
5865 * @OA\Response(
5866 * response="400",
5867 * ref="#/components/responses/badrequest"
5868 * ),
5869 * @OA\Response(
5870 * response="401",
5871 * ref="#/components/responses/unauthorized"
5872 * ),
5873 * security={{"openemr_auth":{}}}
5876 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5877 $return = (new InsuranceRestController())->getOne($pid, $type);
5878 RestConfig::apiLog($return);
5879 return $return;
5883 * Schema for the insurance request
5885 * @OA\Schema(
5886 * schema="api_insurance_request",
5887 * @OA\Property(
5888 * property="provider",
5889 * description="The insurance company id.",
5890 * type="string"
5891 * ),
5892 * @OA\Property(
5893 * property="plan_name",
5894 * description="The plan name of insurance.",
5895 * type="string"
5896 * ),
5897 * @OA\Property(
5898 * property="policy_number",
5899 * description="The policy number of insurance.",
5900 * type="string"
5901 * ),
5902 * @OA\Property(
5903 * property="group_number",
5904 * description="The group number of insurance.",
5905 * type="string"
5906 * ),
5907 * @OA\Property(
5908 * property="subscriber_lname",
5909 * description="The subscriber last name of insurance.",
5910 * type="string"
5911 * ),
5912 * @OA\Property(
5913 * property="subscriber_mname",
5914 * description="The subscriber middle name of insurance.",
5915 * type="string"
5916 * ),
5917 * @OA\Property(
5918 * property="subscriber_fname",
5919 * description="The subscriber first name of insurance.",
5920 * type="string"
5921 * ),
5922 * @OA\Property(
5923 * property="subscriber_relationship",
5924 * description="The subscriber relationship of insurance.",
5925 * type="string"
5926 * ),
5927 * @OA\Property(
5928 * property="subscriber_ss",
5929 * description="The subscriber ss number of insurance.",
5930 * type="string"
5931 * ),
5932 * @OA\Property(
5933 * property="subscriber_DOB",
5934 * description="The subscriber DOB of insurance.",
5935 * type="string"
5936 * ),
5937 * @OA\Property(
5938 * property="subscriber_street",
5939 * description="The subscriber street address of insurance.",
5940 * type="string"
5941 * ),
5942 * @OA\Property(
5943 * property="subscriber_postal_code",
5944 * description="The subscriber postal code of insurance.",
5945 * type="string"
5946 * ),
5947 * @OA\Property(
5948 * property="subscriber_city",
5949 * description="The subscriber city of insurance.",
5950 * type="string"
5951 * ),
5952 * @OA\Property(
5953 * property="subscriber_state",
5954 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5955 * type="string"
5956 * ),
5957 * @OA\Property(
5958 * property="subscriber_country",
5959 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5960 * type="string"
5961 * ),
5962 * @OA\Property(
5963 * property="subscriber_phone",
5964 * description="The subscriber phone of insurance.",
5965 * type="string"
5966 * ),
5967 * @OA\Property(
5968 * property="subscriber_employer",
5969 * description="The subscriber employer of insurance.",
5970 * type="string"
5971 * ),
5972 * @OA\Property(
5973 * property="subscriber_employer_street",
5974 * description="The subscriber employer street of insurance.",
5975 * type="string"
5976 * ),
5977 * @OA\Property(
5978 * property="subscriber_employer_postal_code",
5979 * description="The subscriber employer postal code of insurance.",
5980 * type="string"
5981 * ),
5982 * @OA\Property(
5983 * property="subscriber_employer_state",
5984 * description="The subscriber employer state of insurance.",
5985 * type="string"
5986 * ),
5987 * @OA\Property(
5988 * property="subscriber_employer_country",
5989 * description="The subscriber employer country of insurance.",
5990 * type="string"
5991 * ),
5992 * @OA\Property(
5993 * property="subscriber_employer_city",
5994 * description="The subscriber employer city of insurance.",
5995 * type="string"
5996 * ),
5997 * @OA\Property(
5998 * property="copay",
5999 * description="The copay of insurance.",
6000 * type="string"
6001 * ),
6002 * @OA\Property(
6003 * property="date",
6004 * description="The date of insurance.",
6005 * type="string"
6006 * ),
6007 * @OA\Property(
6008 * property="subscriber_sex",
6009 * description="The subscriber sex of insurance.",
6010 * type="string"
6011 * ),
6012 * @OA\Property(
6013 * property="accept_assignment",
6014 * description="The accept_assignment of insurance.",
6015 * type="string"
6016 * ),
6017 * @OA\Property(
6018 * property="policy_type",
6019 * description="The policy_type of insurance.",
6020 * type="string"
6021 * ),
6022 * 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"},
6023 * example={
6024 * "provider": "33",
6025 * "plan_name": "Some Plan",
6026 * "policy_number": "12345",
6027 * "group_number": "252412",
6028 * "subscriber_lname": "Tester",
6029 * "subscriber_mname": "Xi",
6030 * "subscriber_fname": "Foo",
6031 * "subscriber_relationship": "other",
6032 * "subscriber_ss": "234231234",
6033 * "subscriber_DOB": "2018-10-03",
6034 * "subscriber_street": "183 Cool St",
6035 * "subscriber_postal_code": "23418",
6036 * "subscriber_city": "Cooltown",
6037 * "subscriber_state": "AZ",
6038 * "subscriber_country": "USA",
6039 * "subscriber_phone": "234-598-2123",
6040 * "subscriber_employer": "Some Employer",
6041 * "subscriber_employer_street": "123 Heather Lane",
6042 * "subscriber_employer_postal_code": "23415",
6043 * "subscriber_employer_state": "AZ",
6044 * "subscriber_employer_country": "USA",
6045 * "subscriber_employer_city": "Cooltown",
6046 * "copay": "35",
6047 * "date": "2018-10-15",
6048 * "subscriber_sex": "Female",
6049 * "accept_assignment": "TRUE",
6050 * "policy_type": "a"
6055 * @OA\Post(
6056 * path="/api/patient/{pid}/insurance/{type}",
6057 * description="Submits a new patient insurance (with type)",
6058 * tags={"standard"},
6059 * @OA\Parameter(
6060 * name="pid",
6061 * in="path",
6062 * description="The pid for the patient.",
6063 * required=true,
6064 * @OA\Schema(
6065 * type="string"
6067 * ),
6068 * @OA\Parameter(
6069 * name="type",
6070 * in="path",
6071 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6072 * required=true,
6073 * @OA\Schema(
6074 * type="string"
6076 * ),
6077 * @OA\RequestBody(
6078 * required=true,
6079 * @OA\MediaType(
6080 * mediaType="application/json",
6081 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6083 * ),
6084 * @OA\Response(
6085 * response="200",
6086 * ref="#/components/responses/standard"
6087 * ),
6088 * @OA\Response(
6089 * response="400",
6090 * ref="#/components/responses/badrequest"
6091 * ),
6092 * @OA\Response(
6093 * response="401",
6094 * ref="#/components/responses/unauthorized"
6095 * ),
6096 * security={{"openemr_auth":{}}}
6099 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6100 $data = (array) (json_decode(file_get_contents("php://input")));
6101 $return = (new InsuranceRestController())->post($pid, $type, $data);
6102 RestConfig::apiLog($return, $data);
6103 return $return;
6107 * @OA\Put(
6108 * path="/api/patient/{pid}/insurance/{type}",
6109 * description="Edit a patient insurance (by type)",
6110 * tags={"standard"},
6111 * @OA\Parameter(
6112 * name="pid",
6113 * in="path",
6114 * description="The pid for the patient.",
6115 * required=true,
6116 * @OA\Schema(
6117 * type="string"
6119 * ),
6120 * @OA\Parameter(
6121 * name="type",
6122 * in="path",
6123 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6124 * required=true,
6125 * @OA\Schema(
6126 * type="string"
6128 * ),
6129 * @OA\RequestBody(
6130 * required=true,
6131 * @OA\MediaType(
6132 * mediaType="application/json",
6133 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6135 * ),
6136 * @OA\Response(
6137 * response="200",
6138 * ref="#/components/responses/standard"
6139 * ),
6140 * @OA\Response(
6141 * response="400",
6142 * ref="#/components/responses/badrequest"
6143 * ),
6144 * @OA\Response(
6145 * response="401",
6146 * ref="#/components/responses/unauthorized"
6147 * ),
6148 * security={{"openemr_auth":{}}}
6151 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6152 $data = (array) (json_decode(file_get_contents("php://input")));
6153 $return = (new InsuranceRestController())->put($pid, $type, $data);
6154 RestConfig::apiLog($return, $data);
6155 return $return;
6159 * Schema for the message request
6161 * @OA\Schema(
6162 * schema="api_message_request",
6163 * @OA\Property(
6164 * property="body",
6165 * description="The body of message.",
6166 * type="string"
6167 * ),
6168 * @OA\Property(
6169 * property="groupname",
6170 * description="The group name (usually is 'Default').",
6171 * type="string"
6172 * ),
6173 * @OA\Property(
6174 * property="from",
6175 * description="The sender of the message.",
6176 * type="string"
6177 * ),
6178 * @OA\Property(
6179 * property="to",
6180 * description="The recipient of the message.",
6181 * type="string"
6182 * ),
6183 * @OA\Property(
6184 * property="title",
6185 * description="use an option from resource=/api/list/note_type",
6186 * type="string"
6187 * ),
6188 * @OA\Property(
6189 * property="message_status",
6190 * description="use an option from resource=/api/list/message_status",
6191 * type="string"
6192 * ),
6193 * required={"body", "groupname", "from", "to", "title", "message_status"},
6194 * example={
6195 * "body": "Test 456",
6196 * "groupname": "Default",
6197 * "from": "Matthew",
6198 * "to": "admin",
6199 * "title": "Other",
6200 * "message_status": "New"
6205 * @OA\Post(
6206 * path="/api/patient/{pid}/message",
6207 * description="Submits a pnote message",
6208 * tags={"standard"},
6209 * @OA\Parameter(
6210 * name="pid",
6211 * in="path",
6212 * description="The id for the patient.",
6213 * required=true,
6214 * @OA\Schema(
6215 * type="string"
6217 * ),
6218 * @OA\RequestBody(
6219 * required=true,
6220 * @OA\MediaType(
6221 * mediaType="application/json",
6222 * @OA\Schema(ref="#/components/schemas/api_message_request")
6224 * ),
6225 * @OA\Response(
6226 * response="200",
6227 * ref="#/components/responses/standard"
6228 * ),
6229 * @OA\Response(
6230 * response="400",
6231 * ref="#/components/responses/badrequest"
6232 * ),
6233 * @OA\Response(
6234 * response="401",
6235 * ref="#/components/responses/unauthorized"
6236 * ),
6237 * security={{"openemr_auth":{}}}
6240 "POST /api/patient/:pid/message" => function ($pid) {
6241 RestConfig::authorization_check("patients", "notes");
6242 $data = (array) (json_decode(file_get_contents("php://input")));
6243 $return = (new MessageRestController())->post($pid, $data);
6244 RestConfig::apiLog($return, $data);
6245 return $return;
6249 * @OA\Get(
6250 * path="/api/patient/{pid}/transaction",
6251 * description="Get Transactions for a patient",
6252 * tags={"standard"},
6253 * @OA\Parameter(
6254 * name="pid",
6255 * in="path",
6256 * description="The pid for the patient",
6257 * required=true,
6258 * @OA\Schema(
6259 * type="string"
6261 * ),
6262 * @OA\Response(
6263 * response="200",
6264 * ref="#/components/responses/standard"
6265 * ),
6266 * @OA\Response(
6267 * response="400",
6268 * ref="#/components/responses/badrequest"
6269 * ),
6270 * @OA\Response(
6271 * response="401",
6272 * ref="#/components/responses/unauthorized"
6273 * ),
6274 * security={{"openemr_auth":{}}}
6278 "GET /api/patient/:pid/transaction" => function ($pid) {
6279 RestConfig::authorization_check("patients", "trans");
6280 $cont = new TransactionRestController();
6281 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6282 RestConfig::apiLog($return);
6283 return $return;
6287 * Schema for the transaction request
6289 * @OA\Schema(
6290 * schema="api_transaction_request",
6291 * @OA\Property(
6292 * property="message",
6293 * description="The message of the transaction.",
6294 * type="string"
6295 * ),
6296 * @OA\Property(
6297 * property="type",
6298 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6299 * type="string"
6300 * ),
6301 * @OA\Property(
6302 * property="groupname",
6303 * description="The group name (usually is 'Default').",
6304 * type="string"
6305 * ),
6306 * @OA\Property(
6307 * property="referByNpi",
6308 * description="NPI of the person creating the referral.",
6309 * type="string"
6310 * ),
6311 * @OA\Property(
6312 * property="referToNpi",
6313 * description="NPI of the person getting the referral.",
6314 * type="string"
6315 * ),
6316 * @OA\Property(
6317 * property="referDiagnosis",
6318 * description="The referral diagnosis.",
6319 * type="string"
6320 * ),
6321 * @OA\Property(
6322 * property="riskLevel",
6323 * description="The risk level. (Low, Medium, High)",
6324 * type="string"
6325 * ),
6326 * @OA\Property(
6327 * property="includeVitals",
6328 * description="Are vitals included (0,1)",
6329 * type="string"
6330 * ),
6331 * @OA\Property(
6332 * property="referralDate",
6333 * description="The date of the referral",
6334 * type="string"
6335 * ),
6336 * @OA\Property(
6337 * property="authorization",
6338 * description="The authorization for the referral",
6339 * type="string"
6340 * ),
6341 * @OA\Property(
6342 * property="visits",
6343 * description="The number of vists for the referral",
6344 * type="string"
6345 * ),
6346 * @OA\Property(
6347 * property="validFrom",
6348 * description="The date the referral is valid from",
6349 * type="string"
6350 * ),
6351 * @OA\Property(
6352 * property="validThrough",
6353 * description="The date the referral is valid through",
6354 * type="string"
6355 * ),
6356 * required={"message", "groupname", "title"},
6357 * example={
6358 * "message": "Message",
6359 * "type": "LBTref",
6360 * "groupname": "Default",
6361 * "referByNpi":"9999999999",
6362 * "referToNpi":"9999999999",
6363 * "referDiagnosis":"Diag 1",
6364 * "riskLevel":"Low",
6365 * "includeVitals":"1",
6366 * "referralDate":"2022-01-01",
6367 * "authorization":"Auth_123",
6368 * "visits": "1",
6369 * "validFrom": "2022-01-02",
6370 * "validThrough": "2022-01-03",
6371 * "body": "Reason 1"
6376 * @OA\Post(
6377 * path="/api/patient/{pid}/transaction",
6378 * description="Submits a transaction",
6379 * tags={"standard"},
6380 * @OA\Parameter(
6381 * name="pid",
6382 * in="path",
6383 * description="The pid for the patient.",
6384 * required=true,
6385 * @OA\Schema(
6386 * type="string"
6388 * ),
6389 * @OA\RequestBody(
6390 * required=true,
6391 * @OA\MediaType(
6392 * mediaType="application/json",
6393 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6395 * ),
6396 * @OA\Response(
6397 * response="200",
6398 * ref="#/components/responses/standard"
6399 * ),
6400 * @OA\Response(
6401 * response="400",
6402 * ref="#/components/responses/badrequest"
6403 * ),
6404 * @OA\Response(
6405 * response="401",
6406 * ref="#/components/responses/unauthorized"
6407 * ),
6408 * security={{"openemr_auth":{}}}
6411 "POST /api/patient/:pid/transaction" => function ($pid) {
6412 RestConfig::authorization_check("patients", "trans");
6413 $data = (array) (json_decode(file_get_contents("php://input")));
6414 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6415 RestConfig::apiLog($return, $data);
6416 return $return;
6420 * @OA\PUT(
6421 * path="/api/transaction/{tid}",
6422 * description="Updates a transaction",
6423 * tags={"standard"},
6424 * @OA\Parameter(
6425 * name="tid",
6426 * in="path",
6427 * description="The id for the transaction.",
6428 * required=true,
6429 * @OA\Schema(
6430 * type="string"
6432 * ),
6433 * @OA\RequestBody(
6434 * required=true,
6435 * @OA\MediaType(
6436 * mediaType="application/json",
6437 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6439 * ),
6440 * @OA\Response(
6441 * response="200",
6442 * ref="#/components/responses/standard"
6443 * ),
6444 * @OA\Response(
6445 * response="400",
6446 * ref="#/components/responses/badrequest"
6447 * ),
6448 * @OA\Response(
6449 * response="401",
6450 * ref="#/components/responses/unauthorized"
6451 * ),
6452 * security={{"openemr_auth":{}}}
6455 "PUT /api/transaction/:tid" => function ($tid) {
6456 RestConfig::authorization_check("patients", "trans");
6457 $data = (array) (json_decode(file_get_contents("php://input")));
6458 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6459 RestConfig::apiLog($return, $data);
6460 return $return;
6464 * @OA\Put(
6465 * path="/api/patient/{pid}/message/{mid}",
6466 * description="Edit a pnote message",
6467 * tags={"standard"},
6468 * @OA\Parameter(
6469 * name="pid",
6470 * in="path",
6471 * description="The id for the patient.",
6472 * required=true,
6473 * @OA\Schema(
6474 * type="string"
6476 * ),
6477 * @OA\Parameter(
6478 * name="mid",
6479 * in="path",
6480 * description="The id for the pnote message.",
6481 * required=true,
6482 * @OA\Schema(
6483 * type="string"
6485 * ),
6486 * @OA\RequestBody(
6487 * required=true,
6488 * @OA\MediaType(
6489 * mediaType="application/json",
6490 * @OA\Schema(ref="#/components/schemas/api_message_request")
6492 * ),
6493 * @OA\Response(
6494 * response="200",
6495 * ref="#/components/responses/standard"
6496 * ),
6497 * @OA\Response(
6498 * response="400",
6499 * ref="#/components/responses/badrequest"
6500 * ),
6501 * @OA\Response(
6502 * response="401",
6503 * ref="#/components/responses/unauthorized"
6504 * ),
6505 * security={{"openemr_auth":{}}}
6508 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6509 RestConfig::authorization_check("patients", "notes");
6510 $data = (array) (json_decode(file_get_contents("php://input")));
6511 $return = (new MessageRestController())->put($pid, $mid, $data);
6512 RestConfig::apiLog($return, $data);
6513 return $return;
6517 * @OA\Delete(
6518 * path="/api/patient/{pid}/message/{mid}",
6519 * description="Delete a pnote message",
6520 * tags={"standard"},
6521 * @OA\Parameter(
6522 * name="pid",
6523 * in="path",
6524 * description="The id for the patient.",
6525 * required=true,
6526 * @OA\Schema(
6527 * type="string"
6529 * ),
6530 * @OA\Parameter(
6531 * name="eid",
6532 * in="path",
6533 * description="The id for the pnote message.",
6534 * required=true,
6535 * @OA\Schema(
6536 * type="string"
6538 * ),
6539 * @OA\Response(
6540 * response="200",
6541 * ref="#/components/responses/standard"
6542 * ),
6543 * @OA\Response(
6544 * response="400",
6545 * ref="#/components/responses/badrequest"
6546 * ),
6547 * @OA\Response(
6548 * response="401",
6549 * ref="#/components/responses/unauthorized"
6550 * ),
6551 * security={{"openemr_auth":{}}}
6554 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6555 RestConfig::authorization_check("patients", "notes");
6556 $return = (new MessageRestController())->delete($pid, $mid);
6557 RestConfig::apiLog($return);
6558 return $return;
6562 * @OA\Get(
6563 * path="/api/immunization",
6564 * description="Retrieves a list of immunizations",
6565 * tags={"standard"},
6566 * @OA\Parameter(
6567 * name="patient_id",
6568 * in="query",
6569 * description="The pid for the patient.",
6570 * required=false,
6571 * @OA\Schema(
6572 * type="string"
6574 * ),
6575 * @OA\Parameter(
6576 * name="id",
6577 * in="query",
6578 * description="The id for the immunization.",
6579 * required=false,
6580 * @OA\Schema(
6581 * type="string"
6583 * ),
6584 * @OA\Parameter(
6585 * name="uuid",
6586 * in="query",
6587 * description="The uuid for the immunization.",
6588 * required=false,
6589 * @OA\Schema(
6590 * type="string"
6592 * ),
6593 * @OA\Parameter(
6594 * name="administered_date",
6595 * in="query",
6596 * description="The administered date for the immunization.",
6597 * required=false,
6598 * @OA\Schema(
6599 * type="string"
6601 * ),
6602 * @OA\Parameter(
6603 * name="immunization_id",
6604 * in="query",
6605 * description="The immunization list_id for the immunization.",
6606 * required=false,
6607 * @OA\Schema(
6608 * type="string"
6610 * ),
6611 * @OA\Parameter(
6612 * name="cvx_code",
6613 * in="query",
6614 * description="The cvx code for the immunization.",
6615 * required=false,
6616 * @OA\Schema(
6617 * type="string"
6619 * ),
6620 * @OA\Parameter(
6621 * name="manufacturer",
6622 * in="query",
6623 * description="The manufacturer for the immunization.",
6624 * required=false,
6625 * @OA\Schema(
6626 * type="string"
6628 * ),
6629 * @OA\Parameter(
6630 * name="lot_number",
6631 * in="query",
6632 * description="The lot number for the immunization.",
6633 * required=false,
6634 * @OA\Schema(
6635 * type="string"
6637 * ),
6638 * @OA\Parameter(
6639 * name="administered_by_id",
6640 * in="query",
6641 * description="The administered by id for the immunization.",
6642 * required=false,
6643 * @OA\Schema(
6644 * type="string"
6646 * ),
6647 * @OA\Parameter(
6648 * name="administered_by",
6649 * in="query",
6650 * description="The administered by for the immunization.",
6651 * required=false,
6652 * @OA\Schema(
6653 * type="string"
6655 * ),
6656 * @OA\Parameter(
6657 * name="education_date",
6658 * in="query",
6659 * description="The education date for the immunization.",
6660 * required=false,
6661 * @OA\Schema(
6662 * type="string"
6664 * ),
6665 * @OA\Parameter(
6666 * name="vis_date",
6667 * in="query",
6668 * description="The vis date for the immunization.",
6669 * required=false,
6670 * @OA\Schema(
6671 * type="string"
6673 * ),
6674 * @OA\Parameter(
6675 * name="note",
6676 * in="query",
6677 * description="The note for the immunization.",
6678 * required=false,
6679 * @OA\Schema(
6680 * type="string"
6682 * ),
6683 * @OA\Parameter(
6684 * name="create_date",
6685 * in="query",
6686 * description="The create date for the immunization.",
6687 * required=false,
6688 * @OA\Schema(
6689 * type="string"
6691 * ),
6692 * @OA\Parameter(
6693 * name="update_date",
6694 * in="query",
6695 * description="The update date for the immunization.",
6696 * required=false,
6697 * @OA\Schema(
6698 * type="string"
6700 * ),
6701 * @OA\Parameter(
6702 * name="created_by",
6703 * in="query",
6704 * description="The created_by for the immunization.",
6705 * required=false,
6706 * @OA\Schema(
6707 * type="string"
6709 * ),
6710 * @OA\Parameter(
6711 * name="updated_by",
6712 * in="query",
6713 * description="The updated_by for the immunization.",
6714 * required=false,
6715 * @OA\Schema(
6716 * type="string"
6718 * ),
6719 * @OA\Parameter(
6720 * name="amount_administered",
6721 * in="query",
6722 * description="The amount administered for the immunization.",
6723 * required=false,
6724 * @OA\Schema(
6725 * type="string"
6727 * ),
6728 * @OA\Parameter(
6729 * name="amount_administered_unit",
6730 * in="query",
6731 * description="The amount administered unit for the immunization.",
6732 * required=false,
6733 * @OA\Schema(
6734 * type="string"
6736 * ),
6737 * @OA\Parameter(
6738 * name="expiration_date",
6739 * in="query",
6740 * description="The expiration date for the immunization.",
6741 * required=false,
6742 * @OA\Schema(
6743 * type="string"
6745 * ),
6746 * @OA\Parameter(
6747 * name="route",
6748 * in="query",
6749 * description="The route for the immunization.",
6750 * required=false,
6751 * @OA\Schema(
6752 * type="string"
6754 * ),
6755 * @OA\Parameter(
6756 * name="administration_site",
6757 * in="query",
6758 * description="The administration site for the immunization.",
6759 * required=false,
6760 * @OA\Schema(
6761 * type="string"
6763 * ),
6764 * @OA\Parameter(
6765 * name="added_erroneously",
6766 * in="query",
6767 * description="The added_erroneously for the immunization.",
6768 * required=false,
6769 * @OA\Schema(
6770 * type="string"
6772 * ),
6773 * @OA\Parameter(
6774 * name="external_id",
6775 * in="query",
6776 * description="The external_id for the immunization.",
6777 * required=false,
6778 * @OA\Schema(
6779 * type="string"
6781 * ),
6782 * @OA\Parameter(
6783 * name="completion_status",
6784 * in="query",
6785 * description="The completion status for the immunization.",
6786 * required=false,
6787 * @OA\Schema(
6788 * type="string"
6790 * ),
6791 * @OA\Parameter(
6792 * name="information_source",
6793 * in="query",
6794 * description="The information source for the immunization.",
6795 * required=false,
6796 * @OA\Schema(
6797 * type="string"
6799 * ),
6800 * @OA\Parameter(
6801 * name="refusal_reason",
6802 * in="query",
6803 * description="The refusal reason for the immunization.",
6804 * required=false,
6805 * @OA\Schema(
6806 * type="string"
6808 * ),
6809 * @OA\Parameter(
6810 * name="ordering_provider",
6811 * in="query",
6812 * description="The ordering provider for the immunization.",
6813 * required=false,
6814 * @OA\Schema(
6815 * type="string"
6817 * ),
6818 * @OA\Response(
6819 * response="200",
6820 * ref="#/components/responses/standard"
6821 * ),
6822 * @OA\Response(
6823 * response="400",
6824 * ref="#/components/responses/badrequest"
6825 * ),
6826 * @OA\Response(
6827 * response="401",
6828 * ref="#/components/responses/unauthorized"
6829 * ),
6830 * security={{"openemr_auth":{}}}
6833 "GET /api/immunization" => function () {
6834 RestConfig::authorization_check("patients", "med");
6835 $return = (new ImmunizationRestController())->getAll($_GET);
6836 RestConfig::apiLog($return);
6837 return $return;
6841 * @OA\Get(
6842 * path="/api/immunization/{uuid}",
6843 * description="Retrieves a immunization",
6844 * tags={"standard"},
6845 * @OA\Parameter(
6846 * name="uuid",
6847 * in="path",
6848 * description="The uuid for the immunization.",
6849 * required=true,
6850 * @OA\Schema(
6851 * type="string"
6853 * ),
6854 * @OA\Response(
6855 * response="200",
6856 * ref="#/components/responses/standard"
6857 * ),
6858 * @OA\Response(
6859 * response="400",
6860 * ref="#/components/responses/badrequest"
6861 * ),
6862 * @OA\Response(
6863 * response="401",
6864 * ref="#/components/responses/unauthorized"
6865 * ),
6866 * security={{"openemr_auth":{}}}
6869 "GET /api/immunization/:uuid" => function ($uuid) {
6870 RestConfig::authorization_check("patients", "med");
6871 $return = (new ImmunizationRestController())->getOne($uuid);
6872 RestConfig::apiLog($return);
6873 return $return;
6877 * @OA\Get(
6878 * path="/api/procedure",
6879 * description="Retrieves a list of all procedures",
6880 * tags={"standard"},
6881 * @OA\Response(
6882 * response="200",
6883 * ref="#/components/responses/standard"
6884 * ),
6885 * @OA\Response(
6886 * response="400",
6887 * ref="#/components/responses/badrequest"
6888 * ),
6889 * @OA\Response(
6890 * response="401",
6891 * ref="#/components/responses/unauthorized"
6892 * ),
6893 * security={{"openemr_auth":{}}}
6896 "GET /api/procedure" => function () {
6897 RestConfig::authorization_check("patients", "med");
6898 $return = (new ProcedureRestController())->getAll();
6899 RestConfig::apiLog($return);
6900 return $return;
6904 * @OA\Get(
6905 * path="/api/procedure/{uuid}",
6906 * description="Retrieves a procedure",
6907 * tags={"standard"},
6908 * @OA\Parameter(
6909 * name="uuid",
6910 * in="path",
6911 * description="The uuid for the procedure.",
6912 * required=true,
6913 * @OA\Schema(
6914 * type="string"
6916 * ),
6917 * @OA\Response(
6918 * response="200",
6919 * ref="#/components/responses/standard"
6920 * ),
6921 * @OA\Response(
6922 * response="400",
6923 * ref="#/components/responses/badrequest"
6924 * ),
6925 * @OA\Response(
6926 * response="401",
6927 * ref="#/components/responses/unauthorized"
6928 * ),
6929 * security={{"openemr_auth":{}}}
6932 "GET /api/procedure/:uuid" => function ($uuid) {
6933 RestConfig::authorization_check("patients", "med");
6934 $return = (new ProcedureRestController())->getOne($uuid);
6935 RestConfig::apiLog($return);
6936 return $return;
6940 * @OA\Get(
6941 * path="/api/drug",
6942 * description="Retrieves a list of all drugs",
6943 * tags={"standard"},
6944 * @OA\Response(
6945 * response="200",
6946 * ref="#/components/responses/standard"
6947 * ),
6948 * @OA\Response(
6949 * response="400",
6950 * ref="#/components/responses/badrequest"
6951 * ),
6952 * @OA\Response(
6953 * response="401",
6954 * ref="#/components/responses/unauthorized"
6955 * ),
6956 * security={{"openemr_auth":{}}}
6959 "GET /api/drug" => function () {
6960 RestConfig::authorization_check("patients", "med");
6961 $return = (new DrugRestController())->getAll();
6962 RestConfig::apiLog($return);
6963 return $return;
6967 * @OA\Get(
6968 * path="/api/drug/{uuid}",
6969 * description="Retrieves a drug",
6970 * tags={"standard"},
6971 * @OA\Parameter(
6972 * name="uuid",
6973 * in="path",
6974 * description="The uuid for the drug.",
6975 * required=true,
6976 * @OA\Schema(
6977 * type="string"
6979 * ),
6980 * @OA\Response(
6981 * response="200",
6982 * ref="#/components/responses/standard"
6983 * ),
6984 * @OA\Response(
6985 * response="400",
6986 * ref="#/components/responses/badrequest"
6987 * ),
6988 * @OA\Response(
6989 * response="401",
6990 * ref="#/components/responses/unauthorized"
6991 * ),
6992 * security={{"openemr_auth":{}}}
6995 "GET /api/drug/:uuid" => function ($uuid) {
6996 RestConfig::authorization_check("patients", "med");
6997 $return = (new DrugRestController())->getOne($uuid);
6998 RestConfig::apiLog($return);
6999 return $return;
7003 * @OA\Get(
7004 * path="/api/prescription",
7005 * description="Retrieves a list of all prescriptions",
7006 * tags={"standard"},
7007 * @OA\Response(
7008 * response="200",
7009 * ref="#/components/responses/standard"
7010 * ),
7011 * @OA\Response(
7012 * response="400",
7013 * ref="#/components/responses/badrequest"
7014 * ),
7015 * @OA\Response(
7016 * response="401",
7017 * ref="#/components/responses/unauthorized"
7018 * ),
7019 * security={{"openemr_auth":{}}}
7022 "GET /api/prescription" => function () {
7023 RestConfig::authorization_check("patients", "med");
7024 $return = (new PrescriptionRestController())->getAll();
7025 RestConfig::apiLog($return);
7026 return $return;
7030 * @OA\Get(
7031 * path="/api/prescription/{uuid}",
7032 * description="Retrieves a prescription",
7033 * tags={"standard"},
7034 * @OA\Parameter(
7035 * name="uuid",
7036 * in="path",
7037 * description="The uuid for the prescription.",
7038 * required=true,
7039 * @OA\Schema(
7040 * type="string"
7042 * ),
7043 * @OA\Response(
7044 * response="200",
7045 * ref="#/components/responses/standard"
7046 * ),
7047 * @OA\Response(
7048 * response="400",
7049 * ref="#/components/responses/badrequest"
7050 * ),
7051 * @OA\Response(
7052 * response="401",
7053 * ref="#/components/responses/unauthorized"
7054 * ),
7055 * security={{"openemr_auth":{}}}
7058 "GET /api/prescription/:uuid" => function ($uuid) {
7059 RestConfig::authorization_check("patients", "med");
7060 $return = (new PrescriptionRestController())->getOne($uuid);
7061 RestConfig::apiLog($return);
7062 return $return;
7066 use OpenEMR\Common\Http\StatusCode;
7067 use OpenEMR\Common\Http\Psr17Factory;
7068 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7069 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7070 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7071 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7072 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7073 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7074 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7075 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7076 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7077 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7078 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7079 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7080 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7081 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7082 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7083 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7084 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7085 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7086 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7087 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7088 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7089 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7090 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7091 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7092 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7093 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7095 // Note that the fhir route includes both user role and patient role
7096 // (there is a mechanism in place to ensure patient role is binded
7097 // to only see the data of the one patient)
7098 RestConfig::$FHIR_ROUTE_MAP = array(
7100 * @OA\Get(
7101 * path="/fhir/AllergyIntolerance",
7102 * description="Returns a list of AllergyIntolerance resources.",
7103 * tags={"fhir"},
7104 * @OA\Parameter(
7105 * name="_id",
7106 * in="query",
7107 * description="The uuid for the AllergyIntolerance resource.",
7108 * required=false,
7109 * @OA\Schema(
7110 * type="string"
7112 * ),
7113 * @OA\Parameter(
7114 * name="patient",
7115 * in="query",
7116 * description="The uuid for the patient.",
7117 * required=false,
7118 * @OA\Schema(
7119 * type="string"
7121 * ),
7122 * @OA\Response(
7123 * response="200",
7124 * description="Standard Response",
7125 * @OA\MediaType(
7126 * mediaType="application/json",
7127 * @OA\Schema(
7128 * @OA\Property(
7129 * property="json object",
7130 * description="FHIR Json object.",
7131 * type="object"
7132 * ),
7133 * example={
7134 * "meta": {
7135 * "lastUpdated": "2021-09-14T09:13:51"
7136 * },
7137 * "resourceType": "Bundle",
7138 * "type": "collection",
7139 * "total": 0,
7140 * "link": {
7142 * "relation": "self",
7143 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7149 * ),
7150 * @OA\Response(
7151 * response="400",
7152 * ref="#/components/responses/badrequest"
7153 * ),
7154 * @OA\Response(
7155 * response="401",
7156 * ref="#/components/responses/unauthorized"
7157 * ),
7158 * security={{"openemr_auth":{}}}
7161 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7162 $getParams = $request->getQueryParams();
7163 if ($request->isPatientRequest()) {
7164 // only allow access to data of binded patient
7165 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7166 } else {
7167 RestConfig::authorization_check("patients", "med");
7168 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7170 RestConfig::apiLog($return);
7171 return $return;
7175 * @OA\Get(
7176 * path="/fhir/AllergyIntolerance/{uuid}",
7177 * description="Returns a single AllergyIntolerance resource.",
7178 * tags={"fhir"},
7179 * @OA\Parameter(
7180 * name="uuid",
7181 * in="path",
7182 * description="The uuid for the AllergyIntolerance resource.",
7183 * required=true,
7184 * @OA\Schema(
7185 * type="string"
7187 * ),
7188 * @OA\Response(
7189 * response="200",
7190 * description="Standard Response",
7191 * @OA\MediaType(
7192 * mediaType="application/json",
7193 * @OA\Schema(
7194 * @OA\Property(
7195 * property="json object",
7196 * description="FHIR Json object.",
7197 * type="object"
7198 * ),
7199 * example={
7200 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7201 * "meta": {
7202 * "versionId": "1",
7203 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7204 * },
7205 * "resourceType": "AllergyIntolerance",
7206 * "text": {
7207 * "status": "additional",
7208 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7209 * },
7210 * "clinicalStatus": {
7211 * "coding": {
7213 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7214 * "code": "active",
7215 * "display": "Active"
7218 * },
7219 * "verificationStatus": {
7220 * "coding": {
7222 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7223 * "code": "confirmed",
7224 * "display": "Confirmed"
7227 * },
7228 * "category": {
7229 * "medication"
7230 * },
7231 * "criticality": "low",
7232 * "code": {
7233 * "coding": {
7235 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7236 * "code": "unknown",
7237 * "display": "Unknown"
7240 * },
7241 * "patient": {
7242 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7243 * },
7244 * "reaction": {
7246 * "manifestation": {
7248 * "coding": {
7250 * "system": "http://snomed.info/sct",
7251 * "code": "422587007",
7252 * "display": "Nausea"
7254 * },
7255 * "text": "Nausea"
7263 * ),
7264 * @OA\Response(
7265 * response="400",
7266 * ref="#/components/responses/badrequest"
7267 * ),
7268 * @OA\Response(
7269 * response="401",
7270 * ref="#/components/responses/unauthorized"
7271 * ),
7272 * @OA\Response(
7273 * response="404",
7274 * ref="#/components/responses/uuidnotfound"
7275 * ),
7276 * security={{"openemr_auth":{}}}
7279 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7280 if ($request->isPatientRequest()) {
7281 // only allow access to data of binded patient
7282 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7283 } else {
7284 RestConfig::authorization_check("patients", "med");
7285 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7287 RestConfig::apiLog($return);
7288 return $return;
7292 * @OA\Get(
7293 * path="/fhir/CarePlan",
7294 * description="Returns a list of CarePlan resources.",
7295 * tags={"fhir"},
7296 * @OA\Parameter(
7297 * name="_id",
7298 * in="query",
7299 * description="The uuid for the CarePlan resource.",
7300 * required=false,
7301 * @OA\Schema(
7302 * type="string"
7304 * ),
7305 * @OA\Parameter(
7306 * name="patient",
7307 * in="query",
7308 * description="The uuid for the patient.",
7309 * required=false,
7310 * @OA\Schema(
7311 * type="string"
7313 * ),
7314 * @OA\Parameter(
7315 * name="category",
7316 * in="query",
7317 * description="The category of the CarePlan resource.",
7318 * required=false,
7319 * @OA\Schema(
7320 * type="string"
7322 * ),
7323 * @OA\Response(
7324 * response="200",
7325 * description="Standard Response",
7326 * @OA\MediaType(
7327 * mediaType="application/json",
7328 * @OA\Schema(
7329 * @OA\Property(
7330 * property="json object",
7331 * description="FHIR Json object.",
7332 * type="object"
7333 * ),
7334 * example={
7335 * "meta": {
7336 * "lastUpdated": "2021-09-14T09:13:51"
7337 * },
7338 * "resourceType": "Bundle",
7339 * "type": "collection",
7340 * "total": 0,
7341 * "link": {
7343 * "relation": "self",
7344 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7350 * ),
7351 * @OA\Response(
7352 * response="400",
7353 * ref="#/components/responses/badrequest"
7354 * ),
7355 * @OA\Response(
7356 * response="401",
7357 * ref="#/components/responses/unauthorized"
7358 * ),
7359 * security={{"openemr_auth":{}}}
7362 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7363 $getParams = $request->getQueryParams();
7364 if ($request->isPatientRequest()) {
7365 // only allow access to data of binded patient
7366 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7367 } else {
7368 RestConfig::authorization_check("patients", "med");
7369 $return = (new FhirCarePlanRestController())->getAll($getParams);
7371 RestConfig::apiLog($return);
7372 return $return;
7376 * @OA\Get(
7377 * path="/fhir/CarePlan/{uuid}",
7378 * description="Returns a single CarePlan resource.",
7379 * tags={"fhir"},
7380 * @OA\Parameter(
7381 * name="uuid",
7382 * in="path",
7383 * description="The uuid for the CarePlan resource.",
7384 * required=true,
7385 * @OA\Schema(
7386 * type="string"
7388 * ),
7389 * @OA\Response(
7390 * response="200",
7391 * description="Standard Response",
7392 * @OA\MediaType(
7393 * mediaType="application/json",
7394 * @OA\Schema(
7395 * @OA\Property(
7396 * property="json object",
7397 * description="FHIR Json object.",
7398 * type="object"
7399 * ),
7400 * example={
7401 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7402 * "meta": {
7403 * "versionId": "1",
7404 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7405 * },
7406 * "resourceType": "CarePlan",
7407 * "text": {
7408 * "status": "generated",
7409 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7410 * },
7411 * "status": "active",
7412 * "intent": "plan",
7413 * "category": {
7415 * "coding": {
7417 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7418 * "code": "assess-plan"
7422 * },
7423 * "description": "Treat flu.",
7424 * "subject": {
7425 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7426 * "type": "Patient"
7431 * ),
7432 * @OA\Response(
7433 * response="400",
7434 * ref="#/components/responses/badrequest"
7435 * ),
7436 * @OA\Response(
7437 * response="401",
7438 * ref="#/components/responses/unauthorized"
7439 * ),
7440 * @OA\Response(
7441 * response="404",
7442 * ref="#/components/responses/uuidnotfound"
7443 * ),
7444 * security={{"openemr_auth":{}}}
7447 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7448 if ($request->isPatientRequest()) {
7449 // only allow access to data of binded patient
7450 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7451 } else {
7452 RestConfig::authorization_check("patients", "med");
7453 $return = (new FhirCarePlanRestController())->getOne($uuid);
7455 RestConfig::apiLog($return);
7456 return $return;
7460 * @OA\Get(
7461 * path="/fhir/CareTeam",
7462 * description="Returns a list of CareTeam resources.",
7463 * tags={"fhir"},
7464 * @OA\Parameter(
7465 * name="_id",
7466 * in="query",
7467 * description="The uuid for the CareTeam resource.",
7468 * required=false,
7469 * @OA\Schema(
7470 * type="string"
7472 * ),
7473 * @OA\Parameter(
7474 * name="patient",
7475 * in="query",
7476 * description="The uuid for the patient.",
7477 * required=false,
7478 * @OA\Schema(
7479 * type="string"
7481 * ),
7482 * @OA\Parameter(
7483 * name="status",
7484 * in="query",
7485 * description="The status of the CarePlan resource.",
7486 * required=false,
7487 * @OA\Schema(
7488 * type="string"
7490 * ),
7491 * @OA\Response(
7492 * response="200",
7493 * description="Standard Response",
7494 * @OA\MediaType(
7495 * mediaType="application/json",
7496 * @OA\Schema(
7497 * @OA\Property(
7498 * property="json object",
7499 * description="FHIR Json object.",
7500 * type="object"
7501 * ),
7502 * example={
7503 * "meta": {
7504 * "lastUpdated": "2021-09-14T09:13:51"
7505 * },
7506 * "resourceType": "Bundle",
7507 * "type": "collection",
7508 * "total": 0,
7509 * "link": {
7511 * "relation": "self",
7512 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7518 * ),
7519 * @OA\Response(
7520 * response="400",
7521 * ref="#/components/responses/badrequest"
7522 * ),
7523 * @OA\Response(
7524 * response="401",
7525 * ref="#/components/responses/unauthorized"
7526 * ),
7527 * security={{"openemr_auth":{}}}
7530 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
7531 $getParams = $request->getQueryParams();
7532 if ($request->isPatientRequest()) {
7533 // only allow access to data of binded patient
7534 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7535 } else {
7536 RestConfig::authorization_check("patients", "med");
7537 $return = (new FhirCareTeamRestController())->getAll($getParams);
7539 RestConfig::apiLog($return);
7540 return $return;
7544 * @OA\Get(
7545 * path="/fhir/CareTeam/{uuid}",
7546 * description="Returns a single CareTeam resource.",
7547 * tags={"fhir"},
7548 * @OA\Parameter(
7549 * name="uuid",
7550 * in="path",
7551 * description="The uuid for the CareTeam resource.",
7552 * required=true,
7553 * @OA\Schema(
7554 * type="string"
7556 * ),
7557 * @OA\Response(
7558 * response="200",
7559 * description="Standard Response",
7560 * @OA\MediaType(
7561 * mediaType="application/json",
7562 * @OA\Schema(
7563 * @OA\Property(
7564 * property="json object",
7565 * description="FHIR Json object.",
7566 * type="object"
7567 * ),
7568 * example={
7569 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7570 * "meta": {
7571 * "versionId": "1",
7572 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7573 * },
7574 * "resourceType": "CareTeam",
7575 * "status": "active",
7576 * "subject": {
7577 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7578 * "type": "Patient"
7579 * },
7580 * "participant": {
7582 * "role": {
7584 * "coding": {
7586 * "system": "http://nucc.org/provider-taxonomy",
7587 * "code": "102L00000X",
7588 * "display": "Psychoanalyst"
7592 * },
7593 * "member": {
7594 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7595 * "type": "Practitioner"
7596 * },
7597 * "onBehalfOf": {
7598 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7599 * "type": "Organization"
7601 * },
7603 * "role": {
7605 * "coding": {
7607 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7608 * "code": "unknown",
7609 * "display": "Unknown"
7613 * },
7614 * "member": {
7615 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7616 * "type": "Organization"
7623 * ),
7624 * @OA\Response(
7625 * response="400",
7626 * ref="#/components/responses/badrequest"
7627 * ),
7628 * @OA\Response(
7629 * response="401",
7630 * ref="#/components/responses/unauthorized"
7631 * ),
7632 * @OA\Response(
7633 * response="404",
7634 * ref="#/components/responses/uuidnotfound"
7635 * ),
7636 * security={{"openemr_auth":{}}}
7639 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
7640 if ($request->isPatientRequest()) {
7641 // only allow access to data of binded patient
7642 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7643 } else {
7644 RestConfig::authorization_check("patients", "med");
7645 $return = (new FhirCareTeamRestController())->getOne($uuid);
7647 RestConfig::apiLog($return);
7648 return $return;
7652 * @OA\Get(
7653 * path="/fhir/Condition",
7654 * description="Returns a list of Condition resources.",
7655 * tags={"fhir"},
7656 * @OA\Parameter(
7657 * name="_id",
7658 * in="query",
7659 * description="The uuid for the Condition resource.",
7660 * required=false,
7661 * @OA\Schema(
7662 * type="string"
7664 * ),
7665 * @OA\Parameter(
7666 * name="patient",
7667 * in="query",
7668 * description="The uuid for the patient.",
7669 * required=false,
7670 * @OA\Schema(
7671 * type="string"
7673 * ),
7674 * @OA\Response(
7675 * response="200",
7676 * description="Standard Response",
7677 * @OA\MediaType(
7678 * mediaType="application/json",
7679 * @OA\Schema(
7680 * @OA\Property(
7681 * property="json object",
7682 * description="FHIR Json object.",
7683 * type="object"
7684 * ),
7685 * example={
7686 * "meta": {
7687 * "lastUpdated": "2021-09-14T09:13:51"
7688 * },
7689 * "resourceType": "Bundle",
7690 * "type": "collection",
7691 * "total": 0,
7692 * "link": {
7694 * "relation": "self",
7695 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7701 * ),
7702 * @OA\Response(
7703 * response="400",
7704 * ref="#/components/responses/badrequest"
7705 * ),
7706 * @OA\Response(
7707 * response="401",
7708 * ref="#/components/responses/unauthorized"
7709 * ),
7710 * security={{"openemr_auth":{}}}
7713 "GET /fhir/Condition" => function (HttpRestRequest $request) {
7714 $getParams = $request->getQueryParams();
7715 if ($request->isPatientRequest()) {
7716 // only allow access to data of binded patient
7717 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7718 } else {
7719 RestConfig::authorization_check("patients", "med");
7720 $return = (new FhirConditionRestController())->getAll($getParams);
7722 RestConfig::apiLog($return);
7723 return $return;
7727 * @OA\Get(
7728 * path="/fhir/Condition/{uuid}",
7729 * description="Returns a single Condition resource.",
7730 * tags={"fhir"},
7731 * @OA\Parameter(
7732 * name="uuid",
7733 * in="path",
7734 * description="The uuid for the Condition resource.",
7735 * required=true,
7736 * @OA\Schema(
7737 * type="string"
7739 * ),
7740 * @OA\Response(
7741 * response="200",
7742 * description="Standard Response",
7743 * @OA\MediaType(
7744 * mediaType="application/json",
7745 * @OA\Schema(
7746 * @OA\Property(
7747 * property="json object",
7748 * description="FHIR Json object.",
7749 * type="object"
7750 * ),
7751 * example={
7752 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7753 * "meta": {
7754 * "versionId": "1",
7755 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7756 * },
7757 * "resourceType": "Condition",
7758 * "clinicalStatus": {
7759 * "coding": {
7761 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7762 * "code": "inactive",
7763 * "display": "Inactive"
7766 * },
7767 * "verificationStatus": {
7768 * "coding": {
7770 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7771 * "code": "unconfirmed",
7772 * "display": "Unconfirmed"
7775 * },
7776 * "category": {
7778 * "coding": {
7780 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7781 * "code": "problem-list-item",
7782 * "display": "Problem List Item"
7786 * },
7787 * "code": {
7788 * "coding": {
7790 * "system": "http://snomed.info/sct",
7791 * "code": "444814009",
7792 * "display": ""
7795 * },
7796 * "subject": {
7797 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7802 * ),
7803 * @OA\Response(
7804 * response="400",
7805 * ref="#/components/responses/badrequest"
7806 * ),
7807 * @OA\Response(
7808 * response="401",
7809 * ref="#/components/responses/unauthorized"
7810 * ),
7811 * @OA\Response(
7812 * response="404",
7813 * ref="#/components/responses/uuidnotfound"
7814 * ),
7815 * security={{"openemr_auth":{}}}
7818 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
7819 if ($request->isPatientRequest()) {
7820 // only allow access to data of binded patient
7821 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7822 } else {
7823 RestConfig::authorization_check("patients", "med");
7824 $return = (new FhirConditionRestController())->getOne($uuid);
7826 RestConfig::apiLog($return);
7827 return $return;
7831 * @OA\Get(
7832 * path="/fhir/Coverage",
7833 * description="Returns a list of Coverage resources.",
7834 * tags={"fhir"},
7835 * @OA\Parameter(
7836 * name="_id",
7837 * in="query",
7838 * description="The uuid for the Coverage resource.",
7839 * required=false,
7840 * @OA\Schema(
7841 * type="string"
7843 * ),
7844 * @OA\Parameter(
7845 * name="patient",
7846 * in="query",
7847 * description="The uuid for the patient.",
7848 * required=false,
7849 * @OA\Schema(
7850 * type="string"
7852 * ),
7853 * @OA\Parameter(
7854 * name="payor",
7855 * in="query",
7856 * description="The payor of the Coverage resource.",
7857 * required=false,
7858 * @OA\Schema(
7859 * type="string"
7861 * ),
7862 * @OA\Response(
7863 * response="200",
7864 * description="Standard Response",
7865 * @OA\MediaType(
7866 * mediaType="application/json",
7867 * @OA\Schema(
7868 * @OA\Property(
7869 * property="json object",
7870 * description="FHIR Json object.",
7871 * type="object"
7872 * ),
7873 * example={
7874 * "meta": {
7875 * "lastUpdated": "2021-09-14T09:13:51"
7876 * },
7877 * "resourceType": "Bundle",
7878 * "type": "collection",
7879 * "total": 0,
7880 * "link": {
7882 * "relation": "self",
7883 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7889 * ),
7890 * @OA\Response(
7891 * response="400",
7892 * ref="#/components/responses/badrequest"
7893 * ),
7894 * @OA\Response(
7895 * response="401",
7896 * ref="#/components/responses/unauthorized"
7897 * ),
7898 * security={{"openemr_auth":{}}}
7901 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
7902 if ($request->isPatientRequest()) {
7903 // only allow access to data of binded patient
7904 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7905 } else {
7906 RestConfig::authorization_check("admin", "super");
7907 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7909 RestConfig::apiLog($return);
7910 return $return;
7914 * @OA\Get(
7915 * path="/fhir/Coverage/{uuid}",
7916 * description="Returns a single Coverage resource.",
7917 * tags={"fhir"},
7918 * @OA\Parameter(
7919 * name="uuid",
7920 * in="path",
7921 * description="The uuid for the Coverage resource.",
7922 * required=true,
7923 * @OA\Schema(
7924 * type="string"
7926 * ),
7927 * @OA\Response(
7928 * response="200",
7929 * description="Standard Response",
7930 * @OA\MediaType(
7931 * mediaType="application/json",
7932 * @OA\Schema(
7933 * @OA\Property(
7934 * property="json object",
7935 * description="FHIR Json object.",
7936 * type="object"
7937 * ),
7938 * example={
7939 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
7940 * "meta": {
7941 * "versionId": "1",
7942 * "lastUpdated": "2022-04-14T07:58:45+00:00"
7943 * },
7944 * "resourceType": "Coverage",
7945 * "status": "active",
7946 * "beneficiary": {
7947 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
7948 * },
7949 * "relationship": {
7950 * "coding": {
7952 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
7953 * "code": ""
7960 * ),
7961 * @OA\Response(
7962 * response="400",
7963 * ref="#/components/responses/badrequest"
7964 * ),
7965 * @OA\Response(
7966 * response="401",
7967 * ref="#/components/responses/unauthorized"
7968 * ),
7969 * @OA\Response(
7970 * response="404",
7971 * ref="#/components/responses/uuidnotfound"
7972 * ),
7973 * security={{"openemr_auth":{}}}
7976 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
7977 if ($request->isPatientRequest()) {
7978 // only allow access to data of binded patient
7979 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
7980 } else {
7981 RestConfig::authorization_check("admin", "super");
7982 $return = (new FhirCoverageRestController())->getOne($uuid);
7984 RestConfig::apiLog($return);
7985 return $return;
7989 * @OA\Get(
7990 * path="/fhir/Device",
7991 * description="Returns a list of Device resources.",
7992 * tags={"fhir"},
7993 * @OA\Parameter(
7994 * name="_id",
7995 * in="query",
7996 * description="The uuid for the Device resource.",
7997 * required=false,
7998 * @OA\Schema(
7999 * type="string"
8001 * ),
8002 * @OA\Parameter(
8003 * name="patient",
8004 * in="query",
8005 * description="The uuid for the patient.",
8006 * required=false,
8007 * @OA\Schema(
8008 * type="string"
8010 * ),
8011 * @OA\Response(
8012 * response="200",
8013 * description="Standard Response",
8014 * @OA\MediaType(
8015 * mediaType="application/json",
8016 * @OA\Schema(
8017 * @OA\Property(
8018 * property="json object",
8019 * description="FHIR Json object.",
8020 * type="object"
8021 * ),
8022 * example={
8023 * "meta": {
8024 * "lastUpdated": "2021-09-14T09:13:51"
8025 * },
8026 * "resourceType": "Bundle",
8027 * "type": "collection",
8028 * "total": 0,
8029 * "link": {
8031 * "relation": "self",
8032 * "url": "https://localhost:9300/apis/default/fhir/Device"
8038 * ),
8039 * @OA\Response(
8040 * response="400",
8041 * ref="#/components/responses/badrequest"
8042 * ),
8043 * @OA\Response(
8044 * response="401",
8045 * ref="#/components/responses/unauthorized"
8046 * ),
8047 * security={{"openemr_auth":{}}}
8050 "GET /fhir/Device" => function (HttpRestRequest $request) {
8051 if ($request->isPatientRequest()) {
8052 // only allow access to data of binded patient
8053 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8054 } else {
8055 RestConfig::authorization_check("admin", "super");
8056 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8058 RestConfig::apiLog($return);
8059 return $return;
8063 * @OA\Get(
8064 * path="/fhir/Device/{uuid}",
8065 * description="Returns a single Device resource.",
8066 * tags={"fhir"},
8067 * @OA\Parameter(
8068 * name="uuid",
8069 * in="path",
8070 * description="The uuid for the Device resource.",
8071 * required=true,
8072 * @OA\Schema(
8073 * type="string"
8075 * ),
8076 * @OA\Response(
8077 * response="200",
8078 * description="Standard Response",
8079 * @OA\MediaType(
8080 * mediaType="application/json",
8081 * @OA\Schema(
8082 * @OA\Property(
8083 * property="json object",
8084 * description="FHIR Json object.",
8085 * type="object"
8086 * ),
8087 * example={
8088 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8089 * "meta": {
8090 * "versionId": "1",
8091 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8092 * },
8093 * "resourceType": "Device",
8094 * "udiCarrier": {
8096 * "deviceIdentifier": "08717648200274",
8097 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8099 * },
8100 * "distinctIdentifier": "A99971312345600",
8101 * "manufactureDate": "2013-02-01",
8102 * "expirationDate": "2014-02-01",
8103 * "lotNumber": "000000000000XYZ123",
8104 * "serialNumber": "000025",
8105 * "type": {
8106 * "extension": {
8108 * "valueCode": "unknown",
8109 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8112 * },
8113 * "patient": {
8114 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8115 * "type": "Patient"
8120 * ),
8121 * @OA\Response(
8122 * response="400",
8123 * ref="#/components/responses/badrequest"
8124 * ),
8125 * @OA\Response(
8126 * response="401",
8127 * ref="#/components/responses/unauthorized"
8128 * ),
8129 * @OA\Response(
8130 * response="404",
8131 * ref="#/components/responses/uuidnotfound"
8132 * ),
8133 * security={{"openemr_auth":{}}}
8136 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8137 if ($request->isPatientRequest()) {
8138 // only allow access to data of binded patient
8139 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8140 } else {
8141 RestConfig::authorization_check("admin", "super");
8142 $return = (new FhirDeviceRestController())->getOne($uuid);
8144 RestConfig::apiLog($return);
8145 return $return;
8149 * @OA\Get(
8150 * path="/fhir/DiagnosticReport",
8151 * description="Returns a list of DiagnosticReport resources.",
8152 * tags={"fhir"},
8153 * @OA\Parameter(
8154 * name="_id",
8155 * in="query",
8156 * description="The uuid for the DiagnosticReport resource.",
8157 * required=false,
8158 * @OA\Schema(
8159 * type="string"
8161 * ),
8162 * @OA\Parameter(
8163 * name="patient",
8164 * in="query",
8165 * description="The uuid for the patient.",
8166 * required=false,
8167 * @OA\Schema(
8168 * type="string"
8170 * ),
8171 * @OA\Parameter(
8172 * name="code",
8173 * in="query",
8174 * description="The code of the DiagnosticReport resource.",
8175 * required=false,
8176 * @OA\Schema(
8177 * type="string"
8179 * ),
8180 * @OA\Parameter(
8181 * name="category",
8182 * in="query",
8183 * description="The category of the DiagnosticReport resource.",
8184 * required=false,
8185 * @OA\Schema(
8186 * type="string"
8188 * ),
8189 * @OA\Parameter(
8190 * name="date",
8191 * in="query",
8192 * description="The datetime of the DiagnosticReport resource.",
8193 * required=false,
8194 * @OA\Schema(
8195 * type="string"
8197 * ),
8198 * @OA\Response(
8199 * response="200",
8200 * description="Standard Response",
8201 * @OA\MediaType(
8202 * mediaType="application/json",
8203 * @OA\Schema(
8204 * @OA\Property(
8205 * property="json object",
8206 * description="FHIR Json object.",
8207 * type="object"
8208 * ),
8209 * example={
8210 * "meta": {
8211 * "lastUpdated": "2021-09-14T09:13:51"
8212 * },
8213 * "resourceType": "Bundle",
8214 * "type": "collection",
8215 * "total": 0,
8216 * "link": {
8218 * "relation": "self",
8219 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8225 * ),
8226 * @OA\Response(
8227 * response="400",
8228 * ref="#/components/responses/badrequest"
8229 * ),
8230 * @OA\Response(
8231 * response="401",
8232 * ref="#/components/responses/unauthorized"
8233 * ),
8234 * security={{"openemr_auth":{}}}
8237 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8238 $getParams = $request->getQueryParams();
8239 if ($request->isPatientRequest()) {
8240 // only allow access to data of binded patient
8241 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8242 } else {
8243 RestConfig::authorization_check("admin", "super");
8244 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8246 RestConfig::apiLog($return);
8247 return $return;
8251 * @OA\Get(
8252 * path="/fhir/DiagnosticReport/{uuid}",
8253 * description="Returns a single DiagnosticReport resource.",
8254 * tags={"fhir"},
8255 * @OA\Parameter(
8256 * name="uuid",
8257 * in="path",
8258 * description="The uuid for the DiagnosticReport resource.",
8259 * required=true,
8260 * @OA\Schema(
8261 * type="string"
8263 * ),
8264 * @OA\Response(
8265 * response="200",
8266 * description="Standard Response",
8267 * @OA\MediaType(
8268 * mediaType="application/json",
8269 * @OA\Schema(
8270 * @OA\Property(
8271 * property="json object",
8272 * description="FHIR Json object.",
8273 * type="object"
8274 * ),
8275 * example={
8276 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8277 * "meta": {
8278 * "versionId": "1",
8279 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8280 * },
8281 * "resourceType": "DiagnosticReport",
8282 * "status": "final",
8283 * "category": {
8285 * "coding": {
8287 * "system": "http://loinc.org",
8288 * "code": "LP7839-6",
8289 * "display": "Pathology"
8293 * },
8294 * "code": {
8295 * "coding": {
8297 * "system": "http://loinc.org",
8298 * "code": "11502-2",
8299 * "display": "Laboratory report"
8302 * },
8303 * "subject": {
8304 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8305 * "type": "Patient"
8306 * },
8307 * "encounter": {
8308 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8309 * "type": "Encounter"
8310 * },
8311 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8312 * "issued": "2015-06-22T00:00:00+00:00",
8313 * "performer": {
8315 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8316 * "type": "Organization"
8318 * },
8319 * "presentedForm": {
8321 * "contentType": "text/plain",
8322 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8328 * ),
8329 * @OA\Response(
8330 * response="400",
8331 * ref="#/components/responses/badrequest"
8332 * ),
8333 * @OA\Response(
8334 * response="401",
8335 * ref="#/components/responses/unauthorized"
8336 * ),
8337 * @OA\Response(
8338 * response="404",
8339 * ref="#/components/responses/uuidnotfound"
8340 * ),
8341 * security={{"openemr_auth":{}}}
8344 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8345 $getParams = $request->getQueryParams();
8346 if ($request->isPatientRequest()) {
8347 // only allow access to data of binded patient
8348 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8349 } else {
8350 RestConfig::authorization_check("admin", "super");
8351 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8353 RestConfig::apiLog($return);
8354 return $return;
8358 * @OA\Get(
8359 * path="/fhir/DocumentReference",
8360 * description="Returns a list of DocumentReference resources.",
8361 * tags={"fhir"},
8362 * @OA\Parameter(
8363 * name="_id",
8364 * in="query",
8365 * description="The uuid for the DocumentReference resource.",
8366 * required=false,
8367 * @OA\Schema(
8368 * type="string"
8370 * ),
8371 * @OA\Parameter(
8372 * name="patient",
8373 * in="query",
8374 * description="The uuid for the patient.",
8375 * required=false,
8376 * @OA\Schema(
8377 * type="string"
8379 * ),
8380 * @OA\Parameter(
8381 * name="type",
8382 * in="query",
8383 * description="The type of the DocumentReference resource.",
8384 * required=false,
8385 * @OA\Schema(
8386 * type="string"
8388 * ),
8389 * @OA\Parameter(
8390 * name="category",
8391 * in="query",
8392 * description="The category of the DocumentReference resource.",
8393 * required=false,
8394 * @OA\Schema(
8395 * type="string"
8397 * ),
8398 * @OA\Parameter(
8399 * name="date",
8400 * in="query",
8401 * description="The datetime of the DocumentReference resource.",
8402 * required=false,
8403 * @OA\Schema(
8404 * type="string"
8406 * ),
8407 * @OA\Response(
8408 * response="200",
8409 * description="Standard Response",
8410 * @OA\MediaType(
8411 * mediaType="application/json",
8412 * @OA\Schema(
8413 * @OA\Property(
8414 * property="json object",
8415 * description="FHIR Json object.",
8416 * type="object"
8417 * ),
8418 * example={
8419 * "meta": {
8420 * "lastUpdated": "2021-09-14T09:13:51"
8421 * },
8422 * "resourceType": "Bundle",
8423 * "type": "collection",
8424 * "total": 0,
8425 * "link": {
8427 * "relation": "self",
8428 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8434 * ),
8435 * @OA\Response(
8436 * response="400",
8437 * ref="#/components/responses/badrequest"
8438 * ),
8439 * @OA\Response(
8440 * response="401",
8441 * ref="#/components/responses/unauthorized"
8442 * ),
8443 * security={{"openemr_auth":{}}}
8446 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8447 $getParams = $request->getQueryParams();
8448 if ($request->isPatientRequest()) {
8449 // only allow access to data of binded patient
8450 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8451 } else {
8452 RestConfig::authorization_check("admin", "super");
8453 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8455 RestConfig::apiLog($return);
8456 return $return;
8460 * @OA\POST(
8461 * path="/fhir/DocumentReference/$docref",
8462 * description="The $docref operation is used to request the server generates a document based on the specified parameters. If no additional parameters are specified then a DocumentReference to the patient's most current Clinical Summary of Care Document (CCD) is returned. The document itself is retrieved using the DocumentReference.content.attachment.url element. See <a href='http://hl7.org/fhir/us/core/OperationDefinition-docref.html' target='_blank' rel='noopener'>http://hl7.org/fhir/us/core/OperationDefinition-docref.html</a> for more details.",
8463 * tags={"fhir"},
8464 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8465 * @OA\Parameter(
8466 * name="patient",
8467 * in="query",
8468 * description="The uuid for the patient.",
8469 * required=true,
8470 * @OA\Schema(
8471 * type="string"
8473 * ),
8474 * @OA\Parameter(
8475 * name="start",
8476 * in="query",
8477 * description="The datetime refers to care dates not record currency dates. All records relating to care provided in a certain date range. If no start date is provided then all documents prior to the end date are in scope. If no start and end date are provided, the most recent or current document is in scope.",
8478 * required=false,
8479 * @OA\Schema(
8480 * type="string"
8482 * ),
8483 * @OA\Parameter(
8484 * name="end",
8485 * in="query",
8486 * description="The datetime refers to care dates not record currency dates. All records relating to care provided in a certain date range. If no end date is provided then all documents subsequent to the start date are in scope. If no start and end date are provided, the most recent or current document is in scope.",
8487 * required=false,
8488 * @OA\Schema(
8489 * type="string"
8491 * ),
8492 * @OA\Parameter(
8493 * name="type",
8494 * in="query",
8495 * description="The type refers to the document type. This is a LOINC code from the valueset of <a href='http://hl7.org/fhir/R4/valueset-c80-doc-typecodes.html' target='_blank' rel='noopener'>http://hl7.org/fhir/R4/valueset-c80-doc-typecodes.html</a>. The server currently only supports the LOINC code of 34133-9 (Summary of episode node).",
8496 * required=false,
8497 * @OA\Schema(
8498 * type="string"
8500 * ),
8501 * @OA\Response(
8502 * response="200",
8503 * description="A search bundle of DocumentReferences is returned"
8504 * ),
8505 * @OA\Response(
8506 * response="400",
8507 * ref="#/components/responses/badrequest"
8508 * ),
8509 * @OA\Response(
8510 * response="401",
8511 * ref="#/components/responses/unauthorized"
8512 * ),
8513 * security={{"openemr_auth":{}}}
8516 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
8518 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
8519 if ($request->isPatientRequest()) {
8520 // only allow access to data of binded patient
8521 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8522 } else {
8523 // TODO: it seems like regular users should be able to grab authorship / provenance information
8524 RestConfig::authorization_check("patients", "demo");
8525 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
8527 RestConfig::apiLog($return);
8528 return $return;
8532 * @OA\Get(
8533 * path="/fhir/DocumentReference/{uuid}",
8534 * description="Returns a single DocumentReference resource.",
8535 * tags={"fhir"},
8536 * @OA\Parameter(
8537 * name="uuid",
8538 * in="path",
8539 * description="The uuid for the DocumentReference resource.",
8540 * required=true,
8541 * @OA\Schema(
8542 * type="string"
8544 * ),
8545 * @OA\Response(
8546 * response="200",
8547 * description="Standard Response",
8548 * @OA\MediaType(
8549 * mediaType="application/json",
8550 * @OA\Schema(
8551 * @OA\Property(
8552 * property="json object",
8553 * description="FHIR Json object.",
8554 * type="object"
8555 * ),
8556 * example={
8557 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8558 * "meta": {
8559 * "versionId": "1",
8560 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8561 * },
8562 * "resourceType": "DocumentReference",
8563 * "identifier": {
8565 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8567 * },
8568 * "status": "current",
8569 * "type": {
8570 * "coding": {
8572 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8573 * "code": "UNK",
8574 * "display": "unknown"
8577 * },
8578 * "category": {
8580 * "coding": {
8582 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8583 * "code": "openemr-document",
8584 * "display": "OpenEMR Document"
8588 * },
8589 * "subject": {
8590 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8591 * "type": "Patient"
8592 * },
8593 * "date": "2021-09-19T03:15:56+00:00",
8594 * "author": {
8595 * null
8596 * },
8597 * "content": {
8599 * "attachment": {
8600 * "contentType": "image/gif",
8601 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8602 * },
8603 * "format": {
8604 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8605 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8606 * "display": "mimeType Sufficient"
8613 * ),
8614 * @OA\Response(
8615 * response="400",
8616 * ref="#/components/responses/badrequest"
8617 * ),
8618 * @OA\Response(
8619 * response="401",
8620 * ref="#/components/responses/unauthorized"
8621 * ),
8622 * @OA\Response(
8623 * response="404",
8624 * ref="#/components/responses/uuidnotfound"
8625 * ),
8626 * security={{"openemr_auth":{}}}
8629 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
8630 $getParams = $request->getQueryParams();
8631 if ($request->isPatientRequest()) {
8632 // only allow access to data of binded patient
8633 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8634 } else {
8635 RestConfig::authorization_check("admin", "super");
8636 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8638 RestConfig::apiLog($return);
8639 return $return;
8643 * @OA\Get(
8644 * path="/fhir/Document/{id}/Binary",
8645 * description="Used for downloading binary documents generated either with BULK FHIR Export or with the $docref CCD export operation. 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>",
8646 * tags={"fhir"},
8647 * @OA\Parameter(
8648 * name="id",
8649 * in="path",
8650 * description="The id for the Document.",
8651 * required=true,
8652 * @OA\Schema(
8653 * type="string"
8655 * ),
8656 * @OA\Response(
8657 * response="200",
8658 * description="The documentation for working with BULK FHIR or $docref document exports 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>"
8659 * ),
8660 * @OA\Response(
8661 * response="400",
8662 * ref="#/components/responses/badrequest"
8663 * ),
8664 * @OA\Response(
8665 * response="401",
8666 * ref="#/components/responses/unauthorized"
8667 * ),
8668 * security={{"openemr_auth":{}}}
8671 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest $request) {
8672 // TODO: @adunsulag we need to be able to retrieve our CCDA documents this way...
8673 // currently only allow users with the same permissions as export to take a file out
8674 // this could be relaxed to allow other types of files ie such as patient access etc.
8675 RestConfig::authorization_check("admin", "users");
8677 // Grab the document id
8678 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
8679 $response = $docController->downloadDocument($documentId);
8680 return $response;
8684 * @OA\Get(
8685 * path="/fhir/Encounter",
8686 * description="Returns a list of Encounter resources.",
8687 * tags={"fhir"},
8688 * @OA\Parameter(
8689 * name="_id",
8690 * in="query",
8691 * description="The uuid for the Encounter resource.",
8692 * required=false,
8693 * @OA\Schema(
8694 * type="string"
8696 * ),
8697 * @OA\Parameter(
8698 * name="patient",
8699 * in="query",
8700 * description="The uuid for the patient.",
8701 * required=false,
8702 * @OA\Schema(
8703 * type="string"
8705 * ),
8706 * @OA\Parameter(
8707 * name="date",
8708 * in="query",
8709 * description="The datetime of the Encounter resource.",
8710 * required=false,
8711 * @OA\Schema(
8712 * type="string"
8714 * ),
8715 * @OA\Response(
8716 * response="200",
8717 * description="Standard Response",
8718 * @OA\MediaType(
8719 * mediaType="application/json",
8720 * @OA\Schema(
8721 * @OA\Property(
8722 * property="json object",
8723 * description="FHIR Json object.",
8724 * type="object"
8725 * ),
8726 * example={
8727 * "meta": {
8728 * "lastUpdated": "2021-09-14T09:13:51"
8729 * },
8730 * "resourceType": "Bundle",
8731 * "type": "collection",
8732 * "total": 0,
8733 * "link": {
8735 * "relation": "self",
8736 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8742 * ),
8743 * @OA\Response(
8744 * response="400",
8745 * ref="#/components/responses/badrequest"
8746 * ),
8747 * @OA\Response(
8748 * response="401",
8749 * ref="#/components/responses/unauthorized"
8750 * ),
8751 * security={{"openemr_auth":{}}}
8754 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
8755 $getParams = $request->getQueryParams();
8756 if ($request->isPatientRequest()) {
8757 // only allow access to data of binded patient
8758 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8759 } else {
8760 RestConfig::authorization_check("encounters", "auth_a");
8761 $return = (new FhirEncounterRestController())->getAll($getParams);
8763 RestConfig::apiLog($return);
8764 return $return;
8768 * @OA\Get(
8769 * path="/fhir/Encounter/{uuid}",
8770 * description="Returns a single Encounter resource.",
8771 * tags={"fhir"},
8772 * @OA\Parameter(
8773 * name="uuid",
8774 * in="path",
8775 * description="The uuid for the Encounter resource.",
8776 * required=true,
8777 * @OA\Schema(
8778 * type="string"
8780 * ),
8781 * @OA\Response(
8782 * response="200",
8783 * description="Standard Response",
8784 * @OA\MediaType(
8785 * mediaType="application/json",
8786 * @OA\Schema(
8787 * @OA\Property(
8788 * property="json object",
8789 * description="FHIR Json object.",
8790 * type="object"
8791 * ),
8792 * example={
8793 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8794 * "meta": {
8795 * "versionId": "1",
8796 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8797 * },
8798 * "resourceType": "Encounter",
8799 * "identifier": {
8801 * "system": "urn:ietf:rfc:3986",
8802 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8804 * },
8805 * "status": "finished",
8806 * "class": {
8807 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8808 * "code": "AMB",
8809 * "display": "ambulatory"
8810 * },
8811 * "type": {
8813 * "coding": {
8815 * "system": "http://snomed.info/sct",
8816 * "code": "185349003",
8817 * "display": "Encounter for check up (procedure)"
8821 * },
8822 * "subject": {
8823 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8824 * "type": "Patient"
8825 * },
8826 * "participant": {
8828 * "type": {
8830 * "coding": {
8832 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8833 * "code": "PPRF",
8834 * "display": "Primary Performer"
8838 * },
8839 * "period": {
8840 * "start": "2012-08-13T00:00:00+00:00"
8841 * },
8842 * "individual": {
8843 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8844 * "type": "Practitioner"
8847 * },
8848 * "period": {
8849 * "start": "2012-08-13T00:00:00+00:00"
8854 * ),
8855 * @OA\Response(
8856 * response="400",
8857 * ref="#/components/responses/badrequest"
8858 * ),
8859 * @OA\Response(
8860 * response="401",
8861 * ref="#/components/responses/unauthorized"
8862 * ),
8863 * @OA\Response(
8864 * response="404",
8865 * ref="#/components/responses/uuidnotfound"
8866 * ),
8867 * security={{"openemr_auth":{}}}
8870 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
8871 if ($request->isPatientRequest()) {
8872 // only allow access to data of binded patient
8873 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8874 } else {
8875 RestConfig::authorization_check("admin", "super");
8876 $return = (new FhirEncounterRestController())->getOne($uuid);
8878 RestConfig::apiLog($return);
8879 return $return;
8883 * @OA\Get(
8884 * path="/fhir/Goal",
8885 * description="Returns a list of Condition resources.",
8886 * tags={"fhir"},
8887 * @OA\Parameter(
8888 * name="_id",
8889 * in="query",
8890 * description="The uuid for the Goal resource.",
8891 * required=false,
8892 * @OA\Schema(
8893 * type="string"
8895 * ),
8896 * @OA\Parameter(
8897 * name="patient",
8898 * in="query",
8899 * description="The uuid for the patient.",
8900 * required=false,
8901 * @OA\Schema(
8902 * type="string"
8904 * ),
8905 * @OA\Response(
8906 * response="200",
8907 * description="Standard Response",
8908 * @OA\MediaType(
8909 * mediaType="application/json",
8910 * @OA\Schema(
8911 * @OA\Property(
8912 * property="json object",
8913 * description="FHIR Json object.",
8914 * type="object"
8915 * ),
8916 * example={
8917 * "meta": {
8918 * "lastUpdated": "2021-09-14T09:13:51"
8919 * },
8920 * "resourceType": "Bundle",
8921 * "type": "collection",
8922 * "total": 0,
8923 * "link": {
8925 * "relation": "self",
8926 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8932 * ),
8933 * @OA\Response(
8934 * response="400",
8935 * ref="#/components/responses/badrequest"
8936 * ),
8937 * @OA\Response(
8938 * response="401",
8939 * ref="#/components/responses/unauthorized"
8940 * ),
8941 * security={{"openemr_auth":{}}}
8944 "GET /fhir/Goal" => function (HttpRestRequest $request) {
8945 $getParams = $request->getQueryParams();
8946 if ($request->isPatientRequest()) {
8947 // only allow access to data of binded patient
8948 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8949 } else {
8950 RestConfig::authorization_check("admin", "super");
8951 $return = (new FhirGoalRestController())->getAll($getParams);
8953 RestConfig::apiLog($return);
8954 return $return;
8958 * @OA\Get(
8959 * path="/fhir/Goal/{uuid}",
8960 * description="Returns a single Goal resource.",
8961 * tags={"fhir"},
8962 * @OA\Parameter(
8963 * name="uuid",
8964 * in="path",
8965 * description="The uuid for the Goal resource.",
8966 * required=true,
8967 * @OA\Schema(
8968 * type="string"
8970 * ),
8971 * @OA\Response(
8972 * response="200",
8973 * description="Standard Response",
8974 * @OA\MediaType(
8975 * mediaType="application/json",
8976 * @OA\Schema(
8977 * @OA\Property(
8978 * property="json object",
8979 * description="FHIR Json object.",
8980 * type="object"
8981 * ),
8982 * example={
8983 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8984 * "meta": {
8985 * "versionId": "1",
8986 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8987 * },
8988 * "resourceType": "Goal",
8989 * "lifecycleStatus": "active",
8990 * "description": {
8991 * "text": "Eating more vegetables."
8992 * },
8993 * "subject": {
8994 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8995 * "type": "Patient"
8996 * },
8997 * "target": {
8999 * "measure": {
9000 * "extension": {
9002 * "valueCode": "unknown",
9003 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9006 * },
9007 * "detailString": "Eating more vegetables.",
9008 * "dueDate": "2021-09-09"
9014 * ),
9015 * @OA\Response(
9016 * response="400",
9017 * ref="#/components/responses/badrequest"
9018 * ),
9019 * @OA\Response(
9020 * response="401",
9021 * ref="#/components/responses/unauthorized"
9022 * ),
9023 * @OA\Response(
9024 * response="404",
9025 * ref="#/components/responses/uuidnotfound"
9026 * ),
9027 * security={{"openemr_auth":{}}}
9030 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9031 if ($request->isPatientRequest()) {
9032 // only allow access to data of binded patient
9033 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9034 } else {
9035 RestConfig::authorization_check("admin", "super");
9036 $return = (new FhirGoalRestController())->getOne($uuid);
9038 RestConfig::apiLog($return);
9039 return $return;
9043 * @OA\Get(
9044 * path="/fhir/Group",
9045 * 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>",
9046 * tags={"fhir"},
9047 * @OA\Parameter(
9048 * name="_id",
9049 * in="query",
9050 * description="The uuid for the Group resource.",
9051 * required=false,
9052 * @OA\Schema(
9053 * type="string"
9055 * ),
9056 * @OA\Parameter(
9057 * name="patient",
9058 * in="query",
9059 * description="The uuid for the patient.",
9060 * required=false,
9061 * @OA\Schema(
9062 * type="string"
9064 * ),
9065 * @OA\Response(
9066 * response="200",
9067 * description="Standard Response",
9068 * @OA\MediaType(
9069 * mediaType="application/json",
9070 * @OA\Schema(
9071 * @OA\Property(
9072 * property="json object",
9073 * description="FHIR Json object.",
9074 * type="object"
9075 * ),
9076 * example={
9077 * "meta": {
9078 * "lastUpdated": "2021-09-14T09:13:51"
9079 * },
9080 * "resourceType": "Bundle",
9081 * "type": "collection",
9082 * "total": 0,
9083 * "link": {
9085 * "relation": "self",
9086 * "url": "https://localhost:9300/apis/default/fhir/Group"
9092 * ),
9093 * @OA\Response(
9094 * response="400",
9095 * ref="#/components/responses/badrequest"
9096 * ),
9097 * @OA\Response(
9098 * response="401",
9099 * ref="#/components/responses/unauthorized"
9100 * ),
9101 * security={{"openemr_auth":{}}}
9104 'GET /fhir/Group' => function (HttpRestRequest $request) {
9105 RestConfig::authorization_check("admin", "users");
9106 $getParams = $request->getQueryParams();
9107 if ($request->isPatientRequest()) {
9108 // only allow access to data of binded patient
9109 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9110 } else {
9111 $return = (new FhirGroupRestController())->getAll($getParams);
9113 RestConfig::apiLog($return);
9114 return $return;
9118 * @OA\Get(
9119 * path="/fhir/Group/{uuid}",
9120 * 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>",
9121 * tags={"fhir"},
9122 * @OA\Parameter(
9123 * name="uuid",
9124 * in="path",
9125 * description="The uuid for the Group resource.",
9126 * required=true,
9127 * @OA\Schema(
9128 * type="string"
9130 * ),
9131 * @OA\Response(
9132 * response="200",
9133 * 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>"
9134 * ),
9135 * @OA\Response(
9136 * response="400",
9137 * ref="#/components/responses/badrequest"
9138 * ),
9139 * @OA\Response(
9140 * response="401",
9141 * ref="#/components/responses/unauthorized"
9142 * ),
9143 * @OA\Response(
9144 * response="404",
9145 * ref="#/components/responses/uuidnotfound"
9146 * ),
9147 * security={{"openemr_auth":{}}}
9150 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9151 RestConfig::authorization_check("admin", "users");
9152 if ($request->isPatientRequest()) {
9153 // only allow access to data of binded patient
9154 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9155 } else {
9156 $return = (new FhirGroupRestController())->getOne($uuid);
9158 RestConfig::apiLog($return);
9159 return $return;
9163 * @OA\Get(
9164 * path="/fhir/Group/{id}/$export",
9165 * 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>",
9166 * tags={"fhir"},
9167 * @OA\Response(
9168 * response="200",
9169 * 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>"
9170 * ),
9171 * @OA\Response(
9172 * response="400",
9173 * ref="#/components/responses/badrequest"
9174 * ),
9175 * @OA\Response(
9176 * response="401",
9177 * ref="#/components/responses/unauthorized"
9178 * ),
9179 * security={{"openemr_auth":{}}}
9182 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9183 RestConfig::authorization_check("admin", "users");
9184 $fhirExportService = new FhirOperationExportRestController($request);
9185 $exportParams = $request->getQueryParams();
9186 $exportParams['groupId'] = $groupId;
9187 $return = $fhirExportService->processExport(
9188 $exportParams,
9189 'Group',
9190 $request->getHeader('Accept'),
9191 $request->getHeader('Prefer')
9193 RestConfig::apiLog($return);
9194 return $return;
9198 * @OA\Get(
9199 * path="/fhir/Immunization",
9200 * description="Returns a list of Immunization resources.",
9201 * tags={"fhir"},
9202 * @OA\Parameter(
9203 * name="_id",
9204 * in="query",
9205 * description="The uuid for the Immunization resource.",
9206 * required=false,
9207 * @OA\Schema(
9208 * type="string"
9210 * ),
9211 * @OA\Parameter(
9212 * name="patient",
9213 * in="query",
9214 * description="The uuid for the patient.",
9215 * required=false,
9216 * @OA\Schema(
9217 * type="string"
9219 * ),
9220 * @OA\Response(
9221 * response="200",
9222 * description="Standard Response",
9223 * @OA\MediaType(
9224 * mediaType="application/json",
9225 * @OA\Schema(
9226 * @OA\Property(
9227 * property="json object",
9228 * description="FHIR Json object.",
9229 * type="object"
9230 * ),
9231 * example={
9232 * "meta": {
9233 * "lastUpdated": "2021-09-14T09:13:51"
9234 * },
9235 * "resourceType": "Bundle",
9236 * "type": "collection",
9237 * "total": 0,
9238 * "link": {
9240 * "relation": "self",
9241 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9247 * ),
9248 * @OA\Response(
9249 * response="400",
9250 * ref="#/components/responses/badrequest"
9251 * ),
9252 * @OA\Response(
9253 * response="401",
9254 * ref="#/components/responses/unauthorized"
9255 * ),
9256 * security={{"openemr_auth":{}}}
9259 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9260 $getParams = $request->getQueryParams();
9261 if ($request->isPatientRequest()) {
9262 // only allow access to data of binded patient
9263 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9264 } else {
9265 RestConfig::authorization_check("patients", "med");
9266 $return = (new FhirImmunizationRestController())->getAll($getParams);
9268 RestConfig::apiLog($return);
9269 return $return;
9273 * @OA\Get(
9274 * path="/fhir/Immunization/{uuid}",
9275 * description="Returns a single Immunization resource.",
9276 * tags={"fhir"},
9277 * @OA\Parameter(
9278 * name="uuid",
9279 * in="path",
9280 * description="The uuid for the Immunization resource.",
9281 * required=true,
9282 * @OA\Schema(
9283 * type="string"
9285 * ),
9286 * @OA\Response(
9287 * response="200",
9288 * description="Standard Response",
9289 * @OA\MediaType(
9290 * mediaType="application/json",
9291 * @OA\Schema(
9292 * @OA\Property(
9293 * property="json object",
9294 * description="FHIR Json object.",
9295 * type="object"
9296 * ),
9297 * example={
9298 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9299 * "meta": {
9300 * "versionId": "1",
9301 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9302 * },
9303 * "resourceType": "Immunization",
9304 * "status": "completed",
9305 * "vaccineCode": {
9306 * "coding": {
9308 * "system": "http://hl7.org/fhir/sid/cvx",
9309 * "code": "207",
9310 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9313 * },
9314 * "patient": {
9315 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9316 * },
9317 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9318 * "recorded": "2022-03-26T05:42:26+00:00",
9319 * "primarySource": false
9323 * ),
9324 * @OA\Response(
9325 * response="400",
9326 * ref="#/components/responses/badrequest"
9327 * ),
9328 * @OA\Response(
9329 * response="401",
9330 * ref="#/components/responses/unauthorized"
9331 * ),
9332 * @OA\Response(
9333 * response="404",
9334 * ref="#/components/responses/uuidnotfound"
9335 * ),
9336 * security={{"openemr_auth":{}}}
9339 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9340 if ($request->isPatientRequest()) {
9341 // only allow access to data of binded patient
9342 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9343 } else {
9344 RestConfig::authorization_check("patients", "med");
9345 $return = (new FhirImmunizationRestController())->getOne($uuid);
9347 RestConfig::apiLog($return);
9348 return $return;
9352 * @OA\Get(
9353 * path="/fhir/Location",
9354 * description="Returns a list of Location resources.",
9355 * tags={"fhir"},
9356 * @OA\Parameter(
9357 * name="_id",
9358 * in="query",
9359 * description="The uuid for the Location resource.",
9360 * required=false,
9361 * @OA\Schema(
9362 * type="string"
9364 * ),
9365 * @OA\Response(
9366 * response="200",
9367 * description="Standard Response",
9368 * @OA\MediaType(
9369 * mediaType="application/json",
9370 * @OA\Schema(
9371 * @OA\Property(
9372 * property="json object",
9373 * description="FHIR Json object.",
9374 * type="object"
9375 * ),
9376 * example={
9377 * "meta": {
9378 * "lastUpdated": "2021-09-14T09:13:51"
9379 * },
9380 * "resourceType": "Bundle",
9381 * "type": "collection",
9382 * "total": 0,
9383 * "link": {
9385 * "relation": "self",
9386 * "url": "https://localhost:9300/apis/default/fhir/Location"
9392 * ),
9393 * @OA\Response(
9394 * response="400",
9395 * ref="#/components/responses/badrequest"
9396 * ),
9397 * @OA\Response(
9398 * response="401",
9399 * ref="#/components/responses/unauthorized"
9400 * ),
9401 * security={{"openemr_auth":{}}}
9404 "GET /fhir/Location" => function (HttpRestRequest $request) {
9405 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9406 RestConfig::apiLog($return);
9407 return $return;
9411 * @OA\Get(
9412 * path="/fhir/Location/{uuid}",
9413 * description="Returns a single Location resource.",
9414 * tags={"fhir"},
9415 * @OA\Parameter(
9416 * name="uuid",
9417 * in="path",
9418 * description="The uuid for the Location resource.",
9419 * required=true,
9420 * @OA\Schema(
9421 * type="string"
9423 * ),
9424 * @OA\Response(
9425 * response="200",
9426 * description="Standard Response",
9427 * @OA\MediaType(
9428 * mediaType="application/json",
9429 * @OA\Schema(
9430 * @OA\Property(
9431 * property="json object",
9432 * description="FHIR Json object.",
9433 * type="object"
9434 * ),
9435 * example={
9436 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9437 * "meta": {
9438 * "versionId": "1",
9439 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9440 * },
9441 * "resourceType": "Location",
9442 * "status": "active",
9443 * "name": "Your Clinic Name Here",
9444 * "telecom": {
9446 * "system": "phone",
9447 * "value": "000-000-0000"
9448 * },
9450 * "system": "fax",
9451 * "value": "000-000-0000"
9457 * ),
9458 * @OA\Response(
9459 * response="400",
9460 * ref="#/components/responses/badrequest"
9461 * ),
9462 * @OA\Response(
9463 * response="401",
9464 * ref="#/components/responses/unauthorized"
9465 * ),
9466 * @OA\Response(
9467 * response="404",
9468 * ref="#/components/responses/uuidnotfound"
9469 * ),
9470 * security={{"openemr_auth":{}}}
9473 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9474 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9475 RestConfig::apiLog($return);
9476 return $return;
9480 * @OA\Get(
9481 * path="/fhir/Medication",
9482 * description="Returns a list of Medication resources.",
9483 * tags={"fhir"},
9484 * @OA\Response(
9485 * response="200",
9486 * description="Standard Response",
9487 * @OA\MediaType(
9488 * mediaType="application/json",
9489 * @OA\Schema(
9490 * @OA\Property(
9491 * property="json object",
9492 * description="FHIR Json object.",
9493 * type="object"
9494 * ),
9495 * example={
9496 * "meta": {
9497 * "lastUpdated": "2021-09-14T09:13:51"
9498 * },
9499 * "resourceType": "Bundle",
9500 * "type": "collection",
9501 * "total": 0,
9502 * "link": {
9504 * "relation": "self",
9505 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9511 * ),
9512 * @OA\Response(
9513 * response="400",
9514 * ref="#/components/responses/badrequest"
9515 * ),
9516 * @OA\Response(
9517 * response="401",
9518 * ref="#/components/responses/unauthorized"
9519 * ),
9520 * security={{"openemr_auth":{}}}
9523 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9524 RestConfig::authorization_check("patients", "med");
9525 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9526 RestConfig::apiLog($return);
9527 return $return;
9531 * @OA\Get(
9532 * path="/fhir/Medication/{uuid}",
9533 * description="Returns a single Medication resource.",
9534 * tags={"fhir"},
9535 * @OA\Parameter(
9536 * name="uuid",
9537 * in="path",
9538 * description="The uuid for the Medication resource.",
9539 * required=true,
9540 * @OA\Schema(
9541 * type="string"
9543 * ),
9544 * @OA\Response(
9545 * response="200",
9546 * description="Standard Response",
9547 * @OA\MediaType(
9548 * mediaType="application/json",
9549 * @OA\Schema(
9550 * @OA\Property(
9551 * property="json object",
9552 * description="FHIR Json object.",
9553 * type="object"
9554 * ),
9555 * example={
9556 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
9557 * "meta": {
9558 * "versionId": "1",
9559 * "lastUpdated": "2022-04-19T23:42:14+00:00"
9560 * },
9561 * "resourceType": "Medication",
9562 * "code": {
9563 * "coding": {
9565 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9566 * "code": 153165
9569 * },
9570 * "status": "active",
9571 * "batch": {
9572 * "lotNumber": "132",
9573 * "expirationDate": "0000-00-00"
9578 * ),
9579 * @OA\Response(
9580 * response="400",
9581 * ref="#/components/responses/badrequest"
9582 * ),
9583 * @OA\Response(
9584 * response="401",
9585 * ref="#/components/responses/unauthorized"
9586 * ),
9587 * @OA\Response(
9588 * response="404",
9589 * ref="#/components/responses/uuidnotfound"
9590 * ),
9591 * security={{"openemr_auth":{}}}
9594 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
9595 if ($request->isPatientRequest()) {
9596 // only allow access to data of binded patient
9597 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
9598 } else {
9599 RestConfig::authorization_check("patients", "med");
9600 $return = (new FhirMedicationRestController())->getOne($uuid);
9602 RestConfig::apiLog($return);
9603 return $return;
9607 * @OA\Get(
9608 * path="/fhir/MedicationRequest",
9609 * description="Returns a list of MedicationRequest resources.",
9610 * tags={"fhir"},
9611 * @OA\Parameter(
9612 * name="_id",
9613 * in="query",
9614 * description="The uuid for the MedicationRequest resource.",
9615 * required=false,
9616 * @OA\Schema(
9617 * type="string"
9619 * ),
9620 * @OA\Parameter(
9621 * name="patient",
9622 * in="query",
9623 * description="The uuid for the patient.",
9624 * required=false,
9625 * @OA\Schema(
9626 * type="string"
9628 * ),
9629 * @OA\Parameter(
9630 * name="intent",
9631 * in="query",
9632 * description="The intent of the MedicationRequest resource.",
9633 * required=false,
9634 * @OA\Schema(
9635 * type="string"
9637 * ),
9638 * @OA\Parameter(
9639 * name="status",
9640 * in="query",
9641 * description="The status of the MedicationRequest resource.",
9642 * required=false,
9643 * @OA\Schema(
9644 * type="string"
9646 * ),
9647 * @OA\Response(
9648 * response="200",
9649 * description="Standard Response",
9650 * @OA\MediaType(
9651 * mediaType="application/json",
9652 * @OA\Schema(
9653 * @OA\Property(
9654 * property="json object",
9655 * description="FHIR Json object.",
9656 * type="object"
9657 * ),
9658 * example={
9659 * "meta": {
9660 * "lastUpdated": "2021-09-14T09:13:51"
9661 * },
9662 * "resourceType": "Bundle",
9663 * "type": "collection",
9664 * "total": 0,
9665 * "link": {
9667 * "relation": "self",
9668 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9674 * ),
9675 * @OA\Response(
9676 * response="400",
9677 * ref="#/components/responses/badrequest"
9678 * ),
9679 * @OA\Response(
9680 * response="401",
9681 * ref="#/components/responses/unauthorized"
9682 * ),
9683 * security={{"openemr_auth":{}}}
9686 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
9687 $getParams = $request->getQueryParams();
9688 if ($request->isPatientRequest()) {
9689 // only allow access to data of binded patient
9690 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9691 } else {
9692 RestConfig::authorization_check("patients", "med");
9693 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9695 RestConfig::apiLog($return);
9696 return $return;
9700 * @OA\Get(
9701 * path="/fhir/MedicationRequest/{uuid}",
9702 * description="Returns a single MedicationRequest resource.",
9703 * tags={"fhir"},
9704 * @OA\Parameter(
9705 * name="uuid",
9706 * in="path",
9707 * description="The uuid for the MedicationRequest resource.",
9708 * required=true,
9709 * @OA\Schema(
9710 * type="string"
9712 * ),
9713 * @OA\Response(
9714 * response="200",
9715 * description="Standard Response",
9716 * @OA\MediaType(
9717 * mediaType="application/json",
9718 * @OA\Schema(
9719 * @OA\Property(
9720 * property="json object",
9721 * description="FHIR Json object.",
9722 * type="object"
9723 * ),
9724 * example={
9725 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9726 * "meta": {
9727 * "versionId": "1",
9728 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9729 * },
9730 * "resourceType": "MedicationRequest",
9731 * "status": "active",
9732 * "intent": "order",
9733 * "category": {
9735 * "coding": {
9737 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9738 * "code": "community",
9739 * "display": "Home/Community"
9743 * },
9744 * "reportedBoolean": false,
9745 * "medicationCodeableConcept": {
9746 * "coding": {
9748 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9749 * "code": "1738139",
9750 * "display": "Acetaminophen 325 MG Oral Tablet"
9753 * },
9754 * "subject": {
9755 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9756 * "type": "Patient"
9757 * },
9758 * "authoredOn": "2021-09-18T00:00:00+00:00",
9759 * "requester": {
9760 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9761 * "type": "Practitioner"
9766 * ),
9767 * @OA\Response(
9768 * response="400",
9769 * ref="#/components/responses/badrequest"
9770 * ),
9771 * @OA\Response(
9772 * response="401",
9773 * ref="#/components/responses/unauthorized"
9774 * ),
9775 * @OA\Response(
9776 * response="404",
9777 * ref="#/components/responses/uuidnotfound"
9778 * ),
9779 * security={{"openemr_auth":{}}}
9782 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
9783 if ($request->isPatientRequest()) {
9784 // only allow access to data of binded patient
9785 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9786 } else {
9787 RestConfig::authorization_check("patients", "med");
9788 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9790 RestConfig::apiLog($return);
9791 return $return;
9795 * @OA\Get(
9796 * path="/fhir/Observation",
9797 * description="Returns a list of Observation resources.",
9798 * tags={"fhir"},
9799 * @OA\Parameter(
9800 * name="_id",
9801 * in="query",
9802 * description="The uuid for the Observation resource.",
9803 * required=false,
9804 * @OA\Schema(
9805 * type="string"
9807 * ),
9808 * @OA\Parameter(
9809 * name="patient",
9810 * in="query",
9811 * description="The uuid for the patient.",
9812 * required=false,
9813 * @OA\Schema(
9814 * type="string"
9816 * ),
9817 * @OA\Parameter(
9818 * name="code",
9819 * in="query",
9820 * description="The code of the Observation resource.",
9821 * required=false,
9822 * @OA\Schema(
9823 * type="string"
9825 * ),
9826 * @OA\Parameter(
9827 * name="category",
9828 * in="query",
9829 * description="The category of the Observation resource.",
9830 * required=false,
9831 * @OA\Schema(
9832 * type="string"
9834 * ),
9835 * @OA\Parameter(
9836 * name="date",
9837 * in="query",
9838 * description="The datetime of the Observation resource.",
9839 * required=false,
9840 * @OA\Schema(
9841 * type="string"
9843 * ),
9844 * @OA\Response(
9845 * response="200",
9846 * description="Standard Response",
9847 * @OA\MediaType(
9848 * mediaType="application/json",
9849 * @OA\Schema(
9850 * @OA\Property(
9851 * property="json object",
9852 * description="FHIR Json object.",
9853 * type="object"
9854 * ),
9855 * example={
9856 * "meta": {
9857 * "lastUpdated": "2021-09-14T09:13:51"
9858 * },
9859 * "resourceType": "Bundle",
9860 * "type": "collection",
9861 * "total": 0,
9862 * "link": {
9864 * "relation": "self",
9865 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9871 * ),
9872 * @OA\Response(
9873 * response="400",
9874 * ref="#/components/responses/badrequest"
9875 * ),
9876 * @OA\Response(
9877 * response="401",
9878 * ref="#/components/responses/unauthorized"
9879 * ),
9880 * security={{"openemr_auth":{}}}
9883 "GET /fhir/Observation" => function (HttpRestRequest $request) {
9884 $getParams = $request->getQueryParams();
9885 if ($request->isPatientRequest()) {
9886 // only allow access to data of binded patient
9887 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9888 } else {
9889 RestConfig::authorization_check("patients", "med");
9890 $return = (new FhirObservationRestController())->getAll($getParams);
9892 RestConfig::apiLog($return);
9893 return $return;
9897 * @OA\Get(
9898 * path="/fhir/Observation/{uuid}",
9899 * description="Returns a single Observation resource.",
9900 * tags={"fhir"},
9901 * @OA\Parameter(
9902 * name="uuid",
9903 * in="path",
9904 * description="The uuid for the Observation resource.",
9905 * required=true,
9906 * @OA\Schema(
9907 * type="string"
9909 * ),
9910 * @OA\Response(
9911 * response="200",
9912 * description="Standard Response",
9913 * @OA\MediaType(
9914 * mediaType="application/json",
9915 * @OA\Schema(
9916 * @OA\Property(
9917 * property="json object",
9918 * description="FHIR Json object.",
9919 * type="object"
9920 * ),
9921 * example={
9922 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9923 * "meta": {
9924 * "versionId": "1",
9925 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9926 * },
9927 * "resourceType": "Observation",
9928 * "status": "final",
9929 * "category": {
9931 * "coding": {
9933 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9934 * "code": "vital-signs"
9938 * },
9939 * "code": {
9940 * "coding": {
9942 * "system": "http://loinc.org",
9943 * "code": "85354-9",
9944 * "display": "Blood pressure systolic and diastolic"
9947 * },
9948 * "subject": {
9949 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9950 * "type": "Patient"
9951 * },
9952 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9953 * "component": {
9955 * "code": {
9956 * "coding": {
9958 * "system": "http://loinc.org",
9959 * "code": "8480-6",
9960 * "display": "Systolic blood pressure"
9963 * },
9964 * "valueQuantity": {
9965 * "value": 122,
9966 * "unit": "mm[Hg]",
9967 * "system": "http://unitsofmeasure.org",
9968 * "code": "mm[Hg]"
9970 * },
9972 * "code": {
9973 * "coding": {
9975 * "system": "http://loinc.org",
9976 * "code": "8462-4",
9977 * "display": "Diastolic blood pressure"
9980 * },
9981 * "valueQuantity": {
9982 * "value": 77,
9983 * "unit": "mm[Hg]",
9984 * "system": "http://unitsofmeasure.org",
9985 * "code": "mm[Hg]"
9992 * ),
9993 * @OA\Response(
9994 * response="400",
9995 * ref="#/components/responses/badrequest"
9996 * ),
9997 * @OA\Response(
9998 * response="401",
9999 * ref="#/components/responses/unauthorized"
10000 * ),
10001 * @OA\Response(
10002 * response="404",
10003 * ref="#/components/responses/uuidnotfound"
10004 * ),
10005 * security={{"openemr_auth":{}}}
10008 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10009 if ($request->isPatientRequest()) {
10010 // only allow access to data of binded patient
10011 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10012 } else {
10013 RestConfig::authorization_check("patients", "med");
10014 $return = (new FhirObservationRestController())->getOne($uuid);
10016 RestConfig::apiLog($return);
10017 return $return;
10021 * @OA\Get(
10022 * path="/fhir/Organization",
10023 * description="Returns a list of Organization resources.",
10024 * tags={"fhir"},
10025 * @OA\Parameter(
10026 * name="_id",
10027 * in="query",
10028 * description="The uuid for the Organization resource.",
10029 * required=false,
10030 * @OA\Schema(
10031 * type="string"
10033 * ),
10034 * @OA\Parameter(
10035 * name="name",
10036 * in="query",
10037 * description="The name of the Organization resource.",
10038 * required=false,
10039 * @OA\Schema(
10040 * type="string"
10042 * ),
10043 * @OA\Parameter(
10044 * name="email",
10045 * in="query",
10046 * description="The email of the Organization resource.",
10047 * required=false,
10048 * @OA\Schema(
10049 * type="string"
10051 * ),
10052 * @OA\Parameter(
10053 * name="phone",
10054 * in="query",
10055 * description="The phone of the Organization resource.",
10056 * required=false,
10057 * @OA\Schema(
10058 * type="string"
10060 * ),
10061 * @OA\Parameter(
10062 * name="telecom",
10063 * in="query",
10064 * description="The telecom of the Organization resource.",
10065 * required=false,
10066 * @OA\Schema(
10067 * type="string"
10069 * ),
10070 * @OA\Parameter(
10071 * name="address",
10072 * in="query",
10073 * description="The address of the Organization resource.",
10074 * required=false,
10075 * @OA\Schema(
10076 * type="string"
10078 * ),
10079 * @OA\Parameter(
10080 * name="address-city",
10081 * in="query",
10082 * description="The address-city of the Organization resource.",
10083 * required=false,
10084 * @OA\Schema(
10085 * type="string"
10087 * ),
10088 * @OA\Parameter(
10089 * name="address-postalcode",
10090 * in="query",
10091 * description="The address-postalcode of the Organization resource.",
10092 * required=false,
10093 * @OA\Schema(
10094 * type="string"
10096 * ),
10097 * @OA\Parameter(
10098 * name="address-state",
10099 * in="query",
10100 * description="The address-state of the Organization resource.",
10101 * required=false,
10102 * @OA\Schema(
10103 * type="string"
10105 * ),
10106 * @OA\Response(
10107 * response="200",
10108 * description="Standard Response",
10109 * @OA\MediaType(
10110 * mediaType="application/json",
10111 * @OA\Schema(
10112 * @OA\Property(
10113 * property="json object",
10114 * description="FHIR Json object.",
10115 * type="object"
10116 * ),
10117 * example={
10118 * "meta": {
10119 * "lastUpdated": "2021-09-14T09:13:51"
10120 * },
10121 * "resourceType": "Bundle",
10122 * "type": "collection",
10123 * "total": 0,
10124 * "link": {
10126 * "relation": "self",
10127 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10133 * ),
10134 * @OA\Response(
10135 * response="400",
10136 * ref="#/components/responses/badrequest"
10137 * ),
10138 * @OA\Response(
10139 * response="401",
10140 * ref="#/components/responses/unauthorized"
10141 * ),
10142 * security={{"openemr_auth":{}}}
10145 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10146 if (!$request->isPatientRequest()) {
10147 RestConfig::authorization_check("admin", "users");
10149 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10150 RestConfig::apiLog($return);
10151 return $return;
10155 * @OA\Get(
10156 * path="/fhir/Organization/{uuid}",
10157 * description="Returns a single Organization resource.",
10158 * tags={"fhir"},
10159 * @OA\Parameter(
10160 * name="uuid",
10161 * in="path",
10162 * description="The uuid for the Organization resource.",
10163 * required=true,
10164 * @OA\Schema(
10165 * type="string"
10167 * ),
10168 * @OA\Response(
10169 * response="200",
10170 * description="Standard Response",
10171 * @OA\MediaType(
10172 * mediaType="application/json",
10173 * @OA\Schema(
10174 * @OA\Property(
10175 * property="json object",
10176 * description="FHIR Json object.",
10177 * type="object"
10178 * ),
10179 * example={
10180 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10181 * "meta": {
10182 * "versionId": "1",
10183 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10184 * },
10185 * "resourceType": "Organization",
10186 * "text": {
10187 * "status": "generated",
10188 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10189 * },
10190 * "identifier": {
10192 * "system": "http://hl7.org/fhir/sid/us-npi",
10193 * "value": "1234567890"
10195 * },
10196 * "active": true,
10197 * "type": {
10199 * "coding": {
10201 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10202 * "code": "prov",
10203 * "display": "Healthcare Provider"
10207 * },
10208 * "name": "Your Clinic Name Here",
10209 * "telecom": {
10211 * "system": "phone",
10212 * "value": "000-000-0000",
10213 * "use": "work"
10214 * },
10216 * "system": "fax",
10217 * "value": "000-000-0000",
10218 * "use": "work"
10220 * },
10221 * "address": {
10222 * null
10227 * ),
10228 * @OA\Response(
10229 * response="400",
10230 * ref="#/components/responses/badrequest"
10231 * ),
10232 * @OA\Response(
10233 * response="401",
10234 * ref="#/components/responses/unauthorized"
10235 * ),
10236 * @OA\Response(
10237 * response="404",
10238 * ref="#/components/responses/uuidnotfound"
10239 * ),
10240 * security={{"openemr_auth":{}}}
10243 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10244 $patientUUID = null;
10245 if (!$request->isPatientRequest()) {
10246 RestConfig::authorization_check("admin", "users");
10247 } else {
10248 $patientUUID = $request->getPatientUUIDString();
10250 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10252 RestConfig::apiLog($return);
10253 return $return;
10257 * @OA\Post(
10258 * path="/fhir/Organization",
10259 * description="Adds a Organization resource.",
10260 * tags={"fhir"},
10261 * @OA\RequestBody(
10262 * required=true,
10263 * @OA\MediaType(
10264 * mediaType="application/json",
10265 * @OA\Schema(
10266 * description="The json object for the Organization resource.",
10267 * type="object"
10268 * ),
10269 * example={
10270 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10271 * "meta": {
10272 * "versionId": "1",
10273 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10274 * },
10275 * "resourceType": "Organization",
10276 * "text": {
10277 * "status": "generated",
10278 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10279 * },
10280 * "identifier": {
10282 * "system": "http://hl7.org/fhir/sid/us-npi",
10283 * "value": "1234567890"
10285 * },
10286 * "active": true,
10287 * "type": {
10289 * "coding": {
10291 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10292 * "code": "prov",
10293 * "display": "Healthcare Provider"
10297 * },
10298 * "name": "Your Clinic Name Here Hey",
10299 * "telecom": {
10301 * "system": "phone",
10302 * "value": "000-000-0000",
10303 * "use": "work"
10304 * },
10306 * "system": "fax",
10307 * "value": "000-000-0000",
10308 * "use": "work"
10310 * },
10311 * "address": {
10312 * null
10316 * ),
10317 * @OA\Response(
10318 * response="200",
10319 * description="Standard Response",
10320 * @OA\MediaType(
10321 * mediaType="application/json",
10322 * @OA\Schema(
10323 * @OA\Property(
10324 * property="json object",
10325 * description="FHIR Json object.",
10326 * type="object"
10327 * ),
10328 * example={
10329 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10330 * "meta": {
10331 * "versionId": "1",
10332 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10333 * },
10334 * "resourceType": "Organization",
10335 * "text": {
10336 * "status": "generated",
10337 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10338 * },
10339 * "identifier": {
10341 * "system": "http://hl7.org/fhir/sid/us-npi",
10342 * "value": "1234567890"
10344 * },
10345 * "active": true,
10346 * "type": {
10348 * "coding": {
10350 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10351 * "code": "prov",
10352 * "display": "Healthcare Provider"
10356 * },
10357 * "name": "Your Clinic Name Here Now",
10358 * "telecom": {
10360 * "system": "phone",
10361 * "value": "000-000-0000",
10362 * "use": "work"
10363 * },
10365 * "system": "fax",
10366 * "value": "000-000-0000",
10367 * "use": "work"
10369 * },
10370 * "address": {
10371 * null
10376 * ),
10377 * @OA\Response(
10378 * response="400",
10379 * ref="#/components/responses/badrequest"
10380 * ),
10381 * @OA\Response(
10382 * response="401",
10383 * ref="#/components/responses/unauthorized"
10384 * ),
10385 * security={{"openemr_auth":{}}}
10388 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10389 RestConfig::authorization_check("admin", "super");
10390 $data = (array) (json_decode(file_get_contents("php://input"), true));
10391 $return = (new FhirOrganizationRestController())->post($data);
10392 RestConfig::apiLog($return, $data);
10393 return $return;
10397 * @OA\Put(
10398 * path="/fhir/Organization/{uuid}",
10399 * description="Modifies a Organization resource.",
10400 * tags={"fhir"},
10401 * @OA\Parameter(
10402 * name="uuid",
10403 * in="path",
10404 * description="The uuid for the organization.",
10405 * required=true,
10406 * @OA\Schema(
10407 * type="string"
10409 * ),
10410 * @OA\RequestBody(
10411 * required=true,
10412 * @OA\MediaType(
10413 * mediaType="application/json",
10414 * @OA\Schema(
10415 * description="The json object for the Organization resource.",
10416 * type="object"
10417 * ),
10418 * example={
10419 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10420 * "meta": {
10421 * "versionId": "1",
10422 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10423 * },
10424 * "resourceType": "Organization",
10425 * "text": {
10426 * "status": "generated",
10427 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10428 * },
10429 * "identifier": {
10431 * "system": "http://hl7.org/fhir/sid/us-npi",
10432 * "value": "1234567890"
10434 * },
10435 * "active": true,
10436 * "type": {
10438 * "coding": {
10440 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10441 * "code": "prov",
10442 * "display": "Healthcare Provider"
10446 * },
10447 * "name": "Your Clinic Name Here",
10448 * "telecom": {
10450 * "system": "phone",
10451 * "value": "000-000-0000",
10452 * "use": "work"
10453 * },
10455 * "system": "fax",
10456 * "value": "000-000-0000",
10457 * "use": "work"
10459 * },
10460 * "address": {
10461 * null
10465 * ),
10466 * @OA\Response(
10467 * response="201",
10468 * description="Standard Response",
10469 * @OA\MediaType(
10470 * mediaType="application/json",
10471 * @OA\Schema(
10472 * example={
10473 * "id": 14,
10474 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
10478 * ),
10479 * @OA\Response(
10480 * response="400",
10481 * ref="#/components/responses/badrequest"
10482 * ),
10483 * @OA\Response(
10484 * response="401",
10485 * ref="#/components/responses/unauthorized"
10486 * ),
10487 * security={{"openemr_auth":{}}}
10490 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10491 RestConfig::authorization_check("admin", "super");
10492 $data = (array) (json_decode(file_get_contents("php://input"), true));
10493 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
10494 RestConfig::apiLog($return, $data);
10495 return $return;
10499 * @OA\Post(
10500 * path="/fhir/Patient",
10501 * description="Adds a Patient resource.",
10502 * tags={"fhir"},
10503 * @OA\RequestBody(
10504 * required=true,
10505 * @OA\MediaType(
10506 * mediaType="application/json",
10507 * @OA\Schema(
10508 * description="The json object for the Patient resource.",
10509 * type="object"
10510 * ),
10511 * example={
10512 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10513 * "meta": {
10514 * "versionId": "1",
10515 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10516 * },
10517 * "resourceType": "Patient",
10518 * "text": {
10519 * "status": "generated",
10520 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10521 * },
10522 * "extension": {
10524 * "valueCode": "F",
10525 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10526 * },
10528 * "extension": {
10530 * "valueCoding": {
10531 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10532 * "code": "UNK",
10533 * "display": "Unknown"
10534 * },
10535 * "url": "ombCategory"
10536 * },
10538 * "valueString": "Unknown",
10539 * "url": "text"
10541 * },
10542 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10544 * },
10545 * "identifier": {
10547 * "use": "official",
10548 * "type": {
10549 * "coding": {
10551 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10552 * "code": "PT"
10555 * },
10556 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10557 * "value": "1"
10559 * },
10560 * "active": true,
10561 * "name": {
10563 * "use": "official",
10564 * "family": "Smith",
10565 * "given": {
10566 * "Brenda"
10569 * },
10570 * "gender": "female",
10571 * "birthDate": "2017-03-10",
10572 * "communication": {
10574 * "language": {
10575 * "coding": {
10577 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10578 * "code": "unknown",
10579 * "display": "Unknown"
10587 * ),
10588 * @OA\Response(
10589 * response="200",
10590 * description="Standard Response",
10591 * @OA\MediaType(
10592 * mediaType="application/json",
10593 * @OA\Schema(
10594 * @OA\Property(
10595 * property="json object",
10596 * description="FHIR Json object.",
10597 * type="object"
10598 * ),
10599 * example={
10600 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10601 * "meta": {
10602 * "versionId": "1",
10603 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10604 * },
10605 * "resourceType": "Patient",
10606 * "text": {
10607 * "status": "generated",
10608 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10609 * },
10610 * "extension": {
10612 * "valueCode": "F",
10613 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10614 * },
10616 * "extension": {
10618 * "valueCoding": {
10619 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10620 * "code": "UNK",
10621 * "display": "Unknown"
10622 * },
10623 * "url": "ombCategory"
10624 * },
10626 * "valueString": "Unknown",
10627 * "url": "text"
10629 * },
10630 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10632 * },
10633 * "identifier": {
10635 * "use": "official",
10636 * "type": {
10637 * "coding": {
10639 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10640 * "code": "PT"
10643 * },
10644 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10645 * "value": "1"
10647 * },
10648 * "active": true,
10649 * "name": {
10651 * "use": "official",
10652 * "family": "Smith",
10653 * "given": {
10654 * "Brenda"
10657 * },
10658 * "gender": "female",
10659 * "birthDate": "2017-03-10",
10660 * "communication": {
10662 * "language": {
10663 * "coding": {
10665 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10666 * "code": "unknown",
10667 * "display": "Unknown"
10676 * ),
10677 * @OA\Response(
10678 * response="400",
10679 * ref="#/components/responses/badrequest"
10680 * ),
10681 * @OA\Response(
10682 * response="401",
10683 * ref="#/components/responses/unauthorized"
10684 * ),
10685 * security={{"openemr_auth":{}}}
10688 "POST /fhir/Patient" => function (HttpRestRequest $request) {
10689 RestConfig::authorization_check("patients", "demo");
10690 $data = (array) (json_decode(file_get_contents("php://input"), true));
10691 $return = (new FhirPatientRestController())->post($data);
10692 RestConfig::apiLog($return, $data);
10693 return $return;
10697 * @OA\Put(
10698 * path="/fhir/Patient/{uuid}",
10699 * description="Modifies a Patient resource.",
10700 * tags={"fhir"},
10701 * @OA\Parameter(
10702 * name="uuid",
10703 * in="path",
10704 * description="The uuid for the Patient resource.",
10705 * required=true,
10706 * @OA\Schema(
10707 * type="string"
10709 * ),
10710 * @OA\RequestBody(
10711 * required=true,
10712 * @OA\MediaType(
10713 * mediaType="application/json",
10714 * @OA\Schema(
10715 * description="The json object for the Patient resource.",
10716 * type="object"
10717 * ),
10718 * example={
10719 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10720 * "meta": {
10721 * "versionId": "1",
10722 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10723 * },
10724 * "resourceType": "Patient",
10725 * "text": {
10726 * "status": "generated",
10727 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10728 * },
10729 * "extension": {
10731 * "valueCode": "F",
10732 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10733 * },
10735 * "extension": {
10737 * "valueCoding": {
10738 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10739 * "code": "UNK",
10740 * "display": "Unknown"
10741 * },
10742 * "url": "ombCategory"
10743 * },
10745 * "valueString": "Unknown",
10746 * "url": "text"
10748 * },
10749 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10751 * },
10752 * "identifier": {
10754 * "use": "official",
10755 * "type": {
10756 * "coding": {
10758 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10759 * "code": "PT"
10762 * },
10763 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10764 * "value": "1"
10766 * },
10767 * "active": true,
10768 * "name": {
10770 * "use": "official",
10771 * "family": "Smith",
10772 * "given": {
10773 * "Brenda"
10776 * },
10777 * "gender": "female",
10778 * "birthDate": "2017-03-10",
10779 * "communication": {
10781 * "language": {
10782 * "coding": {
10784 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10785 * "code": "unknown",
10786 * "display": "Unknown"
10794 * ),
10795 * @OA\Response(
10796 * response="201",
10797 * description="Standard Response",
10798 * @OA\MediaType(
10799 * mediaType="application/json",
10800 * @OA\Schema(
10801 * example={
10802 * "id": 2,
10803 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
10807 * ),
10808 * @OA\Response(
10809 * response="400",
10810 * ref="#/components/responses/badrequest"
10811 * ),
10812 * @OA\Response(
10813 * response="401",
10814 * ref="#/components/responses/unauthorized"
10815 * ),
10816 * security={{"openemr_auth":{}}}
10819 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10820 RestConfig::authorization_check("patients", "demo");
10821 $data = (array) (json_decode(file_get_contents("php://input"), true));
10822 $return = (new FhirPatientRestController())->put($uuid, $data);
10823 RestConfig::apiLog($return, $data);
10824 return $return;
10828 * @OA\Get(
10829 * path="/fhir/Patient",
10830 * description="Returns a list of Patient resources.",
10831 * tags={"fhir"},
10832 * @OA\Parameter(
10833 * name="_id",
10834 * in="query",
10835 * description="The uuid for the Patient resource.",
10836 * required=false,
10837 * @OA\Schema(
10838 * type="string"
10840 * ),
10841 * @OA\Parameter(
10842 * name="identifier",
10843 * in="query",
10844 * description="The identifier of the Patient resource.",
10845 * required=false,
10846 * @OA\Schema(
10847 * type="string"
10849 * ),
10850 * @OA\Parameter(
10851 * name="name",
10852 * in="query",
10853 * description="The name of the Patient resource.",
10854 * required=false,
10855 * @OA\Schema(
10856 * type="string"
10858 * ),
10859 * @OA\Parameter(
10860 * name="birthdate",
10861 * in="query",
10862 * description="The birthdate of the Patient resource.",
10863 * required=false,
10864 * @OA\Schema(
10865 * type="string"
10867 * ),
10868 * @OA\Parameter(
10869 * name="gender",
10870 * in="query",
10871 * description="The gender of the Patient resource.",
10872 * required=false,
10873 * @OA\Schema(
10874 * type="string"
10876 * ),
10877 * @OA\Parameter(
10878 * name="address",
10879 * in="query",
10880 * description="The address of the Patient resource.",
10881 * required=false,
10882 * @OA\Schema(
10883 * type="string"
10885 * ),
10886 * @OA\Parameter(
10887 * name="address-city",
10888 * in="query",
10889 * description="The address-city of the Patient resource.",
10890 * required=false,
10891 * @OA\Schema(
10892 * type="string"
10894 * ),
10895 * @OA\Parameter(
10896 * name="address-postalcode",
10897 * in="query",
10898 * description="The address-postalcode of the Patient resource.",
10899 * required=false,
10900 * @OA\Schema(
10901 * type="string"
10903 * ),
10904 * @OA\Parameter(
10905 * name="address-state",
10906 * in="query",
10907 * description="The address-state of the Patient resource.",
10908 * required=false,
10909 * @OA\Schema(
10910 * type="string"
10912 * ),
10913 * @OA\Parameter(
10914 * name="email",
10915 * in="query",
10916 * description="The email of the Patient resource.",
10917 * required=false,
10918 * @OA\Schema(
10919 * type="string"
10921 * ),
10922 * @OA\Parameter(
10923 * name="family",
10924 * in="query",
10925 * description="The family name of the Patient resource.",
10926 * required=false,
10927 * @OA\Schema(
10928 * type="string"
10930 * ),
10931 * @OA\Parameter(
10932 * name="given",
10933 * in="query",
10934 * description="The given name of the Patient resource.",
10935 * required=false,
10936 * @OA\Schema(
10937 * type="string"
10939 * ),
10940 * @OA\Parameter(
10941 * name="phone",
10942 * in="query",
10943 * description="The phone number of the Patient resource.",
10944 * required=false,
10945 * @OA\Schema(
10946 * type="string"
10948 * ),
10949 * @OA\Parameter(
10950 * name="telecom",
10951 * in="query",
10952 * description="The fax number of the Patient resource.",
10953 * required=false,
10954 * @OA\Schema(
10955 * type="string"
10957 * ),
10958 * @OA\Response(
10959 * response="200",
10960 * description="Standard Response",
10961 * @OA\MediaType(
10962 * mediaType="application/json",
10963 * @OA\Schema(
10964 * @OA\Property(
10965 * property="json object",
10966 * description="FHIR Json object.",
10967 * type="object"
10968 * ),
10969 * example={
10970 * "meta": {
10971 * "lastUpdated": "2021-09-14T09:13:51"
10972 * },
10973 * "resourceType": "Bundle",
10974 * "type": "collection",
10975 * "total": 0,
10976 * "link": {
10978 * "relation": "self",
10979 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10985 * ),
10986 * @OA\Response(
10987 * response="400",
10988 * ref="#/components/responses/badrequest"
10989 * ),
10990 * @OA\Response(
10991 * response="401",
10992 * ref="#/components/responses/unauthorized"
10993 * ),
10994 * security={{"openemr_auth":{}}}
10997 "GET /fhir/Patient" => function (HttpRestRequest $request) {
10998 $params = $request->getQueryParams();
10999 if ($request->isPatientRequest()) {
11000 // only allow access to data of binded patient
11001 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11002 // need to use getAll rather than getOne)
11003 $params['_id'] = $request->getPatientUUIDString();
11004 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11005 } else {
11006 RestConfig::authorization_check("patients", "demo");
11007 $return = (new FhirPatientRestController())->getAll($params);
11009 RestConfig::apiLog($return);
11010 return $return;
11014 * @OA\Get(
11015 * path="/fhir/Patient/$export",
11016 * 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>",
11017 * tags={"fhir"},
11018 * @OA\Response(
11019 * response="200",
11020 * 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>"
11021 * ),
11022 * @OA\Response(
11023 * response="400",
11024 * ref="#/components/responses/badrequest"
11025 * ),
11026 * @OA\Response(
11027 * response="401",
11028 * ref="#/components/responses/unauthorized"
11029 * ),
11030 * security={{"openemr_auth":{}}}
11033 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11034 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11035 RestConfig::authorization_check("admin", "users");
11036 $fhirExportService = new FhirOperationExportRestController($request);
11037 $return = $fhirExportService->processExport(
11038 $request->getQueryParams(),
11039 'Patient',
11040 $request->getHeader('Accept'),
11041 $request->getHeader('Prefer')
11043 RestConfig::apiLog($return);
11044 return $return;
11048 * @OA\Get(
11049 * path="/fhir/Patient/{uuid}",
11050 * description="Returns a single Patient resource.",
11051 * tags={"fhir"},
11052 * @OA\Parameter(
11053 * name="uuid",
11054 * in="path",
11055 * description="The uuid for the Patient resource.",
11056 * required=true,
11057 * @OA\Schema(
11058 * type="string"
11060 * ),
11061 * @OA\Response(
11062 * response="200",
11063 * description="Standard Response",
11064 * @OA\MediaType(
11065 * mediaType="application/json",
11066 * @OA\Schema(
11067 * @OA\Property(
11068 * property="json object",
11069 * description="FHIR Json object.",
11070 * type="object"
11071 * ),
11072 * example={
11073 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11074 * "meta": {
11075 * "versionId": "1",
11076 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11077 * },
11078 * "resourceType": "Patient",
11079 * "text": {
11080 * "status": "generated",
11081 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11082 * },
11083 * "extension": {
11085 * "valueCode": "F",
11086 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11087 * },
11089 * "extension": {
11091 * "valueCoding": {
11092 * "system": "urn:oid:2.16.840.1.113883.6.238",
11093 * "code": "1006-6",
11094 * "display": "Abenaki"
11095 * },
11096 * "url": "ombCategory"
11097 * },
11099 * "valueString": "Abenaki",
11100 * "url": "text"
11102 * },
11103 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11104 * },
11106 * "extension": {
11108 * "valueString": "Declined To Specify",
11109 * "url": "text"
11111 * },
11112 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11114 * },
11115 * "identifier": {
11117 * "use": "official",
11118 * "type": {
11119 * "coding": {
11121 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11122 * "code": "PT"
11125 * },
11126 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11127 * "value": "1"
11129 * },
11130 * "active": true,
11131 * "name": {
11133 * "use": "official",
11134 * "family": "Von197",
11135 * "given": {
11136 * "Aurore252"
11139 * },
11140 * "gender": "female",
11141 * "birthDate": "1970-07-03",
11142 * "address": {
11144 * "line": {
11145 * "245 Crona Wall"
11146 * },
11147 * "city": "Boston",
11148 * "state": "Massachusetts",
11149 * "postalCode": "02215",
11150 * "period": {
11151 * "start": "2020-09-21T17:08:03.532+00:00"
11154 * },
11155 * "communication": {
11157 * "language": {
11158 * "coding": {
11160 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11161 * "code": "unknown",
11162 * "display": "Unknown"
11171 * ),
11172 * @OA\Response(
11173 * response="400",
11174 * ref="#/components/responses/badrequest"
11175 * ),
11176 * @OA\Response(
11177 * response="401",
11178 * ref="#/components/responses/unauthorized"
11179 * ),
11180 * @OA\Response(
11181 * response="404",
11182 * ref="#/components/responses/uuidnotfound"
11183 * ),
11184 * security={{"openemr_auth":{}}}
11187 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11188 if ($request->isPatientRequest()) {
11189 // only allow access to data of binded patient
11190 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11191 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11193 $uuid = $request->getPatientUUIDString();
11194 } else {
11195 RestConfig::authorization_check("patients", "demo");
11197 $return = (new FhirPatientRestController())->getOne($uuid);
11198 RestConfig::apiLog($return);
11199 return $return;
11203 * @OA\Get(
11204 * path="/fhir/Person",
11205 * description="Returns a list of Person resources.",
11206 * tags={"fhir"},
11207 * @OA\Parameter(
11208 * name="name",
11209 * in="query",
11210 * description="The name of the Person resource.",
11211 * required=false,
11212 * @OA\Schema(
11213 * type="string"
11215 * ),
11216 * @OA\Parameter(
11217 * name="active",
11218 * in="query",
11219 * description="The active status of the Person resource.",
11220 * required=false,
11221 * @OA\Schema(
11222 * type="string"
11224 * ),
11225 * @OA\Parameter(
11226 * name="address",
11227 * in="query",
11228 * description="The address of the Person resource.",
11229 * required=false,
11230 * @OA\Schema(
11231 * type="string"
11233 * ),
11234 * @OA\Parameter(
11235 * name="address-city",
11236 * in="query",
11237 * description="The address-city of the Person resource.",
11238 * required=false,
11239 * @OA\Schema(
11240 * type="string"
11242 * ),
11243 * @OA\Parameter(
11244 * name="address-postalcode",
11245 * in="query",
11246 * description="The address-postalcode of the Person resource.",
11247 * required=false,
11248 * @OA\Schema(
11249 * type="string"
11251 * ),
11252 * @OA\Parameter(
11253 * name="address-state",
11254 * in="query",
11255 * description="The address-state of the Person resource.",
11256 * required=false,
11257 * @OA\Schema(
11258 * type="string"
11260 * ),
11261 * @OA\Parameter(
11262 * name="email",
11263 * in="query",
11264 * description="The email of the Person resource.",
11265 * required=false,
11266 * @OA\Schema(
11267 * type="string"
11269 * ),
11270 * @OA\Parameter(
11271 * name="family",
11272 * in="query",
11273 * description="The family name of the Person resource.",
11274 * required=false,
11275 * @OA\Schema(
11276 * type="string"
11278 * ),
11279 * @OA\Parameter(
11280 * name="given",
11281 * in="query",
11282 * description="The given name of the Person resource.",
11283 * required=false,
11284 * @OA\Schema(
11285 * type="string"
11287 * ),
11288 * @OA\Parameter(
11289 * name="phone",
11290 * in="query",
11291 * description="The phone number of the Person resource.",
11292 * required=false,
11293 * @OA\Schema(
11294 * type="string"
11296 * ),
11297 * @OA\Parameter(
11298 * name="telecom",
11299 * in="query",
11300 * description="The fax number of the Person resource.",
11301 * required=false,
11302 * @OA\Schema(
11303 * type="string"
11305 * ),
11306 * @OA\Response(
11307 * response="200",
11308 * description="Standard Response",
11309 * @OA\MediaType(
11310 * mediaType="application/json",
11311 * @OA\Schema(
11312 * @OA\Property(
11313 * property="json object",
11314 * description="FHIR Json object.",
11315 * type="object"
11316 * ),
11317 * example={
11318 * "meta": {
11319 * "lastUpdated": "2021-09-14T09:13:51"
11320 * },
11321 * "resourceType": "Bundle",
11322 * "type": "collection",
11323 * "total": 0,
11324 * "link": {
11326 * "relation": "self",
11327 * "url": "https://localhost:9300/apis/default/fhir/Person"
11333 * ),
11334 * @OA\Response(
11335 * response="400",
11336 * ref="#/components/responses/badrequest"
11337 * ),
11338 * @OA\Response(
11339 * response="401",
11340 * ref="#/components/responses/unauthorized"
11341 * ),
11342 * security={{"openemr_auth":{}}}
11345 "GET /fhir/Person" => function (HttpRestRequest $request) {
11346 RestConfig::authorization_check("admin", "users");
11347 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11348 RestConfig::apiLog($return);
11349 return $return;
11353 * @OA\Get(
11354 * path="/fhir/Person/{uuid}",
11355 * description="Returns a single Person resource.",
11356 * tags={"fhir"},
11357 * @OA\Parameter(
11358 * name="uuid",
11359 * in="path",
11360 * description="The uuid for the Person resource.",
11361 * required=true,
11362 * @OA\Schema(
11363 * type="string"
11365 * ),
11366 * @OA\Response(
11367 * response="200",
11368 * description="Standard Response",
11369 * @OA\MediaType(
11370 * mediaType="application/json",
11371 * @OA\Schema(
11372 * @OA\Property(
11373 * property="json object",
11374 * description="FHIR Json object.",
11375 * type="object"
11376 * ),
11377 * example={
11378 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11379 * "meta": {
11380 * "versionId": "1",
11381 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11382 * },
11383 * "resourceType": "Person",
11384 * "text": {
11385 * "status": "generated",
11386 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11387 * },
11388 * "name": {
11390 * "use": "official",
11391 * "family": "Administrator",
11392 * "given": {
11393 * "Administrator",
11394 * "Larry"
11397 * },
11398 * "telecom": {
11400 * "system": "phone",
11401 * "value": "1234567890",
11402 * "use": "home"
11403 * },
11405 * "system": "phone",
11406 * "value": "1234567890",
11407 * "use": "work"
11408 * },
11410 * "system": "phone",
11411 * "value": "1234567890",
11412 * "use": "mobile"
11413 * },
11415 * "system": "email",
11416 * "value": "hey@hey.com",
11417 * "use": "home"
11419 * },
11420 * "address": {
11422 * "line": {
11423 * "123 Lane Street"
11424 * },
11425 * "city": "Bellevue",
11426 * "state": "WA",
11427 * "period": {
11428 * "start": "2021-04-13T08:57:32.146+00:00"
11431 * },
11432 * "active": true
11436 * ),
11437 * @OA\Response(
11438 * response="400",
11439 * ref="#/components/responses/badrequest"
11440 * ),
11441 * @OA\Response(
11442 * response="401",
11443 * ref="#/components/responses/unauthorized"
11444 * ),
11445 * @OA\Response(
11446 * response="404",
11447 * ref="#/components/responses/uuidnotfound"
11448 * ),
11449 * security={{"openemr_auth":{}}}
11452 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11453 RestConfig::authorization_check("admin", "users");
11454 $return = (new FhirPersonRestController())->getOne($uuid);
11455 RestConfig::apiLog($return);
11456 return $return;
11460 * @OA\Get(
11461 * path="/fhir/Practitioner",
11462 * description="Returns a list of Practitioner resources.",
11463 * tags={"fhir"},
11464 * @OA\Parameter(
11465 * name="_id",
11466 * in="query",
11467 * description="The uuid for the Practitioner resource.",
11468 * required=false,
11469 * @OA\Schema(
11470 * type="string"
11472 * ),
11473 * @OA\Parameter(
11474 * name="name",
11475 * in="query",
11476 * description="The name of the Practitioner resource.",
11477 * required=false,
11478 * @OA\Schema(
11479 * type="string"
11481 * ),
11482 * @OA\Parameter(
11483 * name="active",
11484 * in="query",
11485 * description="The active status of the Practitioner resource.",
11486 * required=false,
11487 * @OA\Schema(
11488 * type="string"
11490 * ),
11491 * @OA\Parameter(
11492 * name="address",
11493 * in="query",
11494 * description="The address of the Practitioner resource.",
11495 * required=false,
11496 * @OA\Schema(
11497 * type="string"
11499 * ),
11500 * @OA\Parameter(
11501 * name="address-city",
11502 * in="query",
11503 * description="The address-city of the Practitioner resource.",
11504 * required=false,
11505 * @OA\Schema(
11506 * type="string"
11508 * ),
11509 * @OA\Parameter(
11510 * name="address-postalcode",
11511 * in="query",
11512 * description="The address-postalcode of the Practitioner resource.",
11513 * required=false,
11514 * @OA\Schema(
11515 * type="string"
11517 * ),
11518 * @OA\Parameter(
11519 * name="address-state",
11520 * in="query",
11521 * description="The address-state of the Practitioner resource.",
11522 * required=false,
11523 * @OA\Schema(
11524 * type="string"
11526 * ),
11527 * @OA\Parameter(
11528 * name="email",
11529 * in="query",
11530 * description="The email of the Practitioner resource.",
11531 * required=false,
11532 * @OA\Schema(
11533 * type="string"
11535 * ),
11536 * @OA\Parameter(
11537 * name="family",
11538 * in="query",
11539 * description="The family name of the Practitioner resource.",
11540 * required=false,
11541 * @OA\Schema(
11542 * type="string"
11544 * ),
11545 * @OA\Parameter(
11546 * name="given",
11547 * in="query",
11548 * description="The given name of the Practitioner resource.",
11549 * required=false,
11550 * @OA\Schema(
11551 * type="string"
11553 * ),
11554 * @OA\Parameter(
11555 * name="phone",
11556 * in="query",
11557 * description="The phone number of the Practitioner resource.",
11558 * required=false,
11559 * @OA\Schema(
11560 * type="string"
11562 * ),
11563 * @OA\Parameter(
11564 * name="telecom",
11565 * in="query",
11566 * description="The fax number of the Practitioner resource.",
11567 * required=false,
11568 * @OA\Schema(
11569 * type="string"
11571 * ),
11572 * @OA\Response(
11573 * response="200",
11574 * description="Standard Response",
11575 * @OA\MediaType(
11576 * mediaType="application/json",
11577 * @OA\Schema(
11578 * @OA\Property(
11579 * property="json object",
11580 * description="FHIR Json object.",
11581 * type="object"
11582 * ),
11583 * example={
11584 * "meta": {
11585 * "lastUpdated": "2021-09-14T09:13:51"
11586 * },
11587 * "resourceType": "Bundle",
11588 * "type": "collection",
11589 * "total": 0,
11590 * "link": {
11592 * "relation": "self",
11593 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
11599 * ),
11600 * @OA\Response(
11601 * response="400",
11602 * ref="#/components/responses/badrequest"
11603 * ),
11604 * @OA\Response(
11605 * response="401",
11606 * ref="#/components/responses/unauthorized"
11607 * ),
11608 * security={{"openemr_auth":{}}}
11611 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
11613 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11614 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11615 // I don't believe patients are assigned to a particular practitioner
11616 // should we allow just open api access to admin information? Should we restrict particular pieces
11617 // of data in the practitioner side (phone number, address information) based on a permission set?
11618 if (!$request->isPatientRequest()) {
11619 RestConfig::authorization_check("admin", "users");
11621 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
11622 RestConfig::apiLog($return);
11623 return $return;
11627 * @OA\Get(
11628 * path="/fhir/Practitioner/{uuid}",
11629 * description="Returns a single Practitioner resource.",
11630 * tags={"fhir"},
11631 * @OA\Parameter(
11632 * name="uuid",
11633 * in="path",
11634 * description="The uuid for the Practitioner resource.",
11635 * required=true,
11636 * @OA\Schema(
11637 * type="string"
11639 * ),
11640 * @OA\Response(
11641 * response="200",
11642 * description="Standard Response",
11643 * @OA\MediaType(
11644 * mediaType="application/json",
11645 * @OA\Schema(
11646 * @OA\Property(
11647 * property="json object",
11648 * description="FHIR Json object.",
11649 * type="object"
11650 * ),
11651 * example={
11652 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11653 * "meta": {
11654 * "versionId": "1",
11655 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11656 * },
11657 * "resourceType": "Practitioner",
11658 * "text": {
11659 * "status": "generated",
11660 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11661 * },
11662 * "identifier": {
11664 * "system": "http://hl7.org/fhir/sid/us-npi",
11665 * "value": "11223344554543"
11667 * },
11668 * "active": true,
11669 * "name": {
11671 * "use": "official",
11672 * "family": "Smith",
11673 * "given": {
11674 * "Billy"
11681 * ),
11682 * @OA\Response(
11683 * response="400",
11684 * ref="#/components/responses/badrequest"
11685 * ),
11686 * @OA\Response(
11687 * response="401",
11688 * ref="#/components/responses/unauthorized"
11689 * ),
11690 * @OA\Response(
11691 * response="404",
11692 * ref="#/components/responses/uuidnotfound"
11693 * ),
11694 * security={{"openemr_auth":{}}}
11697 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
11698 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11699 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11700 // I don't believe patients are assigned to a particular practitioner
11701 // should we allow just open api access to admin information? Should we restrict particular pieces
11702 // of data in the practitioner side (phone number, address information) based on a permission set?
11703 if (!$request->isPatientRequest()) {
11704 RestConfig::authorization_check("admin", "users");
11706 $return = (new FhirPractitionerRestController())->getOne($uuid);
11707 RestConfig::apiLog($return);
11708 return $return;
11712 * @OA\Post(
11713 * path="/fhir/Practitioner",
11714 * description="Adds a Practitioner resources.",
11715 * tags={"fhir"},
11716 * @OA\RequestBody(
11717 * required=true,
11718 * @OA\MediaType(
11719 * mediaType="application/json",
11720 * @OA\Schema(
11721 * description="The json object for the Practitioner resource.",
11722 * type="object"
11723 * ),
11724 * example={
11725 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11726 * "meta": {
11727 * "versionId": "1",
11728 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11729 * },
11730 * "resourceType": "Practitioner",
11731 * "text": {
11732 * "status": "generated",
11733 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11734 * },
11735 * "identifier": {
11737 * "system": "http://hl7.org/fhir/sid/us-npi",
11738 * "value": "11223344554543"
11740 * },
11741 * "active": true,
11742 * "name": {
11744 * "use": "official",
11745 * "family": "Smith",
11746 * "given": {
11747 * "Danny"
11753 * ),
11754 * @OA\Response(
11755 * response="200",
11756 * description="Standard Response",
11757 * @OA\MediaType(
11758 * mediaType="application/json",
11759 * @OA\Schema(
11760 * @OA\Property(
11761 * property="json object",
11762 * description="FHIR Json object.",
11763 * type="object"
11764 * ),
11765 * example={
11766 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11767 * "meta": {
11768 * "versionId": "1",
11769 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11770 * },
11771 * "resourceType": "Practitioner",
11772 * "text": {
11773 * "status": "generated",
11774 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11775 * },
11776 * "identifier": {
11778 * "system": "http://hl7.org/fhir/sid/us-npi",
11779 * "value": "11223344554543"
11781 * },
11782 * "active": true,
11783 * "name": {
11785 * "use": "official",
11786 * "family": "Smith",
11787 * "given": {
11788 * "Danny"
11795 * ),
11796 * @OA\Response(
11797 * response="400",
11798 * ref="#/components/responses/badrequest"
11799 * ),
11800 * @OA\Response(
11801 * response="401",
11802 * ref="#/components/responses/unauthorized"
11803 * ),
11804 * security={{"openemr_auth":{}}}
11807 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
11808 RestConfig::authorization_check("admin", "users");
11809 $data = (array) (json_decode(file_get_contents("php://input"), true));
11810 $return = (new FhirPractitionerRestController())->post($data);
11811 RestConfig::apiLog($return, $data);
11812 return $return;
11816 * @OA\Put(
11817 * path="/fhir/Practitioner/{uuid}",
11818 * description="Modify a Practitioner resource.",
11819 * tags={"fhir"},
11820 * @OA\Parameter(
11821 * name="uuid",
11822 * in="path",
11823 * description="The uuid for the Practitioner resource.",
11824 * required=true,
11825 * @OA\Schema(
11826 * type="string"
11828 * ),
11829 * @OA\RequestBody(
11830 * required=true,
11831 * @OA\MediaType(
11832 * mediaType="application/json",
11833 * @OA\Schema(
11834 * description="The json object for the Practitioner resource.",
11835 * type="object"
11836 * ),
11837 * example={
11838 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11839 * "meta": {
11840 * "versionId": "1",
11841 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11842 * },
11843 * "resourceType": "Practitioner",
11844 * "text": {
11845 * "status": "generated",
11846 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11847 * },
11848 * "identifier": {
11850 * "system": "http://hl7.org/fhir/sid/us-npi",
11851 * "value": "11223344554543"
11853 * },
11854 * "active": true,
11855 * "name": {
11857 * "use": "official",
11858 * "family": "Smith",
11859 * "given": {
11860 * "Billy"
11866 * ),
11867 * @OA\Response(
11868 * response="201",
11869 * description="Standard Response",
11870 * @OA\MediaType(
11871 * mediaType="application/json",
11872 * @OA\Schema(
11873 * example={
11874 * "id": 5,
11875 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
11879 * ),
11880 * @OA\Response(
11881 * response="400",
11882 * ref="#/components/responses/badrequest"
11883 * ),
11884 * @OA\Response(
11885 * response="401",
11886 * ref="#/components/responses/unauthorized"
11887 * ),
11888 * security={{"openemr_auth":{}}}
11891 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
11892 RestConfig::authorization_check("admin", "users");
11893 $data = (array) (json_decode(file_get_contents("php://input"), true));
11894 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
11895 RestConfig::apiLog($return, $data);
11896 return $return;
11900 * @OA\Get(
11901 * path="/fhir/PractitionerRole",
11902 * description="Returns a list of PractitionerRole resources.",
11903 * tags={"fhir"},
11904 * @OA\Parameter(
11905 * name="specialty",
11906 * in="query",
11907 * description="The specialty of the PractitionerRole resource.",
11908 * required=false,
11909 * @OA\Schema(
11910 * type="string"
11912 * ),
11913 * @OA\Parameter(
11914 * name="practitioner",
11915 * in="query",
11916 * description="The practitioner of the PractitionerRole resource.",
11917 * required=false,
11918 * @OA\Schema(
11919 * type="string"
11921 * ),
11922 * @OA\Response(
11923 * response="200",
11924 * description="Standard Response",
11925 * @OA\MediaType(
11926 * mediaType="application/json",
11927 * @OA\Schema(
11928 * @OA\Property(
11929 * property="json object",
11930 * description="FHIR Json object.",
11931 * type="object"
11932 * ),
11933 * example={
11934 * "meta": {
11935 * "lastUpdated": "2021-09-14T09:13:51"
11936 * },
11937 * "resourceType": "Bundle",
11938 * "type": "collection",
11939 * "total": 0,
11940 * "link": {
11942 * "relation": "self",
11943 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11949 * ),
11950 * @OA\Response(
11951 * response="400",
11952 * ref="#/components/responses/badrequest"
11953 * ),
11954 * @OA\Response(
11955 * response="401",
11956 * ref="#/components/responses/unauthorized"
11957 * ),
11958 * security={{"openemr_auth":{}}}
11961 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
11962 RestConfig::authorization_check("admin", "users");
11963 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11964 RestConfig::apiLog($return);
11965 return $return;
11969 * @OA\Get(
11970 * path="/fhir/PractitionerRole/{uuid}",
11971 * description="Returns a single PractitionerRole resource.",
11972 * tags={"fhir"},
11973 * @OA\Parameter(
11974 * name="uuid",
11975 * in="path",
11976 * description="The uuid for the PractitionerRole resource.",
11977 * required=true,
11978 * @OA\Schema(
11979 * type="string"
11981 * ),
11982 * @OA\Response(
11983 * response="200",
11984 * description="Standard Response",
11985 * @OA\MediaType(
11986 * mediaType="application/json",
11987 * @OA\Schema(
11988 * @OA\Property(
11989 * property="json object",
11990 * description="FHIR Json object.",
11991 * type="object"
11992 * ),
11993 * example={
11994 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
11995 * "meta": {
11996 * "versionId": "1",
11997 * "lastUpdated": "2022-04-13T06:18:17+00:00"
11998 * },
11999 * "resourceType": "PractitionerRole",
12000 * "practitioner": {
12001 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12002 * "display": "Administrator Administrator"
12003 * },
12004 * "organization": {
12005 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12006 * "display": "Your Clinic Name Here"
12007 * },
12008 * "code": {
12010 * "coding": {
12011 * "102L00000X"
12012 * },
12013 * "text": "Psychoanalyst"
12014 * },
12016 * "coding": {
12017 * "101Y00000X"
12018 * },
12019 * "text": "Counselor"
12025 * ),
12026 * @OA\Response(
12027 * response="400",
12028 * ref="#/components/responses/badrequest"
12029 * ),
12030 * @OA\Response(
12031 * response="401",
12032 * ref="#/components/responses/unauthorized"
12033 * ),
12034 * @OA\Response(
12035 * response="404",
12036 * ref="#/components/responses/uuidnotfound"
12037 * ),
12038 * security={{"openemr_auth":{}}}
12041 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12042 RestConfig::authorization_check("admin", "users");
12043 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12044 RestConfig::apiLog($return);
12045 return $return;
12049 * @OA\Get(
12050 * path="/fhir/Procedure",
12051 * description="Returns a list of Procedure resources.",
12052 * tags={"fhir"},
12053 * @OA\Parameter(
12054 * name="_id",
12055 * in="query",
12056 * description="The uuid for the Procedure resource.",
12057 * required=false,
12058 * @OA\Schema(
12059 * type="string"
12061 * ),
12062 * @OA\Parameter(
12063 * name="patient",
12064 * in="query",
12065 * description="The uuid for the patient.",
12066 * required=false,
12067 * @OA\Schema(
12068 * type="string"
12070 * ),
12071 * @OA\Parameter(
12072 * name="date",
12073 * in="query",
12074 * description="The datetime of the Procedure resource.",
12075 * required=false,
12076 * @OA\Schema(
12077 * type="string"
12079 * ),
12080 * @OA\Response(
12081 * response="200",
12082 * description="Standard Response",
12083 * @OA\MediaType(
12084 * mediaType="application/json",
12085 * @OA\Schema(
12086 * @OA\Property(
12087 * property="json object",
12088 * description="FHIR Json object.",
12089 * type="object"
12090 * ),
12091 * example={
12092 * "meta": {
12093 * "lastUpdated": "2021-09-14T09:13:51"
12094 * },
12095 * "resourceType": "Bundle",
12096 * "type": "collection",
12097 * "total": 0,
12098 * "link": {
12100 * "relation": "self",
12101 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12107 * ),
12108 * @OA\Response(
12109 * response="400",
12110 * ref="#/components/responses/badrequest"
12111 * ),
12112 * @OA\Response(
12113 * response="401",
12114 * ref="#/components/responses/unauthorized"
12115 * ),
12116 * security={{"openemr_auth":{}}}
12119 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12120 if ($request->isPatientRequest()) {
12121 // only allow access to data of binded patient
12122 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12123 } else {
12124 RestConfig::authorization_check("patients", "med");
12125 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12127 RestConfig::apiLog($return);
12128 return $return;
12132 * @OA\Get(
12133 * path="/fhir/Procedure/{uuid}",
12134 * description="Returns a single Procedure resource.",
12135 * tags={"fhir"},
12136 * @OA\Parameter(
12137 * name="uuid",
12138 * in="path",
12139 * description="The uuid for the Procedure resource.",
12140 * required=true,
12141 * @OA\Schema(
12142 * type="string"
12144 * ),
12145 * @OA\Response(
12146 * response="200",
12147 * description="Standard Response",
12148 * @OA\MediaType(
12149 * mediaType="application/json",
12150 * @OA\Schema(
12151 * @OA\Property(
12152 * property="json object",
12153 * description="FHIR Json object.",
12154 * type="object"
12155 * ),
12156 * example={
12157 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12158 * "meta": {
12159 * "versionId": "1",
12160 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12161 * },
12162 * "resourceType": "Procedure",
12163 * "status": "in-progress",
12164 * "subject": {
12165 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12166 * "type": "Patient"
12171 * ),
12172 * @OA\Response(
12173 * response="400",
12174 * ref="#/components/responses/badrequest"
12175 * ),
12176 * @OA\Response(
12177 * response="401",
12178 * ref="#/components/responses/unauthorized"
12179 * ),
12180 * @OA\Response(
12181 * response="404",
12182 * ref="#/components/responses/uuidnotfound"
12183 * ),
12184 * security={{"openemr_auth":{}}}
12187 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12188 if ($request->isPatientRequest()) {
12189 // only allow access to data of binded patient
12190 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12191 } else {
12192 RestConfig::authorization_check("patients", "med");
12193 $return = (new FhirProcedureRestController())->getOne($uuid);
12195 RestConfig::apiLog($return);
12196 return $return;
12200 * @OA\Get(
12201 * path="/fhir/Provenance/{uuid}",
12202 * description="Returns a single Provenance resource.",
12203 * tags={"fhir"},
12204 * @OA\Parameter(
12205 * name="uuid",
12206 * in="path",
12207 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12208 * required=true,
12209 * @OA\Schema(
12210 * type="string"
12212 * ),
12213 * @OA\Response(
12214 * response="200",
12215 * description="Standard Response",
12216 * @OA\MediaType(
12217 * mediaType="application/json",
12218 * @OA\Schema(
12219 * @OA\Property(
12220 * property="json object",
12221 * description="FHIR Json object.",
12222 * type="object"
12223 * ),
12224 * example={
12225 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12226 * "resourceType": "Provenance",
12227 * "target": {
12229 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12230 * "type": "AllergyIntolerance"
12232 * },
12233 * "recorded": "2022-03-26T22:43:30+00:00",
12234 * "agent": {
12236 * "type": {
12237 * "coding": {
12239 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12240 * "code": "author",
12241 * "display": "Author"
12244 * },
12245 * "who": {
12246 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12247 * "type": "Organization"
12248 * },
12249 * "onBehalfOf": {
12250 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12251 * "type": "Organization"
12253 * },
12255 * "type": {
12256 * "coding": {
12258 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12259 * "code": "transmitter",
12260 * "display": "Transmitter"
12264 * },
12265 * "who": {
12266 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12267 * "type": "Organization"
12268 * },
12269 * "onBehalfOf": {
12270 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12271 * "type": "Organization"
12277 * ),
12278 * @OA\Response(
12279 * response="400",
12280 * ref="#/components/responses/badrequest"
12281 * ),
12282 * @OA\Response(
12283 * response="401",
12284 * ref="#/components/responses/unauthorized"
12285 * ),
12286 * @OA\Response(
12287 * response="404",
12288 * ref="#/components/responses/uuidnotfound"
12289 * ),
12290 * security={{"openemr_auth":{}}}
12293 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12294 if ($request->isPatientRequest()) {
12295 // only allow access to data of binded patient
12296 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12297 } else {
12298 RestConfig::authorization_check("admin", "super");
12299 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12301 RestConfig::apiLog($return);
12302 return $return;
12306 * @OA\Get(
12307 * path="/fhir/Provenance",
12308 * description="Returns a list of Provenance resources.",
12309 * tags={"fhir"},
12310 * @OA\Parameter(
12311 * name="_id",
12312 * in="query",
12313 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12314 * required=false,
12315 * @OA\Schema(
12316 * type="string"
12318 * ),
12319 * @OA\Response(
12320 * response="200",
12321 * description="Standard Response",
12322 * @OA\MediaType(
12323 * mediaType="application/json",
12324 * @OA\Schema(
12325 * @OA\Property(
12326 * property="json object",
12327 * description="FHIR Json object.",
12328 * type="object"
12329 * ),
12330 * example={
12331 * "meta": {
12332 * "lastUpdated": "2021-09-14T09:13:51"
12333 * },
12334 * "resourceType": "Bundle",
12335 * "type": "collection",
12336 * "total": 0,
12337 * "link": {
12339 * "relation": "self",
12340 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12346 * ),
12347 * @OA\Response(
12348 * response="400",
12349 * ref="#/components/responses/badrequest"
12350 * ),
12351 * @OA\Response(
12352 * response="401",
12353 * ref="#/components/responses/unauthorized"
12354 * ),
12355 * security={{"openemr_auth":{}}}
12358 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12359 // property to support which is why this endpoint exists.
12360 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12361 if ($request->isPatientRequest()) {
12362 // only allow access to data of binded patient
12363 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12364 } else {
12365 // TODO: it seems like regular users should be able to grab authorship / provenance information
12366 RestConfig::authorization_check("admin", "super");
12367 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12369 RestConfig::apiLog($return);
12370 return $return;
12373 // other endpoints
12376 * @OA\Get(
12377 * path="/fhir/metadata",
12378 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12379 * tags={"fhir"},
12380 * @OA\Response(
12381 * response="200",
12382 * description="Return CapabilityStatement resource of the fhir server"
12386 "GET /fhir/metadata" => function () {
12387 $return = (new FhirMetaDataRestController())->getMetaData();
12388 RestConfig::apiLog($return);
12389 return $return;
12393 * @OA\Get(
12394 * path="/fhir/.well-known/smart-configuration",
12395 * description="Returns smart configuration of the fhir server.",
12396 * tags={"fhir"},
12397 * @OA\Response(
12398 * response="200",
12399 * description="Return smart configuration of the fhir server"
12403 "GET /fhir/.well-known/smart-configuration" => function () {
12404 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12405 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12406 RestConfig::apiLog($return);
12407 return $return;
12410 // FHIR root level operations
12413 * @OA\Get(
12414 * path="/fhir/$export",
12415 * 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>",
12416 * tags={"fhir"},
12417 * @OA\Response(
12418 * response="200",
12419 * 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>"
12420 * ),
12421 * @OA\Response(
12422 * response="400",
12423 * ref="#/components/responses/badrequest"
12424 * ),
12425 * @OA\Response(
12426 * response="401",
12427 * ref="#/components/responses/unauthorized"
12428 * ),
12429 * security={{"openemr_auth":{}}}
12432 'GET /fhir/$export' => function (HttpRestRequest $request) {
12433 RestConfig::authorization_check("admin", "users");
12434 $fhirExportService = new FhirOperationExportRestController($request);
12435 $return = $fhirExportService->processExport(
12436 $request->getQueryParams(),
12437 'System',
12438 $request->getHeader('Accept'),
12439 $request->getHeader('Prefer')
12441 RestConfig::apiLog($return);
12442 return $return;
12445 // these two operations are adopted based on the documentation used in the IBM FHIR Server
12446 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
12447 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
12450 * @OA\Get(
12451 * path="/fhir/$bulkdata-status",
12452 * 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>",
12453 * tags={"fhir"},
12454 * @OA\Response(
12455 * response="200",
12456 * 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>"
12457 * ),
12458 * @OA\Response(
12459 * response="400",
12460 * ref="#/components/responses/badrequest"
12461 * ),
12462 * @OA\Response(
12463 * response="401",
12464 * ref="#/components/responses/unauthorized"
12465 * ),
12466 * security={{"openemr_auth":{}}}
12469 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12470 RestConfig::authorization_check("admin", "users");
12471 $jobUuidString = $request->getQueryParam('job');
12472 // if we were truly async we would return 202 here to say we are in progress with a JSON response
12473 // since OpenEMR data is so small we just return the JSON from the database
12474 $fhirExportService = new FhirOperationExportRestController($request);
12475 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
12476 RestConfig::apiLog($return);
12477 return $return;
12481 * @OA\Delete(
12482 * path="/fhir/$bulkdata-status",
12483 * 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>",
12484 * tags={"fhir"},
12485 * @OA\Response(
12486 * response="200",
12487 * 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>"
12488 * ),
12489 * @OA\Response(
12490 * response="400",
12491 * ref="#/components/responses/badrequest"
12492 * ),
12493 * @OA\Response(
12494 * response="401",
12495 * ref="#/components/responses/unauthorized"
12496 * ),
12497 * security={{"openemr_auth":{}}}
12500 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12501 RestConfig::authorization_check("admin", "users");
12502 $job = $request->getQueryParam('job');
12503 $fhirExportService = new FhirOperationExportRestController($request);
12504 $return = $fhirExportService->processDeleteExportForJob($job);
12505 RestConfig::apiLog($return);
12506 return $return;
12510 // Note that the portal (api) route is only for patient role
12511 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
12512 RestConfig::$PORTAL_ROUTE_MAP = array(
12514 * @OA\Get(
12515 * path="/portal/patient",
12516 * description="Returns the patient.",
12517 * tags={"standard-patient"},
12518 * @OA\Response(
12519 * response="200",
12520 * description="Standard response",
12521 * @OA\MediaType(
12522 * mediaType="application/json",
12523 * @OA\Schema(ref="#/components/schemas/api_patient_response")
12525 * ),
12526 * @OA\Response(
12527 * response="401",
12528 * ref="#/components/responses/unauthorized"
12529 * ),
12530 * security={{"openemr_auth":{}}}
12533 "GET /portal/patient" => function (HttpRestRequest $request) {
12534 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
12535 RestConfig::apiLog($return);
12536 return $return;
12540 * @OA\Get(
12541 * path="/portal/patient/encounter",
12542 * description="Returns encounters for the patient.",
12543 * tags={"standard-patient"},
12544 * @OA\Response(
12545 * response="200",
12546 * ref="#/components/responses/standard"
12547 * ),
12548 * @OA\Response(
12549 * response="400",
12550 * ref="#/components/responses/badrequest"
12551 * ),
12552 * @OA\Response(
12553 * response="401",
12554 * ref="#/components/responses/unauthorized"
12555 * ),
12556 * security={{"openemr_auth":{}}}
12559 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
12560 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
12561 RestConfig::apiLog($return);
12562 return $return;
12566 * @OA\Get(
12567 * path="/portal/patient/encounter/{euuid}",
12568 * description="Returns a selected encounter by its uuid.",
12569 * tags={"standard-patient"},
12570 * @OA\Parameter(
12571 * name="euuid",
12572 * in="path",
12573 * description="The uuid for the encounter.",
12574 * required=true,
12575 * @OA\Schema(
12576 * type="string"
12578 * ),
12579 * @OA\Response(
12580 * response="200",
12581 * ref="#/components/responses/standard"
12582 * ),
12583 * @OA\Response(
12584 * response="400",
12585 * ref="#/components/responses/badrequest"
12586 * ),
12587 * @OA\Response(
12588 * response="401",
12589 * ref="#/components/responses/unauthorized"
12590 * ),
12591 * security={{"openemr_auth":{}}}
12594 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
12595 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
12596 RestConfig::apiLog($return);
12597 return $return;