feat: Improved spacing of additional code buttons on fee sheet (#6790)
[openemr.git] / _rest_routes.inc.php
blobd22bb88df0b936869393b013a7b408dbf1f4d337
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/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
38 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
39 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
40 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
41 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
42 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
43 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
44 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
46 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
47 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
48 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
49 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
50 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
51 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
52 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
53 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
54 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
55 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
56 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
57 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
58 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
59 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
60 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
61 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
62 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
63 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
64 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
65 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
66 * "system/Device.read": "Read all device resources in the system (api:fhir)",
67 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
68 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
69 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
70 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
71 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
72 * "system/Group.read": "Read all group resources in the system (api:fhir)",
73 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
74 * "system/Location.read": "Read all location resources in the system (api:fhir)",
75 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
76 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
77 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
78 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
79 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
80 * "system/Person.read": "Read all person resources in the system (api:fhir)",
81 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
82 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
83 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
84 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
85 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
86 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
87 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
88 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
89 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
90 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
91 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
92 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
93 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
94 * "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)",
95 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
96 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
97 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
98 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
99 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
100 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
101 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
102 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
103 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
104 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
105 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
106 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
107 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
108 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
109 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
110 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
111 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
112 * "api:oemr": "Standard OpenEMR API",
113 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
114 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
115 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
116 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
117 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
118 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
119 * "user/document.read": "Read documents the user has access to (api:oemr)",
120 * "user/document.write": "Write documents the user has access to (api:oemr)",
121 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
122 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
123 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
124 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
125 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
126 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
127 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
128 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
129 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
130 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
131 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
132 * "user/list.read": "Read lists the user has access to (api:oemr)",
133 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
134 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
135 * "user/medication.read": "Read medications the user has access to (api:oemr)",
136 * "user/medication.write": "Write medications the user has access to (api:oemr)",
137 * "user/message.write": "Read messages the user has access to (api:oemr)",
138 * "user/patient.read": "Read patients the user has access to (api:oemr)",
139 * "user/patient.write": "Write patients the user has access to (api:oemr)",
140 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
141 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
142 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
143 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
144 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
145 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
146 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
147 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
148 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
149 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
150 * "user/user.read": "Read users the current user has access to (api:oemr)",
151 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
152 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
153 * "api:port": "Standard Patient Portal OpenEMR API",
154 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
155 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
156 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
160 * @OA\Tag(
161 * name="fhir",
162 * description="FHIR R4 API"
164 * @OA\Tag(
165 * name="standard",
166 * description="Standard OpenEMR API"
168 * @OA\Tag(
169 * name="standard-patient",
170 * description="Standard Patient Portal OpenEMR API"
172 * @OA\Response(
173 * response="standard",
174 * description="Standard Response",
175 * @OA\MediaType(
176 * mediaType="application/json",
177 * @OA\Schema(
178 * @OA\Property(
179 * property="validationErrors",
180 * description="Validation errors.",
181 * type="array",
182 * @OA\Items(
183 * type="object",
184 * ),
185 * ),
186 * @OA\Property(
187 * property="internalErrors",
188 * description="Internal errors.",
189 * type="array",
190 * @OA\Items(
191 * type="object",
192 * ),
193 * ),
194 * @OA\Property(
195 * property="data",
196 * description="Returned data.",
197 * type="array",
198 * @OA\Items(
199 * type="object",
200 * ),
201 * ),
202 * example={
203 * "validationErrors": {},
204 * "error_description": {},
205 * "data": {}
210 * @OA\Response(
211 * response="badrequest",
212 * description="Bad Request",
213 * @OA\MediaType(
214 * mediaType="application/json",
215 * @OA\Schema(
216 * @OA\Property(
217 * property="validationErrors",
218 * description="Validation errors.",
219 * type="object"
220 * ),
221 * example={
222 * "validationErrors":
224 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
230 * @OA\Response(
231 * response="unauthorized",
232 * description="Unauthorized",
233 * @OA\MediaType(
234 * mediaType="application/json",
235 * @OA\Schema(
236 * @OA\Property(
237 * property="error",
238 * description="The error.",
239 * type="string"
240 * ),
241 * @OA\Property(
242 * property="error_description",
243 * description="The description of the error.",
244 * type="string"
245 * ),
246 * @OA\Property(
247 * property="hint",
248 * description="More specific information on the error.",
249 * type="string"
250 * ),
251 * @OA\Property(
252 * property="message",
253 * description="Message regarding the error.",
254 * type="string"
255 * ),
256 * example={
257 * "error": "access_denied",
258 * "error_description": "The resource owner or authorization server denied the request.",
259 * "hint": "Missing ""Authorization"" header",
260 * "message": "The resource owner or authorization server denied the request."
265 * @OA\Response(
266 * response="uuidnotfound",
267 * description="Not Found",
268 * @OA\MediaType(
269 * mediaType="application/json",
270 * @OA\Schema(
271 * @OA\Property(
272 * property="empty",
273 * description="empty",
274 * type="object"
275 * ),
276 * example={}
282 // Lets keep our controller classes with the routes.
284 use OpenEMR\Common\Acl\AccessDeniedException;
285 use OpenEMR\Common\Http\HttpRestRequest;
286 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
287 use OpenEMR\RestControllers\FacilityRestController;
288 use OpenEMR\RestControllers\VersionRestController;
289 use OpenEMR\RestControllers\ProductRegistrationRestController;
290 use OpenEMR\RestControllers\PatientRestController;
291 use OpenEMR\RestControllers\EncounterRestController;
292 use OpenEMR\RestControllers\PractitionerRestController;
293 use OpenEMR\RestControllers\ListRestController;
294 use OpenEMR\RestControllers\InsuranceCompanyRestController;
295 use OpenEMR\RestControllers\AppointmentRestController;
296 use OpenEMR\RestControllers\ConditionRestController;
297 use OpenEMR\RestControllers\ONoteRestController;
298 use OpenEMR\RestControllers\DocumentRestController;
299 use OpenEMR\RestControllers\DrugRestController;
300 use OpenEMR\RestControllers\ImmunizationRestController;
301 use OpenEMR\RestControllers\InsuranceRestController;
302 use OpenEMR\RestControllers\MessageRestController;
303 use OpenEMR\RestControllers\PrescriptionRestController;
304 use OpenEMR\RestControllers\ProcedureRestController;
305 use OpenEMR\RestControllers\TransactionRestController;
306 use OpenEMR\RestControllers\UserRestController;
308 // Note some Http clients may not send auth as json so a function
309 // is implemented to determine and parse encoding on auth route's.
311 // Note that the api route is only for users role
312 // (there is a mechanism in place to ensure only user role can access the api route)
313 RestConfig::$ROUTE_MAP = array(
315 * @OA\Get(
316 * path="/api/facility",
317 * description="Returns a single facility.",
318 * tags={"standard"},
319 * @OA\Parameter(
320 * name="name",
321 * in="query",
322 * description="The name for the facility.",
323 * required=false,
324 * @OA\Schema(
325 * type="string"
327 * ),
328 * @OA\Parameter(
329 * name="facility_npi",
330 * in="query",
331 * description="The facility_npi for the facility.",
332 * required=false,
333 * @OA\Schema(
334 * type="string"
336 * ),
337 * @OA\Parameter(
338 * name="phone",
339 * in="query",
340 * description="The phone for the facility.",
341 * required=false,
342 * @OA\Schema(
343 * type="string"
345 * ),
346 * @OA\Parameter(
347 * name="fax",
348 * in="query",
349 * description="The fax for the facility.",
350 * required=false,
351 * @OA\Schema(
352 * type="string"
354 * ),
355 * @OA\Parameter(
356 * name="street",
357 * in="query",
358 * description="The street for the facility.",
359 * required=false,
360 * @OA\Schema(
361 * type="string"
363 * ),
364 * @OA\Parameter(
365 * name="city",
366 * in="query",
367 * description="The city for the facility.",
368 * required=false,
369 * @OA\Schema(
370 * type="string"
372 * ),
373 * @OA\Parameter(
374 * name="state",
375 * in="query",
376 * description="The state for the facility.",
377 * required=false,
378 * @OA\Schema(
379 * type="string"
381 * ),
382 * @OA\Parameter(
383 * name="postal_code",
384 * in="query",
385 * description="The postal_code for the facility.",
386 * required=false,
387 * @OA\Schema(
388 * type="string"
390 * ),
391 * @OA\Parameter(
392 * name="country_code",
393 * in="query",
394 * description="The country_code for the facility.",
395 * required=false,
396 * @OA\Schema(
397 * type="string"
399 * ),
400 * @OA\Parameter(
401 * name="federal_ein",
402 * in="query",
403 * description="The federal_ein for the facility.",
404 * required=false,
405 * @OA\Schema(
406 * type="string"
408 * ),
409 * @OA\Parameter(
410 * name="website",
411 * in="query",
412 * description="The website for the facility.",
413 * required=false,
414 * @OA\Schema(
415 * type="string"
417 * ),
418 * @OA\Parameter(
419 * name="email",
420 * in="query",
421 * description="The email for the facility.",
422 * required=false,
423 * @OA\Schema(
424 * type="string"
426 * ),
427 * @OA\Parameter(
428 * name="domain_identifier",
429 * in="query",
430 * description="The domain_identifier for the facility.",
431 * required=false,
432 * @OA\Schema(
433 * type="string"
435 * ),
436 * @OA\Parameter(
437 * name="facility_taxonomy",
438 * in="query",
439 * description="The facility_taxonomy for the facility.",
440 * required=false,
441 * @OA\Schema(
442 * type="string"
444 * ),
445 * @OA\Parameter(
446 * name="facility_code",
447 * in="query",
448 * description="The facility_code for the facility.",
449 * required=false,
450 * @OA\Schema(
451 * type="string"
453 * ),
454 * @OA\Parameter(
455 * name="billing_location",
456 * in="query",
457 * description="The billing_location setting for the facility.",
458 * required=false,
459 * @OA\Schema(
460 * type="string"
462 * ),
463 * @OA\Parameter(
464 * name="accepts_assignment",
465 * in="query",
466 * description="The accepts_assignment setting for the facility.",
467 * required=false,
468 * @OA\Schema(
469 * type="string"
471 * ),
472 * @OA\Parameter(
473 * name="oid",
474 * in="query",
475 * description="The oid for the facility.",
476 * required=false,
477 * @OA\Schema(
478 * type="string"
480 * ),
481 * @OA\Parameter(
482 * name="service_location",
483 * in="query",
484 * description="The service_location setting for the facility.",
485 * required=false,
486 * @OA\Schema(
487 * type="string"
489 * ),
490 * @OA\Response(
491 * response="200",
492 * ref="#/components/responses/standard"
493 * ),
494 * @OA\Response(
495 * response="400",
496 * ref="#/components/responses/badrequest"
497 * ),
498 * @OA\Response(
499 * response="401",
500 * ref="#/components/responses/unauthorized"
501 * ),
502 * security={{"openemr_auth":{}}}
505 "GET /api/facility" => function () {
506 RestConfig::authorization_check("admin", "users");
507 $return = (new FacilityRestController())->getAll($_GET);
508 RestConfig::apiLog($return);
509 return $return;
513 * @OA\Get(
514 * path="/api/facility/{fuuid}",
515 * description="Returns a single facility.",
516 * tags={"standard"},
517 * @OA\Parameter(
518 * name="fuuid",
519 * in="path",
520 * description="The uuid for the facility.",
521 * required=true,
522 * @OA\Schema(
523 * type="string"
525 * ),
526 * @OA\Response(
527 * response="200",
528 * ref="#/components/responses/standard"
529 * ),
530 * @OA\Response(
531 * response="400",
532 * ref="#/components/responses/badrequest"
533 * ),
534 * @OA\Response(
535 * response="401",
536 * ref="#/components/responses/unauthorized"
537 * ),
538 * security={{"openemr_auth":{}}}
541 "GET /api/facility/:fuuid" => function ($fuuid) {
542 RestConfig::authorization_check("admin", "users");
543 $return = (new FacilityRestController())->getOne($fuuid);
544 RestConfig::apiLog($return);
545 return $return;
549 * @OA\Post(
550 * path="/api/facility",
551 * description="Creates a facility in the system",
552 * tags={"standard"},
553 * @OA\RequestBody(
554 * required=true,
555 * @OA\MediaType(
556 * mediaType="application/json",
557 * @OA\Schema(
558 * @OA\Property(
559 * property="name",
560 * description="The name for the facility.",
561 * type="string"
562 * ),
563 * @OA\Property(
564 * property="facility_npi",
565 * description="The facility_npi for the facility.",
566 * type="string"
567 * ),
568 * @OA\Property(
569 * property="phone",
570 * description="The phone for the facility.",
571 * type="string"
572 * ),
573 * @OA\Property(
574 * property="fax",
575 * description="The fax for the facility.",
576 * type="string"
577 * ),
578 * @OA\Property(
579 * property="street",
580 * description="The street for the facility.",
581 * type="string"
582 * ),
583 * @OA\Property(
584 * property="city",
585 * description="The city for the facility.",
586 * type="string"
587 * ),
588 * @OA\Property(
589 * property="state",
590 * description="The state for the facility.",
591 * type="string"
592 * ),
593 * @OA\Property(
594 * property="postal_code",
595 * description="The postal_code for the facility.",
596 * type="string"
597 * ),
598 * @OA\Property(
599 * property="country_code",
600 * description="The country_code for the facility.",
601 * type="string"
602 * ),
603 * @OA\Property(
604 * property="federal_ein",
605 * description="The federal_ein for the facility.",
606 * type="string"
607 * ),
608 * @OA\Property(
609 * property="website",
610 * description="The website for the facility.",
611 * type="string"
612 * ),
613 * @OA\Property(
614 * property="email",
615 * description="The email for the facility.",
616 * type="string"
617 * ),
618 * @OA\Property(
619 * property="domain_identifier",
620 * description="The domain_identifier for the facility.",
621 * type="string"
622 * ),
623 * @OA\Property(
624 * property="facility_taxonomy",
625 * description="The facility_taxonomy for the facility.",
626 * type="string"
627 * ),
628 * @OA\Property(
629 * property="facility_code",
630 * description="The facility_code for the facility.",
631 * type="string"
632 * ),
633 * @OA\Property(
634 * property="billing_location",
635 * description="The billing_location setting for the facility.",
636 * type="string"
637 * ),
638 * @OA\Property(
639 * property="accepts_assignment",
640 * description="The accepts_assignment setting for the facility.",
641 * type="string"
642 * ),
643 * @OA\Property(
644 * property="oid",
645 * description="The oid for the facility.",
646 * type="string"
647 * ),
648 * @OA\Property(
649 * property="service_location",
650 * description="The service_location setting for the facility.",
651 * type="string"
652 * ),
653 * required={"name", "facility_npi"},
654 * example={
655 * "name": "Aquaria",
656 * "facility_npi": "123456789123",
657 * "phone": "808-606-3030",
658 * "fax": "808-606-3031",
659 * "street": "1337 Bit Shifter Ln",
660 * "city": "San Lorenzo",
661 * "state": "ZZ",
662 * "postal_code": "54321",
663 * "country_code": "US",
664 * "federal_ein": "4343434",
665 * "website": "https://example.com",
666 * "email": "foo@bar.com",
667 * "domain_identifier": "",
668 * "facility_taxonomy": "",
669 * "facility_code": "",
670 * "billing_location": "1",
671 * "accepts_assignment": "1",
672 * "oid": "",
673 * "service_location": "1"
677 * ),
678 * @OA\Response(
679 * response="200",
680 * ref="#/components/responses/standard"
681 * ),
682 * @OA\Response(
683 * response="400",
684 * ref="#/components/responses/badrequest"
685 * ),
686 * @OA\Response(
687 * response="401",
688 * ref="#/components/responses/unauthorized"
689 * ),
690 * security={{"openemr_auth":{}}}
693 "POST /api/facility" => function () {
694 RestConfig::authorization_check("admin", "super");
695 $data = (array) (json_decode(file_get_contents("php://input")));
696 $return = (new FacilityRestController())->post($data);
697 RestConfig::apiLog($return, $data);
698 return $return;
702 * @OA\Put(
703 * path="/api/facility/{fuuid}",
704 * description="Updates a facility in the system",
705 * tags={"standard"},
706 * @OA\Parameter(
707 * name="fuuid",
708 * in="path",
709 * description="The uuid for the facility.",
710 * required=true,
711 * @OA\Schema(
712 * type="string"
714 * ),
715 * @OA\RequestBody(
716 * required=true,
717 * @OA\MediaType(
718 * mediaType="application/json",
719 * @OA\Schema(
720 * @OA\Property(
721 * property="name",
722 * description="The name for the facility.",
723 * type="string"
724 * ),
725 * @OA\Property(
726 * property="facility_npi",
727 * description="The facility_npi for the facility.",
728 * type="string"
729 * ),
730 * @OA\Property(
731 * property="phone",
732 * description="The phone for the facility.",
733 * type="string"
734 * ),
735 * @OA\Property(
736 * property="fax",
737 * description="The fax for the facility.",
738 * type="string"
739 * ),
740 * @OA\Property(
741 * property="street",
742 * description="The street for the facility.",
743 * type="string"
744 * ),
745 * @OA\Property(
746 * property="city",
747 * description="The city for the facility.",
748 * type="string"
749 * ),
750 * @OA\Property(
751 * property="state",
752 * description="The state for the facility.",
753 * type="string"
754 * ),
755 * @OA\Property(
756 * property="postal_code",
757 * description="The postal_code for the facility.",
758 * type="string"
759 * ),
760 * @OA\Property(
761 * property="country_code",
762 * description="The country_code for the facility.",
763 * type="string"
764 * ),
765 * @OA\Property(
766 * property="federal_ein",
767 * description="The federal_ein for the facility.",
768 * type="string"
769 * ),
770 * @OA\Property(
771 * property="website",
772 * description="The website for the facility.",
773 * type="string"
774 * ),
775 * @OA\Property(
776 * property="email",
777 * description="The email for the facility.",
778 * type="string"
779 * ),
780 * @OA\Property(
781 * property="domain_identifier",
782 * description="The domain_identifier for the facility.",
783 * type="string"
784 * ),
785 * @OA\Property(
786 * property="facility_taxonomy",
787 * description="The facility_taxonomy for the facility.",
788 * type="string"
789 * ),
790 * @OA\Property(
791 * property="facility_code",
792 * description="The facility_code for the facility.",
793 * type="string"
794 * ),
795 * @OA\Property(
796 * property="billing_location",
797 * description="The billing_location setting for the facility.",
798 * type="string"
799 * ),
800 * @OA\Property(
801 * property="accepts_assignment",
802 * description="The accepts_assignment setting for the facility.",
803 * type="string"
804 * ),
805 * @OA\Property(
806 * property="oid",
807 * description="The oid for the facility.",
808 * type="string"
809 * ),
810 * @OA\Property(
811 * property="service_location",
812 * description="The service_location setting for the facility.",
813 * type="string"
814 * ),
815 * example={
816 * "name": "Aquaria",
817 * "facility_npi": "123456789123",
818 * "phone": "808-606-3030",
819 * "fax": "808-606-3031",
820 * "street": "1337 Bit Shifter Ln",
821 * "city": "San Lorenzo",
822 * "state": "ZZ",
823 * "postal_code": "54321",
824 * "country_code": "US",
825 * "federal_ein": "4343434",
826 * "website": "https://example.com",
827 * "email": "foo@bar.com",
828 * "domain_identifier": "",
829 * "facility_taxonomy": "",
830 * "facility_code": "",
831 * "billing_location": "1",
832 * "accepts_assignment": "1",
833 * "oid": "",
834 * "service_location": "1"
838 * ),
839 * @OA\Response(
840 * response="200",
841 * ref="#/components/responses/standard"
842 * ),
843 * @OA\Response(
844 * response="400",
845 * ref="#/components/responses/badrequest"
846 * ),
847 * @OA\Response(
848 * response="401",
849 * ref="#/components/responses/unauthorized"
850 * ),
851 * security={{"openemr_auth":{}}}
854 "PUT /api/facility/:fuuid" => function ($fuuid) {
855 RestConfig::authorization_check("admin", "super");
856 $data = (array) (json_decode(file_get_contents("php://input")));
857 $return = (new FacilityRestController())->patch($fuuid, $data);
858 RestConfig::apiLog($return, $data);
859 return $return;
863 * @OA\Get(
864 * path="/api/patient",
865 * description="Retrieves a list of patients",
866 * tags={"standard"},
867 * @OA\Parameter(
868 * name="fname",
869 * in="query",
870 * description="The first name for the patient.",
871 * required=false,
872 * @OA\Schema(
873 * type="string"
875 * ),
876 * @OA\Parameter(
877 * name="lname",
878 * in="query",
879 * description="The last name for the patient.",
880 * required=false,
881 * @OA\Schema(
882 * type="string"
884 * ),
885 * @OA\Parameter(
886 * name="ss",
887 * in="query",
888 * description="The social security number for the patient.",
889 * required=false,
890 * @OA\Schema(
891 * type="string"
893 * ),
894 * @OA\Parameter(
895 * name="street",
896 * in="query",
897 * description="The street for the patient.",
898 * required=false,
899 * @OA\Schema(
900 * type="string"
902 * ),
903 * @OA\Parameter(
904 * name="postal_code",
905 * in="query",
906 * description="The postal code for the patient.",
907 * required=false,
908 * @OA\Schema(
909 * type="string"
911 * ),
912 * @OA\Parameter(
913 * name="city",
914 * in="query",
915 * description="The city for the patient.",
916 * required=false,
917 * @OA\Schema(
918 * type="string"
920 * ),
921 * @OA\Parameter(
922 * name="state",
923 * in="query",
924 * description="The state for the patient.",
925 * required=false,
926 * @OA\Schema(
927 * type="string"
929 * ),
930 * @OA\Parameter(
931 * name="phone_home",
932 * in="query",
933 * description="The home phone for the patient.",
934 * required=false,
935 * @OA\Schema(
936 * type="string"
938 * ),
939 * @OA\Parameter(
940 * name="phone_biz",
941 * in="query",
942 * description="The business phone for the patient.",
943 * required=false,
944 * @OA\Schema(
945 * type="string"
947 * ),
948 * @OA\Parameter(
949 * name="phone_cell",
950 * in="query",
951 * description="The cell phone for the patient.",
952 * required=false,
953 * @OA\Schema(
954 * type="string"
956 * ),
957 * @OA\Parameter(
958 * name="postal_contact",
959 * in="query",
960 * description="The postal_contact for the patient.",
961 * required=false,
962 * @OA\Schema(
963 * type="string"
965 * ),
966 * @OA\Parameter(
967 * name="sex",
968 * in="query",
969 * description="The gender for the patient.",
970 * required=false,
971 * @OA\Schema(
972 * type="string"
974 * ),
975 * @OA\Parameter(
976 * name="country_code",
977 * in="query",
978 * description="The country code for the patient.",
979 * required=false,
980 * @OA\Schema(
981 * type="string"
983 * ),
984 * @OA\Parameter(
985 * name="email",
986 * in="query",
987 * description="The email for the patient.",
988 * required=false,
989 * @OA\Schema(
990 * type="string"
992 * ),
993 * @OA\Parameter(
994 * name="DOB",
995 * in="query",
996 * description="The DOB for the patient.",
997 * required=false,
998 * @OA\Schema(
999 * type="string"
1001 * ),
1002 * @OA\Response(
1003 * response="200",
1004 * ref="#/components/responses/standard"
1005 * ),
1006 * @OA\Response(
1007 * response="400",
1008 * ref="#/components/responses/badrequest"
1009 * ),
1010 * @OA\Response(
1011 * response="401",
1012 * ref="#/components/responses/unauthorized"
1013 * ),
1014 * security={{"openemr_auth":{}}}
1017 "GET /api/patient" => function () {
1018 RestConfig::authorization_check("patients", "demo");
1019 $return = (new PatientRestController())->getAll($_GET);
1020 RestConfig::apiLog($return);
1021 return $return;
1025 * Schema for the patient request
1027 * @OA\Schema(
1028 * schema="api_patient_request",
1029 * @OA\Property(
1030 * property="title",
1031 * description="The title of patient.",
1032 * type="string"
1033 * ),
1034 * @OA\Property(
1035 * property="fname",
1036 * description="The fname of patient.",
1037 * type="string"
1038 * ),
1039 * @OA\Property(
1040 * property="mname",
1041 * description="The mname of patient.",
1042 * type="string"
1043 * ),
1044 * @OA\Property(
1045 * property="lname",
1046 * description="The lname of patient.",
1047 * type="string"
1048 * ),
1049 * @OA\Property(
1050 * property="street",
1051 * description="The street address of patient.",
1052 * type="string"
1053 * ),
1054 * @OA\Property(
1055 * property="postal_code",
1056 * description="The postal code of patient.",
1057 * type="string"
1058 * ),
1059 * @OA\Property(
1060 * property="city",
1061 * description="The city of patient.",
1062 * type="string"
1063 * ),
1064 * @OA\Property(
1065 * property="state",
1066 * description="The state of patient.",
1067 * type="string"
1068 * ),
1069 * @OA\Property(
1070 * property="country_code",
1071 * description="The country code of patient.",
1072 * type="string"
1073 * ),
1074 * @OA\Property(
1075 * property="phone_contact",
1076 * description="The phone contact of patient.",
1077 * type="string"
1078 * ),
1079 * @OA\Property(
1080 * property="DOB",
1081 * description="The DOB of patient.",
1082 * type="string"
1083 * ),
1084 * @OA\Property(
1085 * property="sex",
1086 * description="The lname of patient.",
1087 * type="string"
1088 * ),
1089 * @OA\Property(
1090 * property="race",
1091 * description="The race of patient.",
1092 * type="string"
1093 * ),
1094 * @OA\Property(
1095 * property="ethnicity",
1096 * description="The ethnicity of patient.",
1097 * type="string"
1098 * ),
1099 * required={"fname", "lname", "DOB", "sex"},
1100 * example={
1101 * "title": "Mr",
1102 * "fname": "Foo",
1103 * "mname": "",
1104 * "lname": "Bar",
1105 * "street": "456 Tree Lane",
1106 * "postal_code": "08642",
1107 * "city": "FooTown",
1108 * "state": "FL",
1109 * "country_code": "US",
1110 * "phone_contact": "123-456-7890",
1111 * "DOB": "1992-02-02",
1112 * "sex": "Male",
1113 * "race": "",
1114 * "ethnicity": ""
1119 * @OA\Post(
1120 * path="/api/patient",
1121 * description="Creates a new patient",
1122 * tags={"standard"},
1123 * @OA\RequestBody(
1124 * required=true,
1125 * @OA\MediaType(
1126 * mediaType="application/json",
1127 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1129 * ),
1130 * @OA\Response(
1131 * response="200",
1132 * description="Standard response",
1133 * @OA\MediaType(
1134 * mediaType="application/json",
1135 * @OA\Schema(
1136 * @OA\Property(
1137 * property="validationErrors",
1138 * description="Validation errors.",
1139 * type="array",
1140 * @OA\Items(
1141 * type="object",
1142 * ),
1143 * ),
1144 * @OA\Property(
1145 * property="internalErrors",
1146 * description="Internal errors.",
1147 * type="array",
1148 * @OA\Items(
1149 * type="object",
1150 * ),
1151 * ),
1152 * @OA\Property(
1153 * property="data",
1154 * description="Returned data.",
1155 * type="array",
1156 * @OA\Items(
1157 * @OA\Property(
1158 * property="pid",
1159 * description="patient pid",
1160 * type="integer",
1162 * ),
1163 * ),
1164 * example={
1165 * "validationErrors": {},
1166 * "error_description": {},
1167 * "data": {
1168 * "pid": 1
1173 * ),
1174 * @OA\Response(
1175 * response="401",
1176 * ref="#/components/responses/unauthorized"
1177 * ),
1178 * security={{"openemr_auth":{}}}
1181 "POST /api/patient" => function () {
1182 RestConfig::authorization_check("patients", "demo");
1183 $data = (array) (json_decode(file_get_contents("php://input")));
1184 $return = (new PatientRestController())->post($data);
1185 RestConfig::apiLog($return, $data);
1186 return $return;
1190 * Schema for the patient response
1192 * @OA\Schema(
1193 * schema="api_patient_response",
1194 * @OA\Property(
1195 * property="validationErrors",
1196 * description="Validation errors.",
1197 * type="array",
1198 * @OA\Items(
1199 * type="object",
1200 * ),
1201 * ),
1202 * @OA\Property(
1203 * property="internalErrors",
1204 * description="Internal errors.",
1205 * type="array",
1206 * @OA\Items(
1207 * type="object",
1208 * ),
1209 * ),
1210 * @OA\Property(
1211 * property="data",
1212 * description="Returned data.",
1213 * type="array",
1214 * @OA\Items(
1215 * @OA\Property(
1216 * property="id",
1217 * description="patient id",
1218 * type="string",
1219 * ),
1220 * @OA\Property(
1221 * property="pid",
1222 * description="patient pid",
1223 * type="string",
1224 * ),
1225 * @OA\Property(
1226 * property="pubpid",
1227 * description="patient public id",
1228 * type="string",
1229 * ),
1230 * @OA\Property(
1231 * property="title",
1232 * description="patient title",
1233 * type="string",
1234 * ),
1235 * @OA\Property(
1236 * property="fname",
1237 * description="patient first name",
1238 * type="string",
1239 * ),
1240 * @OA\Property(
1241 * property="mname",
1242 * description="patient middle name",
1243 * type="string",
1244 * ),
1245 * @OA\Property(
1246 * property="lname",
1247 * description="patient last name",
1248 * type="string",
1249 * ),
1250 * @OA\Property(
1251 * property="ss",
1252 * description="patient social security number",
1253 * type="string",
1254 * ),
1255 * @OA\Property(
1256 * property="street",
1257 * description="patient street address",
1258 * type="string",
1259 * ),
1260 * @OA\Property(
1261 * property="postal_code",
1262 * description="patient postal code",
1263 * type="string",
1264 * ),
1265 * @OA\Property(
1266 * property="city",
1267 * description="patient city",
1268 * type="string",
1269 * ),
1270 * @OA\Property(
1271 * property="state",
1272 * description="patient state",
1273 * type="string",
1274 * ),
1275 * @OA\Property(
1276 * property="county",
1277 * description="patient county",
1278 * type="string",
1279 * ),
1280 * @OA\Property(
1281 * property="country_code",
1282 * description="patient country code",
1283 * type="string",
1284 * ),
1285 * @OA\Property(
1286 * property="drivers_license",
1287 * description="patient drivers license id",
1288 * type="string",
1289 * ),
1290 * @OA\Property(
1291 * property="contact_relationship",
1292 * description="patient contact relationship",
1293 * type="string",
1294 * ),
1295 * @OA\Property(
1296 * property="phone_contact",
1297 * description="patient phone contact",
1298 * type="string",
1299 * ),
1300 * @OA\Property(
1301 * property="phone_home",
1302 * description="patient home phone",
1303 * type="string",
1304 * ),
1305 * @OA\Property(
1306 * property="phone_biz",
1307 * description="patient work phone",
1308 * type="string",
1309 * ),
1310 * @OA\Property(
1311 * property="phone_cell",
1312 * description="patient mobile phone",
1313 * type="string",
1314 * ),
1315 * @OA\Property(
1316 * property="email",
1317 * description="patient email",
1318 * type="string",
1319 * ),
1320 * @OA\Property(
1321 * property="DOB",
1322 * description="patient DOB",
1323 * type="string",
1324 * ),
1325 * @OA\Property(
1326 * property="sex",
1327 * description="patient sex (gender)",
1328 * type="string",
1329 * ),
1330 * @OA\Property(
1331 * property="race",
1332 * description="patient race",
1333 * type="string",
1334 * ),
1335 * @OA\Property(
1336 * property="ethnicity",
1337 * description="patient ethnicity",
1338 * type="string",
1339 * ),
1340 * @OA\Property(
1341 * property="status",
1342 * description="patient status",
1343 * type="string",
1344 * ),
1345 * ),
1346 * ),
1347 * example={
1348 * "validationErrors": {},
1349 * "error_description": {},
1350 * "data": {
1351 * "id": "193",
1352 * "pid": "1",
1353 * "pubpid": "",
1354 * "title": "Mr",
1355 * "fname": "Baz",
1356 * "mname": "",
1357 * "lname": "Bop",
1358 * "ss": "",
1359 * "street": "456 Tree Lane",
1360 * "postal_code": "08642",
1361 * "city": "FooTown",
1362 * "state": "FL",
1363 * "county": "",
1364 * "country_code": "US",
1365 * "drivers_license": "",
1366 * "contact_relationship": "",
1367 * "phone_contact": "123-456-7890",
1368 * "phone_home": "",
1369 * "phone_biz": "",
1370 * "phone_cell": "",
1371 * "email": "",
1372 * "DOB": "1992-02-03",
1373 * "sex": "Male",
1374 * "race": "",
1375 * "ethnicity": "",
1376 * "status": ""
1382 * @OA\Put(
1383 * path="/api/patient/{puuid}",
1384 * description="Updates a patient",
1385 * tags={"standard"},
1386 * @OA\Parameter(
1387 * name="puuid",
1388 * in="path",
1389 * description="The uuid for the patient.",
1390 * required=true,
1391 * @OA\Schema(
1392 * type="string"
1394 * ),
1395 * @OA\RequestBody(
1396 * required=true,
1397 * @OA\MediaType(
1398 * mediaType="application/json",
1399 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1401 * ),
1402 * @OA\Response(
1403 * response="200",
1404 * description="Standard response",
1405 * @OA\MediaType(
1406 * mediaType="application/json",
1407 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1409 * ),
1410 * @OA\Response(
1411 * response="401",
1412 * ref="#/components/responses/unauthorized"
1413 * ),
1414 * security={{"openemr_auth":{}}}
1417 "PUT /api/patient/:puuid" => function ($puuid) {
1418 RestConfig::authorization_check("patients", "demo");
1419 $data = (array) (json_decode(file_get_contents("php://input")));
1420 $return = (new PatientRestController())->put($puuid, $data);
1421 RestConfig::apiLog($return, $data);
1422 return $return;
1426 * @OA\Get(
1427 * path="/api/patient/{puuid}",
1428 * description="Retrieves a single patient by their uuid",
1429 * tags={"standard"},
1430 * @OA\Parameter(
1431 * name="puuid",
1432 * in="path",
1433 * description="The uuid for the patient.",
1434 * required=true,
1435 * @OA\Schema(
1436 * type="string"
1438 * ),
1439 * @OA\Response(
1440 * response="200",
1441 * description="Standard response",
1442 * @OA\MediaType(
1443 * mediaType="application/json",
1444 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1446 * ),
1447 * @OA\Response(
1448 * response="401",
1449 * ref="#/components/responses/unauthorized"
1450 * ),
1451 * security={{"openemr_auth":{}}}
1454 "GET /api/patient/:puuid" => function ($puuid) {
1455 RestConfig::authorization_check("patients", "demo");
1456 $return = (new PatientRestController())->getOne($puuid);
1457 RestConfig::apiLog($return);
1458 return $return;
1462 * @OA\Get(
1463 * path="/api/patient/{puuid}/encounter",
1464 * description="Retrieves a list of encounters for a single patient",
1465 * tags={"standard"},
1466 * @OA\Parameter(
1467 * name="puuid",
1468 * in="path",
1469 * description="The uuid for the patient.",
1470 * required=true,
1471 * @OA\Schema(
1472 * type="string"
1474 * ),
1475 * @OA\Response(
1476 * response="200",
1477 * ref="#/components/responses/standard"
1478 * ),
1479 * @OA\Response(
1480 * response="400",
1481 * ref="#/components/responses/badrequest"
1482 * ),
1483 * @OA\Response(
1484 * response="401",
1485 * ref="#/components/responses/unauthorized"
1486 * ),
1487 * security={{"openemr_auth":{}}}
1490 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1491 RestConfig::authorization_check("encounters", "auth_a");
1492 $return = (new EncounterRestController())->getAll($puuid);
1493 RestConfig::apiLog($return);
1494 return $return;
1498 * Schema for the encounter request
1500 * @OA\Schema(
1501 * schema="api_encounter_request",
1502 * @OA\Property(
1503 * property="date",
1504 * description="The date of encounter.",
1505 * type="string"
1506 * ),
1507 * @OA\Property(
1508 * property="onset_date",
1509 * description="The onset date of encounter.",
1510 * type="string"
1511 * ),
1512 * @OA\Property(
1513 * property="reason",
1514 * description="The reason of encounter.",
1515 * type="string"
1516 * ),
1517 * @OA\Property(
1518 * property="facility",
1519 * description="The facility of encounter.",
1520 * type="string"
1521 * ),
1522 * @OA\Property(
1523 * property="pc_catid",
1524 * description="The pc_catid of encounter.",
1525 * type="string"
1526 * ),
1527 * @OA\Property(
1528 * property="facility_id",
1529 * description="The facility id of encounter.",
1530 * type="string"
1531 * ),
1532 * @OA\Property(
1533 * property="billing_facility",
1534 * description="The billing facility id of encounter.",
1535 * type="string"
1536 * ),
1537 * @OA\Property(
1538 * property="sensitivity",
1539 * description="The sensitivity of encounter.",
1540 * type="string"
1541 * ),
1542 * @OA\Property(
1543 * property="referral_source",
1544 * description="The referral source of encounter.",
1545 * type="string"
1546 * ),
1547 * @OA\Property(
1548 * property="pos_code",
1549 * description="The pos_code of encounter.",
1550 * type="string"
1551 * ),
1552 * @OA\Property(
1553 * property="external_id",
1554 * description="The external id of encounter.",
1555 * type="string"
1556 * ),
1557 * @OA\Property(
1558 * property="provider_id",
1559 * description="The provider id of encounter.",
1560 * type="string"
1561 * ),
1562 * @OA\Property(
1563 * property="class_code",
1564 * description="The class_code of encounter.",
1565 * type="string"
1566 * ),
1567 * required={"pc_catid", "class_code"},
1568 * example={
1569 * "date":"2020-11-10",
1570 * "onset_date": "",
1571 * "reason": "Pregnancy Test",
1572 * "facility": "Owerri General Hospital",
1573 * "pc_catid": "5",
1574 * "facility_id": "3",
1575 * "billing_facility": "3",
1576 * "sensitivity": "normal",
1577 * "referral_source": "",
1578 * "pos_code": "0",
1579 * "external_id": "",
1580 * "provider_id": "1",
1581 * "class_code" : "AMB"
1586 * @OA\Post(
1587 * path="/api/patient/{puuid}/encounter",
1588 * description="Creates a new encounter",
1589 * tags={"standard"},
1590 * @OA\Parameter(
1591 * name="puuid",
1592 * in="path",
1593 * description="The uuid for the patient.",
1594 * required=true,
1595 * @OA\Schema(
1596 * type="string"
1598 * ),
1599 * @OA\RequestBody(
1600 * required=true,
1601 * @OA\MediaType(
1602 * mediaType="application/json",
1603 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1605 * ),
1606 * @OA\Response(
1607 * response="200",
1608 * description="Standard response",
1609 * @OA\MediaType(
1610 * mediaType="application/json",
1611 * @OA\Schema(
1612 * @OA\Property(
1613 * property="validationErrors",
1614 * description="Validation errors.",
1615 * type="array",
1616 * @OA\Items(
1617 * type="object",
1618 * ),
1619 * ),
1620 * @OA\Property(
1621 * property="internalErrors",
1622 * description="Internal errors.",
1623 * type="array",
1624 * @OA\Items(
1625 * type="object",
1626 * ),
1627 * ),
1628 * @OA\Property(
1629 * property="data",
1630 * description="Returned data.",
1631 * type="array",
1632 * @OA\Items(
1633 * @OA\Property(
1634 * property="encounter",
1635 * description="encounter id",
1636 * type="integer",
1637 * ),
1638 * @OA\Property(
1639 * property="uuid",
1640 * description="encounter uuid",
1641 * type="string",
1643 * ),
1644 * ),
1645 * example={
1646 * "validationErrors": {},
1647 * "error_description": {},
1648 * "data": {
1649 * "encounter": 1,
1650 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1655 * ),
1656 * @OA\Response(
1657 * response="401",
1658 * ref="#/components/responses/unauthorized"
1659 * ),
1660 * security={{"openemr_auth":{}}}
1663 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1664 RestConfig::authorization_check("encounters", "auth_a");
1665 $data = (array) (json_decode(file_get_contents("php://input")));
1666 $return = (new EncounterRestController())->post($puuid, $data);
1667 RestConfig::apiLog($return, $data);
1668 return $return;
1672 * Schema for the encounter response
1674 * @OA\Schema(
1675 * schema="api_encounter_response",
1676 * @OA\Property(
1677 * property="validationErrors",
1678 * description="Validation errors.",
1679 * type="array",
1680 * @OA\Items(
1681 * type="object",
1682 * ),
1683 * ),
1684 * @OA\Property(
1685 * property="internalErrors",
1686 * description="Internal errors.",
1687 * type="array",
1688 * @OA\Items(
1689 * type="object",
1690 * ),
1691 * ),
1692 * @OA\Property(
1693 * property="data",
1694 * description="Returned data.",
1695 * type="array",
1696 * @OA\Items(
1697 * @OA\Property(
1698 * property="id",
1699 * description="encounter id",
1700 * type="string",
1701 * ),
1702 * @OA\Property(
1703 * property="uuid",
1704 * description="encounter uuid",
1705 * type="string",
1706 * ),
1707 * @OA\Property(
1708 * property="date",
1709 * description="encounter date",
1710 * type="string",
1711 * ),
1712 * @OA\Property(
1713 * property="reason",
1714 * description="encounter reason",
1715 * type="string",
1716 * ),
1717 * @OA\Property(
1718 * property="facility",
1719 * description="encounter facility name",
1720 * type="string",
1721 * ),
1722 * @OA\Property(
1723 * property="facility_id",
1724 * description="encounter facility id name",
1725 * type="string",
1726 * ),
1727 * @OA\Property(
1728 * property="pid",
1729 * description="encounter for patient pid",
1730 * type="string",
1731 * ),
1732 * @OA\Property(
1733 * property="onset_date",
1734 * description="encounter onset date",
1735 * type="string",
1736 * ),
1737 * @OA\Property(
1738 * property="sensitivity",
1739 * description="encounter sensitivity",
1740 * type="string",
1741 * ),
1742 * @OA\Property(
1743 * property="billing_note",
1744 * description="encounter billing note",
1745 * type="string",
1746 * ),
1747 * @OA\Property(
1748 * property="pc_catid",
1749 * description="encounter pc_catid",
1750 * type="string",
1751 * ),
1752 * @OA\Property(
1753 * property="last_level_billed",
1754 * description="encounter last_level_billed",
1755 * type="string",
1756 * ),
1757 * @OA\Property(
1758 * property="last_level_closed",
1759 * description="encounter last_level_closed",
1760 * type="string",
1761 * ),
1762 * @OA\Property(
1763 * property="last_stmt_date",
1764 * description="encounter last_stmt_date",
1765 * type="string",
1766 * ),
1767 * @OA\Property(
1768 * property="stmt_count",
1769 * description="encounter stmt_count",
1770 * type="string",
1771 * ),
1772 * @OA\Property(
1773 * property="provider_id",
1774 * description="provider id",
1775 * type="string",
1776 * ),
1777 * @OA\Property(
1778 * property="supervisor_id",
1779 * description="encounter supervisor id",
1780 * type="string",
1781 * ),
1782 * @OA\Property(
1783 * property="invoice_refno",
1784 * description="encounter invoice_refno",
1785 * type="string",
1786 * ),
1787 * @OA\Property(
1788 * property="referral_source",
1789 * description="encounter referral source",
1790 * type="string",
1791 * ),
1792 * @OA\Property(
1793 * property="billing_facility",
1794 * description="encounter billing facility id",
1795 * type="string",
1796 * ),
1797 * @OA\Property(
1798 * property="external_id",
1799 * description="encounter external id",
1800 * type="string",
1801 * ),
1802 * @OA\Property(
1803 * property="pos_code",
1804 * description="encounter pos_code",
1805 * type="string",
1806 * ),
1807 * @OA\Property(
1808 * property="class_code",
1809 * description="encounter class_code",
1810 * type="string",
1811 * ),
1812 * @OA\Property(
1813 * property="class_title",
1814 * description="encounter class_title",
1815 * type="string",
1816 * ),
1817 * @OA\Property(
1818 * property="pc_catname",
1819 * description="encounter pc_catname",
1820 * type="string",
1821 * ),
1822 * @OA\Property(
1823 * property="billing_facility_name",
1824 * description="encounter billing facility name",
1825 * type="string",
1826 * ),
1827 * ),
1828 * ),
1829 * example={
1830 * "validationErrors": {},
1831 * "error_description": {},
1832 * "data": {
1833 * "id": "1",
1834 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1835 * "date": "2019-09-14 00:00:00",
1836 * "reason": "Pregnancy Test",
1837 * "facility": "Owerri General Hospital",
1838 * "facility_id": "3",
1839 * "pid": "1",
1840 * "onset_date": "2019-04-20 00:00:00",
1841 * "sensitivity": "normal",
1842 * "billing_note": null,
1843 * "pc_catid": "5",
1844 * "last_level_billed": "0",
1845 * "last_level_closed": "0",
1846 * "last_stmt_date": null,
1847 * "stmt_count": "0",
1848 * "provider_id": "1",
1849 * "supervisor_id": "0",
1850 * "invoice_refno": "",
1851 * "referral_source": "",
1852 * "billing_facility": "3",
1853 * "external_id": "",
1854 * "pos_code": "0",
1855 * "class_code": "AMB",
1856 * "class_title": "ambulatory",
1857 * "pc_catname": "Office Visit",
1858 * "billing_facility_name": "Owerri General Hospital"
1864 * @OA\Put(
1865 * path="/api/patient/{puuid}/encounter/{euuid}",
1866 * description="Modify a encounter",
1867 * tags={"standard"},
1868 * @OA\Parameter(
1869 * name="puuid",
1870 * in="path",
1871 * description="The uuid for the patient.",
1872 * required=true,
1873 * @OA\Schema(
1874 * type="string"
1876 * ),
1877 * @OA\Parameter(
1878 * name="euuid",
1879 * in="path",
1880 * description="The uuid for the encounter.",
1881 * required=true,
1882 * @OA\Schema(
1883 * type="string"
1885 * ),
1886 * @OA\RequestBody(
1887 * required=true,
1888 * @OA\MediaType(
1889 * mediaType="application/json",
1890 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1892 * ),
1893 * @OA\Response(
1894 * response="200",
1895 * description="Standard response",
1896 * @OA\MediaType(
1897 * mediaType="application/json",
1898 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1900 * ),
1901 * @OA\Response(
1902 * response="401",
1903 * ref="#/components/responses/unauthorized"
1904 * ),
1905 * security={{"openemr_auth":{}}}
1908 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1909 RestConfig::authorization_check("encounters", "auth_a");
1910 $data = (array) (json_decode(file_get_contents("php://input")));
1911 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1912 RestConfig::apiLog($return, $data);
1913 return $return;
1917 * @OA\Get(
1918 * path="/api/patient/{puuid}/encounter/{euuid}",
1919 * description="Retrieves a single encounter for a patient",
1920 * tags={"standard"},
1921 * @OA\Parameter(
1922 * name="puuid",
1923 * in="path",
1924 * description="The uuid for the patient.",
1925 * required=true,
1926 * @OA\Schema(
1927 * type="string"
1929 * ),
1930 * @OA\Parameter(
1931 * name="euuid",
1932 * in="path",
1933 * description="The uuid for the encounter.",
1934 * required=true,
1935 * @OA\Schema(
1936 * type="string"
1938 * ),
1939 * @OA\Response(
1940 * response="200",
1941 * description="Standard response",
1942 * @OA\MediaType(
1943 * mediaType="application/json",
1944 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1946 * ),
1947 * @OA\Response(
1948 * response="401",
1949 * ref="#/components/responses/unauthorized"
1950 * ),
1951 * security={{"openemr_auth":{}}}
1954 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1955 RestConfig::authorization_check("encounters", "auth_a");
1956 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1957 RestConfig::apiLog($return);
1958 return $return;
1962 * @OA\Get(
1963 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1964 * description="Retrieves soap notes from an encounter for a patient",
1965 * tags={"standard"},
1966 * @OA\Parameter(
1967 * name="pid",
1968 * in="path",
1969 * description="The pid for the patient.",
1970 * required=true,
1971 * @OA\Schema(
1972 * type="string"
1974 * ),
1975 * @OA\Parameter(
1976 * name="eid",
1977 * in="path",
1978 * description="The id for the encounter.",
1979 * required=true,
1980 * @OA\Schema(
1981 * type="string"
1983 * ),
1984 * @OA\Response(
1985 * response="200",
1986 * ref="#/components/responses/standard"
1987 * ),
1988 * @OA\Response(
1989 * response="400",
1990 * ref="#/components/responses/badrequest"
1991 * ),
1992 * @OA\Response(
1993 * response="401",
1994 * ref="#/components/responses/unauthorized"
1995 * ),
1996 * security={{"openemr_auth":{}}}
1999 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2000 RestConfig::authorization_check("encounters", "notes");
2001 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2002 RestConfig::apiLog($return);
2003 return $return;
2007 * Schema for the vital request
2009 * @OA\Schema(
2010 * schema="api_vital_request",
2011 * @OA\Property(
2012 * property="bps",
2013 * description="The bps of vitals.",
2014 * type="string"
2015 * ),
2016 * @OA\Property(
2017 * property="bpd",
2018 * description="The bpd of vitals.",
2019 * type="string"
2020 * ),
2021 * @OA\Property(
2022 * property="weight",
2023 * description="The weight of vitals. (unit is lb)",
2024 * type="string"
2025 * ),
2026 * @OA\Property(
2027 * property="height",
2028 * description="The height of vitals. (unit is inches)",
2029 * type="string"
2030 * ),
2031 * @OA\Property(
2032 * property="temperature",
2033 * description="The temperature of temperature. (unit is F)",
2034 * type="string"
2035 * ),
2036 * @OA\Property(
2037 * property="temp_method",
2038 * description="The temp_method of vitals.",
2039 * type="string"
2040 * ),
2041 * @OA\Property(
2042 * property="pulse",
2043 * description="The pulse of vitals.",
2044 * type="string"
2045 * ),
2046 * @OA\Property(
2047 * property="respiration",
2048 * description="The respiration of vitals.",
2049 * type="string"
2050 * ),
2051 * @OA\Property(
2052 * property="note",
2053 * description="The note (ie. comments) of vitals.",
2054 * type="string"
2055 * ),
2056 * @OA\Property(
2057 * property="waist_circ",
2058 * description="The waist circumference of vitals. (unit is inches)",
2059 * type="string"
2060 * ),
2061 * @OA\Property(
2062 * property="head_circ",
2063 * description="The head circumference of vitals. (unit is inches)",
2064 * type="string"
2065 * ),
2066 * @OA\Property(
2067 * property="oxygen_saturation",
2068 * description="The oxygen_saturation of vitals.",
2069 * type="string"
2070 * ),
2071 * example={
2072 * "bps": "130",
2073 * "bpd": "80",
2074 * "weight": "220",
2075 * "height": "70",
2076 * "temperature": "98",
2077 * "temp_method": "Oral",
2078 * "pulse": "60",
2079 * "respiration": "20",
2080 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2081 * "waist_circ": "37",
2082 * "head_circ": "22.2",
2083 * "oxygen_saturation": "96"
2088 * @OA\Post(
2089 * path="/api/patient/{pid}/encounter/{eid}/vital",
2090 * description="Submits a new vitals form",
2091 * tags={"standard"},
2092 * @OA\Parameter(
2093 * name="pid",
2094 * in="path",
2095 * description="The id for the patient.",
2096 * required=true,
2097 * @OA\Schema(
2098 * type="string"
2100 * ),
2101 * @OA\Parameter(
2102 * name="eid",
2103 * in="path",
2104 * description="The id for the encounter.",
2105 * required=true,
2106 * @OA\Schema(
2107 * type="string"
2109 * ),
2110 * @OA\RequestBody(
2111 * required=true,
2112 * @OA\MediaType(
2113 * mediaType="application/json",
2114 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2116 * ),
2117 * @OA\Response(
2118 * response="200",
2119 * ref="#/components/responses/standard"
2120 * ),
2121 * @OA\Response(
2122 * response="400",
2123 * ref="#/components/responses/badrequest"
2124 * ),
2125 * @OA\Response(
2126 * response="401",
2127 * ref="#/components/responses/unauthorized"
2128 * ),
2129 * security={{"openemr_auth":{}}}
2132 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2133 RestConfig::authorization_check("encounters", "notes");
2134 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2135 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2136 RestConfig::apiLog($return, $data);
2137 return $return;
2141 * @OA\Put(
2142 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2143 * description="Edit a vitals form",
2144 * tags={"standard"},
2145 * @OA\Parameter(
2146 * name="pid",
2147 * in="path",
2148 * description="The id for the patient.",
2149 * required=true,
2150 * @OA\Schema(
2151 * type="string"
2153 * ),
2154 * @OA\Parameter(
2155 * name="eid",
2156 * in="path",
2157 * description="The id for the encounter.",
2158 * required=true,
2159 * @OA\Schema(
2160 * type="string"
2162 * ),
2163 * @OA\Parameter(
2164 * name="vid",
2165 * in="path",
2166 * description="The id for the vitalss form.",
2167 * required=true,
2168 * @OA\Schema(
2169 * type="string"
2171 * ),
2172 * @OA\RequestBody(
2173 * required=true,
2174 * @OA\MediaType(
2175 * mediaType="application/json",
2176 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2178 * ),
2179 * @OA\Response(
2180 * response="200",
2181 * ref="#/components/responses/standard"
2182 * ),
2183 * @OA\Response(
2184 * response="400",
2185 * ref="#/components/responses/badrequest"
2186 * ),
2187 * @OA\Response(
2188 * response="401",
2189 * ref="#/components/responses/unauthorized"
2190 * ),
2191 * security={{"openemr_auth":{}}}
2194 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2195 RestConfig::authorization_check("encounters", "notes");
2196 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2197 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2198 RestConfig::apiLog($return, $data);
2199 return $return;
2203 * @OA\Get(
2204 * path="/api/patient/{pid}/encounter/{eid}/vital",
2205 * description="Retrieves all vitals from an encounter for a patient",
2206 * tags={"standard"},
2207 * @OA\Parameter(
2208 * name="pid",
2209 * in="path",
2210 * description="The pid for the patient.",
2211 * required=true,
2212 * @OA\Schema(
2213 * type="string"
2215 * ),
2216 * @OA\Parameter(
2217 * name="eid",
2218 * in="path",
2219 * description="The id for the encounter.",
2220 * required=true,
2221 * @OA\Schema(
2222 * type="string"
2224 * ),
2225 * @OA\Response(
2226 * response="200",
2227 * ref="#/components/responses/standard"
2228 * ),
2229 * @OA\Response(
2230 * response="400",
2231 * ref="#/components/responses/badrequest"
2232 * ),
2233 * @OA\Response(
2234 * response="401",
2235 * ref="#/components/responses/unauthorized"
2236 * ),
2237 * security={{"openemr_auth":{}}}
2240 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2241 RestConfig::authorization_check("encounters", "notes");
2242 $return = (new EncounterRestController())->getVitals($pid, $eid);
2243 RestConfig::apiLog($return);
2244 return $return;
2248 * @OA\Get(
2249 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2250 * description="Retrieves a vitals form from an encounter for a patient",
2251 * tags={"standard"},
2252 * @OA\Parameter(
2253 * name="pid",
2254 * in="path",
2255 * description="The pid for the patient.",
2256 * required=true,
2257 * @OA\Schema(
2258 * type="string"
2260 * ),
2261 * @OA\Parameter(
2262 * name="eid",
2263 * in="path",
2264 * description="The id for the encounter.",
2265 * required=true,
2266 * @OA\Schema(
2267 * type="string"
2269 * ),
2270 * @OA\Parameter(
2271 * name="vid",
2272 * in="path",
2273 * description="The id for the vitals form.",
2274 * required=true,
2275 * @OA\Schema(
2276 * type="string"
2278 * ),
2279 * @OA\Response(
2280 * response="200",
2281 * ref="#/components/responses/standard"
2282 * ),
2283 * @OA\Response(
2284 * response="400",
2285 * ref="#/components/responses/badrequest"
2286 * ),
2287 * @OA\Response(
2288 * response="401",
2289 * ref="#/components/responses/unauthorized"
2290 * ),
2291 * security={{"openemr_auth":{}}}
2294 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2295 RestConfig::authorization_check("encounters", "notes");
2296 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2297 RestConfig::apiLog($return);
2298 return $return;
2302 * @OA\Get(
2303 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2304 * description="Retrieves a soap note from an encounter for a patient",
2305 * tags={"standard"},
2306 * @OA\Parameter(
2307 * name="pid",
2308 * in="path",
2309 * description="The pid for the patient.",
2310 * required=true,
2311 * @OA\Schema(
2312 * type="string"
2314 * ),
2315 * @OA\Parameter(
2316 * name="eid",
2317 * in="path",
2318 * description="The id for the encounter.",
2319 * required=true,
2320 * @OA\Schema(
2321 * type="string"
2323 * ),
2324 * @OA\Parameter(
2325 * name="sid",
2326 * in="path",
2327 * description="The id for the soap note.",
2328 * required=true,
2329 * @OA\Schema(
2330 * type="string"
2332 * ),
2333 * @OA\Response(
2334 * response="200",
2335 * ref="#/components/responses/standard"
2336 * ),
2337 * @OA\Response(
2338 * response="400",
2339 * ref="#/components/responses/badrequest"
2340 * ),
2341 * @OA\Response(
2342 * response="401",
2343 * ref="#/components/responses/unauthorized"
2344 * ),
2345 * security={{"openemr_auth":{}}}
2348 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2349 RestConfig::authorization_check("encounters", "notes");
2350 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2351 RestConfig::apiLog($return);
2352 return $return;
2356 * Schema for the soap_note request
2358 * @OA\Schema(
2359 * schema="api_soap_note_request",
2360 * @OA\Property(
2361 * property="subjective",
2362 * description="The subjective of soap note.",
2363 * type="string"
2364 * ),
2365 * @OA\Property(
2366 * property="objective",
2367 * description="The objective of soap note.",
2368 * type="string"
2369 * ),
2370 * @OA\Property(
2371 * property="assessment",
2372 * description="The assessment of soap note.",
2373 * type="string"
2374 * ),
2375 * @OA\Property(
2376 * property="plan",
2377 * description="The plan of soap note.",
2378 * type="string"
2379 * ),
2380 * example={
2381 * "subjective": "The patient with mechanical fall and cut finger.",
2382 * "objective": "The patient with finger laceration on exam.",
2383 * "assessment": "The patient with finger laceration requiring sutures.",
2384 * "plan": "Sutured finger laceration."
2389 * @OA\Post(
2390 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2391 * description="Submits a new soap note",
2392 * tags={"standard"},
2393 * @OA\Parameter(
2394 * name="pid",
2395 * in="path",
2396 * description="The id for the patient.",
2397 * required=true,
2398 * @OA\Schema(
2399 * type="string"
2401 * ),
2402 * @OA\Parameter(
2403 * name="eid",
2404 * in="path",
2405 * description="The id for the encounter.",
2406 * required=true,
2407 * @OA\Schema(
2408 * type="string"
2410 * ),
2411 * @OA\RequestBody(
2412 * required=true,
2413 * @OA\MediaType(
2414 * mediaType="application/json",
2415 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2417 * ),
2418 * @OA\Response(
2419 * response="200",
2420 * ref="#/components/responses/standard"
2421 * ),
2422 * @OA\Response(
2423 * response="400",
2424 * ref="#/components/responses/badrequest"
2425 * ),
2426 * @OA\Response(
2427 * response="401",
2428 * ref="#/components/responses/unauthorized"
2429 * ),
2430 * security={{"openemr_auth":{}}}
2433 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2434 RestConfig::authorization_check("encounters", "notes");
2435 $data = (array) (json_decode(file_get_contents("php://input")));
2436 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2437 RestConfig::apiLog($return, $data);
2438 return $return;
2442 * @OA\Put(
2443 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2444 * description="Edit a soap note",
2445 * tags={"standard"},
2446 * @OA\Parameter(
2447 * name="pid",
2448 * in="path",
2449 * description="The id for the patient.",
2450 * required=true,
2451 * @OA\Schema(
2452 * type="string"
2454 * ),
2455 * @OA\Parameter(
2456 * name="eid",
2457 * in="path",
2458 * description="The id for the encounter.",
2459 * required=true,
2460 * @OA\Schema(
2461 * type="string"
2463 * ),
2464 * @OA\Parameter(
2465 * name="sid",
2466 * in="path",
2467 * description="The id for the soap noted.",
2468 * required=true,
2469 * @OA\Schema(
2470 * type="string"
2472 * ),
2473 * @OA\RequestBody(
2474 * required=true,
2475 * @OA\MediaType(
2476 * mediaType="application/json",
2477 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2479 * ),
2480 * @OA\Response(
2481 * response="200",
2482 * ref="#/components/responses/standard"
2483 * ),
2484 * @OA\Response(
2485 * response="400",
2486 * ref="#/components/responses/badrequest"
2487 * ),
2488 * @OA\Response(
2489 * response="401",
2490 * ref="#/components/responses/unauthorized"
2491 * ),
2492 * security={{"openemr_auth":{}}}
2495 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2496 RestConfig::authorization_check("encounters", "notes");
2497 $data = (array) (json_decode(file_get_contents("php://input")));
2498 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2499 RestConfig::apiLog($return, $data);
2500 return $return;
2505 * @OA\Get(
2506 * path="/api/practitioner",
2507 * description="Retrieves a list of practitioners",
2508 * tags={"standard"},
2509 * @OA\Parameter(
2510 * name="title",
2511 * in="query",
2512 * description="The title for the practitioner.",
2513 * required=false,
2514 * @OA\Schema(
2515 * type="string"
2517 * ),
2518 * @OA\Parameter(
2519 * name="fname",
2520 * in="query",
2521 * description="The first name for the practitioner.",
2522 * required=false,
2523 * @OA\Schema(
2524 * type="string"
2526 * ),
2527 * @OA\Parameter(
2528 * name="lname",
2529 * in="query",
2530 * description="The last name for the practitioner.",
2531 * required=false,
2532 * @OA\Schema(
2533 * type="string"
2535 * ),
2536 * @OA\Parameter(
2537 * name="mname",
2538 * in="query",
2539 * description="The middle name for the practitioner.",
2540 * required=false,
2541 * @OA\Schema(
2542 * type="string"
2544 * ),
2545 * @OA\Parameter(
2546 * name="federaltaxid",
2547 * in="query",
2548 * description="The federal tax id for the practitioner.",
2549 * required=false,
2550 * @OA\Schema(
2551 * type="string"
2553 * ),
2554 * @OA\Parameter(
2555 * name="federaldrugid",
2556 * in="query",
2557 * description="The federal drug id for the practitioner.",
2558 * required=false,
2559 * @OA\Schema(
2560 * type="string"
2562 * ),
2563 * @OA\Parameter(
2564 * name="upin",
2565 * in="query",
2566 * description="The upin for the practitioner.",
2567 * required=false,
2568 * @OA\Schema(
2569 * type="string"
2571 * ),
2572 * @OA\Parameter(
2573 * name="facility_id",
2574 * in="query",
2575 * description="The facility id for the practitioner.",
2576 * required=false,
2577 * @OA\Schema(
2578 * type="string"
2580 * ),
2581 * @OA\Parameter(
2582 * name="facility",
2583 * in="query",
2584 * description="The facility for the practitioner.",
2585 * required=false,
2586 * @OA\Schema(
2587 * type="string"
2589 * ),
2590 * @OA\Parameter(
2591 * name="npi",
2592 * in="query",
2593 * description="The npi for the practitioner.",
2594 * required=false,
2595 * @OA\Schema(
2596 * type="string"
2598 * ),
2599 * @OA\Parameter(
2600 * name="email",
2601 * in="query",
2602 * description="The email for the practitioner.",
2603 * required=false,
2604 * @OA\Schema(
2605 * type="string"
2607 * ),
2608 * @OA\Parameter(
2609 * name="specialty",
2610 * in="query",
2611 * description="The specialty for the practitioner.",
2612 * required=false,
2613 * @OA\Schema(
2614 * type="string"
2616 * ),
2617 * @OA\Parameter(
2618 * name="billname",
2619 * in="query",
2620 * description="The billname for the practitioner.",
2621 * required=false,
2622 * @OA\Schema(
2623 * type="string"
2625 * ),
2626 * @OA\Parameter(
2627 * name="url",
2628 * in="query",
2629 * description="The url for the practitioner.",
2630 * required=false,
2631 * @OA\Schema(
2632 * type="string"
2634 * ),
2635 * @OA\Parameter(
2636 * name="assistant",
2637 * in="query",
2638 * description="The assistant for the practitioner.",
2639 * required=false,
2640 * @OA\Schema(
2641 * type="string"
2643 * ),
2644 * @OA\Parameter(
2645 * name="organization",
2646 * in="query",
2647 * description="The organization for the practitioner.",
2648 * required=false,
2649 * @OA\Schema(
2650 * type="string"
2652 * ),
2653 * @OA\Parameter(
2654 * name="valedictory",
2655 * in="query",
2656 * description="The valedictory for the practitioner.",
2657 * required=false,
2658 * @OA\Schema(
2659 * type="string"
2661 * ),
2662 * @OA\Parameter(
2663 * name="street",
2664 * in="query",
2665 * description="The street for the practitioner.",
2666 * required=false,
2667 * @OA\Schema(
2668 * type="string"
2670 * ),
2671 * @OA\Parameter(
2672 * name="streetb",
2673 * in="query",
2674 * description="The street (line 2) for the practitioner.",
2675 * required=false,
2676 * @OA\Schema(
2677 * type="string"
2679 * ),
2680 * @OA\Parameter(
2681 * name="city",
2682 * in="query",
2683 * description="The city for the practitioner.",
2684 * required=false,
2685 * @OA\Schema(
2686 * type="string"
2688 * ),
2689 * @OA\Parameter(
2690 * name="state",
2691 * in="query",
2692 * description="The state for the practitioner.",
2693 * required=false,
2694 * @OA\Schema(
2695 * type="string"
2697 * ),
2698 * @OA\Parameter(
2699 * name="zip",
2700 * in="query",
2701 * description="The zip for the practitioner.",
2702 * required=false,
2703 * @OA\Schema(
2704 * type="string"
2706 * ),
2707 * @OA\Parameter(
2708 * name="phone",
2709 * in="query",
2710 * description="The phone for the practitioner.",
2711 * required=false,
2712 * @OA\Schema(
2713 * type="string"
2715 * ),
2716 * @OA\Parameter(
2717 * name="fax",
2718 * in="query",
2719 * description="The fax for the practitioner.",
2720 * required=false,
2721 * @OA\Schema(
2722 * type="string"
2724 * ),
2725 * @OA\Parameter(
2726 * name="phonew1",
2727 * in="query",
2728 * description="The phonew1 for the practitioner.",
2729 * required=false,
2730 * @OA\Schema(
2731 * type="string"
2733 * ),
2734 * @OA\Parameter(
2735 * name="phonecell",
2736 * in="query",
2737 * description="The phonecell for the practitioner.",
2738 * required=false,
2739 * @OA\Schema(
2740 * type="string"
2742 * ),
2743 * @OA\Parameter(
2744 * name="notes",
2745 * in="query",
2746 * description="The notes for the practitioner.",
2747 * required=false,
2748 * @OA\Schema(
2749 * type="string"
2751 * ),
2752 * @OA\Parameter(
2753 * name="state_license_number2",
2754 * in="query",
2755 * description="The state license number for the practitioner.",
2756 * required=false,
2757 * @OA\Schema(
2758 * type="string"
2760 * ),
2761 * @OA\Parameter(
2762 * name="username",
2763 * in="query",
2764 * description="The username for the practitioner.",
2765 * required=false,
2766 * @OA\Schema(
2767 * type="string"
2769 * ),
2770 * @OA\Response(
2771 * response="200",
2772 * ref="#/components/responses/standard"
2773 * ),
2774 * @OA\Response(
2775 * response="400",
2776 * ref="#/components/responses/badrequest"
2777 * ),
2778 * @OA\Response(
2779 * response="401",
2780 * ref="#/components/responses/unauthorized"
2781 * ),
2782 * security={{"openemr_auth":{}}}
2785 "GET /api/practitioner" => function () {
2786 RestConfig::authorization_check("admin", "users");
2787 $return = (new PractitionerRestController())->getAll($_GET);
2788 RestConfig::apiLog($return);
2789 return $return;
2793 * @OA\Get(
2794 * path="/api/practitioner/{pruuid}",
2795 * description="Retrieves a single practitioner by their uuid",
2796 * tags={"standard"},
2797 * @OA\Parameter(
2798 * name="pruuid",
2799 * in="path",
2800 * description="The uuid for the practitioner.",
2801 * required=true,
2802 * @OA\Schema(
2803 * type="string"
2805 * ),
2806 * @OA\Response(
2807 * response="200",
2808 * ref="#/components/responses/standard"
2809 * ),
2810 * @OA\Response(
2811 * response="400",
2812 * ref="#/components/responses/badrequest"
2813 * ),
2814 * @OA\Response(
2815 * response="401",
2816 * ref="#/components/responses/unauthorized"
2817 * ),
2818 * security={{"openemr_auth":{}}}
2821 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2822 RestConfig::authorization_check("admin", "users");
2823 $return = (new PractitionerRestController())->getOne($pruuid);
2824 RestConfig::apiLog($return);
2825 return $return;
2829 * @OA\Post(
2830 * path="/api/practitioner",
2831 * description="Submits a new practitioner",
2832 * tags={"standard"},
2833 * @OA\RequestBody(
2834 * required=true,
2835 * @OA\MediaType(
2836 * mediaType="application/json",
2837 * @OA\Schema(
2838 * @OA\Property(
2839 * property="title",
2840 * description="The title for the practitioner.",
2841 * type="string"
2842 * ),
2843 * @OA\Property(
2844 * property="fname",
2845 * description="The first name for the practitioner.",
2846 * type="string"
2847 * ),
2848 * @OA\Property(
2849 * property="mname",
2850 * description="The middle name for the practitioner.",
2851 * type="string"
2852 * ),
2853 * @OA\Property(
2854 * property="lname",
2855 * description="The last name for the practitioner.",
2856 * type="string"
2857 * ),
2858 * @OA\Property(
2859 * property="federaltaxid",
2860 * description="The federal tax id for the practitioner.",
2861 * type="string"
2862 * ),
2863 * @OA\Property(
2864 * property="federaldrugid",
2865 * description="The federal drug id for the practitioner.",
2866 * type="string"
2867 * ),
2868 * @OA\Property(
2869 * property="upin",
2870 * description="The upin for the practitioner.",
2871 * type="string"
2872 * ),
2873 * @OA\Property(
2874 * property="facility_id",
2875 * description="The facility_id for the practitioner.",
2876 * type="string"
2877 * ),
2878 * @OA\Property(
2879 * property="facility",
2880 * description="The facility name for the practitioner.",
2881 * type="string"
2882 * ),
2883 * @OA\Property(
2884 * property="npi",
2885 * description="The npi for the practitioner.",
2886 * type="string"
2887 * ),
2888 * @OA\Property(
2889 * property="email",
2890 * description="The email for the practitioner.",
2891 * type="string"
2892 * ),
2893 * @OA\Property(
2894 * property="specialty",
2895 * description="The specialty for the practitioner.",
2896 * type="string"
2897 * ),
2898 * @OA\Property(
2899 * property="billname",
2900 * description="The billname for the practitioner.",
2901 * type="string"
2902 * ),
2903 * @OA\Property(
2904 * property="url",
2905 * description="The url for the practitioner.",
2906 * type="string"
2907 * ),
2908 * @OA\Property(
2909 * property="assistant",
2910 * description="The assistant for the practitioner.",
2911 * type="string"
2912 * ),
2913 * @OA\Property(
2914 * property="valedictory",
2915 * description="The valedictory for the practitioner.",
2916 * type="string"
2917 * ),
2918 * @OA\Property(
2919 * property="street",
2920 * description="The street address for the practitioner.",
2921 * type="string"
2922 * ),
2923 * @OA\Property(
2924 * property="streetb",
2925 * description="The streetb address for the practitioner.",
2926 * type="string"
2927 * ),
2928 * @OA\Property(
2929 * property="city",
2930 * description="The city for the practitioner.",
2931 * type="string"
2932 * ),
2933 * @OA\Property(
2934 * property="state",
2935 * description="The state for the practitioner.",
2936 * type="string"
2937 * ),
2938 * @OA\Property(
2939 * property="zip",
2940 * description="The zip for the practitioner.",
2941 * type="string"
2942 * ),
2943 * @OA\Property(
2944 * property="phone",
2945 * description="The phone for the practitioner.",
2946 * type="string"
2947 * ),
2948 * @OA\Property(
2949 * property="fax",
2950 * description="The fax for the practitioner.",
2951 * type="string"
2952 * ),
2953 * @OA\Property(
2954 * property="phonew1",
2955 * description="The phonew1 for the practitioner.",
2956 * type="string"
2957 * ),
2958 * @OA\Property(
2959 * property="phonecell",
2960 * description="The phonecell for the practitioner.",
2961 * type="string"
2962 * ),
2963 * @OA\Property(
2964 * property="notes",
2965 * description="The notes for the practitioner.",
2966 * type="string"
2967 * ),
2968 * @OA\Property(
2969 * property="state_license_number",
2970 * description="The state license number for the practitioner.",
2971 * type="string"
2972 * ),
2973 * @OA\Property(
2974 * property="username",
2975 * description="The username for the practitioner.",
2976 * type="string"
2977 * ),
2978 * required={"fname", "lname", "npi"},
2979 * example={
2980 * "title": "Mrs.",
2981 * "fname": "Eduardo",
2982 * "mname": "Kathy",
2983 * "lname": "Perez",
2984 * "federaltaxid": "",
2985 * "federaldrugid": "",
2986 * "upin": "",
2987 * "facility_id": "3",
2988 * "facility": "Your Clinic Name Here",
2989 * "npi": "12345678901",
2990 * "email": "info@pennfirm.com",
2991 * "specialty": "",
2992 * "billname": null,
2993 * "url": null,
2994 * "assistant": null,
2995 * "organization": null,
2996 * "valedictory": null,
2997 * "street": "789 Third Avenue",
2998 * "streetb": "123 Cannaut Street",
2999 * "city": "San Diego",
3000 * "state": "CA",
3001 * "zip": "90210",
3002 * "phone": "(619) 555-9827",
3003 * "fax": null,
3004 * "phonew1": "(619) 555-7822",
3005 * "phonecell": "(619) 555-7821",
3006 * "notes": null,
3007 * "state_license_number": "123456",
3008 * "username": "eduardoperez"
3012 * ),
3013 * @OA\Response(
3014 * response="200",
3015 * description="Standard response",
3016 * @OA\MediaType(
3017 * mediaType="application/json",
3018 * @OA\Schema(
3019 * @OA\Property(
3020 * property="validationErrors",
3021 * description="Validation errors.",
3022 * type="array",
3023 * @OA\Items(
3024 * type="object",
3025 * ),
3026 * ),
3027 * @OA\Property(
3028 * property="internalErrors",
3029 * description="Internal errors.",
3030 * type="array",
3031 * @OA\Items(
3032 * type="object",
3033 * ),
3034 * ),
3035 * @OA\Property(
3036 * property="data",
3037 * description="Returned data.",
3038 * type="array",
3039 * @OA\Items(
3040 * @OA\Property(
3041 * property="id",
3042 * description="practitioner id",
3043 * type="integer",
3044 * ),
3045 * @OA\Property(
3046 * property="uuid",
3047 * description="practitioner uuid",
3048 * type="string",
3049 * ),
3050 * ),
3051 * ),
3052 * example={
3053 * "validationErrors": {},
3054 * "error_description": {},
3055 * "data": {
3056 * "id": 7,
3057 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3062 * ),
3063 * @OA\Response(
3064 * response="401",
3065 * ref="#/components/responses/unauthorized"
3066 * ),
3067 * security={{"openemr_auth":{}}}
3070 "POST /api/practitioner" => function () {
3071 RestConfig::authorization_check("admin", "users");
3072 $data = (array) (json_decode(file_get_contents("php://input")));
3073 $return = (new PractitionerRestController())->post($data);
3074 RestConfig::apiLog($return, $data);
3075 return $return;
3079 * @OA\Put(
3080 * path="/api/practitioner/{pruuid}",
3081 * description="Edit a practitioner",
3082 * tags={"standard"},
3083 * @OA\Parameter(
3084 * name="pruuid",
3085 * in="path",
3086 * description="The uuid for the practitioner.",
3087 * required=true,
3088 * @OA\Schema(
3089 * type="string"
3091 * ),
3092 * @OA\RequestBody(
3093 * required=true,
3094 * @OA\MediaType(
3095 * mediaType="application/json",
3096 * @OA\Schema(
3097 * @OA\Property(
3098 * property="title",
3099 * description="The title for the practitioner.",
3100 * type="string"
3101 * ),
3102 * @OA\Property(
3103 * property="fname",
3104 * description="The first name for the practitioner.",
3105 * type="string"
3106 * ),
3107 * @OA\Property(
3108 * property="mname",
3109 * description="The middle name for the practitioner.",
3110 * type="string"
3111 * ),
3112 * @OA\Property(
3113 * property="lname",
3114 * description="The last name for the practitioner.",
3115 * type="string"
3116 * ),
3117 * @OA\Property(
3118 * property="federaltaxid",
3119 * description="The federal tax id for the practitioner.",
3120 * type="string"
3121 * ),
3122 * @OA\Property(
3123 * property="federaldrugid",
3124 * description="The federal drug id for the practitioner.",
3125 * type="string"
3126 * ),
3127 * @OA\Property(
3128 * property="upin",
3129 * description="The upin for the practitioner.",
3130 * type="string"
3131 * ),
3132 * @OA\Property(
3133 * property="facility_id",
3134 * description="The facility_id for the practitioner.",
3135 * type="string"
3136 * ),
3137 * @OA\Property(
3138 * property="facility",
3139 * description="The facility name for the practitioner.",
3140 * type="string"
3141 * ),
3142 * @OA\Property(
3143 * property="npi",
3144 * description="The npi for the practitioner.",
3145 * type="string"
3146 * ),
3147 * @OA\Property(
3148 * property="email",
3149 * description="The email for the practitioner.",
3150 * type="string"
3151 * ),
3152 * @OA\Property(
3153 * property="specialty",
3154 * description="The specialty for the practitioner.",
3155 * type="string"
3156 * ),
3157 * @OA\Property(
3158 * property="billname",
3159 * description="The billname for the practitioner.",
3160 * type="string"
3161 * ),
3162 * @OA\Property(
3163 * property="url",
3164 * description="The url for the practitioner.",
3165 * type="string"
3166 * ),
3167 * @OA\Property(
3168 * property="assistant",
3169 * description="The assistant for the practitioner.",
3170 * type="string"
3171 * ),
3172 * @OA\Property(
3173 * property="valedictory",
3174 * description="The valedictory for the practitioner.",
3175 * type="string"
3176 * ),
3177 * @OA\Property(
3178 * property="street",
3179 * description="The street address for the practitioner.",
3180 * type="string"
3181 * ),
3182 * @OA\Property(
3183 * property="streetb",
3184 * description="The streetb address for the practitioner.",
3185 * type="string"
3186 * ),
3187 * @OA\Property(
3188 * property="city",
3189 * description="The city for the practitioner.",
3190 * type="string"
3191 * ),
3192 * @OA\Property(
3193 * property="state",
3194 * description="The state for the practitioner.",
3195 * type="string"
3196 * ),
3197 * @OA\Property(
3198 * property="zip",
3199 * description="The zip for the practitioner.",
3200 * type="string"
3201 * ),
3202 * @OA\Property(
3203 * property="phone",
3204 * description="The phone for the practitioner.",
3205 * type="string"
3206 * ),
3207 * @OA\Property(
3208 * property="fax",
3209 * description="The fax for the practitioner.",
3210 * type="string"
3211 * ),
3212 * @OA\Property(
3213 * property="phonew1",
3214 * description="The phonew1 for the practitioner.",
3215 * type="string"
3216 * ),
3217 * @OA\Property(
3218 * property="phonecell",
3219 * description="The phonecell for the practitioner.",
3220 * type="string"
3221 * ),
3222 * @OA\Property(
3223 * property="notes",
3224 * description="The notes for the practitioner.",
3225 * type="string"
3226 * ),
3227 * @OA\Property(
3228 * property="state_license_number",
3229 * description="The state license number for the practitioner.",
3230 * type="string"
3231 * ),
3232 * @OA\Property(
3233 * property="username",
3234 * description="The username for the practitioner.",
3235 * type="string"
3236 * ),
3237 * example={
3238 * "title": "Mr",
3239 * "fname": "Baz",
3240 * "mname": "",
3241 * "lname": "Bop",
3242 * "street": "456 Tree Lane",
3243 * "zip": "08642",
3244 * "city": "FooTown",
3245 * "state": "FL",
3246 * "phone": "123-456-7890"
3250 * ),
3251 * @OA\Response(
3252 * response="200",
3253 * description="Standard response",
3254 * @OA\MediaType(
3255 * mediaType="application/json",
3256 * @OA\Schema(
3257 * @OA\Property(
3258 * property="validationErrors",
3259 * description="Validation errors.",
3260 * type="array",
3261 * @OA\Items(
3262 * type="object",
3263 * ),
3264 * ),
3265 * @OA\Property(
3266 * property="internalErrors",
3267 * description="Internal errors.",
3268 * type="array",
3269 * @OA\Items(
3270 * type="object",
3271 * ),
3272 * ),
3273 * @OA\Property(
3274 * property="data",
3275 * description="Returned data.",
3276 * type="array",
3277 * @OA\Items(
3278 * @OA\Property(
3279 * property="id",
3280 * description="practitioner id",
3281 * type="string",
3282 * ),
3283 * @OA\Property(
3284 * property="uuid",
3285 * description="practitioner uuid",
3286 * type="string",
3287 * ),
3288 * @OA\Property(
3289 * property="title",
3290 * description="practitioner title",
3291 * type="string",
3292 * ),
3293 * @OA\Property(
3294 * property="fname",
3295 * description="practitioner fname",
3296 * type="string",
3297 * ),
3298 * @OA\Property(
3299 * property="lname",
3300 * description="practitioner lname",
3301 * type="string",
3302 * ),
3303 * @OA\Property(
3304 * property="mname",
3305 * description="practitioner mname",
3306 * type="string",
3307 * ),
3308 * @OA\Property(
3309 * property="federaltaxid",
3310 * description="practitioner federaltaxid",
3311 * type="string",
3312 * ),
3313 * @OA\Property(
3314 * property="federaldrugid",
3315 * description="practitioner federaldrugid",
3316 * type="string",
3317 * ),
3318 * @OA\Property(
3319 * property="upin",
3320 * description="practitioner upin",
3321 * type="string",
3322 * ),
3323 * @OA\Property(
3324 * property="facility_id",
3325 * description="practitioner facility_id",
3326 * type="string",
3327 * ),
3328 * @OA\Property(
3329 * property="facility",
3330 * description="practitioner facility",
3331 * type="string",
3332 * ),
3333 * @OA\Property(
3334 * property="npi",
3335 * description="practitioner npi",
3336 * type="string",
3337 * ),
3338 * @OA\Property(
3339 * property="email",
3340 * description="practitioner email",
3341 * type="string",
3342 * ),
3343 * @OA\Property(
3344 * property="active",
3345 * description="practitioner active setting",
3346 * type="string",
3347 * ),
3348 * @OA\Property(
3349 * property="specialty",
3350 * description="practitioner specialty",
3351 * type="string",
3352 * ),
3353 * @OA\Property(
3354 * property="billname",
3355 * description="practitioner billname",
3356 * type="string",
3357 * ),
3358 * @OA\Property(
3359 * property="url",
3360 * description="practitioner url",
3361 * type="string",
3362 * ),
3363 * @OA\Property(
3364 * property="assistant",
3365 * description="practitioner assistant",
3366 * type="string",
3367 * ),
3368 * @OA\Property(
3369 * property="organization",
3370 * description="practitioner organization",
3371 * type="string",
3372 * ),
3373 * @OA\Property(
3374 * property="valedictory",
3375 * description="practitioner valedictory",
3376 * type="string",
3377 * ),
3378 * @OA\Property(
3379 * property="street",
3380 * description="practitioner street",
3381 * type="string",
3382 * ),
3383 * @OA\Property(
3384 * property="streetb",
3385 * description="practitioner streetb",
3386 * type="string",
3387 * ),
3388 * @OA\Property(
3389 * property="city",
3390 * description="practitioner city",
3391 * type="string",
3392 * ),
3393 * @OA\Property(
3394 * property="state",
3395 * description="practitioner state",
3396 * type="string",
3397 * ),
3398 * @OA\Property(
3399 * property="zip",
3400 * description="practitioner zip",
3401 * type="string",
3402 * ),
3403 * @OA\Property(
3404 * property="phone",
3405 * description="practitioner phone",
3406 * type="string",
3407 * ),
3408 * @OA\Property(
3409 * property="fax",
3410 * description="fax",
3411 * type="string",
3412 * ),
3413 * @OA\Property(
3414 * property="phonew1",
3415 * description="practitioner phonew1",
3416 * type="string",
3417 * ),
3418 * @OA\Property(
3419 * property="phonecell",
3420 * description="practitioner phonecell",
3421 * type="string",
3422 * ),
3423 * @OA\Property(
3424 * property="notes",
3425 * description="practitioner notes",
3426 * type="string",
3427 * ),
3428 * @OA\Property(
3429 * property="state_license_number",
3430 * description="practitioner state license number",
3431 * type="string",
3432 * ),
3433 * @OA\Property(
3434 * property="abook_title",
3435 * description="practitioner abook title",
3436 * type="string",
3437 * ),
3438 * @OA\Property(
3439 * property="physician_title",
3440 * description="practitioner physician title",
3441 * type="string",
3442 * ),
3443 * @OA\Property(
3444 * property="physician_code",
3445 * description="practitioner physician code",
3446 * type="string",
3448 * ),
3449 * ),
3450 * example={
3451 * "validationErrors": {},
3452 * "error_description": {},
3453 * "data": {
3454 * "id": 7,
3455 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3456 * "title": "Mr",
3457 * "fname": "Baz",
3458 * "lname": "Bop",
3459 * "mname": "",
3460 * "federaltaxid": "",
3461 * "federaldrugid": "",
3462 * "upin": "",
3463 * "facility_id": "3",
3464 * "facility": "Your Clinic Name Here",
3465 * "npi": "0123456789",
3466 * "email": "info@pennfirm.com",
3467 * "active": "1",
3468 * "specialty": "",
3469 * "billname": "",
3470 * "url": "",
3471 * "assistant": "",
3472 * "organization": "",
3473 * "valedictory": "",
3474 * "street": "456 Tree Lane",
3475 * "streetb": "123 Cannaut Street",
3476 * "city": "FooTown",
3477 * "state": "FL",
3478 * "zip": "08642",
3479 * "phone": "123-456-7890",
3480 * "fax": "",
3481 * "phonew1": "(619) 555-7822",
3482 * "phonecell": "(619) 555-7821",
3483 * "notes": "",
3484 * "state_license_number": "123456",
3485 * "abook_title": null,
3486 * "physician_title": null,
3487 * "physician_code": null
3492 * ),
3493 * @OA\Response(
3494 * response="401",
3495 * ref="#/components/responses/unauthorized"
3496 * ),
3497 * security={{"openemr_auth":{}}}
3500 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3501 RestConfig::authorization_check("admin", "users");
3502 $data = (array) (json_decode(file_get_contents("php://input")));
3503 $return = (new PractitionerRestController())->patch($pruuid, $data);
3504 RestConfig::apiLog($return, $data);
3505 return $return;
3509 * @OA\Get(
3510 * path="/api/medical_problem",
3511 * description="Retrieves a list of medical problems",
3512 * tags={"standard"},
3513 * @OA\Parameter(
3514 * name="puuid",
3515 * in="query",
3516 * description="The uuid for the patient.",
3517 * required=false,
3518 * @OA\Schema(
3519 * type="string"
3521 * ),
3522 * @OA\Parameter(
3523 * name="condition_uuid",
3524 * in="query",
3525 * description="The uuid for the medical problem.",
3526 * required=false,
3527 * @OA\Schema(
3528 * type="string"
3530 * ),
3531 * @OA\Parameter(
3532 * name="title",
3533 * in="query",
3534 * description="The title for the medical problem.",
3535 * required=false,
3536 * @OA\Schema(
3537 * type="string"
3539 * ),
3540 * @OA\Parameter(
3541 * name="begdate",
3542 * in="query",
3543 * description="The start date for the medical problem.",
3544 * required=false,
3545 * @OA\Schema(
3546 * type="string"
3548 * ),
3549 * @OA\Parameter(
3550 * name="enddate",
3551 * in="query",
3552 * description="The end date for the medical problem.",
3553 * required=false,
3554 * @OA\Schema(
3555 * type="string"
3557 * ),
3558 * @OA\Parameter(
3559 * name="diagnosis",
3560 * in="query",
3561 * description="The diagnosis for the medical problem.",
3562 * required=false,
3563 * @OA\Schema(
3564 * type="string"
3566 * ),
3567 * @OA\Response(
3568 * response="200",
3569 * ref="#/components/responses/standard"
3570 * ),
3571 * @OA\Response(
3572 * response="400",
3573 * ref="#/components/responses/badrequest"
3574 * ),
3575 * @OA\Response(
3576 * response="401",
3577 * ref="#/components/responses/unauthorized"
3578 * ),
3579 * security={{"openemr_auth":{}}}
3582 "GET /api/medical_problem" => function () {
3583 RestConfig::authorization_check("encounters", "notes");
3584 $return = (new ConditionRestController())->getAll();
3585 RestConfig::apiLog($return);
3586 return $return;
3590 * @OA\Get(
3591 * path="/api/medical_problem/{muuid}",
3592 * description="Retrieves a single medical problem by their uuid",
3593 * tags={"standard"},
3594 * @OA\Parameter(
3595 * name="muuid",
3596 * in="path",
3597 * description="The uuid for the medical problem.",
3598 * required=true,
3599 * @OA\Schema(
3600 * type="string"
3602 * ),
3603 * @OA\Response(
3604 * response="200",
3605 * ref="#/components/responses/standard"
3606 * ),
3607 * @OA\Response(
3608 * response="400",
3609 * ref="#/components/responses/badrequest"
3610 * ),
3611 * @OA\Response(
3612 * response="401",
3613 * ref="#/components/responses/unauthorized"
3614 * ),
3615 * security={{"openemr_auth":{}}}
3618 "GET /api/medical_problem/:muuid" => function ($muuid) {
3619 RestConfig::authorization_check("encounters", "notes");
3620 $return = (new ConditionRestController())->getOne($muuid);
3621 RestConfig::apiLog($return);
3622 return $return;
3626 * @OA\Get(
3627 * path="/api/patient/{puuid}/medical_problem",
3628 * description="Retrieves all medical problems for a patient",
3629 * tags={"standard"},
3630 * @OA\Parameter(
3631 * name="puuid",
3632 * in="path",
3633 * description="The uuid for the patient.",
3634 * required=true,
3635 * @OA\Schema(
3636 * type="string"
3638 * ),
3639 * @OA\Response(
3640 * response="200",
3641 * ref="#/components/responses/standard"
3642 * ),
3643 * @OA\Response(
3644 * response="400",
3645 * ref="#/components/responses/badrequest"
3646 * ),
3647 * @OA\Response(
3648 * response="401",
3649 * ref="#/components/responses/unauthorized"
3650 * ),
3651 * security={{"openemr_auth":{}}}
3654 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3655 RestConfig::authorization_check("encounters", "notes");
3656 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3657 RestConfig::apiLog($return);
3658 return $return;
3662 * @OA\Get(
3663 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3664 * description="Retrieves a medical problem for a patient",
3665 * tags={"standard"},
3666 * @OA\Parameter(
3667 * name="puuid",
3668 * in="path",
3669 * description="The uuid for the patient.",
3670 * required=true,
3671 * @OA\Schema(
3672 * type="string"
3674 * ),
3675 * @OA\Parameter(
3676 * name="muuid",
3677 * in="path",
3678 * description="The uuid for the medical problem.",
3679 * required=true,
3680 * @OA\Schema(
3681 * type="string"
3683 * ),
3684 * @OA\Response(
3685 * response="200",
3686 * ref="#/components/responses/standard"
3687 * ),
3688 * @OA\Response(
3689 * response="400",
3690 * ref="#/components/responses/badrequest"
3691 * ),
3692 * @OA\Response(
3693 * response="401",
3694 * ref="#/components/responses/unauthorized"
3695 * ),
3696 * security={{"openemr_auth":{}}}
3699 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3700 RestConfig::authorization_check("patients", "med");
3701 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3702 RestConfig::apiLog($return);
3703 return $return;
3707 * Schema for the medical_problem request
3709 * @OA\Schema(
3710 * schema="api_medical_problem_request",
3711 * @OA\Property(
3712 * property="title",
3713 * description="The title of medical problem.",
3714 * type="string"
3715 * ),
3716 * @OA\Property(
3717 * property="begdate",
3718 * description="The beginning date of medical problem.",
3719 * type="string"
3720 * ),
3721 * @OA\Property(
3722 * property="enddate",
3723 * description="The end date of medical problem.",
3724 * type="string"
3725 * ),
3726 * @OA\Property(
3727 * property="diagnosis",
3728 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3729 * type="string"
3730 * ),
3731 * required={"title", "begdate"},
3732 * example={
3733 * "title": "Dermatochalasis",
3734 * "begdate": "2010-10-13",
3735 * "enddate": null,
3736 * "diagnosis": "ICD10:H02.839"
3741 * @OA\Post(
3742 * path="/api/patient/{puuid}/medical_problem",
3743 * description="Submits a new medical problem",
3744 * tags={"standard"},
3745 * @OA\Parameter(
3746 * name="puuid",
3747 * in="path",
3748 * description="The uuid for the patient.",
3749 * required=true,
3750 * @OA\Schema(
3751 * type="string"
3753 * ),
3754 * @OA\RequestBody(
3755 * required=true,
3756 * @OA\MediaType(
3757 * mediaType="application/json",
3758 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3760 * ),
3761 * @OA\Response(
3762 * response="200",
3763 * ref="#/components/responses/standard"
3764 * ),
3765 * @OA\Response(
3766 * response="400",
3767 * ref="#/components/responses/badrequest"
3768 * ),
3769 * @OA\Response(
3770 * response="401",
3771 * ref="#/components/responses/unauthorized"
3772 * ),
3773 * security={{"openemr_auth":{}}}
3776 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3777 RestConfig::authorization_check("patients", "med");
3778 $data = (array) (json_decode(file_get_contents("php://input")));
3779 $return = (new ConditionRestController())->post($puuid, $data);
3780 RestConfig::apiLog($return, $data);
3781 return $return;
3785 * @OA\Put(
3786 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3787 * description="Edit a medical problem",
3788 * tags={"standard"},
3789 * @OA\Parameter(
3790 * name="puuid",
3791 * in="path",
3792 * description="The uuid for the patient.",
3793 * required=true,
3794 * @OA\Schema(
3795 * type="string"
3797 * ),
3798 * @OA\Parameter(
3799 * name="muuid",
3800 * in="path",
3801 * description="The uuid for the medical problem.",
3802 * required=true,
3803 * @OA\Schema(
3804 * type="string"
3806 * ),
3807 * @OA\RequestBody(
3808 * required=true,
3809 * @OA\MediaType(
3810 * mediaType="application/json",
3811 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3813 * ),
3814 * @OA\Response(
3815 * response="200",
3816 * ref="#/components/responses/standard"
3817 * ),
3818 * @OA\Response(
3819 * response="400",
3820 * ref="#/components/responses/badrequest"
3821 * ),
3822 * @OA\Response(
3823 * response="401",
3824 * ref="#/components/responses/unauthorized"
3825 * ),
3826 * security={{"openemr_auth":{}}}
3829 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3830 RestConfig::authorization_check("patients", "med");
3831 $data = (array) (json_decode(file_get_contents("php://input")));
3832 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3833 RestConfig::apiLog($return, $data);
3834 return $return;
3838 * @OA\Delete(
3839 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3840 * description="Delete a medical problem",
3841 * tags={"standard"},
3842 * @OA\Parameter(
3843 * name="puuid",
3844 * in="path",
3845 * description="The uuid for the patient.",
3846 * required=true,
3847 * @OA\Schema(
3848 * type="string"
3850 * ),
3851 * @OA\Parameter(
3852 * name="muuid",
3853 * in="path",
3854 * description="The uuid for the medical problem.",
3855 * required=true,
3856 * @OA\Schema(
3857 * type="string"
3859 * ),
3860 * @OA\Response(
3861 * response="200",
3862 * ref="#/components/responses/standard"
3863 * ),
3864 * @OA\Response(
3865 * response="400",
3866 * ref="#/components/responses/badrequest"
3867 * ),
3868 * @OA\Response(
3869 * response="401",
3870 * ref="#/components/responses/unauthorized"
3871 * ),
3872 * security={{"openemr_auth":{}}}
3875 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3876 RestConfig::authorization_check("patients", "med");
3877 $return = (new ConditionRestController())->delete($puuid, $muuid);
3878 RestConfig::apiLog($return);
3879 return $return;
3883 * @OA\Get(
3884 * path="/api/allergy",
3885 * description="Retrieves a list of allergies",
3886 * tags={"standard"},
3887 * @OA\Parameter(
3888 * name="lists.pid",
3889 * in="query",
3890 * description="The uuid for the patient.",
3891 * required=false,
3892 * @OA\Schema(
3893 * type="string"
3895 * ),
3896 * @OA\Parameter(
3897 * name="lists.id",
3898 * in="query",
3899 * description="The uuid for the allergy.",
3900 * required=false,
3901 * @OA\Schema(
3902 * type="string"
3904 * ),
3905 * @OA\Parameter(
3906 * name="title",
3907 * in="query",
3908 * description="The title for the allergy.",
3909 * required=false,
3910 * @OA\Schema(
3911 * type="string"
3913 * ),
3914 * @OA\Parameter(
3915 * name="begdate",
3916 * in="query",
3917 * description="The start date for the allergy.",
3918 * required=false,
3919 * @OA\Schema(
3920 * type="string"
3922 * ),
3923 * @OA\Parameter(
3924 * name="enddate",
3925 * in="query",
3926 * description="The end date for the allergy.",
3927 * required=false,
3928 * @OA\Schema(
3929 * type="string"
3931 * ),
3932 * @OA\Parameter(
3933 * name="diagnosis",
3934 * in="query",
3935 * description="The diagnosis for the allergy.",
3936 * required=false,
3937 * @OA\Schema(
3938 * type="string"
3940 * ),
3941 * @OA\Response(
3942 * response="200",
3943 * ref="#/components/responses/standard"
3944 * ),
3945 * @OA\Response(
3946 * response="400",
3947 * ref="#/components/responses/badrequest"
3948 * ),
3949 * @OA\Response(
3950 * response="401",
3951 * ref="#/components/responses/unauthorized"
3952 * ),
3953 * security={{"openemr_auth":{}}}
3956 "GET /api/allergy" => function () {
3957 RestConfig::authorization_check("patients", "med");
3958 $return = (new AllergyIntoleranceRestController())->getAll();
3959 RestConfig::apiLog($return);
3960 return $return;
3964 * @OA\Get(
3965 * path="/api/allergy/{auuid}",
3966 * description="Retrieves a single allergy by their uuid",
3967 * tags={"standard"},
3968 * @OA\Parameter(
3969 * name="auuid",
3970 * in="path",
3971 * description="The uuid for the allergy.",
3972 * required=true,
3973 * @OA\Schema(
3974 * type="string"
3976 * ),
3977 * @OA\Response(
3978 * response="200",
3979 * ref="#/components/responses/standard"
3980 * ),
3981 * @OA\Response(
3982 * response="400",
3983 * ref="#/components/responses/badrequest"
3984 * ),
3985 * @OA\Response(
3986 * response="401",
3987 * ref="#/components/responses/unauthorized"
3988 * ),
3989 * security={{"openemr_auth":{}}}
3992 "GET /api/allergy/:auuid" => function ($auuid) {
3993 RestConfig::authorization_check("patients", "med");
3994 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3995 RestConfig::apiLog($return);
3996 return $return;
4000 * @OA\Get(
4001 * path="/api/patient/{puuid}/allergy",
4002 * description="Retrieves all allergies for a patient",
4003 * tags={"standard"},
4004 * @OA\Parameter(
4005 * name="puuid",
4006 * in="path",
4007 * description="The uuid for the patient.",
4008 * required=true,
4009 * @OA\Schema(
4010 * type="string"
4012 * ),
4013 * @OA\Response(
4014 * response="200",
4015 * ref="#/components/responses/standard"
4016 * ),
4017 * @OA\Response(
4018 * response="400",
4019 * ref="#/components/responses/badrequest"
4020 * ),
4021 * @OA\Response(
4022 * response="401",
4023 * ref="#/components/responses/unauthorized"
4024 * ),
4025 * security={{"openemr_auth":{}}}
4028 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4029 RestConfig::authorization_check("patients", "med");
4030 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4031 RestConfig::apiLog($return);
4032 return $return;
4036 * @OA\Get(
4037 * path="/api/patient/{puuid}/allergy/{auuid}",
4038 * description="Retrieves a allergy for a patient",
4039 * tags={"standard"},
4040 * @OA\Parameter(
4041 * name="puuid",
4042 * in="path",
4043 * description="The uuid for the patient.",
4044 * required=true,
4045 * @OA\Schema(
4046 * type="string"
4048 * ),
4049 * @OA\Parameter(
4050 * name="auuid",
4051 * in="path",
4052 * description="The uuid for the allergy.",
4053 * required=true,
4054 * @OA\Schema(
4055 * type="string"
4057 * ),
4058 * @OA\Response(
4059 * response="200",
4060 * ref="#/components/responses/standard"
4061 * ),
4062 * @OA\Response(
4063 * response="400",
4064 * ref="#/components/responses/badrequest"
4065 * ),
4066 * @OA\Response(
4067 * response="401",
4068 * ref="#/components/responses/unauthorized"
4069 * ),
4070 * security={{"openemr_auth":{}}}
4073 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4074 RestConfig::authorization_check("patients", "med");
4075 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4076 RestConfig::apiLog($return);
4077 return $return;
4081 * Schema for the allergy request
4083 * @OA\Schema(
4084 * schema="api_allergy_request",
4085 * @OA\Property(
4086 * property="title",
4087 * description="The title of allergy.",
4088 * type="string"
4089 * ),
4090 * @OA\Property(
4091 * property="begdate",
4092 * description="The beginning date of allergy.",
4093 * type="string"
4094 * ),
4095 * @OA\Property(
4096 * property="enddate",
4097 * description="The end date of allergy.",
4098 * type="string"
4099 * ),
4100 * @OA\Property(
4101 * property="diagnosis",
4102 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4103 * type="string"
4104 * ),
4105 * required={"title", "begdate"},
4106 * example={
4107 * "title": "Iodine",
4108 * "begdate": "2010-10-13",
4109 * "enddate": null
4114 * @OA\Post(
4115 * path="/api/patient/{puuid}/allergy",
4116 * description="Submits a new allergy",
4117 * tags={"standard"},
4118 * @OA\Parameter(
4119 * name="puuid",
4120 * in="path",
4121 * description="The uuid for the patient.",
4122 * required=true,
4123 * @OA\Schema(
4124 * type="string"
4126 * ),
4127 * @OA\RequestBody(
4128 * required=true,
4129 * @OA\MediaType(
4130 * mediaType="application/json",
4131 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4133 * ),
4134 * @OA\Response(
4135 * response="200",
4136 * ref="#/components/responses/standard"
4137 * ),
4138 * @OA\Response(
4139 * response="400",
4140 * ref="#/components/responses/badrequest"
4141 * ),
4142 * @OA\Response(
4143 * response="401",
4144 * ref="#/components/responses/unauthorized"
4145 * ),
4146 * security={{"openemr_auth":{}}}
4149 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4150 RestConfig::authorization_check("patients", "med");
4151 $data = (array) (json_decode(file_get_contents("php://input")));
4152 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4153 RestConfig::apiLog($return, $data);
4154 return $return;
4158 * @OA\Put(
4159 * path="/api/patient/{puuid}/allergy/{auuid}",
4160 * description="Edit a allergy",
4161 * tags={"standard"},
4162 * @OA\Parameter(
4163 * name="puuid",
4164 * in="path",
4165 * description="The uuid for the patient.",
4166 * required=true,
4167 * @OA\Schema(
4168 * type="string"
4170 * ),
4171 * @OA\Parameter(
4172 * name="auuid",
4173 * in="path",
4174 * description="The uuid for the allergy.",
4175 * required=true,
4176 * @OA\Schema(
4177 * type="string"
4179 * ),
4180 * @OA\RequestBody(
4181 * required=true,
4182 * @OA\MediaType(
4183 * mediaType="application/json",
4184 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4186 * ),
4187 * @OA\Response(
4188 * response="200",
4189 * ref="#/components/responses/standard"
4190 * ),
4191 * @OA\Response(
4192 * response="400",
4193 * ref="#/components/responses/badrequest"
4194 * ),
4195 * @OA\Response(
4196 * response="401",
4197 * ref="#/components/responses/unauthorized"
4198 * ),
4199 * security={{"openemr_auth":{}}}
4202 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4203 RestConfig::authorization_check("patients", "med");
4204 $data = (array) (json_decode(file_get_contents("php://input")));
4205 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4206 RestConfig::apiLog($return, $data);
4207 return $return;
4211 * @OA\Delete(
4212 * path="/api/patient/{puuid}/allergy/{auuid}",
4213 * description="Delete a medical problem",
4214 * tags={"standard"},
4215 * @OA\Parameter(
4216 * name="puuid",
4217 * in="path",
4218 * description="The uuid for the patient.",
4219 * required=true,
4220 * @OA\Schema(
4221 * type="string"
4223 * ),
4224 * @OA\Parameter(
4225 * name="auuid",
4226 * in="path",
4227 * description="The uuid for the allergy.",
4228 * required=true,
4229 * @OA\Schema(
4230 * type="string"
4232 * ),
4233 * @OA\Response(
4234 * response="200",
4235 * ref="#/components/responses/standard"
4236 * ),
4237 * @OA\Response(
4238 * response="400",
4239 * ref="#/components/responses/badrequest"
4240 * ),
4241 * @OA\Response(
4242 * response="401",
4243 * ref="#/components/responses/unauthorized"
4244 * ),
4245 * security={{"openemr_auth":{}}}
4248 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4249 RestConfig::authorization_check("patients", "med");
4250 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4251 RestConfig::apiLog($return);
4252 return $return;
4256 * @OA\Get(
4257 * path="/api/patient/{pid}/medication",
4258 * description="Retrieves all medications for a patient",
4259 * tags={"standard"},
4260 * @OA\Parameter(
4261 * name="pid",
4262 * in="path",
4263 * description="The pid for the patient.",
4264 * required=true,
4265 * @OA\Schema(
4266 * type="string"
4268 * ),
4269 * @OA\Response(
4270 * response="200",
4271 * ref="#/components/responses/standard"
4272 * ),
4273 * @OA\Response(
4274 * response="400",
4275 * ref="#/components/responses/badrequest"
4276 * ),
4277 * @OA\Response(
4278 * response="401",
4279 * ref="#/components/responses/unauthorized"
4280 * ),
4281 * security={{"openemr_auth":{}}}
4284 "GET /api/patient/:pid/medication" => function ($pid) {
4285 RestConfig::authorization_check("patients", "med");
4286 $return = (new ListRestController())->getAll($pid, "medication");
4287 RestConfig::apiLog($return);
4288 return $return;
4292 * Schema for the medication request
4294 * @OA\Schema(
4295 * schema="api_medication_request",
4296 * @OA\Property(
4297 * property="title",
4298 * description="The title of medication.",
4299 * type="string"
4300 * ),
4301 * @OA\Property(
4302 * property="begdate",
4303 * description="The beginning date of medication.",
4304 * type="string"
4305 * ),
4306 * @OA\Property(
4307 * property="enddate",
4308 * description="The end date of medication.",
4309 * type="string"
4310 * ),
4311 * @OA\Property(
4312 * property="diagnosis",
4313 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4314 * type="string"
4315 * ),
4316 * required={"title", "begdate"},
4317 * example={
4318 * "title": "Norvasc",
4319 * "begdate": "2013-04-13",
4320 * "enddate": null
4325 * @OA\Post(
4326 * path="/api/patient/{pid}/medication",
4327 * description="Submits a new medication",
4328 * tags={"standard"},
4329 * @OA\Parameter(
4330 * name="pid",
4331 * in="path",
4332 * description="The pid for the patient.",
4333 * required=true,
4334 * @OA\Schema(
4335 * type="string"
4337 * ),
4338 * @OA\RequestBody(
4339 * required=true,
4340 * @OA\MediaType(
4341 * mediaType="application/json",
4342 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4344 * ),
4345 * @OA\Response(
4346 * response="200",
4347 * ref="#/components/responses/standard"
4348 * ),
4349 * @OA\Response(
4350 * response="400",
4351 * ref="#/components/responses/badrequest"
4352 * ),
4353 * @OA\Response(
4354 * response="401",
4355 * ref="#/components/responses/unauthorized"
4356 * ),
4357 * security={{"openemr_auth":{}}}
4360 "POST /api/patient/:pid/medication" => function ($pid) {
4361 RestConfig::authorization_check("patients", "med");
4362 $data = (array) (json_decode(file_get_contents("php://input")));
4363 $return = (new ListRestController())->post($pid, "medication", $data);
4364 RestConfig::apiLog($return, $data);
4365 return $return;
4369 * @OA\Put(
4370 * path="/api/patient/{pid}/medication/{mid}",
4371 * description="Edit a medication",
4372 * tags={"standard"},
4373 * @OA\Parameter(
4374 * name="pid",
4375 * in="path",
4376 * description="The pid for the patient.",
4377 * required=true,
4378 * @OA\Schema(
4379 * type="string"
4381 * ),
4382 * @OA\Parameter(
4383 * name="mid",
4384 * in="path",
4385 * description="The id for the medication.",
4386 * required=true,
4387 * @OA\Schema(
4388 * type="string"
4390 * ),
4391 * @OA\RequestBody(
4392 * required=true,
4393 * @OA\MediaType(
4394 * mediaType="application/json",
4395 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4397 * ),
4398 * @OA\Response(
4399 * response="200",
4400 * ref="#/components/responses/standard"
4401 * ),
4402 * @OA\Response(
4403 * response="400",
4404 * ref="#/components/responses/badrequest"
4405 * ),
4406 * @OA\Response(
4407 * response="401",
4408 * ref="#/components/responses/unauthorized"
4409 * ),
4410 * security={{"openemr_auth":{}}}
4413 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4414 RestConfig::authorization_check("patients", "med");
4415 $data = (array) (json_decode(file_get_contents("php://input")));
4416 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4417 RestConfig::apiLog($return, $data);
4418 return $return;
4422 * @OA\Get(
4423 * path="/api/patient/{pid}/medication/{mid}",
4424 * description="Retrieves a medication for a patient",
4425 * tags={"standard"},
4426 * @OA\Parameter(
4427 * name="pid",
4428 * in="path",
4429 * description="The id for the patient.",
4430 * required=true,
4431 * @OA\Schema(
4432 * type="string"
4434 * ),
4435 * @OA\Parameter(
4436 * name="mid",
4437 * in="path",
4438 * description="The id for the medication.",
4439 * required=true,
4440 * @OA\Schema(
4441 * type="string"
4443 * ),
4444 * @OA\Response(
4445 * response="200",
4446 * ref="#/components/responses/standard"
4447 * ),
4448 * @OA\Response(
4449 * response="400",
4450 * ref="#/components/responses/badrequest"
4451 * ),
4452 * @OA\Response(
4453 * response="401",
4454 * ref="#/components/responses/unauthorized"
4455 * ),
4456 * security={{"openemr_auth":{}}}
4459 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4460 RestConfig::authorization_check("patients", "med");
4461 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4462 RestConfig::apiLog($return);
4463 return $return;
4467 * @OA\Delete(
4468 * path="/api/patient/{pid}/medication/{mid}",
4469 * description="Delete a medication",
4470 * tags={"standard"},
4471 * @OA\Parameter(
4472 * name="pid",
4473 * in="path",
4474 * description="The id for the patient.",
4475 * required=true,
4476 * @OA\Schema(
4477 * type="string"
4479 * ),
4480 * @OA\Parameter(
4481 * name="mid",
4482 * in="path",
4483 * description="The id for the medication.",
4484 * required=true,
4485 * @OA\Schema(
4486 * type="string"
4488 * ),
4489 * @OA\Response(
4490 * response="200",
4491 * ref="#/components/responses/standard"
4492 * ),
4493 * @OA\Response(
4494 * response="400",
4495 * ref="#/components/responses/badrequest"
4496 * ),
4497 * @OA\Response(
4498 * response="401",
4499 * ref="#/components/responses/unauthorized"
4500 * ),
4501 * security={{"openemr_auth":{}}}
4504 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4505 RestConfig::authorization_check("patients", "med");
4506 $return = (new ListRestController())->delete($pid, $mid, "medication");
4507 RestConfig::apiLog($return);
4508 return $return;
4512 * @OA\Get(
4513 * path="/api/patient/{pid}/surgery",
4514 * description="Retrieves all surgeries for a patient",
4515 * tags={"standard"},
4516 * @OA\Parameter(
4517 * name="pid",
4518 * in="path",
4519 * description="The pid for the patient.",
4520 * required=true,
4521 * @OA\Schema(
4522 * type="string"
4524 * ),
4525 * @OA\Response(
4526 * response="200",
4527 * ref="#/components/responses/standard"
4528 * ),
4529 * @OA\Response(
4530 * response="400",
4531 * ref="#/components/responses/badrequest"
4532 * ),
4533 * @OA\Response(
4534 * response="401",
4535 * ref="#/components/responses/unauthorized"
4536 * ),
4537 * security={{"openemr_auth":{}}}
4540 "GET /api/patient/:pid/surgery" => function ($pid) {
4541 RestConfig::authorization_check("patients", "med");
4542 $return = (new ListRestController())->getAll($pid, "surgery");
4543 RestConfig::apiLog($return);
4544 return $return;
4548 * @OA\Get(
4549 * path="/api/patient/{pid}/surgery/{sid}",
4550 * description="Retrieves a surgery for a patient",
4551 * tags={"standard"},
4552 * @OA\Parameter(
4553 * name="pid",
4554 * in="path",
4555 * description="The id for the patient.",
4556 * required=true,
4557 * @OA\Schema(
4558 * type="string"
4560 * ),
4561 * @OA\Parameter(
4562 * name="sid",
4563 * in="path",
4564 * description="The id for the surgery.",
4565 * required=true,
4566 * @OA\Schema(
4567 * type="string"
4569 * ),
4570 * @OA\Response(
4571 * response="200",
4572 * ref="#/components/responses/standard"
4573 * ),
4574 * @OA\Response(
4575 * response="400",
4576 * ref="#/components/responses/badrequest"
4577 * ),
4578 * @OA\Response(
4579 * response="401",
4580 * ref="#/components/responses/unauthorized"
4581 * ),
4582 * security={{"openemr_auth":{}}}
4585 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4586 RestConfig::authorization_check("patients", "med");
4587 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4588 RestConfig::apiLog($return);
4589 return $return;
4593 * @OA\Delete(
4594 * path="/api/patient/{pid}/surgery/{sid}",
4595 * description="Delete a surgery",
4596 * tags={"standard"},
4597 * @OA\Parameter(
4598 * name="pid",
4599 * in="path",
4600 * description="The id for the patient.",
4601 * required=true,
4602 * @OA\Schema(
4603 * type="string"
4605 * ),
4606 * @OA\Parameter(
4607 * name="sid",
4608 * in="path",
4609 * description="The id for the surgery.",
4610 * required=true,
4611 * @OA\Schema(
4612 * type="string"
4614 * ),
4615 * @OA\Response(
4616 * response="200",
4617 * ref="#/components/responses/standard"
4618 * ),
4619 * @OA\Response(
4620 * response="400",
4621 * ref="#/components/responses/badrequest"
4622 * ),
4623 * @OA\Response(
4624 * response="401",
4625 * ref="#/components/responses/unauthorized"
4626 * ),
4627 * security={{"openemr_auth":{}}}
4630 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4631 RestConfig::authorization_check("patients", "med");
4632 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4633 RestConfig::apiLog($return);
4634 return $return;
4638 * Schema for the surgery request
4640 * @OA\Schema(
4641 * schema="api_surgery_request",
4642 * @OA\Property(
4643 * property="title",
4644 * description="The title of surgery.",
4645 * type="string"
4646 * ),
4647 * @OA\Property(
4648 * property="begdate",
4649 * description="The beginning date of surgery.",
4650 * type="string"
4651 * ),
4652 * @OA\Property(
4653 * property="enddate",
4654 * description="The end date of surgery.",
4655 * type="string"
4656 * ),
4657 * @OA\Property(
4658 * property="diagnosis",
4659 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4660 * type="string"
4661 * ),
4662 * required={"title", "begdate"},
4663 * example={
4664 * "title": "Blepharoplasty",
4665 * "begdate": "2013-10-14",
4666 * "enddate": null,
4667 * "diagnosis": "CPT4:15823-50"
4672 * @OA\Post(
4673 * path="/api/patient/{pid}/surgery",
4674 * description="Submits a new surgery",
4675 * tags={"standard"},
4676 * @OA\Parameter(
4677 * name="pid",
4678 * in="path",
4679 * description="The pid for the patient.",
4680 * required=true,
4681 * @OA\Schema(
4682 * type="string"
4684 * ),
4685 * @OA\RequestBody(
4686 * required=true,
4687 * @OA\MediaType(
4688 * mediaType="application/json",
4689 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4691 * ),
4692 * @OA\Response(
4693 * response="200",
4694 * ref="#/components/responses/standard"
4695 * ),
4696 * @OA\Response(
4697 * response="400",
4698 * ref="#/components/responses/badrequest"
4699 * ),
4700 * @OA\Response(
4701 * response="401",
4702 * ref="#/components/responses/unauthorized"
4703 * ),
4704 * security={{"openemr_auth":{}}}
4707 "POST /api/patient/:pid/surgery" => function ($pid) {
4708 RestConfig::authorization_check("patients", "med");
4709 $data = (array) (json_decode(file_get_contents("php://input")));
4710 $return = (new ListRestController())->post($pid, "surgery", $data);
4711 RestConfig::apiLog($return, $data);
4712 return $return;
4716 * @OA\Put(
4717 * path="/api/patient/{pid}/surgery/{sid}",
4718 * description="Edit a surgery",
4719 * tags={"standard"},
4720 * @OA\Parameter(
4721 * name="pid",
4722 * in="path",
4723 * description="The pid for the patient.",
4724 * required=true,
4725 * @OA\Schema(
4726 * type="string"
4728 * ),
4729 * @OA\Parameter(
4730 * name="sid",
4731 * in="path",
4732 * description="The id for the surgery.",
4733 * required=true,
4734 * @OA\Schema(
4735 * type="string"
4737 * ),
4738 * @OA\RequestBody(
4739 * required=true,
4740 * @OA\MediaType(
4741 * mediaType="application/json",
4742 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4744 * ),
4745 * @OA\Response(
4746 * response="200",
4747 * ref="#/components/responses/standard"
4748 * ),
4749 * @OA\Response(
4750 * response="400",
4751 * ref="#/components/responses/badrequest"
4752 * ),
4753 * @OA\Response(
4754 * response="401",
4755 * ref="#/components/responses/unauthorized"
4756 * ),
4757 * security={{"openemr_auth":{}}}
4760 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4761 RestConfig::authorization_check("patients", "med");
4762 $data = (array) (json_decode(file_get_contents("php://input")));
4763 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4764 RestConfig::apiLog($return, $data);
4765 return $return;
4769 * @OA\Get(
4770 * path="/api/patient/{pid}/dental_issue",
4771 * description="Retrieves all dental issues for a patient",
4772 * tags={"standard"},
4773 * @OA\Parameter(
4774 * name="pid",
4775 * in="path",
4776 * description="The pid for the patient.",
4777 * required=true,
4778 * @OA\Schema(
4779 * type="string"
4781 * ),
4782 * @OA\Response(
4783 * response="200",
4784 * ref="#/components/responses/standard"
4785 * ),
4786 * @OA\Response(
4787 * response="400",
4788 * ref="#/components/responses/badrequest"
4789 * ),
4790 * @OA\Response(
4791 * response="401",
4792 * ref="#/components/responses/unauthorized"
4793 * ),
4794 * security={{"openemr_auth":{}}}
4797 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4798 RestConfig::authorization_check("patients", "med");
4799 $return = (new ListRestController())->getAll($pid, "dental");
4800 RestConfig::apiLog($return);
4801 return $return;
4805 * @OA\Get(
4806 * path="/api/patient/{pid}/dental_issue/{did}",
4807 * description="Retrieves a dental issue for a patient",
4808 * tags={"standard"},
4809 * @OA\Parameter(
4810 * name="pid",
4811 * in="path",
4812 * description="The id for the patient.",
4813 * required=true,
4814 * @OA\Schema(
4815 * type="string"
4817 * ),
4818 * @OA\Parameter(
4819 * name="did",
4820 * in="path",
4821 * description="The id for the dental issue.",
4822 * required=true,
4823 * @OA\Schema(
4824 * type="string"
4826 * ),
4827 * @OA\Response(
4828 * response="200",
4829 * ref="#/components/responses/standard"
4830 * ),
4831 * @OA\Response(
4832 * response="400",
4833 * ref="#/components/responses/badrequest"
4834 * ),
4835 * @OA\Response(
4836 * response="401",
4837 * ref="#/components/responses/unauthorized"
4838 * ),
4839 * security={{"openemr_auth":{}}}
4842 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4843 RestConfig::authorization_check("patients", "med");
4844 $return = (new ListRestController())->getOne($pid, "dental", $did);
4845 RestConfig::apiLog($return);
4846 return $return;
4850 * @OA\Delete(
4851 * path="/api/patient/{pid}/dental_issue/{did}",
4852 * description="Delete a dental issue",
4853 * tags={"standard"},
4854 * @OA\Parameter(
4855 * name="pid",
4856 * in="path",
4857 * description="The id for the patient.",
4858 * required=true,
4859 * @OA\Schema(
4860 * type="string"
4862 * ),
4863 * @OA\Parameter(
4864 * name="did",
4865 * in="path",
4866 * description="The id for the dental issue.",
4867 * required=true,
4868 * @OA\Schema(
4869 * type="string"
4871 * ),
4872 * @OA\Response(
4873 * response="200",
4874 * ref="#/components/responses/standard"
4875 * ),
4876 * @OA\Response(
4877 * response="400",
4878 * ref="#/components/responses/badrequest"
4879 * ),
4880 * @OA\Response(
4881 * response="401",
4882 * ref="#/components/responses/unauthorized"
4883 * ),
4884 * security={{"openemr_auth":{}}}
4887 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4888 RestConfig::authorization_check("patients", "med");
4889 $return = (new ListRestController())->delete($pid, $did, "dental");
4890 RestConfig::apiLog($return);
4891 return $return;
4895 * Schema for the dental_issue request
4897 * @OA\Schema(
4898 * schema="api_dental_issue_request",
4899 * @OA\Property(
4900 * property="title",
4901 * description="The title of dental issue.",
4902 * type="string"
4903 * ),
4904 * @OA\Property(
4905 * property="begdate",
4906 * description="The beginning date of dental issue.",
4907 * type="string"
4908 * ),
4909 * @OA\Property(
4910 * property="enddate",
4911 * description="The end date of dental issue.",
4912 * type="string"
4913 * ),
4914 * @OA\Property(
4915 * property="diagnosis",
4916 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4917 * type="string"
4918 * ),
4919 * required={"title", "begdate"},
4920 * example={
4921 * "title": "Halitosis",
4922 * "begdate": "2015-03-17",
4923 * "enddate": null,
4928 * @OA\Post(
4929 * path="/api/patient/{pid}/dental_issue",
4930 * description="Submits a new dental issue",
4931 * tags={"standard"},
4932 * @OA\Parameter(
4933 * name="pid",
4934 * in="path",
4935 * description="The pid for the patient.",
4936 * required=true,
4937 * @OA\Schema(
4938 * type="string"
4940 * ),
4941 * @OA\RequestBody(
4942 * required=true,
4943 * @OA\MediaType(
4944 * mediaType="application/json",
4945 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4947 * ),
4948 * @OA\Response(
4949 * response="200",
4950 * ref="#/components/responses/standard"
4951 * ),
4952 * @OA\Response(
4953 * response="400",
4954 * ref="#/components/responses/badrequest"
4955 * ),
4956 * @OA\Response(
4957 * response="401",
4958 * ref="#/components/responses/unauthorized"
4959 * ),
4960 * security={{"openemr_auth":{}}}
4963 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4964 RestConfig::authorization_check("patients", "med");
4965 $data = (array) (json_decode(file_get_contents("php://input")));
4966 $return = (new ListRestController())->post($pid, "dental", $data);
4967 RestConfig::apiLog($return, $data);
4968 return $return;
4972 * @OA\Put(
4973 * path="/api/patient/{pid}/dental_issue/{did}",
4974 * description="Edit a dental issue",
4975 * tags={"standard"},
4976 * @OA\Parameter(
4977 * name="pid",
4978 * in="path",
4979 * description="The pid for the patient.",
4980 * required=true,
4981 * @OA\Schema(
4982 * type="string"
4984 * ),
4985 * @OA\Parameter(
4986 * name="did",
4987 * in="path",
4988 * description="The id for the dental issue.",
4989 * required=true,
4990 * @OA\Schema(
4991 * type="string"
4993 * ),
4994 * @OA\RequestBody(
4995 * required=true,
4996 * @OA\MediaType(
4997 * mediaType="application/json",
4998 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5000 * ),
5001 * @OA\Response(
5002 * response="200",
5003 * ref="#/components/responses/standard"
5004 * ),
5005 * @OA\Response(
5006 * response="400",
5007 * ref="#/components/responses/badrequest"
5008 * ),
5009 * @OA\Response(
5010 * response="401",
5011 * ref="#/components/responses/unauthorized"
5012 * ),
5013 * security={{"openemr_auth":{}}}
5016 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5017 RestConfig::authorization_check("patients", "med");
5018 $data = (array) (json_decode(file_get_contents("php://input")));
5019 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5020 RestConfig::apiLog($return, $data);
5021 return $return;
5025 * @OA\Get(
5026 * path="/api/patient/{pid}/appointment",
5027 * description="Retrieves all appointments for a patient",
5028 * tags={"standard"},
5029 * @OA\Parameter(
5030 * name="pid",
5031 * in="path",
5032 * description="The pid for the patient.",
5033 * required=true,
5034 * @OA\Schema(
5035 * type="string"
5037 * ),
5038 * @OA\Response(
5039 * response="200",
5040 * ref="#/components/responses/standard"
5041 * ),
5042 * @OA\Response(
5043 * response="400",
5044 * ref="#/components/responses/badrequest"
5045 * ),
5046 * @OA\Response(
5047 * response="401",
5048 * ref="#/components/responses/unauthorized"
5049 * ),
5050 * security={{"openemr_auth":{}}}
5053 "GET /api/patient/:pid/appointment" => function ($pid) {
5054 RestConfig::authorization_check("patients", "appt");
5055 $return = (new AppointmentRestController())->getAllForPatient($pid);
5056 RestConfig::apiLog($return);
5057 return $return;
5061 * @OA\Post(
5062 * path="/api/patient/{pid}/appointment",
5063 * description="Submits a new appointment",
5064 * tags={"standard"},
5065 * @OA\Parameter(
5066 * name="pid",
5067 * in="path",
5068 * description="The id for the patient.",
5069 * required=true,
5070 * @OA\Schema(
5071 * type="string"
5073 * ),
5074 * @OA\RequestBody(
5075 * required=true,
5076 * @OA\MediaType(
5077 * mediaType="application/json",
5078 * @OA\Schema(
5079 * @OA\Property(
5080 * property="pc_catid",
5081 * description="The category of the appointment.",
5082 * type="string"
5083 * ),
5084 * @OA\Property(
5085 * property="pc_title",
5086 * description="The title of the appointment.",
5087 * type="string"
5088 * ),
5089 * @OA\Property(
5090 * property="pc_duration",
5091 * description="The duration of the appointment.",
5092 * type="string"
5093 * ),
5094 * @OA\Property(
5095 * property="pc_hometext",
5096 * description="Comments for the appointment.",
5097 * type="string"
5098 * ),
5099 * @OA\Property(
5100 * property="pc_apptstatus",
5101 * description="use an option from resource=/api/list/apptstat",
5102 * type="string"
5103 * ),
5104 * @OA\Property(
5105 * property="pc_eventDate",
5106 * description="The date of the appointment.",
5107 * type="string"
5108 * ),
5109 * @OA\Property(
5110 * property="pc_startTime",
5111 * description="The time of the appointment.",
5112 * type="string"
5113 * ),
5114 * @OA\Property(
5115 * property="pc_facility",
5116 * description="The facility id of the appointment.",
5117 * type="string"
5118 * ),
5119 * @OA\Property(
5120 * property="pc_billing_location",
5121 * description="The billinag location id of the appointment.",
5122 * type="string"
5123 * ),
5124 * @OA\Property(
5125 * property="pc_aid",
5126 * description="The provider id for the appointment.",
5127 * type="string"
5128 * ),
5129 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5130 * example={
5131 * "pc_catid": "5",
5132 * "pc_title": "Office Visit",
5133 * "pc_duration": "900",
5134 * "pc_hometext": "Test",
5135 * "pc_apptstatus": "-",
5136 * "pc_eventDate": "2018-10-19",
5137 * "pc_startTime": "09:00",
5138 * "pc_facility": "9",
5139 * "pc_billing_location": "10",
5140 * "pc_aid": "1"
5144 * ),
5145 * @OA\Response(
5146 * response="200",
5147 * ref="#/components/responses/standard"
5148 * ),
5149 * @OA\Response(
5150 * response="400",
5151 * ref="#/components/responses/badrequest"
5152 * ),
5153 * @OA\Response(
5154 * response="401",
5155 * ref="#/components/responses/unauthorized"
5156 * ),
5157 * security={{"openemr_auth":{}}}
5160 "POST /api/patient/:pid/appointment" => function ($pid) {
5161 RestConfig::authorization_check("patients", "appt");
5162 $data = (array) (json_decode(file_get_contents("php://input")));
5163 $return = (new AppointmentRestController())->post($pid, $data);
5164 RestConfig::apiLog($return, $data);
5165 return $return;
5169 * @OA\Get(
5170 * path="/api/appointment",
5171 * description="Retrieves all appointments",
5172 * tags={"standard"},
5173 * @OA\Response(
5174 * response="200",
5175 * ref="#/components/responses/standard"
5176 * ),
5177 * @OA\Response(
5178 * response="400",
5179 * ref="#/components/responses/badrequest"
5180 * ),
5181 * @OA\Response(
5182 * response="401",
5183 * ref="#/components/responses/unauthorized"
5184 * ),
5185 * security={{"openemr_auth":{}}}
5188 "GET /api/appointment" => function () {
5189 RestConfig::authorization_check("patients", "appt");
5190 $return = (new AppointmentRestController())->getAll();
5191 RestConfig::apiLog($return);
5192 return $return;
5196 * @OA\Get(
5197 * path="/api/appointment/{eid}",
5198 * description="Retrieves an appointment",
5199 * tags={"standard"},
5200 * @OA\Parameter(
5201 * name="eid",
5202 * in="path",
5203 * description="The eid for the appointment.",
5204 * required=true,
5205 * @OA\Schema(
5206 * type="string"
5208 * ),
5209 * @OA\Response(
5210 * response="200",
5211 * ref="#/components/responses/standard"
5212 * ),
5213 * @OA\Response(
5214 * response="400",
5215 * ref="#/components/responses/badrequest"
5216 * ),
5217 * @OA\Response(
5218 * response="401",
5219 * ref="#/components/responses/unauthorized"
5220 * ),
5221 * security={{"openemr_auth":{}}}
5224 "GET /api/appointment/:eid" => function ($eid) {
5225 RestConfig::authorization_check("patients", "appt");
5226 $return = (new AppointmentRestController())->getOne($eid);
5227 RestConfig::apiLog($return);
5228 return $return;
5232 * @OA\Delete(
5233 * path="/api/patient/{pid}/appointment/{eid}",
5234 * description="Delete a appointment",
5235 * tags={"standard"},
5236 * @OA\Parameter(
5237 * name="pid",
5238 * in="path",
5239 * description="The id for the patient.",
5240 * required=true,
5241 * @OA\Schema(
5242 * type="string"
5244 * ),
5245 * @OA\Parameter(
5246 * name="eid",
5247 * in="path",
5248 * description="The eid for the appointment.",
5249 * required=true,
5250 * @OA\Schema(
5251 * type="string"
5253 * ),
5254 * @OA\Response(
5255 * response="200",
5256 * ref="#/components/responses/standard"
5257 * ),
5258 * @OA\Response(
5259 * response="400",
5260 * ref="#/components/responses/badrequest"
5261 * ),
5262 * @OA\Response(
5263 * response="401",
5264 * ref="#/components/responses/unauthorized"
5265 * ),
5266 * security={{"openemr_auth":{}}}
5269 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5270 RestConfig::authorization_check("patients", "appt");
5271 $return = (new AppointmentRestController())->delete($eid);
5272 RestConfig::apiLog($return);
5273 return $return;
5277 * @OA\Get(
5278 * path="/api/patient/{pid}/appointment/{eid}",
5279 * description="Retrieves a appointment for a patient",
5280 * tags={"standard"},
5281 * @OA\Parameter(
5282 * name="pid",
5283 * in="path",
5284 * description="The id for the patient.",
5285 * required=true,
5286 * @OA\Schema(
5287 * type="string"
5289 * ),
5290 * @OA\Parameter(
5291 * name="eid",
5292 * in="path",
5293 * description="The eid for the appointment.",
5294 * required=true,
5295 * @OA\Schema(
5296 * type="string"
5298 * ),
5299 * @OA\Response(
5300 * response="200",
5301 * ref="#/components/responses/standard"
5302 * ),
5303 * @OA\Response(
5304 * response="400",
5305 * ref="#/components/responses/badrequest"
5306 * ),
5307 * @OA\Response(
5308 * response="401",
5309 * ref="#/components/responses/unauthorized"
5310 * ),
5311 * security={{"openemr_auth":{}}}
5314 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5315 RestConfig::authorization_check("patients", "appt");
5316 $return = (new AppointmentRestController())->getOne($eid);
5317 RestConfig::apiLog($return);
5318 return $return;
5322 * @OA\Get(
5323 * path="/api/list/{list_name}",
5324 * description="Retrieves a list",
5325 * tags={"standard"},
5326 * @OA\Parameter(
5327 * name="list_name",
5328 * in="path",
5329 * description="The list_id of the list.",
5330 * required=true,
5331 * @OA\Schema(
5332 * type="string"
5334 * ),
5335 * @OA\Response(
5336 * response="200",
5337 * ref="#/components/responses/standard"
5338 * ),
5339 * @OA\Response(
5340 * response="400",
5341 * ref="#/components/responses/badrequest"
5342 * ),
5343 * @OA\Response(
5344 * response="401",
5345 * ref="#/components/responses/unauthorized"
5346 * ),
5347 * security={{"openemr_auth":{}}}
5350 "GET /api/list/:list_name" => function ($list_name) {
5351 RestConfig::authorization_check("lists", "default");
5352 $return = (new ListRestController())->getOptions($list_name);
5353 RestConfig::apiLog($return);
5354 return $return;
5358 * @OA\Get(
5359 * path="/api/user",
5360 * description="Retrieves a list of users",
5361 * tags={"standard"},
5362 * @OA\Parameter(
5363 * name="id",
5364 * in="query",
5365 * description="The id for the user.",
5366 * required=false,
5367 * @OA\Schema(
5368 * type="string"
5370 * ),
5371 * @OA\Parameter(
5372 * name="title",
5373 * in="query",
5374 * description="The title for the user.",
5375 * required=false,
5376 * @OA\Schema(
5377 * type="string"
5379 * ),
5380 * @OA\Parameter(
5381 * name="fname",
5382 * in="query",
5383 * description="The first name for the user.",
5384 * required=false,
5385 * @OA\Schema(
5386 * type="string"
5388 * ),
5389 * @OA\Parameter(
5390 * name="lname",
5391 * in="query",
5392 * description="The last name for the user.",
5393 * required=false,
5394 * @OA\Schema(
5395 * type="string"
5397 * ),
5398 * @OA\Parameter(
5399 * name="mname",
5400 * in="query",
5401 * description="The middle name for the user.",
5402 * required=false,
5403 * @OA\Schema(
5404 * type="string"
5406 * ),
5407 * @OA\Parameter(
5408 * name="federaltaxid",
5409 * in="query",
5410 * description="The federal tax id for the user.",
5411 * required=false,
5412 * @OA\Schema(
5413 * type="string"
5415 * ),
5416 * @OA\Parameter(
5417 * name="federaldrugid",
5418 * in="query",
5419 * description="The federal drug id for the user.",
5420 * required=false,
5421 * @OA\Schema(
5422 * type="string"
5424 * ),
5425 * @OA\Parameter(
5426 * name="upin",
5427 * in="query",
5428 * description="The upin for the user.",
5429 * required=false,
5430 * @OA\Schema(
5431 * type="string"
5433 * ),
5434 * @OA\Parameter(
5435 * name="facility_id",
5436 * in="query",
5437 * description="The facility id for the user.",
5438 * required=false,
5439 * @OA\Schema(
5440 * type="string"
5442 * ),
5443 * @OA\Parameter(
5444 * name="facility",
5445 * in="query",
5446 * description="The facility for the user.",
5447 * required=false,
5448 * @OA\Schema(
5449 * type="string"
5451 * ),
5452 * @OA\Parameter(
5453 * name="npi",
5454 * in="query",
5455 * description="The npi for the user.",
5456 * required=false,
5457 * @OA\Schema(
5458 * type="string"
5460 * ),
5461 * @OA\Parameter(
5462 * name="email",
5463 * in="query",
5464 * description="The email for the user.",
5465 * required=false,
5466 * @OA\Schema(
5467 * type="string"
5469 * ),
5470 * @OA\Parameter(
5471 * name="specialty",
5472 * in="query",
5473 * description="The specialty for the user.",
5474 * required=false,
5475 * @OA\Schema(
5476 * type="string"
5478 * ),
5479 * @OA\Parameter(
5480 * name="billname",
5481 * in="query",
5482 * description="The billname for the user.",
5483 * required=false,
5484 * @OA\Schema(
5485 * type="string"
5487 * ),
5488 * @OA\Parameter(
5489 * name="url",
5490 * in="query",
5491 * description="The url for the user.",
5492 * required=false,
5493 * @OA\Schema(
5494 * type="string"
5496 * ),
5497 * @OA\Parameter(
5498 * name="assistant",
5499 * in="query",
5500 * description="The assistant for the user.",
5501 * required=false,
5502 * @OA\Schema(
5503 * type="string"
5505 * ),
5506 * @OA\Parameter(
5507 * name="organization",
5508 * in="query",
5509 * description="The organization for the user.",
5510 * required=false,
5511 * @OA\Schema(
5512 * type="string"
5514 * ),
5515 * @OA\Parameter(
5516 * name="valedictory",
5517 * in="query",
5518 * description="The valedictory for the user.",
5519 * required=false,
5520 * @OA\Schema(
5521 * type="string"
5523 * ),
5524 * @OA\Parameter(
5525 * name="street",
5526 * in="query",
5527 * description="The street for the user.",
5528 * required=false,
5529 * @OA\Schema(
5530 * type="string"
5532 * ),
5533 * @OA\Parameter(
5534 * name="streetb",
5535 * in="query",
5536 * description="The street (line 2) for the user.",
5537 * required=false,
5538 * @OA\Schema(
5539 * type="string"
5541 * ),
5542 * @OA\Parameter(
5543 * name="city",
5544 * in="query",
5545 * description="The city for the user.",
5546 * required=false,
5547 * @OA\Schema(
5548 * type="string"
5550 * ),
5551 * @OA\Parameter(
5552 * name="state",
5553 * in="query",
5554 * description="The state for the user.",
5555 * required=false,
5556 * @OA\Schema(
5557 * type="string"
5559 * ),
5560 * @OA\Parameter(
5561 * name="zip",
5562 * in="query",
5563 * description="The zip for the user.",
5564 * required=false,
5565 * @OA\Schema(
5566 * type="string"
5568 * ),
5569 * @OA\Parameter(
5570 * name="phone",
5571 * in="query",
5572 * description="The phone for the user.",
5573 * required=false,
5574 * @OA\Schema(
5575 * type="string"
5577 * ),
5578 * @OA\Parameter(
5579 * name="fax",
5580 * in="query",
5581 * description="The fax for the user.",
5582 * required=false,
5583 * @OA\Schema(
5584 * type="string"
5586 * ),
5587 * @OA\Parameter(
5588 * name="phonew1",
5589 * in="query",
5590 * description="The phonew1 for the user.",
5591 * required=false,
5592 * @OA\Schema(
5593 * type="string"
5595 * ),
5596 * @OA\Parameter(
5597 * name="phonecell",
5598 * in="query",
5599 * description="The phonecell for the user.",
5600 * required=false,
5601 * @OA\Schema(
5602 * type="string"
5604 * ),
5605 * @OA\Parameter(
5606 * name="notes",
5607 * in="query",
5608 * description="The notes for the user.",
5609 * required=false,
5610 * @OA\Schema(
5611 * type="string"
5613 * ),
5614 * @OA\Parameter(
5615 * name="state_license_number2",
5616 * in="query",
5617 * description="The state license number for the user.",
5618 * required=false,
5619 * @OA\Schema(
5620 * type="string"
5622 * ),
5623 * @OA\Parameter(
5624 * name="username",
5625 * in="query",
5626 * description="The username for the user.",
5627 * required=false,
5628 * @OA\Schema(
5629 * type="string"
5631 * ),
5632 * @OA\Response(
5633 * response="200",
5634 * ref="#/components/responses/standard"
5635 * ),
5636 * @OA\Response(
5637 * response="400",
5638 * ref="#/components/responses/badrequest"
5639 * ),
5640 * @OA\Response(
5641 * response="401",
5642 * ref="#/components/responses/unauthorized"
5643 * ),
5644 * security={{"openemr_auth":{}}}
5647 "GET /api/user" => function () {
5648 RestConfig::authorization_check("admin", "users");
5649 $return = (new UserRestController())->getAll($_GET);
5650 RestConfig::apiLog($return);
5651 return $return;
5655 * @OA\Get(
5656 * path="/api/user/{uuid}",
5657 * description="Retrieves a single user by their uuid",
5658 * tags={"standard"},
5659 * @OA\Parameter(
5660 * name="uuid",
5661 * in="path",
5662 * description="The uuid for the user.",
5663 * required=true,
5664 * @OA\Schema(
5665 * type="string"
5667 * ),
5668 * @OA\Response(
5669 * response="200",
5670 * ref="#/components/responses/standard"
5671 * ),
5672 * @OA\Response(
5673 * response="400",
5674 * ref="#/components/responses/badrequest"
5675 * ),
5676 * @OA\Response(
5677 * response="401",
5678 * ref="#/components/responses/unauthorized"
5679 * ),
5680 * security={{"openemr_auth":{}}}
5683 "GET /api/user/:uuid" => function ($uuid) {
5684 RestConfig::authorization_check("admin", "users");
5685 $return = (new UserRestController())->getOne($uuid);
5686 RestConfig::apiLog($return);
5687 return $return;
5691 * @OA\Get(
5692 * path="/api/version",
5693 * description="Retrieves the OpenEMR version information",
5694 * tags={"standard"},
5695 * @OA\Response(
5696 * response="200",
5697 * ref="#/components/responses/standard"
5698 * ),
5699 * @OA\Response(
5700 * response="400",
5701 * ref="#/components/responses/badrequest"
5702 * ),
5703 * @OA\Response(
5704 * response="401",
5705 * ref="#/components/responses/unauthorized"
5706 * ),
5707 * security={{"openemr_auth":{}}}
5710 "GET /api/version" => function () {
5711 $return = (new VersionRestController())->getOne();
5712 RestConfig::apiLog($return);
5713 return $return;
5717 * @OA\Get(
5718 * path="/api/product",
5719 * description="Retrieves the OpenEMR product registration information",
5720 * tags={"standard"},
5721 * @OA\Response(
5722 * response="200",
5723 * ref="#/components/responses/standard"
5724 * ),
5725 * @OA\Response(
5726 * response="400",
5727 * ref="#/components/responses/badrequest"
5728 * ),
5729 * @OA\Response(
5730 * response="401",
5731 * ref="#/components/responses/unauthorized"
5732 * ),
5733 * security={{"openemr_auth":{}}}
5736 "GET /api/product" => function () {
5737 $return = (new ProductRegistrationRestController())->getOne();
5738 RestConfig::apiLog($return);
5739 return $return;
5743 * @OA\Get(
5744 * path="/api/insurance_company",
5745 * description="Retrieves all insurance companies",
5746 * tags={"standard"},
5747 * @OA\Response(
5748 * response="200",
5749 * ref="#/components/responses/standard"
5750 * ),
5751 * @OA\Response(
5752 * response="400",
5753 * ref="#/components/responses/badrequest"
5754 * ),
5755 * @OA\Response(
5756 * response="401",
5757 * ref="#/components/responses/unauthorized"
5758 * ),
5759 * security={{"openemr_auth":{}}}
5762 "GET /api/insurance_company" => function () {
5763 $return = (new InsuranceCompanyRestController())->getAll();
5764 RestConfig::apiLog($return);
5765 return $return;
5769 * @OA\Get(
5770 * path="/api/insurance_company/{iid}",
5771 * description="Retrieves insurance company",
5772 * tags={"standard"},
5773 * @OA\Parameter(
5774 * name="iid",
5775 * in="path",
5776 * description="The id of the insurance company.",
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/insurance_company/:iid" => function ($iid) {
5798 $return = (new InsuranceCompanyRestController())->getOne($iid);
5799 RestConfig::apiLog($return);
5800 return $return;
5804 * @OA\Get(
5805 * path="/api/insurance_type",
5806 * description="Retrieves all insurance types",
5807 * tags={"standard"},
5808 * @OA\Response(
5809 * response="200",
5810 * ref="#/components/responses/standard"
5811 * ),
5812 * @OA\Response(
5813 * response="400",
5814 * ref="#/components/responses/badrequest"
5815 * ),
5816 * @OA\Response(
5817 * response="401",
5818 * ref="#/components/responses/unauthorized"
5819 * ),
5820 * security={{"openemr_auth":{}}}
5823 "GET /api/insurance_type" => function () {
5824 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5825 RestConfig::apiLog($return);
5826 return $return;
5830 * Schema for the insurance_company request
5832 * @OA\Schema(
5833 * schema="api_insurance_company_request",
5834 * @OA\Property(
5835 * property="name",
5836 * description="The name of insurance company.",
5837 * type="string"
5838 * ),
5839 * @OA\Property(
5840 * property="attn",
5841 * description="The attn of insurance company.",
5842 * type="string"
5843 * ),
5844 * @OA\Property(
5845 * property="cms_id",
5846 * description="The cms id of insurance company.",
5847 * type="string"
5848 * ),
5849 * @OA\Property(
5850 * property="ins_type_code",
5851 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5852 * type="string"
5853 * ),
5854 * @OA\Property(
5855 * property="x12_receiver_id",
5856 * description="The x12 receiver id of insurance company.",
5857 * type="string"
5858 * ),
5859 * @OA\Property(
5860 * property="x12_default_partner_id",
5861 * description="The x12 default partner id of insurance company.",
5862 * type="string"
5863 * ),
5864 * @OA\Property(
5865 * property="alt_cms_id",
5866 * description="The alternate cms id of insurance company.",
5867 * type="string"
5868 * ),
5869 * @OA\Property(
5870 * property="line1",
5871 * description="The line1 address of insurance company.",
5872 * type="string"
5873 * ),
5874 * @OA\Property(
5875 * property="line2",
5876 * description="The line2 address of insurance company.",
5877 * type="string"
5878 * ),
5879 * @OA\Property(
5880 * property="city",
5881 * description="The city of insurance company.",
5882 * type="string"
5883 * ),
5884 * @OA\Property(
5885 * property="state",
5886 * description="The state of insurance company.",
5887 * type="string"
5888 * ),
5889 * @OA\Property(
5890 * property="zip",
5891 * description="The zip of insurance company.",
5892 * type="string"
5893 * ),
5894 * @OA\Property(
5895 * property="country",
5896 * description="The country of insurance company.",
5897 * type="string"
5898 * ),
5899 * required={"name"},
5900 * example={
5901 * "name": "Cool Insurance Company",
5902 * "attn": null,
5903 * "cms_id": null,
5904 * "ins_type_code": "2",
5905 * "x12_receiver_id": null,
5906 * "x12_default_partner_id": null,
5907 * "alt_cms_id": "",
5908 * "line1": "123 Cool Lane",
5909 * "line2": "Suite 123",
5910 * "city": "Cooltown",
5911 * "state": "CA",
5912 * "zip": "12245",
5913 * "country": "USA"
5918 * @OA\Post(
5919 * path="/api/insurance_company",
5920 * description="Submits a new insurance company",
5921 * tags={"standard"},
5922 * @OA\RequestBody(
5923 * required=true,
5924 * @OA\MediaType(
5925 * mediaType="application/json",
5926 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5928 * ),
5929 * @OA\Response(
5930 * response="200",
5931 * ref="#/components/responses/standard"
5932 * ),
5933 * @OA\Response(
5934 * response="400",
5935 * ref="#/components/responses/badrequest"
5936 * ),
5937 * @OA\Response(
5938 * response="401",
5939 * ref="#/components/responses/unauthorized"
5940 * ),
5941 * security={{"openemr_auth":{}}}
5944 "POST /api/insurance_company" => function () {
5945 $data = (array) (json_decode(file_get_contents("php://input")));
5946 $return = (new InsuranceCompanyRestController())->post($data);
5947 RestConfig::apiLog($return, $data);
5948 return $return;
5952 * @OA\Put(
5953 * path="/api/insurance_company/{iid}",
5954 * description="Edit a insurance company",
5955 * tags={"standard"},
5956 * @OA\Parameter(
5957 * name="iid",
5958 * in="path",
5959 * description="The id for the insurance company.",
5960 * required=true,
5961 * @OA\Schema(
5962 * type="string"
5964 * ),
5965 * @OA\RequestBody(
5966 * required=true,
5967 * @OA\MediaType(
5968 * mediaType="application/json",
5969 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5971 * ),
5972 * @OA\Response(
5973 * response="200",
5974 * ref="#/components/responses/standard"
5975 * ),
5976 * @OA\Response(
5977 * response="400",
5978 * ref="#/components/responses/badrequest"
5979 * ),
5980 * @OA\Response(
5981 * response="401",
5982 * ref="#/components/responses/unauthorized"
5983 * ),
5984 * security={{"openemr_auth":{}}}
5987 "PUT /api/insurance_company/:iid" => function ($iid) {
5988 $data = (array) (json_decode(file_get_contents("php://input")));
5989 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5990 RestConfig::apiLog($return, $data);
5991 return $return;
5995 * @OA\Post(
5996 * path="/api/patient/{pid}/document",
5997 * description="Submits a new patient document",
5998 * tags={"standard"},
5999 * @OA\Parameter(
6000 * name="pid",
6001 * in="path",
6002 * description="The pid for the patient.",
6003 * required=true,
6004 * @OA\Schema(
6005 * type="string"
6007 * ),
6008 * @OA\Parameter(
6009 * name="path",
6010 * in="query",
6011 * description="The category of the document.",
6012 * required=true,
6013 * @OA\Schema(
6014 * type="string"
6016 * ),
6017 * @OA\RequestBody(
6018 * required=true,
6019 * @OA\MediaType(
6020 * mediaType="multipart/form-data",
6021 * @OA\Schema(
6022 * @OA\Property(
6023 * property="document",
6024 * description="document",
6025 * type="string",
6026 * format="binary"
6027 * ),
6028 * ),
6029 * ),
6030 * ),
6031 * @OA\Response(
6032 * response="200",
6033 * ref="#/components/responses/standard"
6034 * ),
6035 * @OA\Response(
6036 * response="400",
6037 * ref="#/components/responses/badrequest"
6038 * ),
6039 * @OA\Response(
6040 * response="401",
6041 * ref="#/components/responses/unauthorized"
6042 * ),
6043 * security={{"openemr_auth":{}}}
6046 "POST /api/patient/:pid/document" => function ($pid) {
6047 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6048 RestConfig::apiLog($return);
6049 return $return;
6053 * @OA\Get(
6054 * path="/api/patient/{pid}/document",
6055 * description="Retrieves all file information of documents from a category for a patient",
6056 * tags={"standard"},
6057 * @OA\Parameter(
6058 * name="pid",
6059 * in="path",
6060 * description="The pid for the patient.",
6061 * required=true,
6062 * @OA\Schema(
6063 * type="string"
6065 * ),
6066 * @OA\Parameter(
6067 * name="path",
6068 * in="query",
6069 * description="The category of the documents.",
6070 * required=true,
6071 * @OA\Schema(
6072 * type="string"
6074 * ),
6075 * @OA\Response(
6076 * response="200",
6077 * ref="#/components/responses/standard"
6078 * ),
6079 * @OA\Response(
6080 * response="400",
6081 * ref="#/components/responses/badrequest"
6082 * ),
6083 * @OA\Response(
6084 * response="401",
6085 * ref="#/components/responses/unauthorized"
6086 * ),
6087 * security={{"openemr_auth":{}}}
6090 "GET /api/patient/:pid/document" => function ($pid) {
6091 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6092 RestConfig::apiLog($return);
6093 return $return;
6097 * @OA\Get(
6098 * path="/api/patient/{pid}/document/{did}",
6099 * description="Retrieves a document for a patient",
6100 * tags={"standard"},
6101 * @OA\Parameter(
6102 * name="pid",
6103 * in="path",
6104 * description="The pid for the patient.",
6105 * required=true,
6106 * @OA\Schema(
6107 * type="string"
6109 * ),
6110 * @OA\Parameter(
6111 * name="did",
6112 * in="path",
6113 * description="The id for the patient document.",
6114 * required=true,
6115 * @OA\Schema(
6116 * type="string"
6118 * ),
6119 * @OA\Response(
6120 * response="200",
6121 * ref="#/components/responses/standard"
6122 * ),
6123 * @OA\Response(
6124 * response="400",
6125 * ref="#/components/responses/badrequest"
6126 * ),
6127 * @OA\Response(
6128 * response="401",
6129 * ref="#/components/responses/unauthorized"
6130 * ),
6131 * security={{"openemr_auth":{}}}
6134 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6135 $return = (new DocumentRestController())->downloadFile($pid, $did);
6136 RestConfig::apiLog($return);
6137 return $return;
6141 * @OA\Get(
6142 * path="/api/patient/{pid}/insurance",
6143 * description="Retrieves all insurances for a patient",
6144 * tags={"standard"},
6145 * @OA\Parameter(
6146 * name="pid",
6147 * in="path",
6148 * description="The pid for the patient.",
6149 * required=true,
6150 * @OA\Schema(
6151 * type="string"
6153 * ),
6154 * @OA\Response(
6155 * response="200",
6156 * ref="#/components/responses/standard"
6157 * ),
6158 * @OA\Response(
6159 * response="400",
6160 * ref="#/components/responses/badrequest"
6161 * ),
6162 * @OA\Response(
6163 * response="401",
6164 * ref="#/components/responses/unauthorized"
6165 * ),
6166 * security={{"openemr_auth":{}}}
6169 "GET /api/patient/:pid/insurance" => function ($pid) {
6170 $return = (new InsuranceRestController())->getAll($pid);
6171 RestConfig::apiLog($return);
6172 return $return;
6176 * @OA\Get(
6177 * path="/api/patient/{pid}/insurance/{type}",
6178 * description="Retrieves a insurance (by type) for a patient",
6179 * tags={"standard"},
6180 * @OA\Parameter(
6181 * name="pid",
6182 * in="path",
6183 * description="The pid for the patient.",
6184 * required=true,
6185 * @OA\Schema(
6186 * type="string"
6188 * ),
6189 * @OA\Parameter(
6190 * name="type",
6191 * in="path",
6192 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6193 * required=true,
6194 * @OA\Schema(
6195 * type="string"
6197 * ),
6198 * @OA\Response(
6199 * response="200",
6200 * ref="#/components/responses/standard"
6201 * ),
6202 * @OA\Response(
6203 * response="400",
6204 * ref="#/components/responses/badrequest"
6205 * ),
6206 * @OA\Response(
6207 * response="401",
6208 * ref="#/components/responses/unauthorized"
6209 * ),
6210 * security={{"openemr_auth":{}}}
6213 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6214 $return = (new InsuranceRestController())->getOne($pid, $type);
6215 RestConfig::apiLog($return);
6216 return $return;
6220 * Schema for the insurance request
6222 * @OA\Schema(
6223 * schema="api_insurance_request",
6224 * @OA\Property(
6225 * property="provider",
6226 * description="The insurance company id.",
6227 * type="string"
6228 * ),
6229 * @OA\Property(
6230 * property="plan_name",
6231 * description="The plan name of insurance.",
6232 * type="string"
6233 * ),
6234 * @OA\Property(
6235 * property="policy_number",
6236 * description="The policy number of insurance.",
6237 * type="string"
6238 * ),
6239 * @OA\Property(
6240 * property="group_number",
6241 * description="The group number of insurance.",
6242 * type="string"
6243 * ),
6244 * @OA\Property(
6245 * property="subscriber_lname",
6246 * description="The subscriber last name of insurance.",
6247 * type="string"
6248 * ),
6249 * @OA\Property(
6250 * property="subscriber_mname",
6251 * description="The subscriber middle name of insurance.",
6252 * type="string"
6253 * ),
6254 * @OA\Property(
6255 * property="subscriber_fname",
6256 * description="The subscriber first name of insurance.",
6257 * type="string"
6258 * ),
6259 * @OA\Property(
6260 * property="subscriber_relationship",
6261 * description="The subscriber relationship of insurance.",
6262 * type="string"
6263 * ),
6264 * @OA\Property(
6265 * property="subscriber_ss",
6266 * description="The subscriber ss number of insurance.",
6267 * type="string"
6268 * ),
6269 * @OA\Property(
6270 * property="subscriber_DOB",
6271 * description="The subscriber DOB of insurance.",
6272 * type="string"
6273 * ),
6274 * @OA\Property(
6275 * property="subscriber_street",
6276 * description="The subscriber street address of insurance.",
6277 * type="string"
6278 * ),
6279 * @OA\Property(
6280 * property="subscriber_postal_code",
6281 * description="The subscriber postal code of insurance.",
6282 * type="string"
6283 * ),
6284 * @OA\Property(
6285 * property="subscriber_city",
6286 * description="The subscriber city of insurance.",
6287 * type="string"
6288 * ),
6289 * @OA\Property(
6290 * property="subscriber_state",
6291 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6292 * type="string"
6293 * ),
6294 * @OA\Property(
6295 * property="subscriber_country",
6296 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6297 * type="string"
6298 * ),
6299 * @OA\Property(
6300 * property="subscriber_phone",
6301 * description="The subscriber phone of insurance.",
6302 * type="string"
6303 * ),
6304 * @OA\Property(
6305 * property="subscriber_employer",
6306 * description="The subscriber employer of insurance.",
6307 * type="string"
6308 * ),
6309 * @OA\Property(
6310 * property="subscriber_employer_street",
6311 * description="The subscriber employer street of insurance.",
6312 * type="string"
6313 * ),
6314 * @OA\Property(
6315 * property="subscriber_employer_postal_code",
6316 * description="The subscriber employer postal code of insurance.",
6317 * type="string"
6318 * ),
6319 * @OA\Property(
6320 * property="subscriber_employer_state",
6321 * description="The subscriber employer state of insurance.",
6322 * type="string"
6323 * ),
6324 * @OA\Property(
6325 * property="subscriber_employer_country",
6326 * description="The subscriber employer country of insurance.",
6327 * type="string"
6328 * ),
6329 * @OA\Property(
6330 * property="subscriber_employer_city",
6331 * description="The subscriber employer city of insurance.",
6332 * type="string"
6333 * ),
6334 * @OA\Property(
6335 * property="copay",
6336 * description="The copay of insurance.",
6337 * type="string"
6338 * ),
6339 * @OA\Property(
6340 * property="date",
6341 * description="The date of insurance.",
6342 * type="string"
6343 * ),
6344 * @OA\Property(
6345 * property="subscriber_sex",
6346 * description="The subscriber sex of insurance.",
6347 * type="string"
6348 * ),
6349 * @OA\Property(
6350 * property="accept_assignment",
6351 * description="The accept_assignment of insurance.",
6352 * type="string"
6353 * ),
6354 * @OA\Property(
6355 * property="policy_type",
6356 * description="The policy_type of insurance.",
6357 * type="string"
6358 * ),
6359 * 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"},
6360 * example={
6361 * "provider": "33",
6362 * "plan_name": "Some Plan",
6363 * "policy_number": "12345",
6364 * "group_number": "252412",
6365 * "subscriber_lname": "Tester",
6366 * "subscriber_mname": "Xi",
6367 * "subscriber_fname": "Foo",
6368 * "subscriber_relationship": "other",
6369 * "subscriber_ss": "234231234",
6370 * "subscriber_DOB": "2018-10-03",
6371 * "subscriber_street": "183 Cool St",
6372 * "subscriber_postal_code": "23418",
6373 * "subscriber_city": "Cooltown",
6374 * "subscriber_state": "AZ",
6375 * "subscriber_country": "USA",
6376 * "subscriber_phone": "234-598-2123",
6377 * "subscriber_employer": "Some Employer",
6378 * "subscriber_employer_street": "123 Heather Lane",
6379 * "subscriber_employer_postal_code": "23415",
6380 * "subscriber_employer_state": "AZ",
6381 * "subscriber_employer_country": "USA",
6382 * "subscriber_employer_city": "Cooltown",
6383 * "copay": "35",
6384 * "date": "2018-10-15",
6385 * "subscriber_sex": "Female",
6386 * "accept_assignment": "TRUE",
6387 * "policy_type": "a"
6392 * @OA\Post(
6393 * path="/api/patient/{pid}/insurance/{type}",
6394 * description="Submits a new patient insurance (with type)",
6395 * tags={"standard"},
6396 * @OA\Parameter(
6397 * name="pid",
6398 * in="path",
6399 * description="The pid for the patient.",
6400 * required=true,
6401 * @OA\Schema(
6402 * type="string"
6404 * ),
6405 * @OA\Parameter(
6406 * name="type",
6407 * in="path",
6408 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6409 * required=true,
6410 * @OA\Schema(
6411 * type="string"
6413 * ),
6414 * @OA\RequestBody(
6415 * required=true,
6416 * @OA\MediaType(
6417 * mediaType="application/json",
6418 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6420 * ),
6421 * @OA\Response(
6422 * response="200",
6423 * ref="#/components/responses/standard"
6424 * ),
6425 * @OA\Response(
6426 * response="400",
6427 * ref="#/components/responses/badrequest"
6428 * ),
6429 * @OA\Response(
6430 * response="401",
6431 * ref="#/components/responses/unauthorized"
6432 * ),
6433 * security={{"openemr_auth":{}}}
6436 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6437 $data = (array) (json_decode(file_get_contents("php://input")));
6438 $return = (new InsuranceRestController())->post($pid, $type, $data);
6439 RestConfig::apiLog($return, $data);
6440 return $return;
6444 * @OA\Put(
6445 * path="/api/patient/{pid}/insurance/{type}",
6446 * description="Edit a patient insurance (by type)",
6447 * tags={"standard"},
6448 * @OA\Parameter(
6449 * name="pid",
6450 * in="path",
6451 * description="The pid for the patient.",
6452 * required=true,
6453 * @OA\Schema(
6454 * type="string"
6456 * ),
6457 * @OA\Parameter(
6458 * name="type",
6459 * in="path",
6460 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6461 * required=true,
6462 * @OA\Schema(
6463 * type="string"
6465 * ),
6466 * @OA\RequestBody(
6467 * required=true,
6468 * @OA\MediaType(
6469 * mediaType="application/json",
6470 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6472 * ),
6473 * @OA\Response(
6474 * response="200",
6475 * ref="#/components/responses/standard"
6476 * ),
6477 * @OA\Response(
6478 * response="400",
6479 * ref="#/components/responses/badrequest"
6480 * ),
6481 * @OA\Response(
6482 * response="401",
6483 * ref="#/components/responses/unauthorized"
6484 * ),
6485 * security={{"openemr_auth":{}}}
6488 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6489 $data = (array) (json_decode(file_get_contents("php://input")));
6490 $return = (new InsuranceRestController())->put($pid, $type, $data);
6491 RestConfig::apiLog($return, $data);
6492 return $return;
6496 * Schema for the message request
6498 * @OA\Schema(
6499 * schema="api_message_request",
6500 * @OA\Property(
6501 * property="body",
6502 * description="The body of message.",
6503 * type="string"
6504 * ),
6505 * @OA\Property(
6506 * property="groupname",
6507 * description="The group name (usually is 'Default').",
6508 * type="string"
6509 * ),
6510 * @OA\Property(
6511 * property="from",
6512 * description="The sender of the message.",
6513 * type="string"
6514 * ),
6515 * @OA\Property(
6516 * property="to",
6517 * description="The recipient of the message.",
6518 * type="string"
6519 * ),
6520 * @OA\Property(
6521 * property="title",
6522 * description="use an option from resource=/api/list/note_type",
6523 * type="string"
6524 * ),
6525 * @OA\Property(
6526 * property="message_status",
6527 * description="use an option from resource=/api/list/message_status",
6528 * type="string"
6529 * ),
6530 * required={"body", "groupname", "from", "to", "title", "message_status"},
6531 * example={
6532 * "body": "Test 456",
6533 * "groupname": "Default",
6534 * "from": "Matthew",
6535 * "to": "admin",
6536 * "title": "Other",
6537 * "message_status": "New"
6542 * @OA\Post(
6543 * path="/api/patient/{pid}/message",
6544 * description="Submits a pnote message",
6545 * tags={"standard"},
6546 * @OA\Parameter(
6547 * name="pid",
6548 * in="path",
6549 * description="The id for the patient.",
6550 * required=true,
6551 * @OA\Schema(
6552 * type="string"
6554 * ),
6555 * @OA\RequestBody(
6556 * required=true,
6557 * @OA\MediaType(
6558 * mediaType="application/json",
6559 * @OA\Schema(ref="#/components/schemas/api_message_request")
6561 * ),
6562 * @OA\Response(
6563 * response="200",
6564 * ref="#/components/responses/standard"
6565 * ),
6566 * @OA\Response(
6567 * response="400",
6568 * ref="#/components/responses/badrequest"
6569 * ),
6570 * @OA\Response(
6571 * response="401",
6572 * ref="#/components/responses/unauthorized"
6573 * ),
6574 * security={{"openemr_auth":{}}}
6577 "POST /api/patient/:pid/message" => function ($pid) {
6578 RestConfig::authorization_check("patients", "notes");
6579 $data = (array) (json_decode(file_get_contents("php://input")));
6580 $return = (new MessageRestController())->post($pid, $data);
6581 RestConfig::apiLog($return, $data);
6582 return $return;
6586 * @OA\Get(
6587 * path="/api/patient/{pid}/transaction",
6588 * description="Get Transactions for a patient",
6589 * tags={"standard"},
6590 * @OA\Parameter(
6591 * name="pid",
6592 * in="path",
6593 * description="The pid for the patient",
6594 * required=true,
6595 * @OA\Schema(
6596 * type="string"
6598 * ),
6599 * @OA\Response(
6600 * response="200",
6601 * ref="#/components/responses/standard"
6602 * ),
6603 * @OA\Response(
6604 * response="400",
6605 * ref="#/components/responses/badrequest"
6606 * ),
6607 * @OA\Response(
6608 * response="401",
6609 * ref="#/components/responses/unauthorized"
6610 * ),
6611 * security={{"openemr_auth":{}}}
6615 "GET /api/patient/:pid/transaction" => function ($pid) {
6616 RestConfig::authorization_check("patients", "trans");
6617 $cont = new TransactionRestController();
6618 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6619 RestConfig::apiLog($return);
6620 return $return;
6624 * Schema for the transaction request
6626 * @OA\Schema(
6627 * schema="api_transaction_request",
6628 * @OA\Property(
6629 * property="message",
6630 * description="The message of the transaction.",
6631 * type="string"
6632 * ),
6633 * @OA\Property(
6634 * property="type",
6635 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6636 * type="string"
6637 * ),
6638 * @OA\Property(
6639 * property="groupname",
6640 * description="The group name (usually is 'Default').",
6641 * type="string"
6642 * ),
6643 * @OA\Property(
6644 * property="referByNpi",
6645 * description="NPI of the person creating the referral.",
6646 * type="string"
6647 * ),
6648 * @OA\Property(
6649 * property="referToNpi",
6650 * description="NPI of the person getting the referral.",
6651 * type="string"
6652 * ),
6653 * @OA\Property(
6654 * property="referDiagnosis",
6655 * description="The referral diagnosis.",
6656 * type="string"
6657 * ),
6658 * @OA\Property(
6659 * property="riskLevel",
6660 * description="The risk level. (Low, Medium, High)",
6661 * type="string"
6662 * ),
6663 * @OA\Property(
6664 * property="includeVitals",
6665 * description="Are vitals included (0,1)",
6666 * type="string"
6667 * ),
6668 * @OA\Property(
6669 * property="referralDate",
6670 * description="The date of the referral",
6671 * type="string"
6672 * ),
6673 * @OA\Property(
6674 * property="authorization",
6675 * description="The authorization for the referral",
6676 * type="string"
6677 * ),
6678 * @OA\Property(
6679 * property="visits",
6680 * description="The number of vists for the referral",
6681 * type="string"
6682 * ),
6683 * @OA\Property(
6684 * property="validFrom",
6685 * description="The date the referral is valid from",
6686 * type="string"
6687 * ),
6688 * @OA\Property(
6689 * property="validThrough",
6690 * description="The date the referral is valid through",
6691 * type="string"
6692 * ),
6693 * required={"message", "groupname", "title"},
6694 * example={
6695 * "message": "Message",
6696 * "type": "LBTref",
6697 * "groupname": "Default",
6698 * "referByNpi":"9999999999",
6699 * "referToNpi":"9999999999",
6700 * "referDiagnosis":"Diag 1",
6701 * "riskLevel":"Low",
6702 * "includeVitals":"1",
6703 * "referralDate":"2022-01-01",
6704 * "authorization":"Auth_123",
6705 * "visits": "1",
6706 * "validFrom": "2022-01-02",
6707 * "validThrough": "2022-01-03",
6708 * "body": "Reason 1"
6713 * @OA\Post(
6714 * path="/api/patient/{pid}/transaction",
6715 * description="Submits a transaction",
6716 * tags={"standard"},
6717 * @OA\Parameter(
6718 * name="pid",
6719 * in="path",
6720 * description="The pid for the patient.",
6721 * required=true,
6722 * @OA\Schema(
6723 * type="string"
6725 * ),
6726 * @OA\RequestBody(
6727 * required=true,
6728 * @OA\MediaType(
6729 * mediaType="application/json",
6730 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6732 * ),
6733 * @OA\Response(
6734 * response="200",
6735 * ref="#/components/responses/standard"
6736 * ),
6737 * @OA\Response(
6738 * response="400",
6739 * ref="#/components/responses/badrequest"
6740 * ),
6741 * @OA\Response(
6742 * response="401",
6743 * ref="#/components/responses/unauthorized"
6744 * ),
6745 * security={{"openemr_auth":{}}}
6748 "POST /api/patient/:pid/transaction" => function ($pid) {
6749 RestConfig::authorization_check("patients", "trans");
6750 $data = (array) (json_decode(file_get_contents("php://input")));
6751 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6752 RestConfig::apiLog($return, $data);
6753 return $return;
6757 * @OA\PUT(
6758 * path="/api/transaction/{tid}",
6759 * description="Updates a transaction",
6760 * tags={"standard"},
6761 * @OA\Parameter(
6762 * name="tid",
6763 * in="path",
6764 * description="The id for the transaction.",
6765 * required=true,
6766 * @OA\Schema(
6767 * type="string"
6769 * ),
6770 * @OA\RequestBody(
6771 * required=true,
6772 * @OA\MediaType(
6773 * mediaType="application/json",
6774 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6776 * ),
6777 * @OA\Response(
6778 * response="200",
6779 * ref="#/components/responses/standard"
6780 * ),
6781 * @OA\Response(
6782 * response="400",
6783 * ref="#/components/responses/badrequest"
6784 * ),
6785 * @OA\Response(
6786 * response="401",
6787 * ref="#/components/responses/unauthorized"
6788 * ),
6789 * security={{"openemr_auth":{}}}
6792 "PUT /api/transaction/:tid" => function ($tid) {
6793 RestConfig::authorization_check("patients", "trans");
6794 $data = (array) (json_decode(file_get_contents("php://input")));
6795 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6796 RestConfig::apiLog($return, $data);
6797 return $return;
6801 * @OA\Put(
6802 * path="/api/patient/{pid}/message/{mid}",
6803 * description="Edit a pnote message",
6804 * tags={"standard"},
6805 * @OA\Parameter(
6806 * name="pid",
6807 * in="path",
6808 * description="The id for the patient.",
6809 * required=true,
6810 * @OA\Schema(
6811 * type="string"
6813 * ),
6814 * @OA\Parameter(
6815 * name="mid",
6816 * in="path",
6817 * description="The id for the pnote message.",
6818 * required=true,
6819 * @OA\Schema(
6820 * type="string"
6822 * ),
6823 * @OA\RequestBody(
6824 * required=true,
6825 * @OA\MediaType(
6826 * mediaType="application/json",
6827 * @OA\Schema(ref="#/components/schemas/api_message_request")
6829 * ),
6830 * @OA\Response(
6831 * response="200",
6832 * ref="#/components/responses/standard"
6833 * ),
6834 * @OA\Response(
6835 * response="400",
6836 * ref="#/components/responses/badrequest"
6837 * ),
6838 * @OA\Response(
6839 * response="401",
6840 * ref="#/components/responses/unauthorized"
6841 * ),
6842 * security={{"openemr_auth":{}}}
6845 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6846 RestConfig::authorization_check("patients", "notes");
6847 $data = (array) (json_decode(file_get_contents("php://input")));
6848 $return = (new MessageRestController())->put($pid, $mid, $data);
6849 RestConfig::apiLog($return, $data);
6850 return $return;
6854 * @OA\Delete(
6855 * path="/api/patient/{pid}/message/{mid}",
6856 * description="Delete a pnote message",
6857 * tags={"standard"},
6858 * @OA\Parameter(
6859 * name="pid",
6860 * in="path",
6861 * description="The id for the patient.",
6862 * required=true,
6863 * @OA\Schema(
6864 * type="string"
6866 * ),
6867 * @OA\Parameter(
6868 * name="eid",
6869 * in="path",
6870 * description="The id for the pnote message.",
6871 * required=true,
6872 * @OA\Schema(
6873 * type="string"
6875 * ),
6876 * @OA\Response(
6877 * response="200",
6878 * ref="#/components/responses/standard"
6879 * ),
6880 * @OA\Response(
6881 * response="400",
6882 * ref="#/components/responses/badrequest"
6883 * ),
6884 * @OA\Response(
6885 * response="401",
6886 * ref="#/components/responses/unauthorized"
6887 * ),
6888 * security={{"openemr_auth":{}}}
6891 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6892 RestConfig::authorization_check("patients", "notes");
6893 $return = (new MessageRestController())->delete($pid, $mid);
6894 RestConfig::apiLog($return);
6895 return $return;
6899 * @OA\Get(
6900 * path="/api/immunization",
6901 * description="Retrieves a list of immunizations",
6902 * tags={"standard"},
6903 * @OA\Parameter(
6904 * name="patient_id",
6905 * in="query",
6906 * description="The pid for the patient.",
6907 * required=false,
6908 * @OA\Schema(
6909 * type="string"
6911 * ),
6912 * @OA\Parameter(
6913 * name="id",
6914 * in="query",
6915 * description="The id for the immunization.",
6916 * required=false,
6917 * @OA\Schema(
6918 * type="string"
6920 * ),
6921 * @OA\Parameter(
6922 * name="uuid",
6923 * in="query",
6924 * description="The uuid for the immunization.",
6925 * required=false,
6926 * @OA\Schema(
6927 * type="string"
6929 * ),
6930 * @OA\Parameter(
6931 * name="administered_date",
6932 * in="query",
6933 * description="The administered date for the immunization.",
6934 * required=false,
6935 * @OA\Schema(
6936 * type="string"
6938 * ),
6939 * @OA\Parameter(
6940 * name="immunization_id",
6941 * in="query",
6942 * description="The immunization list_id for the immunization.",
6943 * required=false,
6944 * @OA\Schema(
6945 * type="string"
6947 * ),
6948 * @OA\Parameter(
6949 * name="cvx_code",
6950 * in="query",
6951 * description="The cvx code for the immunization.",
6952 * required=false,
6953 * @OA\Schema(
6954 * type="string"
6956 * ),
6957 * @OA\Parameter(
6958 * name="manufacturer",
6959 * in="query",
6960 * description="The manufacturer for the immunization.",
6961 * required=false,
6962 * @OA\Schema(
6963 * type="string"
6965 * ),
6966 * @OA\Parameter(
6967 * name="lot_number",
6968 * in="query",
6969 * description="The lot number for the immunization.",
6970 * required=false,
6971 * @OA\Schema(
6972 * type="string"
6974 * ),
6975 * @OA\Parameter(
6976 * name="administered_by_id",
6977 * in="query",
6978 * description="The administered by id for the immunization.",
6979 * required=false,
6980 * @OA\Schema(
6981 * type="string"
6983 * ),
6984 * @OA\Parameter(
6985 * name="administered_by",
6986 * in="query",
6987 * description="The administered by for the immunization.",
6988 * required=false,
6989 * @OA\Schema(
6990 * type="string"
6992 * ),
6993 * @OA\Parameter(
6994 * name="education_date",
6995 * in="query",
6996 * description="The education date for the immunization.",
6997 * required=false,
6998 * @OA\Schema(
6999 * type="string"
7001 * ),
7002 * @OA\Parameter(
7003 * name="vis_date",
7004 * in="query",
7005 * description="The vis date for the immunization.",
7006 * required=false,
7007 * @OA\Schema(
7008 * type="string"
7010 * ),
7011 * @OA\Parameter(
7012 * name="note",
7013 * in="query",
7014 * description="The note for the immunization.",
7015 * required=false,
7016 * @OA\Schema(
7017 * type="string"
7019 * ),
7020 * @OA\Parameter(
7021 * name="create_date",
7022 * in="query",
7023 * description="The create date for the immunization.",
7024 * required=false,
7025 * @OA\Schema(
7026 * type="string"
7028 * ),
7029 * @OA\Parameter(
7030 * name="update_date",
7031 * in="query",
7032 * description="The update date for the immunization.",
7033 * required=false,
7034 * @OA\Schema(
7035 * type="string"
7037 * ),
7038 * @OA\Parameter(
7039 * name="created_by",
7040 * in="query",
7041 * description="The created_by for the immunization.",
7042 * required=false,
7043 * @OA\Schema(
7044 * type="string"
7046 * ),
7047 * @OA\Parameter(
7048 * name="updated_by",
7049 * in="query",
7050 * description="The updated_by for the immunization.",
7051 * required=false,
7052 * @OA\Schema(
7053 * type="string"
7055 * ),
7056 * @OA\Parameter(
7057 * name="amount_administered",
7058 * in="query",
7059 * description="The amount administered for the immunization.",
7060 * required=false,
7061 * @OA\Schema(
7062 * type="string"
7064 * ),
7065 * @OA\Parameter(
7066 * name="amount_administered_unit",
7067 * in="query",
7068 * description="The amount administered unit for the immunization.",
7069 * required=false,
7070 * @OA\Schema(
7071 * type="string"
7073 * ),
7074 * @OA\Parameter(
7075 * name="expiration_date",
7076 * in="query",
7077 * description="The expiration date for the immunization.",
7078 * required=false,
7079 * @OA\Schema(
7080 * type="string"
7082 * ),
7083 * @OA\Parameter(
7084 * name="route",
7085 * in="query",
7086 * description="The route for the immunization.",
7087 * required=false,
7088 * @OA\Schema(
7089 * type="string"
7091 * ),
7092 * @OA\Parameter(
7093 * name="administration_site",
7094 * in="query",
7095 * description="The administration site for the immunization.",
7096 * required=false,
7097 * @OA\Schema(
7098 * type="string"
7100 * ),
7101 * @OA\Parameter(
7102 * name="added_erroneously",
7103 * in="query",
7104 * description="The added_erroneously for the immunization.",
7105 * required=false,
7106 * @OA\Schema(
7107 * type="string"
7109 * ),
7110 * @OA\Parameter(
7111 * name="external_id",
7112 * in="query",
7113 * description="The external_id for the immunization.",
7114 * required=false,
7115 * @OA\Schema(
7116 * type="string"
7118 * ),
7119 * @OA\Parameter(
7120 * name="completion_status",
7121 * in="query",
7122 * description="The completion status for the immunization.",
7123 * required=false,
7124 * @OA\Schema(
7125 * type="string"
7127 * ),
7128 * @OA\Parameter(
7129 * name="information_source",
7130 * in="query",
7131 * description="The information source for the immunization.",
7132 * required=false,
7133 * @OA\Schema(
7134 * type="string"
7136 * ),
7137 * @OA\Parameter(
7138 * name="refusal_reason",
7139 * in="query",
7140 * description="The refusal reason for the immunization.",
7141 * required=false,
7142 * @OA\Schema(
7143 * type="string"
7145 * ),
7146 * @OA\Parameter(
7147 * name="ordering_provider",
7148 * in="query",
7149 * description="The ordering provider for the immunization.",
7150 * required=false,
7151 * @OA\Schema(
7152 * type="string"
7154 * ),
7155 * @OA\Response(
7156 * response="200",
7157 * ref="#/components/responses/standard"
7158 * ),
7159 * @OA\Response(
7160 * response="400",
7161 * ref="#/components/responses/badrequest"
7162 * ),
7163 * @OA\Response(
7164 * response="401",
7165 * ref="#/components/responses/unauthorized"
7166 * ),
7167 * security={{"openemr_auth":{}}}
7170 "GET /api/immunization" => function () {
7171 RestConfig::authorization_check("patients", "med");
7172 $return = (new ImmunizationRestController())->getAll($_GET);
7173 RestConfig::apiLog($return);
7174 return $return;
7178 * @OA\Get(
7179 * path="/api/immunization/{uuid}",
7180 * description="Retrieves a immunization",
7181 * tags={"standard"},
7182 * @OA\Parameter(
7183 * name="uuid",
7184 * in="path",
7185 * description="The uuid for the immunization.",
7186 * required=true,
7187 * @OA\Schema(
7188 * type="string"
7190 * ),
7191 * @OA\Response(
7192 * response="200",
7193 * ref="#/components/responses/standard"
7194 * ),
7195 * @OA\Response(
7196 * response="400",
7197 * ref="#/components/responses/badrequest"
7198 * ),
7199 * @OA\Response(
7200 * response="401",
7201 * ref="#/components/responses/unauthorized"
7202 * ),
7203 * security={{"openemr_auth":{}}}
7206 "GET /api/immunization/:uuid" => function ($uuid) {
7207 RestConfig::authorization_check("patients", "med");
7208 $return = (new ImmunizationRestController())->getOne($uuid);
7209 RestConfig::apiLog($return);
7210 return $return;
7214 * @OA\Get(
7215 * path="/api/procedure",
7216 * description="Retrieves a list of all procedures",
7217 * tags={"standard"},
7218 * @OA\Response(
7219 * response="200",
7220 * ref="#/components/responses/standard"
7221 * ),
7222 * @OA\Response(
7223 * response="400",
7224 * ref="#/components/responses/badrequest"
7225 * ),
7226 * @OA\Response(
7227 * response="401",
7228 * ref="#/components/responses/unauthorized"
7229 * ),
7230 * security={{"openemr_auth":{}}}
7233 "GET /api/procedure" => function () {
7234 RestConfig::authorization_check("patients", "med");
7235 $return = (new ProcedureRestController())->getAll();
7236 RestConfig::apiLog($return);
7237 return $return;
7241 * @OA\Get(
7242 * path="/api/procedure/{uuid}",
7243 * description="Retrieves a procedure",
7244 * tags={"standard"},
7245 * @OA\Parameter(
7246 * name="uuid",
7247 * in="path",
7248 * description="The uuid for the procedure.",
7249 * required=true,
7250 * @OA\Schema(
7251 * type="string"
7253 * ),
7254 * @OA\Response(
7255 * response="200",
7256 * ref="#/components/responses/standard"
7257 * ),
7258 * @OA\Response(
7259 * response="400",
7260 * ref="#/components/responses/badrequest"
7261 * ),
7262 * @OA\Response(
7263 * response="401",
7264 * ref="#/components/responses/unauthorized"
7265 * ),
7266 * security={{"openemr_auth":{}}}
7269 "GET /api/procedure/:uuid" => function ($uuid) {
7270 RestConfig::authorization_check("patients", "med");
7271 $return = (new ProcedureRestController())->getOne($uuid);
7272 RestConfig::apiLog($return);
7273 return $return;
7277 * @OA\Get(
7278 * path="/api/drug",
7279 * description="Retrieves a list of all drugs",
7280 * tags={"standard"},
7281 * @OA\Response(
7282 * response="200",
7283 * ref="#/components/responses/standard"
7284 * ),
7285 * @OA\Response(
7286 * response="400",
7287 * ref="#/components/responses/badrequest"
7288 * ),
7289 * @OA\Response(
7290 * response="401",
7291 * ref="#/components/responses/unauthorized"
7292 * ),
7293 * security={{"openemr_auth":{}}}
7296 "GET /api/drug" => function () {
7297 RestConfig::authorization_check("patients", "med");
7298 $return = (new DrugRestController())->getAll();
7299 RestConfig::apiLog($return);
7300 return $return;
7304 * @OA\Get(
7305 * path="/api/drug/{uuid}",
7306 * description="Retrieves a drug",
7307 * tags={"standard"},
7308 * @OA\Parameter(
7309 * name="uuid",
7310 * in="path",
7311 * description="The uuid for the drug.",
7312 * required=true,
7313 * @OA\Schema(
7314 * type="string"
7316 * ),
7317 * @OA\Response(
7318 * response="200",
7319 * ref="#/components/responses/standard"
7320 * ),
7321 * @OA\Response(
7322 * response="400",
7323 * ref="#/components/responses/badrequest"
7324 * ),
7325 * @OA\Response(
7326 * response="401",
7327 * ref="#/components/responses/unauthorized"
7328 * ),
7329 * security={{"openemr_auth":{}}}
7332 "GET /api/drug/:uuid" => function ($uuid) {
7333 RestConfig::authorization_check("patients", "med");
7334 $return = (new DrugRestController())->getOne($uuid);
7335 RestConfig::apiLog($return);
7336 return $return;
7340 * @OA\Get(
7341 * path="/api/prescription",
7342 * description="Retrieves a list of all prescriptions",
7343 * tags={"standard"},
7344 * @OA\Response(
7345 * response="200",
7346 * ref="#/components/responses/standard"
7347 * ),
7348 * @OA\Response(
7349 * response="400",
7350 * ref="#/components/responses/badrequest"
7351 * ),
7352 * @OA\Response(
7353 * response="401",
7354 * ref="#/components/responses/unauthorized"
7355 * ),
7356 * security={{"openemr_auth":{}}}
7359 "GET /api/prescription" => function () {
7360 RestConfig::authorization_check("patients", "med");
7361 $return = (new PrescriptionRestController())->getAll();
7362 RestConfig::apiLog($return);
7363 return $return;
7367 * @OA\Get(
7368 * path="/api/prescription/{uuid}",
7369 * description="Retrieves a prescription",
7370 * tags={"standard"},
7371 * @OA\Parameter(
7372 * name="uuid",
7373 * in="path",
7374 * description="The uuid for the prescription.",
7375 * required=true,
7376 * @OA\Schema(
7377 * type="string"
7379 * ),
7380 * @OA\Response(
7381 * response="200",
7382 * ref="#/components/responses/standard"
7383 * ),
7384 * @OA\Response(
7385 * response="400",
7386 * ref="#/components/responses/badrequest"
7387 * ),
7388 * @OA\Response(
7389 * response="401",
7390 * ref="#/components/responses/unauthorized"
7391 * ),
7392 * security={{"openemr_auth":{}}}
7395 "GET /api/prescription/:uuid" => function ($uuid) {
7396 RestConfig::authorization_check("patients", "med");
7397 $return = (new PrescriptionRestController())->getOne($uuid);
7398 RestConfig::apiLog($return);
7399 return $return;
7403 use OpenEMR\Common\Http\StatusCode;
7404 use OpenEMR\Common\Http\Psr17Factory;
7405 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7406 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController;
7407 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7408 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7409 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7410 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7411 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7412 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7413 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7414 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7415 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7416 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7417 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7418 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7419 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7420 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7421 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7422 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7423 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7424 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7425 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7426 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7427 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7428 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7429 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7430 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7431 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7432 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController;
7434 // Note that the fhir route includes both user role and patient role
7435 // (there is a mechanism in place to ensure patient role is binded
7436 // to only see the data of the one patient)
7437 RestConfig::$FHIR_ROUTE_MAP = array(
7439 * @OA\Get(
7440 * path="/fhir/AllergyIntolerance",
7441 * description="Returns a list of AllergyIntolerance resources.",
7442 * tags={"fhir"},
7443 * @OA\Parameter(
7444 * name="_id",
7445 * in="query",
7446 * description="The uuid for the AllergyIntolerance resource.",
7447 * required=false,
7448 * @OA\Schema(
7449 * type="string"
7451 * ),
7452 * @OA\Parameter(
7453 * name="patient",
7454 * in="query",
7455 * description="The uuid for the patient.",
7456 * required=false,
7457 * @OA\Schema(
7458 * type="string"
7460 * ),
7461 * @OA\Response(
7462 * response="200",
7463 * description="Standard Response",
7464 * @OA\MediaType(
7465 * mediaType="application/json",
7466 * @OA\Schema(
7467 * @OA\Property(
7468 * property="json object",
7469 * description="FHIR Json object.",
7470 * type="object"
7471 * ),
7472 * example={
7473 * "meta": {
7474 * "lastUpdated": "2021-09-14T09:13:51"
7475 * },
7476 * "resourceType": "Bundle",
7477 * "type": "collection",
7478 * "total": 0,
7479 * "link": {
7481 * "relation": "self",
7482 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7488 * ),
7489 * @OA\Response(
7490 * response="400",
7491 * ref="#/components/responses/badrequest"
7492 * ),
7493 * @OA\Response(
7494 * response="401",
7495 * ref="#/components/responses/unauthorized"
7496 * ),
7497 * security={{"openemr_auth":{}}}
7500 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7501 $getParams = $request->getQueryParams();
7502 if ($request->isPatientRequest()) {
7503 // only allow access to data of binded patient
7504 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7505 } else {
7506 RestConfig::authorization_check("patients", "med");
7507 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7509 RestConfig::apiLog($return);
7510 return $return;
7514 * @OA\Get(
7515 * path="/fhir/AllergyIntolerance/{uuid}",
7516 * description="Returns a single AllergyIntolerance resource.",
7517 * tags={"fhir"},
7518 * @OA\Parameter(
7519 * name="uuid",
7520 * in="path",
7521 * description="The uuid for the AllergyIntolerance resource.",
7522 * required=true,
7523 * @OA\Schema(
7524 * type="string"
7526 * ),
7527 * @OA\Response(
7528 * response="200",
7529 * description="Standard Response",
7530 * @OA\MediaType(
7531 * mediaType="application/json",
7532 * @OA\Schema(
7533 * @OA\Property(
7534 * property="json object",
7535 * description="FHIR Json object.",
7536 * type="object"
7537 * ),
7538 * example={
7539 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7540 * "meta": {
7541 * "versionId": "1",
7542 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7543 * },
7544 * "resourceType": "AllergyIntolerance",
7545 * "text": {
7546 * "status": "additional",
7547 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7548 * },
7549 * "clinicalStatus": {
7550 * "coding": {
7552 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7553 * "code": "active",
7554 * "display": "Active"
7557 * },
7558 * "verificationStatus": {
7559 * "coding": {
7561 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7562 * "code": "confirmed",
7563 * "display": "Confirmed"
7566 * },
7567 * "category": {
7568 * "medication"
7569 * },
7570 * "criticality": "low",
7571 * "code": {
7572 * "coding": {
7574 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7575 * "code": "unknown",
7576 * "display": "Unknown"
7579 * },
7580 * "patient": {
7581 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7582 * },
7583 * "reaction": {
7585 * "manifestation": {
7587 * "coding": {
7589 * "system": "http://snomed.info/sct",
7590 * "code": "422587007",
7591 * "display": "Nausea"
7593 * },
7594 * "text": "Nausea"
7602 * ),
7603 * @OA\Response(
7604 * response="400",
7605 * ref="#/components/responses/badrequest"
7606 * ),
7607 * @OA\Response(
7608 * response="401",
7609 * ref="#/components/responses/unauthorized"
7610 * ),
7611 * @OA\Response(
7612 * response="404",
7613 * ref="#/components/responses/uuidnotfound"
7614 * ),
7615 * security={{"openemr_auth":{}}}
7618 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7619 if ($request->isPatientRequest()) {
7620 // only allow access to data of binded patient
7621 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7622 } else {
7623 RestConfig::authorization_check("patients", "med");
7624 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7626 RestConfig::apiLog($return);
7627 return $return;
7631 * @OA\Get(
7632 * path="/fhir/Appointment",
7633 * description="Returns a list of Appointment resources.",
7634 * tags={"fhir"},
7635 * @OA\Parameter(
7636 * name="_id",
7637 * in="query",
7638 * description="The uuid for the Appointment resource.",
7639 * required=false,
7640 * @OA\Schema(
7641 * type="string"
7643 * ),
7644 * @OA\Parameter(
7645 * name="patient",
7646 * in="query",
7647 * description="The uuid for the patient.",
7648 * required=false,
7649 * @OA\Schema(
7650 * type="string"
7652 * ),
7653 * @OA\Response(
7654 * response="200",
7655 * description="Standard Response",
7656 * @OA\MediaType(
7657 * mediaType="application/json",
7658 * @OA\Schema(
7659 * @OA\Property(
7660 * property="json object",
7661 * description="FHIR Json object.",
7662 * type="object"
7663 * ),
7664 * example={
7665 * "meta": {
7666 * "lastUpdated": "2021-09-14T09:13:51"
7667 * },
7668 * "resourceType": "Bundle",
7669 * "type": "collection",
7670 * "total": 0,
7671 * "link": {
7673 * "relation": "self",
7674 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7680 * ),
7681 * @OA\Response(
7682 * response="400",
7683 * ref="#/components/responses/badrequest"
7684 * ),
7685 * @OA\Response(
7686 * response="401",
7687 * ref="#/components/responses/unauthorized"
7688 * ),
7689 * security={{"openemr_auth":{}}}
7692 "GET /fhir/Appointment" => function (HttpRestRequest $request) {
7693 $getParams = $request->getQueryParams();
7694 if ($request->isPatientRequest()) {
7695 // only allow access to data of binded patient
7696 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7697 } else {
7698 RestConfig::authorization_check("patients", "appt");
7699 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7701 RestConfig::apiLog($return);
7702 return $return;
7706 * @OA\Get(
7707 * path="/fhir/Appointment/{uuid}",
7708 * description="Returns a single Appointment resource.",
7709 * tags={"fhir"},
7710 * @OA\Parameter(
7711 * name="uuid",
7712 * in="path",
7713 * description="The uuid for the Appointment resource.",
7714 * required=true,
7715 * @OA\Schema(
7716 * type="string"
7718 * ),
7719 * @OA\Response(
7720 * response="200",
7721 * description="Standard Response",
7722 * @OA\MediaType(
7723 * mediaType="application/json",
7724 * @OA\Schema(
7725 * @OA\Property(
7726 * property="json object",
7727 * description="FHIR Json object.",
7728 * type="object"
7729 * ),
7730 * example={}
7733 * ),
7734 * @OA\Response(
7735 * response="400",
7736 * ref="#/components/responses/badrequest"
7737 * ),
7738 * @OA\Response(
7739 * response="401",
7740 * ref="#/components/responses/unauthorized"
7741 * ),
7742 * @OA\Response(
7743 * response="404",
7744 * ref="#/components/responses/uuidnotfound"
7745 * ),
7746 * security={{"openemr_auth":{}}}
7749 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest $request) {
7750 if ($request->isPatientRequest()) {
7751 // only allow access to data of binded patient
7752 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7753 } else {
7754 RestConfig::authorization_check("patients", "appt");
7755 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7757 RestConfig::apiLog($return);
7758 return $return;
7762 * @OA\Get(
7763 * path="/fhir/CarePlan",
7764 * description="Returns a list of CarePlan resources.",
7765 * tags={"fhir"},
7766 * @OA\Parameter(
7767 * name="_id",
7768 * in="query",
7769 * description="The uuid for the CarePlan resource.",
7770 * required=false,
7771 * @OA\Schema(
7772 * type="string"
7774 * ),
7775 * @OA\Parameter(
7776 * name="patient",
7777 * in="query",
7778 * description="The uuid for the patient.",
7779 * required=false,
7780 * @OA\Schema(
7781 * type="string"
7783 * ),
7784 * @OA\Parameter(
7785 * name="category",
7786 * in="query",
7787 * description="The category of the CarePlan resource.",
7788 * required=false,
7789 * @OA\Schema(
7790 * type="string"
7792 * ),
7793 * @OA\Response(
7794 * response="200",
7795 * description="Standard Response",
7796 * @OA\MediaType(
7797 * mediaType="application/json",
7798 * @OA\Schema(
7799 * @OA\Property(
7800 * property="json object",
7801 * description="FHIR Json object.",
7802 * type="object"
7803 * ),
7804 * example={
7805 * "meta": {
7806 * "lastUpdated": "2021-09-14T09:13:51"
7807 * },
7808 * "resourceType": "Bundle",
7809 * "type": "collection",
7810 * "total": 0,
7811 * "link": {
7813 * "relation": "self",
7814 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7820 * ),
7821 * @OA\Response(
7822 * response="400",
7823 * ref="#/components/responses/badrequest"
7824 * ),
7825 * @OA\Response(
7826 * response="401",
7827 * ref="#/components/responses/unauthorized"
7828 * ),
7829 * security={{"openemr_auth":{}}}
7832 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7833 $getParams = $request->getQueryParams();
7834 if ($request->isPatientRequest()) {
7835 // only allow access to data of binded patient
7836 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7837 } else {
7838 RestConfig::authorization_check("patients", "med");
7839 $return = (new FhirCarePlanRestController())->getAll($getParams);
7841 RestConfig::apiLog($return);
7842 return $return;
7846 * @OA\Get(
7847 * path="/fhir/CarePlan/{uuid}",
7848 * description="Returns a single CarePlan resource.",
7849 * tags={"fhir"},
7850 * @OA\Parameter(
7851 * name="uuid",
7852 * in="path",
7853 * description="The uuid for the CarePlan resource.",
7854 * required=true,
7855 * @OA\Schema(
7856 * type="string"
7858 * ),
7859 * @OA\Response(
7860 * response="200",
7861 * description="Standard Response",
7862 * @OA\MediaType(
7863 * mediaType="application/json",
7864 * @OA\Schema(
7865 * @OA\Property(
7866 * property="json object",
7867 * description="FHIR Json object.",
7868 * type="object"
7869 * ),
7870 * example={
7871 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7872 * "meta": {
7873 * "versionId": "1",
7874 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7875 * },
7876 * "resourceType": "CarePlan",
7877 * "text": {
7878 * "status": "generated",
7879 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7880 * },
7881 * "status": "active",
7882 * "intent": "plan",
7883 * "category": {
7885 * "coding": {
7887 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7888 * "code": "assess-plan"
7892 * },
7893 * "description": "Treat flu.",
7894 * "subject": {
7895 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7896 * "type": "Patient"
7901 * ),
7902 * @OA\Response(
7903 * response="400",
7904 * ref="#/components/responses/badrequest"
7905 * ),
7906 * @OA\Response(
7907 * response="401",
7908 * ref="#/components/responses/unauthorized"
7909 * ),
7910 * @OA\Response(
7911 * response="404",
7912 * ref="#/components/responses/uuidnotfound"
7913 * ),
7914 * security={{"openemr_auth":{}}}
7917 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7918 if ($request->isPatientRequest()) {
7919 // only allow access to data of binded patient
7920 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7921 } else {
7922 RestConfig::authorization_check("patients", "med");
7923 $return = (new FhirCarePlanRestController())->getOne($uuid);
7925 RestConfig::apiLog($return);
7926 return $return;
7930 * @OA\Get(
7931 * path="/fhir/CareTeam",
7932 * description="Returns a list of CareTeam resources.",
7933 * tags={"fhir"},
7934 * @OA\Parameter(
7935 * name="_id",
7936 * in="query",
7937 * description="The uuid for the CareTeam resource.",
7938 * required=false,
7939 * @OA\Schema(
7940 * type="string"
7942 * ),
7943 * @OA\Parameter(
7944 * name="patient",
7945 * in="query",
7946 * description="The uuid for the patient.",
7947 * required=false,
7948 * @OA\Schema(
7949 * type="string"
7951 * ),
7952 * @OA\Parameter(
7953 * name="status",
7954 * in="query",
7955 * description="The status of the CarePlan resource.",
7956 * required=false,
7957 * @OA\Schema(
7958 * type="string"
7960 * ),
7961 * @OA\Response(
7962 * response="200",
7963 * description="Standard Response",
7964 * @OA\MediaType(
7965 * mediaType="application/json",
7966 * @OA\Schema(
7967 * @OA\Property(
7968 * property="json object",
7969 * description="FHIR Json object.",
7970 * type="object"
7971 * ),
7972 * example={
7973 * "meta": {
7974 * "lastUpdated": "2021-09-14T09:13:51"
7975 * },
7976 * "resourceType": "Bundle",
7977 * "type": "collection",
7978 * "total": 0,
7979 * "link": {
7981 * "relation": "self",
7982 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7988 * ),
7989 * @OA\Response(
7990 * response="400",
7991 * ref="#/components/responses/badrequest"
7992 * ),
7993 * @OA\Response(
7994 * response="401",
7995 * ref="#/components/responses/unauthorized"
7996 * ),
7997 * security={{"openemr_auth":{}}}
8000 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
8001 $getParams = $request->getQueryParams();
8002 if ($request->isPatientRequest()) {
8003 // only allow access to data of binded patient
8004 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8005 } else {
8006 RestConfig::authorization_check("patients", "med");
8007 $return = (new FhirCareTeamRestController())->getAll($getParams);
8009 RestConfig::apiLog($return);
8010 return $return;
8014 * @OA\Get(
8015 * path="/fhir/CareTeam/{uuid}",
8016 * description="Returns a single CareTeam resource.",
8017 * tags={"fhir"},
8018 * @OA\Parameter(
8019 * name="uuid",
8020 * in="path",
8021 * description="The uuid for the CareTeam resource.",
8022 * required=true,
8023 * @OA\Schema(
8024 * type="string"
8026 * ),
8027 * @OA\Response(
8028 * response="200",
8029 * description="Standard Response",
8030 * @OA\MediaType(
8031 * mediaType="application/json",
8032 * @OA\Schema(
8033 * @OA\Property(
8034 * property="json object",
8035 * description="FHIR Json object.",
8036 * type="object"
8037 * ),
8038 * example={
8039 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8040 * "meta": {
8041 * "versionId": "1",
8042 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8043 * },
8044 * "resourceType": "CareTeam",
8045 * "status": "active",
8046 * "subject": {
8047 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8048 * "type": "Patient"
8049 * },
8050 * "participant": {
8052 * "role": {
8054 * "coding": {
8056 * "system": "http://nucc.org/provider-taxonomy",
8057 * "code": "102L00000X",
8058 * "display": "Psychoanalyst"
8062 * },
8063 * "member": {
8064 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8065 * "type": "Practitioner"
8066 * },
8067 * "onBehalfOf": {
8068 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8069 * "type": "Organization"
8071 * },
8073 * "role": {
8075 * "coding": {
8077 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8078 * "code": "unknown",
8079 * "display": "Unknown"
8083 * },
8084 * "member": {
8085 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8086 * "type": "Organization"
8093 * ),
8094 * @OA\Response(
8095 * response="400",
8096 * ref="#/components/responses/badrequest"
8097 * ),
8098 * @OA\Response(
8099 * response="401",
8100 * ref="#/components/responses/unauthorized"
8101 * ),
8102 * @OA\Response(
8103 * response="404",
8104 * ref="#/components/responses/uuidnotfound"
8105 * ),
8106 * security={{"openemr_auth":{}}}
8109 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
8110 if ($request->isPatientRequest()) {
8111 // only allow access to data of binded patient
8112 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8113 } else {
8114 RestConfig::authorization_check("patients", "med");
8115 $return = (new FhirCareTeamRestController())->getOne($uuid);
8117 RestConfig::apiLog($return);
8118 return $return;
8122 * @OA\Get(
8123 * path="/fhir/Condition",
8124 * description="Returns a list of Condition resources.",
8125 * tags={"fhir"},
8126 * @OA\Parameter(
8127 * name="_id",
8128 * in="query",
8129 * description="The uuid for the Condition resource.",
8130 * required=false,
8131 * @OA\Schema(
8132 * type="string"
8134 * ),
8135 * @OA\Parameter(
8136 * name="patient",
8137 * in="query",
8138 * description="The uuid for the patient.",
8139 * required=false,
8140 * @OA\Schema(
8141 * type="string"
8143 * ),
8144 * @OA\Response(
8145 * response="200",
8146 * description="Standard Response",
8147 * @OA\MediaType(
8148 * mediaType="application/json",
8149 * @OA\Schema(
8150 * @OA\Property(
8151 * property="json object",
8152 * description="FHIR Json object.",
8153 * type="object"
8154 * ),
8155 * example={
8156 * "meta": {
8157 * "lastUpdated": "2021-09-14T09:13:51"
8158 * },
8159 * "resourceType": "Bundle",
8160 * "type": "collection",
8161 * "total": 0,
8162 * "link": {
8164 * "relation": "self",
8165 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8171 * ),
8172 * @OA\Response(
8173 * response="400",
8174 * ref="#/components/responses/badrequest"
8175 * ),
8176 * @OA\Response(
8177 * response="401",
8178 * ref="#/components/responses/unauthorized"
8179 * ),
8180 * security={{"openemr_auth":{}}}
8183 "GET /fhir/Condition" => function (HttpRestRequest $request) {
8184 $getParams = $request->getQueryParams();
8185 if ($request->isPatientRequest()) {
8186 // only allow access to data of binded patient
8187 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8188 } else {
8189 RestConfig::authorization_check("patients", "med");
8190 $return = (new FhirConditionRestController())->getAll($getParams);
8192 RestConfig::apiLog($return);
8193 return $return;
8197 * @OA\Get(
8198 * path="/fhir/Condition/{uuid}",
8199 * description="Returns a single Condition resource.",
8200 * tags={"fhir"},
8201 * @OA\Parameter(
8202 * name="uuid",
8203 * in="path",
8204 * description="The uuid for the Condition resource.",
8205 * required=true,
8206 * @OA\Schema(
8207 * type="string"
8209 * ),
8210 * @OA\Response(
8211 * response="200",
8212 * description="Standard Response",
8213 * @OA\MediaType(
8214 * mediaType="application/json",
8215 * @OA\Schema(
8216 * @OA\Property(
8217 * property="json object",
8218 * description="FHIR Json object.",
8219 * type="object"
8220 * ),
8221 * example={
8222 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8223 * "meta": {
8224 * "versionId": "1",
8225 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8226 * },
8227 * "resourceType": "Condition",
8228 * "clinicalStatus": {
8229 * "coding": {
8231 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8232 * "code": "inactive",
8233 * "display": "Inactive"
8236 * },
8237 * "verificationStatus": {
8238 * "coding": {
8240 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8241 * "code": "unconfirmed",
8242 * "display": "Unconfirmed"
8245 * },
8246 * "category": {
8248 * "coding": {
8250 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8251 * "code": "problem-list-item",
8252 * "display": "Problem List Item"
8256 * },
8257 * "code": {
8258 * "coding": {
8260 * "system": "http://snomed.info/sct",
8261 * "code": "444814009",
8262 * "display": ""
8265 * },
8266 * "subject": {
8267 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8272 * ),
8273 * @OA\Response(
8274 * response="400",
8275 * ref="#/components/responses/badrequest"
8276 * ),
8277 * @OA\Response(
8278 * response="401",
8279 * ref="#/components/responses/unauthorized"
8280 * ),
8281 * @OA\Response(
8282 * response="404",
8283 * ref="#/components/responses/uuidnotfound"
8284 * ),
8285 * security={{"openemr_auth":{}}}
8288 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
8289 if ($request->isPatientRequest()) {
8290 // only allow access to data of binded patient
8291 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8292 } else {
8293 RestConfig::authorization_check("patients", "med");
8294 $return = (new FhirConditionRestController())->getOne($uuid);
8296 RestConfig::apiLog($return);
8297 return $return;
8301 * @OA\Get(
8302 * path="/fhir/Coverage",
8303 * description="Returns a list of Coverage resources.",
8304 * tags={"fhir"},
8305 * @OA\Parameter(
8306 * name="_id",
8307 * in="query",
8308 * description="The uuid for the Coverage resource.",
8309 * required=false,
8310 * @OA\Schema(
8311 * type="string"
8313 * ),
8314 * @OA\Parameter(
8315 * name="patient",
8316 * in="query",
8317 * description="The uuid for the patient.",
8318 * required=false,
8319 * @OA\Schema(
8320 * type="string"
8322 * ),
8323 * @OA\Parameter(
8324 * name="payor",
8325 * in="query",
8326 * description="The payor of the Coverage resource.",
8327 * required=false,
8328 * @OA\Schema(
8329 * type="string"
8331 * ),
8332 * @OA\Response(
8333 * response="200",
8334 * description="Standard Response",
8335 * @OA\MediaType(
8336 * mediaType="application/json",
8337 * @OA\Schema(
8338 * @OA\Property(
8339 * property="json object",
8340 * description="FHIR Json object.",
8341 * type="object"
8342 * ),
8343 * example={
8344 * "meta": {
8345 * "lastUpdated": "2021-09-14T09:13:51"
8346 * },
8347 * "resourceType": "Bundle",
8348 * "type": "collection",
8349 * "total": 0,
8350 * "link": {
8352 * "relation": "self",
8353 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8359 * ),
8360 * @OA\Response(
8361 * response="400",
8362 * ref="#/components/responses/badrequest"
8363 * ),
8364 * @OA\Response(
8365 * response="401",
8366 * ref="#/components/responses/unauthorized"
8367 * ),
8368 * security={{"openemr_auth":{}}}
8371 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
8372 if ($request->isPatientRequest()) {
8373 // only allow access to data of binded patient
8374 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8375 } else {
8376 RestConfig::authorization_check("admin", "super");
8377 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8379 RestConfig::apiLog($return);
8380 return $return;
8384 * @OA\Get(
8385 * path="/fhir/Coverage/{uuid}",
8386 * description="Returns a single Coverage resource.",
8387 * tags={"fhir"},
8388 * @OA\Parameter(
8389 * name="uuid",
8390 * in="path",
8391 * description="The uuid for the Coverage resource.",
8392 * required=true,
8393 * @OA\Schema(
8394 * type="string"
8396 * ),
8397 * @OA\Response(
8398 * response="200",
8399 * description="Standard Response",
8400 * @OA\MediaType(
8401 * mediaType="application/json",
8402 * @OA\Schema(
8403 * @OA\Property(
8404 * property="json object",
8405 * description="FHIR Json object.",
8406 * type="object"
8407 * ),
8408 * example={
8409 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8410 * "meta": {
8411 * "versionId": "1",
8412 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8413 * },
8414 * "resourceType": "Coverage",
8415 * "status": "active",
8416 * "beneficiary": {
8417 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8418 * },
8419 * "relationship": {
8420 * "coding": {
8422 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8423 * "code": ""
8430 * ),
8431 * @OA\Response(
8432 * response="400",
8433 * ref="#/components/responses/badrequest"
8434 * ),
8435 * @OA\Response(
8436 * response="401",
8437 * ref="#/components/responses/unauthorized"
8438 * ),
8439 * @OA\Response(
8440 * response="404",
8441 * ref="#/components/responses/uuidnotfound"
8442 * ),
8443 * security={{"openemr_auth":{}}}
8446 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
8447 if ($request->isPatientRequest()) {
8448 // only allow access to data of binded patient
8449 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8450 } else {
8451 RestConfig::authorization_check("admin", "super");
8452 $return = (new FhirCoverageRestController())->getOne($uuid);
8454 RestConfig::apiLog($return);
8455 return $return;
8459 * @OA\Get(
8460 * path="/fhir/Device",
8461 * description="Returns a list of Device resources.",
8462 * tags={"fhir"},
8463 * @OA\Parameter(
8464 * name="_id",
8465 * in="query",
8466 * description="The uuid for the Device resource.",
8467 * required=false,
8468 * @OA\Schema(
8469 * type="string"
8471 * ),
8472 * @OA\Parameter(
8473 * name="patient",
8474 * in="query",
8475 * description="The uuid for the patient.",
8476 * required=false,
8477 * @OA\Schema(
8478 * type="string"
8480 * ),
8481 * @OA\Response(
8482 * response="200",
8483 * description="Standard Response",
8484 * @OA\MediaType(
8485 * mediaType="application/json",
8486 * @OA\Schema(
8487 * @OA\Property(
8488 * property="json object",
8489 * description="FHIR Json object.",
8490 * type="object"
8491 * ),
8492 * example={
8493 * "meta": {
8494 * "lastUpdated": "2021-09-14T09:13:51"
8495 * },
8496 * "resourceType": "Bundle",
8497 * "type": "collection",
8498 * "total": 0,
8499 * "link": {
8501 * "relation": "self",
8502 * "url": "https://localhost:9300/apis/default/fhir/Device"
8508 * ),
8509 * @OA\Response(
8510 * response="400",
8511 * ref="#/components/responses/badrequest"
8512 * ),
8513 * @OA\Response(
8514 * response="401",
8515 * ref="#/components/responses/unauthorized"
8516 * ),
8517 * security={{"openemr_auth":{}}}
8520 "GET /fhir/Device" => function (HttpRestRequest $request) {
8521 if ($request->isPatientRequest()) {
8522 // only allow access to data of binded patient
8523 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8524 } else {
8525 RestConfig::authorization_check("admin", "super");
8526 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8528 RestConfig::apiLog($return);
8529 return $return;
8533 * @OA\Get(
8534 * path="/fhir/Device/{uuid}",
8535 * description="Returns a single Device resource.",
8536 * tags={"fhir"},
8537 * @OA\Parameter(
8538 * name="uuid",
8539 * in="path",
8540 * description="The uuid for the Device resource.",
8541 * required=true,
8542 * @OA\Schema(
8543 * type="string"
8545 * ),
8546 * @OA\Response(
8547 * response="200",
8548 * description="Standard Response",
8549 * @OA\MediaType(
8550 * mediaType="application/json",
8551 * @OA\Schema(
8552 * @OA\Property(
8553 * property="json object",
8554 * description="FHIR Json object.",
8555 * type="object"
8556 * ),
8557 * example={
8558 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8559 * "meta": {
8560 * "versionId": "1",
8561 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8562 * },
8563 * "resourceType": "Device",
8564 * "udiCarrier": {
8566 * "deviceIdentifier": "08717648200274",
8567 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8569 * },
8570 * "distinctIdentifier": "A99971312345600",
8571 * "manufactureDate": "2013-02-01",
8572 * "expirationDate": "2014-02-01",
8573 * "lotNumber": "000000000000XYZ123",
8574 * "serialNumber": "000025",
8575 * "type": {
8576 * "extension": {
8578 * "valueCode": "unknown",
8579 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8582 * },
8583 * "patient": {
8584 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8585 * "type": "Patient"
8590 * ),
8591 * @OA\Response(
8592 * response="400",
8593 * ref="#/components/responses/badrequest"
8594 * ),
8595 * @OA\Response(
8596 * response="401",
8597 * ref="#/components/responses/unauthorized"
8598 * ),
8599 * @OA\Response(
8600 * response="404",
8601 * ref="#/components/responses/uuidnotfound"
8602 * ),
8603 * security={{"openemr_auth":{}}}
8606 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8607 if ($request->isPatientRequest()) {
8608 // only allow access to data of binded patient
8609 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8610 } else {
8611 RestConfig::authorization_check("admin", "super");
8612 $return = (new FhirDeviceRestController())->getOne($uuid);
8614 RestConfig::apiLog($return);
8615 return $return;
8619 * @OA\Get(
8620 * path="/fhir/DiagnosticReport",
8621 * description="Returns a list of DiagnosticReport resources.",
8622 * tags={"fhir"},
8623 * @OA\Parameter(
8624 * name="_id",
8625 * in="query",
8626 * description="The uuid for the DiagnosticReport resource.",
8627 * required=false,
8628 * @OA\Schema(
8629 * type="string"
8631 * ),
8632 * @OA\Parameter(
8633 * name="patient",
8634 * in="query",
8635 * description="The uuid for the patient.",
8636 * required=false,
8637 * @OA\Schema(
8638 * type="string"
8640 * ),
8641 * @OA\Parameter(
8642 * name="code",
8643 * in="query",
8644 * description="The code of the DiagnosticReport resource.",
8645 * required=false,
8646 * @OA\Schema(
8647 * type="string"
8649 * ),
8650 * @OA\Parameter(
8651 * name="category",
8652 * in="query",
8653 * description="The category of the DiagnosticReport resource.",
8654 * required=false,
8655 * @OA\Schema(
8656 * type="string"
8658 * ),
8659 * @OA\Parameter(
8660 * name="date",
8661 * in="query",
8662 * description="The datetime of the DiagnosticReport resource.",
8663 * required=false,
8664 * @OA\Schema(
8665 * type="string"
8667 * ),
8668 * @OA\Response(
8669 * response="200",
8670 * description="Standard Response",
8671 * @OA\MediaType(
8672 * mediaType="application/json",
8673 * @OA\Schema(
8674 * @OA\Property(
8675 * property="json object",
8676 * description="FHIR Json object.",
8677 * type="object"
8678 * ),
8679 * example={
8680 * "meta": {
8681 * "lastUpdated": "2021-09-14T09:13:51"
8682 * },
8683 * "resourceType": "Bundle",
8684 * "type": "collection",
8685 * "total": 0,
8686 * "link": {
8688 * "relation": "self",
8689 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8695 * ),
8696 * @OA\Response(
8697 * response="400",
8698 * ref="#/components/responses/badrequest"
8699 * ),
8700 * @OA\Response(
8701 * response="401",
8702 * ref="#/components/responses/unauthorized"
8703 * ),
8704 * security={{"openemr_auth":{}}}
8707 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8708 $getParams = $request->getQueryParams();
8709 if ($request->isPatientRequest()) {
8710 // only allow access to data of binded patient
8711 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8712 } else {
8713 RestConfig::authorization_check("admin", "super");
8714 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8716 RestConfig::apiLog($return);
8717 return $return;
8721 * @OA\Get(
8722 * path="/fhir/DiagnosticReport/{uuid}",
8723 * description="Returns a single DiagnosticReport resource.",
8724 * tags={"fhir"},
8725 * @OA\Parameter(
8726 * name="uuid",
8727 * in="path",
8728 * description="The uuid for the DiagnosticReport resource.",
8729 * required=true,
8730 * @OA\Schema(
8731 * type="string"
8733 * ),
8734 * @OA\Response(
8735 * response="200",
8736 * description="Standard Response",
8737 * @OA\MediaType(
8738 * mediaType="application/json",
8739 * @OA\Schema(
8740 * @OA\Property(
8741 * property="json object",
8742 * description="FHIR Json object.",
8743 * type="object"
8744 * ),
8745 * example={
8746 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8747 * "meta": {
8748 * "versionId": "1",
8749 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8750 * },
8751 * "resourceType": "DiagnosticReport",
8752 * "status": "final",
8753 * "category": {
8755 * "coding": {
8757 * "system": "http://loinc.org",
8758 * "code": "LP7839-6",
8759 * "display": "Pathology"
8763 * },
8764 * "code": {
8765 * "coding": {
8767 * "system": "http://loinc.org",
8768 * "code": "11502-2",
8769 * "display": "Laboratory report"
8772 * },
8773 * "subject": {
8774 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8775 * "type": "Patient"
8776 * },
8777 * "encounter": {
8778 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8779 * "type": "Encounter"
8780 * },
8781 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8782 * "issued": "2015-06-22T00:00:00+00:00",
8783 * "performer": {
8785 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8786 * "type": "Organization"
8788 * },
8789 * "presentedForm": {
8791 * "contentType": "text/plain",
8792 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8798 * ),
8799 * @OA\Response(
8800 * response="400",
8801 * ref="#/components/responses/badrequest"
8802 * ),
8803 * @OA\Response(
8804 * response="401",
8805 * ref="#/components/responses/unauthorized"
8806 * ),
8807 * @OA\Response(
8808 * response="404",
8809 * ref="#/components/responses/uuidnotfound"
8810 * ),
8811 * security={{"openemr_auth":{}}}
8814 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8815 $getParams = $request->getQueryParams();
8816 if ($request->isPatientRequest()) {
8817 // only allow access to data of binded patient
8818 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8819 } else {
8820 RestConfig::authorization_check("admin", "super");
8821 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8823 RestConfig::apiLog($return);
8824 return $return;
8828 * @OA\Get(
8829 * path="/fhir/DocumentReference",
8830 * description="Returns a list of DocumentReference resources.",
8831 * tags={"fhir"},
8832 * @OA\Parameter(
8833 * name="_id",
8834 * in="query",
8835 * description="The uuid for the DocumentReference resource.",
8836 * required=false,
8837 * @OA\Schema(
8838 * type="string"
8840 * ),
8841 * @OA\Parameter(
8842 * name="patient",
8843 * in="query",
8844 * description="The uuid for the patient.",
8845 * required=false,
8846 * @OA\Schema(
8847 * type="string"
8849 * ),
8850 * @OA\Parameter(
8851 * name="type",
8852 * in="query",
8853 * description="The type of the DocumentReference resource.",
8854 * required=false,
8855 * @OA\Schema(
8856 * type="string"
8858 * ),
8859 * @OA\Parameter(
8860 * name="category",
8861 * in="query",
8862 * description="The category of the DocumentReference resource.",
8863 * required=false,
8864 * @OA\Schema(
8865 * type="string"
8867 * ),
8868 * @OA\Parameter(
8869 * name="date",
8870 * in="query",
8871 * description="The datetime of the DocumentReference resource.",
8872 * required=false,
8873 * @OA\Schema(
8874 * type="string"
8876 * ),
8877 * @OA\Response(
8878 * response="200",
8879 * description="Standard Response",
8880 * @OA\MediaType(
8881 * mediaType="application/json",
8882 * @OA\Schema(
8883 * @OA\Property(
8884 * property="json object",
8885 * description="FHIR Json object.",
8886 * type="object"
8887 * ),
8888 * example={
8889 * "meta": {
8890 * "lastUpdated": "2021-09-14T09:13:51"
8891 * },
8892 * "resourceType": "Bundle",
8893 * "type": "collection",
8894 * "total": 0,
8895 * "link": {
8897 * "relation": "self",
8898 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8904 * ),
8905 * @OA\Response(
8906 * response="400",
8907 * ref="#/components/responses/badrequest"
8908 * ),
8909 * @OA\Response(
8910 * response="401",
8911 * ref="#/components/responses/unauthorized"
8912 * ),
8913 * security={{"openemr_auth":{}}}
8916 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8917 $getParams = $request->getQueryParams();
8918 if ($request->isPatientRequest()) {
8919 // only allow access to data of binded patient
8920 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8921 } else {
8922 RestConfig::authorization_check("admin", "super");
8923 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8925 RestConfig::apiLog($return);
8926 return $return;
8930 * @OA\POST(
8931 * path="/fhir/DocumentReference/$docref",
8932 * 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.",
8933 * tags={"fhir"},
8934 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8935 * @OA\Parameter(
8936 * name="patient",
8937 * in="query",
8938 * description="The uuid for the patient.",
8939 * required=true,
8940 * @OA\Schema(
8941 * type="string"
8943 * ),
8944 * @OA\Parameter(
8945 * name="start",
8946 * in="query",
8947 * 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.",
8948 * required=false,
8949 * @OA\Schema(
8950 * type="string"
8952 * ),
8953 * @OA\Parameter(
8954 * name="end",
8955 * in="query",
8956 * 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.",
8957 * required=false,
8958 * @OA\Schema(
8959 * type="string"
8961 * ),
8962 * @OA\Parameter(
8963 * name="type",
8964 * in="query",
8965 * 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).",
8966 * required=false,
8967 * @OA\Schema(
8968 * type="string"
8970 * ),
8971 * @OA\Response(
8972 * response="200",
8973 * description="A search bundle of DocumentReferences is returned"
8974 * ),
8975 * @OA\Response(
8976 * response="400",
8977 * ref="#/components/responses/badrequest"
8978 * ),
8979 * @OA\Response(
8980 * response="401",
8981 * ref="#/components/responses/unauthorized"
8982 * ),
8983 * security={{"openemr_auth":{}}}
8986 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
8988 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
8989 if ($request->isPatientRequest()) {
8990 // only allow access to data of binded patient
8991 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8992 } else {
8993 // TODO: it seems like regular users should be able to grab authorship / provenance information
8994 RestConfig::authorization_check("patients", "demo");
8995 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
8997 RestConfig::apiLog($return);
8998 return $return;
9002 * @OA\Get(
9003 * path="/fhir/DocumentReference/{uuid}",
9004 * description="Returns a single DocumentReference resource.",
9005 * tags={"fhir"},
9006 * @OA\Parameter(
9007 * name="uuid",
9008 * in="path",
9009 * description="The uuid for the DocumentReference resource.",
9010 * required=true,
9011 * @OA\Schema(
9012 * type="string"
9014 * ),
9015 * @OA\Response(
9016 * response="200",
9017 * description="Standard Response",
9018 * @OA\MediaType(
9019 * mediaType="application/json",
9020 * @OA\Schema(
9021 * @OA\Property(
9022 * property="json object",
9023 * description="FHIR Json object.",
9024 * type="object"
9025 * ),
9026 * example={
9027 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9028 * "meta": {
9029 * "versionId": "1",
9030 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9031 * },
9032 * "resourceType": "DocumentReference",
9033 * "identifier": {
9035 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9037 * },
9038 * "status": "current",
9039 * "type": {
9040 * "coding": {
9042 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9043 * "code": "UNK",
9044 * "display": "unknown"
9047 * },
9048 * "category": {
9050 * "coding": {
9052 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9053 * "code": "openemr-document",
9054 * "display": "OpenEMR Document"
9058 * },
9059 * "subject": {
9060 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9061 * "type": "Patient"
9062 * },
9063 * "date": "2021-09-19T03:15:56+00:00",
9064 * "author": {
9065 * null
9066 * },
9067 * "content": {
9069 * "attachment": {
9070 * "contentType": "image/gif",
9071 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9072 * },
9073 * "format": {
9074 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9075 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9076 * "display": "mimeType Sufficient"
9083 * ),
9084 * @OA\Response(
9085 * response="400",
9086 * ref="#/components/responses/badrequest"
9087 * ),
9088 * @OA\Response(
9089 * response="401",
9090 * ref="#/components/responses/unauthorized"
9091 * ),
9092 * @OA\Response(
9093 * response="404",
9094 * ref="#/components/responses/uuidnotfound"
9095 * ),
9096 * security={{"openemr_auth":{}}}
9099 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
9100 $getParams = $request->getQueryParams();
9101 if ($request->isPatientRequest()) {
9102 // only allow access to data of binded patient
9103 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9104 } else {
9105 RestConfig::authorization_check("admin", "super");
9106 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9108 RestConfig::apiLog($return);
9109 return $return;
9113 * @OA\Get(
9114 * path="/fhir/Binary/{id}",
9115 * 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>",
9116 * tags={"fhir"},
9117 * @OA\Parameter(
9118 * name="id",
9119 * in="path",
9120 * description="The id for the Document.",
9121 * required=true,
9122 * @OA\Schema(
9123 * type="string"
9125 * ),
9126 * @OA\Response(
9127 * response="200",
9128 * 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>"
9129 * ),
9130 * @OA\Response(
9131 * response="400",
9132 * ref="#/components/responses/badrequest"
9133 * ),
9134 * @OA\Response(
9135 * response="401",
9136 * ref="#/components/responses/unauthorized"
9137 * ),
9138 * security={{"openemr_auth":{}}}
9141 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest $request) {
9142 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
9144 if ($request->isPatientRequest()) {
9145 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9146 } else {
9147 RestConfig::authorization_check("admin", "users");
9148 $response = $docController->downloadDocument($documentId);
9151 return $response;
9155 * @OA\Get(
9156 * path="/fhir/Encounter",
9157 * description="Returns a list of Encounter resources.",
9158 * tags={"fhir"},
9159 * @OA\Parameter(
9160 * name="_id",
9161 * in="query",
9162 * description="The uuid for the Encounter resource.",
9163 * required=false,
9164 * @OA\Schema(
9165 * type="string"
9167 * ),
9168 * @OA\Parameter(
9169 * name="patient",
9170 * in="query",
9171 * description="The uuid for the patient.",
9172 * required=false,
9173 * @OA\Schema(
9174 * type="string"
9176 * ),
9177 * @OA\Parameter(
9178 * name="date",
9179 * in="query",
9180 * description="The datetime of the Encounter resource.",
9181 * required=false,
9182 * @OA\Schema(
9183 * type="string"
9185 * ),
9186 * @OA\Response(
9187 * response="200",
9188 * description="Standard Response",
9189 * @OA\MediaType(
9190 * mediaType="application/json",
9191 * @OA\Schema(
9192 * @OA\Property(
9193 * property="json object",
9194 * description="FHIR Json object.",
9195 * type="object"
9196 * ),
9197 * example={
9198 * "meta": {
9199 * "lastUpdated": "2021-09-14T09:13:51"
9200 * },
9201 * "resourceType": "Bundle",
9202 * "type": "collection",
9203 * "total": 0,
9204 * "link": {
9206 * "relation": "self",
9207 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9213 * ),
9214 * @OA\Response(
9215 * response="400",
9216 * ref="#/components/responses/badrequest"
9217 * ),
9218 * @OA\Response(
9219 * response="401",
9220 * ref="#/components/responses/unauthorized"
9221 * ),
9222 * security={{"openemr_auth":{}}}
9225 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
9226 $getParams = $request->getQueryParams();
9227 if ($request->isPatientRequest()) {
9228 // only allow access to data of binded patient
9229 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9230 } else {
9231 RestConfig::authorization_check("encounters", "auth_a");
9232 $return = (new FhirEncounterRestController())->getAll($getParams);
9234 RestConfig::apiLog($return);
9235 return $return;
9239 * @OA\Get(
9240 * path="/fhir/Encounter/{uuid}",
9241 * description="Returns a single Encounter resource.",
9242 * tags={"fhir"},
9243 * @OA\Parameter(
9244 * name="uuid",
9245 * in="path",
9246 * description="The uuid for the Encounter resource.",
9247 * required=true,
9248 * @OA\Schema(
9249 * type="string"
9251 * ),
9252 * @OA\Response(
9253 * response="200",
9254 * description="Standard Response",
9255 * @OA\MediaType(
9256 * mediaType="application/json",
9257 * @OA\Schema(
9258 * @OA\Property(
9259 * property="json object",
9260 * description="FHIR Json object.",
9261 * type="object"
9262 * ),
9263 * example={
9264 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9265 * "meta": {
9266 * "versionId": "1",
9267 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9268 * },
9269 * "resourceType": "Encounter",
9270 * "identifier": {
9272 * "system": "urn:ietf:rfc:3986",
9273 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9275 * },
9276 * "status": "finished",
9277 * "class": {
9278 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9279 * "code": "AMB",
9280 * "display": "ambulatory"
9281 * },
9282 * "type": {
9284 * "coding": {
9286 * "system": "http://snomed.info/sct",
9287 * "code": "185349003",
9288 * "display": "Encounter for check up (procedure)"
9292 * },
9293 * "subject": {
9294 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9295 * "type": "Patient"
9296 * },
9297 * "participant": {
9299 * "type": {
9301 * "coding": {
9303 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9304 * "code": "PPRF",
9305 * "display": "Primary Performer"
9309 * },
9310 * "period": {
9311 * "start": "2012-08-13T00:00:00+00:00"
9312 * },
9313 * "individual": {
9314 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9315 * "type": "Practitioner"
9318 * },
9319 * "period": {
9320 * "start": "2012-08-13T00:00:00+00:00"
9325 * ),
9326 * @OA\Response(
9327 * response="400",
9328 * ref="#/components/responses/badrequest"
9329 * ),
9330 * @OA\Response(
9331 * response="401",
9332 * ref="#/components/responses/unauthorized"
9333 * ),
9334 * @OA\Response(
9335 * response="404",
9336 * ref="#/components/responses/uuidnotfound"
9337 * ),
9338 * security={{"openemr_auth":{}}}
9341 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
9342 if ($request->isPatientRequest()) {
9343 // only allow access to data of binded patient
9344 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9345 } else {
9346 RestConfig::authorization_check("admin", "super");
9347 $return = (new FhirEncounterRestController())->getOne($uuid);
9349 RestConfig::apiLog($return);
9350 return $return;
9354 * @OA\Get(
9355 * path="/fhir/Goal",
9356 * description="Returns a list of Condition resources.",
9357 * tags={"fhir"},
9358 * @OA\Parameter(
9359 * name="_id",
9360 * in="query",
9361 * description="The uuid for the Goal resource.",
9362 * required=false,
9363 * @OA\Schema(
9364 * type="string"
9366 * ),
9367 * @OA\Parameter(
9368 * name="patient",
9369 * in="query",
9370 * description="The uuid for the patient.",
9371 * required=false,
9372 * @OA\Schema(
9373 * type="string"
9375 * ),
9376 * @OA\Response(
9377 * response="200",
9378 * description="Standard Response",
9379 * @OA\MediaType(
9380 * mediaType="application/json",
9381 * @OA\Schema(
9382 * @OA\Property(
9383 * property="json object",
9384 * description="FHIR Json object.",
9385 * type="object"
9386 * ),
9387 * example={
9388 * "meta": {
9389 * "lastUpdated": "2021-09-14T09:13:51"
9390 * },
9391 * "resourceType": "Bundle",
9392 * "type": "collection",
9393 * "total": 0,
9394 * "link": {
9396 * "relation": "self",
9397 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9403 * ),
9404 * @OA\Response(
9405 * response="400",
9406 * ref="#/components/responses/badrequest"
9407 * ),
9408 * @OA\Response(
9409 * response="401",
9410 * ref="#/components/responses/unauthorized"
9411 * ),
9412 * security={{"openemr_auth":{}}}
9415 "GET /fhir/Goal" => function (HttpRestRequest $request) {
9416 $getParams = $request->getQueryParams();
9417 if ($request->isPatientRequest()) {
9418 // only allow access to data of binded patient
9419 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9420 } else {
9421 RestConfig::authorization_check("admin", "super");
9422 $return = (new FhirGoalRestController())->getAll($getParams);
9424 RestConfig::apiLog($return);
9425 return $return;
9429 * @OA\Get(
9430 * path="/fhir/Goal/{uuid}",
9431 * description="Returns a single Goal resource.",
9432 * tags={"fhir"},
9433 * @OA\Parameter(
9434 * name="uuid",
9435 * in="path",
9436 * description="The uuid for the Goal resource.",
9437 * required=true,
9438 * @OA\Schema(
9439 * type="string"
9441 * ),
9442 * @OA\Response(
9443 * response="200",
9444 * description="Standard Response",
9445 * @OA\MediaType(
9446 * mediaType="application/json",
9447 * @OA\Schema(
9448 * @OA\Property(
9449 * property="json object",
9450 * description="FHIR Json object.",
9451 * type="object"
9452 * ),
9453 * example={
9454 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9455 * "meta": {
9456 * "versionId": "1",
9457 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9458 * },
9459 * "resourceType": "Goal",
9460 * "lifecycleStatus": "active",
9461 * "description": {
9462 * "text": "Eating more vegetables."
9463 * },
9464 * "subject": {
9465 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9466 * "type": "Patient"
9467 * },
9468 * "target": {
9470 * "measure": {
9471 * "extension": {
9473 * "valueCode": "unknown",
9474 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9477 * },
9478 * "detailString": "Eating more vegetables.",
9479 * "dueDate": "2021-09-09"
9485 * ),
9486 * @OA\Response(
9487 * response="400",
9488 * ref="#/components/responses/badrequest"
9489 * ),
9490 * @OA\Response(
9491 * response="401",
9492 * ref="#/components/responses/unauthorized"
9493 * ),
9494 * @OA\Response(
9495 * response="404",
9496 * ref="#/components/responses/uuidnotfound"
9497 * ),
9498 * security={{"openemr_auth":{}}}
9501 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9502 if ($request->isPatientRequest()) {
9503 // only allow access to data of binded patient
9504 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9505 } else {
9506 RestConfig::authorization_check("admin", "super");
9507 $return = (new FhirGoalRestController())->getOne($uuid);
9509 RestConfig::apiLog($return);
9510 return $return;
9514 * @OA\Get(
9515 * path="/fhir/Group",
9516 * 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>",
9517 * tags={"fhir"},
9518 * @OA\Parameter(
9519 * name="_id",
9520 * in="query",
9521 * description="The uuid for the Group resource.",
9522 * required=false,
9523 * @OA\Schema(
9524 * type="string"
9526 * ),
9527 * @OA\Parameter(
9528 * name="patient",
9529 * in="query",
9530 * description="The uuid for the patient.",
9531 * required=false,
9532 * @OA\Schema(
9533 * type="string"
9535 * ),
9536 * @OA\Response(
9537 * response="200",
9538 * description="Standard Response",
9539 * @OA\MediaType(
9540 * mediaType="application/json",
9541 * @OA\Schema(
9542 * @OA\Property(
9543 * property="json object",
9544 * description="FHIR Json object.",
9545 * type="object"
9546 * ),
9547 * example={
9548 * "meta": {
9549 * "lastUpdated": "2021-09-14T09:13:51"
9550 * },
9551 * "resourceType": "Bundle",
9552 * "type": "collection",
9553 * "total": 0,
9554 * "link": {
9556 * "relation": "self",
9557 * "url": "https://localhost:9300/apis/default/fhir/Group"
9563 * ),
9564 * @OA\Response(
9565 * response="400",
9566 * ref="#/components/responses/badrequest"
9567 * ),
9568 * @OA\Response(
9569 * response="401",
9570 * ref="#/components/responses/unauthorized"
9571 * ),
9572 * security={{"openemr_auth":{}}}
9575 'GET /fhir/Group' => function (HttpRestRequest $request) {
9576 RestConfig::authorization_check("admin", "users");
9577 $getParams = $request->getQueryParams();
9578 if ($request->isPatientRequest()) {
9579 // only allow access to data of binded patient
9580 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9581 } else {
9582 $return = (new FhirGroupRestController())->getAll($getParams);
9584 RestConfig::apiLog($return);
9585 return $return;
9589 * @OA\Get(
9590 * path="/fhir/Group/{uuid}",
9591 * 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>",
9592 * tags={"fhir"},
9593 * @OA\Parameter(
9594 * name="uuid",
9595 * in="path",
9596 * description="The uuid for the Group resource.",
9597 * required=true,
9598 * @OA\Schema(
9599 * type="string"
9601 * ),
9602 * @OA\Response(
9603 * response="200",
9604 * 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>"
9605 * ),
9606 * @OA\Response(
9607 * response="400",
9608 * ref="#/components/responses/badrequest"
9609 * ),
9610 * @OA\Response(
9611 * response="401",
9612 * ref="#/components/responses/unauthorized"
9613 * ),
9614 * @OA\Response(
9615 * response="404",
9616 * ref="#/components/responses/uuidnotfound"
9617 * ),
9618 * security={{"openemr_auth":{}}}
9621 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9622 RestConfig::authorization_check("admin", "users");
9623 if ($request->isPatientRequest()) {
9624 // only allow access to data of binded patient
9625 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9626 } else {
9627 $return = (new FhirGroupRestController())->getOne($uuid);
9629 RestConfig::apiLog($return);
9630 return $return;
9634 * @OA\Get(
9635 * path="/fhir/Group/{id}/$export",
9636 * 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>",
9637 * tags={"fhir"},
9638 * @OA\Response(
9639 * response="200",
9640 * 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>"
9641 * ),
9642 * @OA\Response(
9643 * response="400",
9644 * ref="#/components/responses/badrequest"
9645 * ),
9646 * @OA\Response(
9647 * response="401",
9648 * ref="#/components/responses/unauthorized"
9649 * ),
9650 * security={{"openemr_auth":{}}}
9653 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9654 RestConfig::authorization_check("admin", "users");
9655 $fhirExportService = new FhirOperationExportRestController($request);
9656 $exportParams = $request->getQueryParams();
9657 $exportParams['groupId'] = $groupId;
9658 $return = $fhirExportService->processExport(
9659 $exportParams,
9660 'Group',
9661 $request->getHeader('Accept')[0] ?? '',
9662 $request->getHeader('Prefer')[0] ?? ''
9664 RestConfig::apiLog($return);
9665 return $return;
9669 * @OA\Get(
9670 * path="/fhir/Immunization",
9671 * description="Returns a list of Immunization resources.",
9672 * tags={"fhir"},
9673 * @OA\Parameter(
9674 * name="_id",
9675 * in="query",
9676 * description="The uuid for the Immunization resource.",
9677 * required=false,
9678 * @OA\Schema(
9679 * type="string"
9681 * ),
9682 * @OA\Parameter(
9683 * name="patient",
9684 * in="query",
9685 * description="The uuid for the patient.",
9686 * required=false,
9687 * @OA\Schema(
9688 * type="string"
9690 * ),
9691 * @OA\Response(
9692 * response="200",
9693 * description="Standard Response",
9694 * @OA\MediaType(
9695 * mediaType="application/json",
9696 * @OA\Schema(
9697 * @OA\Property(
9698 * property="json object",
9699 * description="FHIR Json object.",
9700 * type="object"
9701 * ),
9702 * example={
9703 * "meta": {
9704 * "lastUpdated": "2021-09-14T09:13:51"
9705 * },
9706 * "resourceType": "Bundle",
9707 * "type": "collection",
9708 * "total": 0,
9709 * "link": {
9711 * "relation": "self",
9712 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9718 * ),
9719 * @OA\Response(
9720 * response="400",
9721 * ref="#/components/responses/badrequest"
9722 * ),
9723 * @OA\Response(
9724 * response="401",
9725 * ref="#/components/responses/unauthorized"
9726 * ),
9727 * security={{"openemr_auth":{}}}
9730 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9731 $getParams = $request->getQueryParams();
9732 if ($request->isPatientRequest()) {
9733 // only allow access to data of binded patient
9734 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9735 } else {
9736 RestConfig::authorization_check("patients", "med");
9737 $return = (new FhirImmunizationRestController())->getAll($getParams);
9739 RestConfig::apiLog($return);
9740 return $return;
9744 * @OA\Get(
9745 * path="/fhir/Immunization/{uuid}",
9746 * description="Returns a single Immunization resource.",
9747 * tags={"fhir"},
9748 * @OA\Parameter(
9749 * name="uuid",
9750 * in="path",
9751 * description="The uuid for the Immunization resource.",
9752 * required=true,
9753 * @OA\Schema(
9754 * type="string"
9756 * ),
9757 * @OA\Response(
9758 * response="200",
9759 * description="Standard Response",
9760 * @OA\MediaType(
9761 * mediaType="application/json",
9762 * @OA\Schema(
9763 * @OA\Property(
9764 * property="json object",
9765 * description="FHIR Json object.",
9766 * type="object"
9767 * ),
9768 * example={
9769 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9770 * "meta": {
9771 * "versionId": "1",
9772 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9773 * },
9774 * "resourceType": "Immunization",
9775 * "status": "completed",
9776 * "vaccineCode": {
9777 * "coding": {
9779 * "system": "http://hl7.org/fhir/sid/cvx",
9780 * "code": "207",
9781 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9784 * },
9785 * "patient": {
9786 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9787 * },
9788 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9789 * "recorded": "2022-03-26T05:42:26+00:00",
9790 * "primarySource": false
9794 * ),
9795 * @OA\Response(
9796 * response="400",
9797 * ref="#/components/responses/badrequest"
9798 * ),
9799 * @OA\Response(
9800 * response="401",
9801 * ref="#/components/responses/unauthorized"
9802 * ),
9803 * @OA\Response(
9804 * response="404",
9805 * ref="#/components/responses/uuidnotfound"
9806 * ),
9807 * security={{"openemr_auth":{}}}
9810 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9811 if ($request->isPatientRequest()) {
9812 // only allow access to data of binded patient
9813 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9814 } else {
9815 RestConfig::authorization_check("patients", "med");
9816 $return = (new FhirImmunizationRestController())->getOne($uuid);
9818 RestConfig::apiLog($return);
9819 return $return;
9823 * @OA\Get(
9824 * path="/fhir/Location",
9825 * description="Returns a list of Location resources.",
9826 * tags={"fhir"},
9827 * @OA\Parameter(
9828 * name="_id",
9829 * in="query",
9830 * description="The uuid for the Location resource.",
9831 * required=false,
9832 * @OA\Schema(
9833 * type="string"
9835 * ),
9836 * @OA\Response(
9837 * response="200",
9838 * description="Standard Response",
9839 * @OA\MediaType(
9840 * mediaType="application/json",
9841 * @OA\Schema(
9842 * @OA\Property(
9843 * property="json object",
9844 * description="FHIR Json object.",
9845 * type="object"
9846 * ),
9847 * example={
9848 * "meta": {
9849 * "lastUpdated": "2021-09-14T09:13:51"
9850 * },
9851 * "resourceType": "Bundle",
9852 * "type": "collection",
9853 * "total": 0,
9854 * "link": {
9856 * "relation": "self",
9857 * "url": "https://localhost:9300/apis/default/fhir/Location"
9863 * ),
9864 * @OA\Response(
9865 * response="400",
9866 * ref="#/components/responses/badrequest"
9867 * ),
9868 * @OA\Response(
9869 * response="401",
9870 * ref="#/components/responses/unauthorized"
9871 * ),
9872 * security={{"openemr_auth":{}}}
9875 "GET /fhir/Location" => function (HttpRestRequest $request) {
9876 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9877 RestConfig::apiLog($return);
9878 return $return;
9882 * @OA\Get(
9883 * path="/fhir/Location/{uuid}",
9884 * description="Returns a single Location resource.",
9885 * tags={"fhir"},
9886 * @OA\Parameter(
9887 * name="uuid",
9888 * in="path",
9889 * description="The uuid for the Location resource.",
9890 * required=true,
9891 * @OA\Schema(
9892 * type="string"
9894 * ),
9895 * @OA\Response(
9896 * response="200",
9897 * description="Standard Response",
9898 * @OA\MediaType(
9899 * mediaType="application/json",
9900 * @OA\Schema(
9901 * @OA\Property(
9902 * property="json object",
9903 * description="FHIR Json object.",
9904 * type="object"
9905 * ),
9906 * example={
9907 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9908 * "meta": {
9909 * "versionId": "1",
9910 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9911 * },
9912 * "resourceType": "Location",
9913 * "status": "active",
9914 * "name": "Your Clinic Name Here",
9915 * "telecom": {
9917 * "system": "phone",
9918 * "value": "000-000-0000"
9919 * },
9921 * "system": "fax",
9922 * "value": "000-000-0000"
9928 * ),
9929 * @OA\Response(
9930 * response="400",
9931 * ref="#/components/responses/badrequest"
9932 * ),
9933 * @OA\Response(
9934 * response="401",
9935 * ref="#/components/responses/unauthorized"
9936 * ),
9937 * @OA\Response(
9938 * response="404",
9939 * ref="#/components/responses/uuidnotfound"
9940 * ),
9941 * security={{"openemr_auth":{}}}
9944 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9945 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9946 RestConfig::apiLog($return);
9947 return $return;
9951 * @OA\Get(
9952 * path="/fhir/Medication",
9953 * description="Returns a list of Medication resources.",
9954 * tags={"fhir"},
9955 * @OA\Response(
9956 * response="200",
9957 * description="Standard Response",
9958 * @OA\MediaType(
9959 * mediaType="application/json",
9960 * @OA\Schema(
9961 * @OA\Property(
9962 * property="json object",
9963 * description="FHIR Json object.",
9964 * type="object"
9965 * ),
9966 * example={
9967 * "meta": {
9968 * "lastUpdated": "2021-09-14T09:13:51"
9969 * },
9970 * "resourceType": "Bundle",
9971 * "type": "collection",
9972 * "total": 0,
9973 * "link": {
9975 * "relation": "self",
9976 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9982 * ),
9983 * @OA\Response(
9984 * response="400",
9985 * ref="#/components/responses/badrequest"
9986 * ),
9987 * @OA\Response(
9988 * response="401",
9989 * ref="#/components/responses/unauthorized"
9990 * ),
9991 * security={{"openemr_auth":{}}}
9994 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9995 RestConfig::authorization_check("patients", "med");
9996 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9997 RestConfig::apiLog($return);
9998 return $return;
10002 * @OA\Get(
10003 * path="/fhir/Medication/{uuid}",
10004 * description="Returns a single Medication resource.",
10005 * tags={"fhir"},
10006 * @OA\Parameter(
10007 * name="uuid",
10008 * in="path",
10009 * description="The uuid for the Medication resource.",
10010 * required=true,
10011 * @OA\Schema(
10012 * type="string"
10014 * ),
10015 * @OA\Response(
10016 * response="200",
10017 * description="Standard Response",
10018 * @OA\MediaType(
10019 * mediaType="application/json",
10020 * @OA\Schema(
10021 * @OA\Property(
10022 * property="json object",
10023 * description="FHIR Json object.",
10024 * type="object"
10025 * ),
10026 * example={
10027 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10028 * "meta": {
10029 * "versionId": "1",
10030 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10031 * },
10032 * "resourceType": "Medication",
10033 * "code": {
10034 * "coding": {
10036 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10037 * "code": 153165
10040 * },
10041 * "status": "active",
10042 * "batch": {
10043 * "lotNumber": "132",
10044 * "expirationDate": "0000-00-00"
10049 * ),
10050 * @OA\Response(
10051 * response="400",
10052 * ref="#/components/responses/badrequest"
10053 * ),
10054 * @OA\Response(
10055 * response="401",
10056 * ref="#/components/responses/unauthorized"
10057 * ),
10058 * @OA\Response(
10059 * response="404",
10060 * ref="#/components/responses/uuidnotfound"
10061 * ),
10062 * security={{"openemr_auth":{}}}
10065 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
10066 if ($request->isPatientRequest()) {
10067 // only allow access to data of binded patient
10068 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10069 } else {
10070 RestConfig::authorization_check("patients", "med");
10071 $return = (new FhirMedicationRestController())->getOne($uuid);
10073 RestConfig::apiLog($return);
10074 return $return;
10078 * @OA\Get(
10079 * path="/fhir/MedicationRequest",
10080 * description="Returns a list of MedicationRequest resources.",
10081 * tags={"fhir"},
10082 * @OA\Parameter(
10083 * name="_id",
10084 * in="query",
10085 * description="The uuid for the MedicationRequest resource.",
10086 * required=false,
10087 * @OA\Schema(
10088 * type="string"
10090 * ),
10091 * @OA\Parameter(
10092 * name="patient",
10093 * in="query",
10094 * description="The uuid for the patient.",
10095 * required=false,
10096 * @OA\Schema(
10097 * type="string"
10099 * ),
10100 * @OA\Parameter(
10101 * name="intent",
10102 * in="query",
10103 * description="The intent of the MedicationRequest resource.",
10104 * required=false,
10105 * @OA\Schema(
10106 * type="string"
10108 * ),
10109 * @OA\Parameter(
10110 * name="status",
10111 * in="query",
10112 * description="The status of the MedicationRequest resource.",
10113 * required=false,
10114 * @OA\Schema(
10115 * type="string"
10117 * ),
10118 * @OA\Response(
10119 * response="200",
10120 * description="Standard Response",
10121 * @OA\MediaType(
10122 * mediaType="application/json",
10123 * @OA\Schema(
10124 * @OA\Property(
10125 * property="json object",
10126 * description="FHIR Json object.",
10127 * type="object"
10128 * ),
10129 * example={
10130 * "meta": {
10131 * "lastUpdated": "2021-09-14T09:13:51"
10132 * },
10133 * "resourceType": "Bundle",
10134 * "type": "collection",
10135 * "total": 0,
10136 * "link": {
10138 * "relation": "self",
10139 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10145 * ),
10146 * @OA\Response(
10147 * response="400",
10148 * ref="#/components/responses/badrequest"
10149 * ),
10150 * @OA\Response(
10151 * response="401",
10152 * ref="#/components/responses/unauthorized"
10153 * ),
10154 * security={{"openemr_auth":{}}}
10157 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
10158 $getParams = $request->getQueryParams();
10159 if ($request->isPatientRequest()) {
10160 // only allow access to data of binded patient
10161 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10162 } else {
10163 RestConfig::authorization_check("patients", "med");
10164 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10166 RestConfig::apiLog($return);
10167 return $return;
10171 * @OA\Get(
10172 * path="/fhir/MedicationRequest/{uuid}",
10173 * description="Returns a single MedicationRequest resource.",
10174 * tags={"fhir"},
10175 * @OA\Parameter(
10176 * name="uuid",
10177 * in="path",
10178 * description="The uuid for the MedicationRequest resource.",
10179 * required=true,
10180 * @OA\Schema(
10181 * type="string"
10183 * ),
10184 * @OA\Response(
10185 * response="200",
10186 * description="Standard Response",
10187 * @OA\MediaType(
10188 * mediaType="application/json",
10189 * @OA\Schema(
10190 * @OA\Property(
10191 * property="json object",
10192 * description="FHIR Json object.",
10193 * type="object"
10194 * ),
10195 * example={
10196 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10197 * "meta": {
10198 * "versionId": "1",
10199 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10200 * },
10201 * "resourceType": "MedicationRequest",
10202 * "status": "active",
10203 * "intent": "order",
10204 * "category": {
10206 * "coding": {
10208 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10209 * "code": "community",
10210 * "display": "Home/Community"
10214 * },
10215 * "reportedBoolean": false,
10216 * "medicationCodeableConcept": {
10217 * "coding": {
10219 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10220 * "code": "1738139",
10221 * "display": "Acetaminophen 325 MG Oral Tablet"
10224 * },
10225 * "subject": {
10226 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10227 * "type": "Patient"
10228 * },
10229 * "authoredOn": "2021-09-18T00:00:00+00:00",
10230 * "requester": {
10231 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10232 * "type": "Practitioner"
10237 * ),
10238 * @OA\Response(
10239 * response="400",
10240 * ref="#/components/responses/badrequest"
10241 * ),
10242 * @OA\Response(
10243 * response="401",
10244 * ref="#/components/responses/unauthorized"
10245 * ),
10246 * @OA\Response(
10247 * response="404",
10248 * ref="#/components/responses/uuidnotfound"
10249 * ),
10250 * security={{"openemr_auth":{}}}
10253 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
10254 if ($request->isPatientRequest()) {
10255 // only allow access to data of binded patient
10256 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10257 } else {
10258 RestConfig::authorization_check("patients", "med");
10259 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10261 RestConfig::apiLog($return);
10262 return $return;
10266 * @OA\Get(
10267 * path="/fhir/Observation",
10268 * description="Returns a list of Observation resources.",
10269 * tags={"fhir"},
10270 * @OA\Parameter(
10271 * name="_id",
10272 * in="query",
10273 * description="The uuid for the Observation resource.",
10274 * required=false,
10275 * @OA\Schema(
10276 * type="string"
10278 * ),
10279 * @OA\Parameter(
10280 * name="patient",
10281 * in="query",
10282 * description="The uuid for the patient.",
10283 * required=false,
10284 * @OA\Schema(
10285 * type="string"
10287 * ),
10288 * @OA\Parameter(
10289 * name="code",
10290 * in="query",
10291 * description="The code of the Observation resource.",
10292 * required=false,
10293 * @OA\Schema(
10294 * type="string"
10296 * ),
10297 * @OA\Parameter(
10298 * name="category",
10299 * in="query",
10300 * description="The category of the Observation resource.",
10301 * required=false,
10302 * @OA\Schema(
10303 * type="string"
10305 * ),
10306 * @OA\Parameter(
10307 * name="date",
10308 * in="query",
10309 * description="The datetime of the Observation resource.",
10310 * required=false,
10311 * @OA\Schema(
10312 * type="string"
10314 * ),
10315 * @OA\Response(
10316 * response="200",
10317 * description="Standard Response",
10318 * @OA\MediaType(
10319 * mediaType="application/json",
10320 * @OA\Schema(
10321 * @OA\Property(
10322 * property="json object",
10323 * description="FHIR Json object.",
10324 * type="object"
10325 * ),
10326 * example={
10327 * "meta": {
10328 * "lastUpdated": "2021-09-14T09:13:51"
10329 * },
10330 * "resourceType": "Bundle",
10331 * "type": "collection",
10332 * "total": 0,
10333 * "link": {
10335 * "relation": "self",
10336 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10342 * ),
10343 * @OA\Response(
10344 * response="400",
10345 * ref="#/components/responses/badrequest"
10346 * ),
10347 * @OA\Response(
10348 * response="401",
10349 * ref="#/components/responses/unauthorized"
10350 * ),
10351 * security={{"openemr_auth":{}}}
10354 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10355 $getParams = $request->getQueryParams();
10356 if ($request->isPatientRequest()) {
10357 // only allow access to data of binded patient
10358 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10359 } else {
10360 RestConfig::authorization_check("patients", "med");
10361 $return = (new FhirObservationRestController())->getAll($getParams);
10363 RestConfig::apiLog($return);
10364 return $return;
10368 * @OA\Get(
10369 * path="/fhir/Observation/{uuid}",
10370 * description="Returns a single Observation resource.",
10371 * tags={"fhir"},
10372 * @OA\Parameter(
10373 * name="uuid",
10374 * in="path",
10375 * description="The uuid for the Observation resource.",
10376 * required=true,
10377 * @OA\Schema(
10378 * type="string"
10380 * ),
10381 * @OA\Response(
10382 * response="200",
10383 * description="Standard Response",
10384 * @OA\MediaType(
10385 * mediaType="application/json",
10386 * @OA\Schema(
10387 * @OA\Property(
10388 * property="json object",
10389 * description="FHIR Json object.",
10390 * type="object"
10391 * ),
10392 * example={
10393 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10394 * "meta": {
10395 * "versionId": "1",
10396 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10397 * },
10398 * "resourceType": "Observation",
10399 * "status": "final",
10400 * "category": {
10402 * "coding": {
10404 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10405 * "code": "vital-signs"
10409 * },
10410 * "code": {
10411 * "coding": {
10413 * "system": "http://loinc.org",
10414 * "code": "85354-9",
10415 * "display": "Blood pressure systolic and diastolic"
10418 * },
10419 * "subject": {
10420 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10421 * "type": "Patient"
10422 * },
10423 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10424 * "component": {
10426 * "code": {
10427 * "coding": {
10429 * "system": "http://loinc.org",
10430 * "code": "8480-6",
10431 * "display": "Systolic blood pressure"
10434 * },
10435 * "valueQuantity": {
10436 * "value": 122,
10437 * "unit": "mm[Hg]",
10438 * "system": "http://unitsofmeasure.org",
10439 * "code": "mm[Hg]"
10441 * },
10443 * "code": {
10444 * "coding": {
10446 * "system": "http://loinc.org",
10447 * "code": "8462-4",
10448 * "display": "Diastolic blood pressure"
10451 * },
10452 * "valueQuantity": {
10453 * "value": 77,
10454 * "unit": "mm[Hg]",
10455 * "system": "http://unitsofmeasure.org",
10456 * "code": "mm[Hg]"
10463 * ),
10464 * @OA\Response(
10465 * response="400",
10466 * ref="#/components/responses/badrequest"
10467 * ),
10468 * @OA\Response(
10469 * response="401",
10470 * ref="#/components/responses/unauthorized"
10471 * ),
10472 * @OA\Response(
10473 * response="404",
10474 * ref="#/components/responses/uuidnotfound"
10475 * ),
10476 * security={{"openemr_auth":{}}}
10479 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10480 if ($request->isPatientRequest()) {
10481 // only allow access to data of binded patient
10482 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10483 } else {
10484 RestConfig::authorization_check("patients", "med");
10485 $return = (new FhirObservationRestController())->getOne($uuid);
10487 RestConfig::apiLog($return);
10488 return $return;
10492 * @OA\Get(
10493 * path="/fhir/Organization",
10494 * description="Returns a list of Organization resources.",
10495 * tags={"fhir"},
10496 * @OA\Parameter(
10497 * name="_id",
10498 * in="query",
10499 * description="The uuid for the Organization resource.",
10500 * required=false,
10501 * @OA\Schema(
10502 * type="string"
10504 * ),
10505 * @OA\Parameter(
10506 * name="name",
10507 * in="query",
10508 * description="The name of the Organization resource.",
10509 * required=false,
10510 * @OA\Schema(
10511 * type="string"
10513 * ),
10514 * @OA\Parameter(
10515 * name="email",
10516 * in="query",
10517 * description="The email of the Organization resource.",
10518 * required=false,
10519 * @OA\Schema(
10520 * type="string"
10522 * ),
10523 * @OA\Parameter(
10524 * name="phone",
10525 * in="query",
10526 * description="The phone of the Organization resource.",
10527 * required=false,
10528 * @OA\Schema(
10529 * type="string"
10531 * ),
10532 * @OA\Parameter(
10533 * name="telecom",
10534 * in="query",
10535 * description="The telecom of the Organization resource.",
10536 * required=false,
10537 * @OA\Schema(
10538 * type="string"
10540 * ),
10541 * @OA\Parameter(
10542 * name="address",
10543 * in="query",
10544 * description="The address of the Organization resource.",
10545 * required=false,
10546 * @OA\Schema(
10547 * type="string"
10549 * ),
10550 * @OA\Parameter(
10551 * name="address-city",
10552 * in="query",
10553 * description="The address-city of the Organization resource.",
10554 * required=false,
10555 * @OA\Schema(
10556 * type="string"
10558 * ),
10559 * @OA\Parameter(
10560 * name="address-postalcode",
10561 * in="query",
10562 * description="The address-postalcode of the Organization resource.",
10563 * required=false,
10564 * @OA\Schema(
10565 * type="string"
10567 * ),
10568 * @OA\Parameter(
10569 * name="address-state",
10570 * in="query",
10571 * description="The address-state of the Organization resource.",
10572 * required=false,
10573 * @OA\Schema(
10574 * type="string"
10576 * ),
10577 * @OA\Response(
10578 * response="200",
10579 * description="Standard Response",
10580 * @OA\MediaType(
10581 * mediaType="application/json",
10582 * @OA\Schema(
10583 * @OA\Property(
10584 * property="json object",
10585 * description="FHIR Json object.",
10586 * type="object"
10587 * ),
10588 * example={
10589 * "meta": {
10590 * "lastUpdated": "2021-09-14T09:13:51"
10591 * },
10592 * "resourceType": "Bundle",
10593 * "type": "collection",
10594 * "total": 0,
10595 * "link": {
10597 * "relation": "self",
10598 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10604 * ),
10605 * @OA\Response(
10606 * response="400",
10607 * ref="#/components/responses/badrequest"
10608 * ),
10609 * @OA\Response(
10610 * response="401",
10611 * ref="#/components/responses/unauthorized"
10612 * ),
10613 * security={{"openemr_auth":{}}}
10616 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10617 if (!$request->isPatientRequest()) {
10618 RestConfig::authorization_check("admin", "users");
10620 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10621 RestConfig::apiLog($return);
10622 return $return;
10626 * @OA\Get(
10627 * path="/fhir/Organization/{uuid}",
10628 * description="Returns a single Organization resource.",
10629 * tags={"fhir"},
10630 * @OA\Parameter(
10631 * name="uuid",
10632 * in="path",
10633 * description="The uuid for the Organization resource.",
10634 * required=true,
10635 * @OA\Schema(
10636 * type="string"
10638 * ),
10639 * @OA\Response(
10640 * response="200",
10641 * description="Standard Response",
10642 * @OA\MediaType(
10643 * mediaType="application/json",
10644 * @OA\Schema(
10645 * @OA\Property(
10646 * property="json object",
10647 * description="FHIR Json object.",
10648 * type="object"
10649 * ),
10650 * example={
10651 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10652 * "meta": {
10653 * "versionId": "1",
10654 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10655 * },
10656 * "resourceType": "Organization",
10657 * "text": {
10658 * "status": "generated",
10659 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10660 * },
10661 * "identifier": {
10663 * "system": "http://hl7.org/fhir/sid/us-npi",
10664 * "value": "1234567890"
10666 * },
10667 * "active": true,
10668 * "type": {
10670 * "coding": {
10672 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10673 * "code": "prov",
10674 * "display": "Healthcare Provider"
10678 * },
10679 * "name": "Your Clinic Name Here",
10680 * "telecom": {
10682 * "system": "phone",
10683 * "value": "000-000-0000",
10684 * "use": "work"
10685 * },
10687 * "system": "fax",
10688 * "value": "000-000-0000",
10689 * "use": "work"
10691 * },
10692 * "address": {
10693 * null
10698 * ),
10699 * @OA\Response(
10700 * response="400",
10701 * ref="#/components/responses/badrequest"
10702 * ),
10703 * @OA\Response(
10704 * response="401",
10705 * ref="#/components/responses/unauthorized"
10706 * ),
10707 * @OA\Response(
10708 * response="404",
10709 * ref="#/components/responses/uuidnotfound"
10710 * ),
10711 * security={{"openemr_auth":{}}}
10714 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10715 $patientUUID = null;
10716 if (!$request->isPatientRequest()) {
10717 RestConfig::authorization_check("admin", "users");
10718 } else {
10719 $patientUUID = $request->getPatientUUIDString();
10721 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10723 RestConfig::apiLog($return);
10724 return $return;
10728 * @OA\Post(
10729 * path="/fhir/Organization",
10730 * description="Adds a Organization resource.",
10731 * tags={"fhir"},
10732 * @OA\RequestBody(
10733 * required=true,
10734 * @OA\MediaType(
10735 * mediaType="application/json",
10736 * @OA\Schema(
10737 * description="The json object for the Organization resource.",
10738 * type="object"
10739 * ),
10740 * example={
10741 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10742 * "meta": {
10743 * "versionId": "1",
10744 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10745 * },
10746 * "resourceType": "Organization",
10747 * "text": {
10748 * "status": "generated",
10749 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10750 * },
10751 * "identifier": {
10753 * "system": "http://hl7.org/fhir/sid/us-npi",
10754 * "value": "1234567890"
10756 * },
10757 * "active": true,
10758 * "type": {
10760 * "coding": {
10762 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10763 * "code": "prov",
10764 * "display": "Healthcare Provider"
10768 * },
10769 * "name": "Your Clinic Name Here Hey",
10770 * "telecom": {
10772 * "system": "phone",
10773 * "value": "000-000-0000",
10774 * "use": "work"
10775 * },
10777 * "system": "fax",
10778 * "value": "000-000-0000",
10779 * "use": "work"
10781 * },
10782 * "address": {
10783 * null
10787 * ),
10788 * @OA\Response(
10789 * response="200",
10790 * description="Standard Response",
10791 * @OA\MediaType(
10792 * mediaType="application/json",
10793 * @OA\Schema(
10794 * @OA\Property(
10795 * property="json object",
10796 * description="FHIR Json object.",
10797 * type="object"
10798 * ),
10799 * example={
10800 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10801 * "meta": {
10802 * "versionId": "1",
10803 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10804 * },
10805 * "resourceType": "Organization",
10806 * "text": {
10807 * "status": "generated",
10808 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10809 * },
10810 * "identifier": {
10812 * "system": "http://hl7.org/fhir/sid/us-npi",
10813 * "value": "1234567890"
10815 * },
10816 * "active": true,
10817 * "type": {
10819 * "coding": {
10821 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10822 * "code": "prov",
10823 * "display": "Healthcare Provider"
10827 * },
10828 * "name": "Your Clinic Name Here Now",
10829 * "telecom": {
10831 * "system": "phone",
10832 * "value": "000-000-0000",
10833 * "use": "work"
10834 * },
10836 * "system": "fax",
10837 * "value": "000-000-0000",
10838 * "use": "work"
10840 * },
10841 * "address": {
10842 * null
10847 * ),
10848 * @OA\Response(
10849 * response="400",
10850 * ref="#/components/responses/badrequest"
10851 * ),
10852 * @OA\Response(
10853 * response="401",
10854 * ref="#/components/responses/unauthorized"
10855 * ),
10856 * security={{"openemr_auth":{}}}
10859 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10860 RestConfig::authorization_check("admin", "super");
10861 $data = (array) (json_decode(file_get_contents("php://input"), true));
10862 $return = (new FhirOrganizationRestController())->post($data);
10863 RestConfig::apiLog($return, $data);
10864 return $return;
10868 * @OA\Put(
10869 * path="/fhir/Organization/{uuid}",
10870 * description="Modifies a Organization resource.",
10871 * tags={"fhir"},
10872 * @OA\Parameter(
10873 * name="uuid",
10874 * in="path",
10875 * description="The uuid for the organization.",
10876 * required=true,
10877 * @OA\Schema(
10878 * type="string"
10880 * ),
10881 * @OA\RequestBody(
10882 * required=true,
10883 * @OA\MediaType(
10884 * mediaType="application/json",
10885 * @OA\Schema(
10886 * description="The json object for the Organization resource.",
10887 * type="object"
10888 * ),
10889 * example={
10890 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10891 * "meta": {
10892 * "versionId": "1",
10893 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10894 * },
10895 * "resourceType": "Organization",
10896 * "text": {
10897 * "status": "generated",
10898 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10899 * },
10900 * "identifier": {
10902 * "system": "http://hl7.org/fhir/sid/us-npi",
10903 * "value": "1234567890"
10905 * },
10906 * "active": true,
10907 * "type": {
10909 * "coding": {
10911 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10912 * "code": "prov",
10913 * "display": "Healthcare Provider"
10917 * },
10918 * "name": "Your Clinic Name Here",
10919 * "telecom": {
10921 * "system": "phone",
10922 * "value": "000-000-0000",
10923 * "use": "work"
10924 * },
10926 * "system": "fax",
10927 * "value": "000-000-0000",
10928 * "use": "work"
10930 * },
10931 * "address": {
10932 * null
10936 * ),
10937 * @OA\Response(
10938 * response="201",
10939 * description="Standard Response",
10940 * @OA\MediaType(
10941 * mediaType="application/json",
10942 * @OA\Schema(
10943 * example={
10944 * "id": 14,
10945 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
10949 * ),
10950 * @OA\Response(
10951 * response="400",
10952 * ref="#/components/responses/badrequest"
10953 * ),
10954 * @OA\Response(
10955 * response="401",
10956 * ref="#/components/responses/unauthorized"
10957 * ),
10958 * security={{"openemr_auth":{}}}
10961 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10962 RestConfig::authorization_check("admin", "super");
10963 $data = (array) (json_decode(file_get_contents("php://input"), true));
10964 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
10965 RestConfig::apiLog($return, $data);
10966 return $return;
10970 * @OA\Post(
10971 * path="/fhir/Patient",
10972 * description="Adds a Patient resource.",
10973 * tags={"fhir"},
10974 * @OA\RequestBody(
10975 * required=true,
10976 * @OA\MediaType(
10977 * mediaType="application/json",
10978 * @OA\Schema(
10979 * description="The json object for the Patient resource.",
10980 * type="object"
10981 * ),
10982 * example={
10983 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10984 * "meta": {
10985 * "versionId": "1",
10986 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10987 * },
10988 * "resourceType": "Patient",
10989 * "text": {
10990 * "status": "generated",
10991 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10992 * },
10993 * "extension": {
10995 * "valueCode": "F",
10996 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10997 * },
10999 * "extension": {
11001 * "valueCoding": {
11002 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11003 * "code": "UNK",
11004 * "display": "Unknown"
11005 * },
11006 * "url": "ombCategory"
11007 * },
11009 * "valueString": "Unknown",
11010 * "url": "text"
11012 * },
11013 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11015 * },
11016 * "identifier": {
11018 * "use": "official",
11019 * "type": {
11020 * "coding": {
11022 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11023 * "code": "PT"
11026 * },
11027 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11028 * "value": "1"
11030 * },
11031 * "active": true,
11032 * "name": {
11034 * "use": "official",
11035 * "family": "Smith",
11036 * "given": {
11037 * "Brenda"
11040 * },
11041 * "gender": "female",
11042 * "birthDate": "2017-03-10",
11043 * "communication": {
11045 * "language": {
11046 * "coding": {
11048 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11049 * "code": "unknown",
11050 * "display": "Unknown"
11058 * ),
11059 * @OA\Response(
11060 * response="200",
11061 * description="Standard Response",
11062 * @OA\MediaType(
11063 * mediaType="application/json",
11064 * @OA\Schema(
11065 * @OA\Property(
11066 * property="json object",
11067 * description="FHIR Json object.",
11068 * type="object"
11069 * ),
11070 * example={
11071 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11072 * "meta": {
11073 * "versionId": "1",
11074 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11075 * },
11076 * "resourceType": "Patient",
11077 * "text": {
11078 * "status": "generated",
11079 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11080 * },
11081 * "extension": {
11083 * "valueCode": "F",
11084 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11085 * },
11087 * "extension": {
11089 * "valueCoding": {
11090 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11091 * "code": "UNK",
11092 * "display": "Unknown"
11093 * },
11094 * "url": "ombCategory"
11095 * },
11097 * "valueString": "Unknown",
11098 * "url": "text"
11100 * },
11101 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11103 * },
11104 * "identifier": {
11106 * "use": "official",
11107 * "type": {
11108 * "coding": {
11110 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11111 * "code": "PT"
11114 * },
11115 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11116 * "value": "1"
11118 * },
11119 * "active": true,
11120 * "name": {
11122 * "use": "official",
11123 * "family": "Smith",
11124 * "given": {
11125 * "Brenda"
11128 * },
11129 * "gender": "female",
11130 * "birthDate": "2017-03-10",
11131 * "communication": {
11133 * "language": {
11134 * "coding": {
11136 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11137 * "code": "unknown",
11138 * "display": "Unknown"
11147 * ),
11148 * @OA\Response(
11149 * response="400",
11150 * ref="#/components/responses/badrequest"
11151 * ),
11152 * @OA\Response(
11153 * response="401",
11154 * ref="#/components/responses/unauthorized"
11155 * ),
11156 * security={{"openemr_auth":{}}}
11159 "POST /fhir/Patient" => function (HttpRestRequest $request) {
11160 RestConfig::authorization_check("patients", "demo");
11161 $data = (array) (json_decode(file_get_contents("php://input"), true));
11162 $return = (new FhirPatientRestController())->post($data);
11163 RestConfig::apiLog($return, $data);
11164 return $return;
11168 * @OA\Put(
11169 * path="/fhir/Patient/{uuid}",
11170 * description="Modifies a Patient resource.",
11171 * tags={"fhir"},
11172 * @OA\Parameter(
11173 * name="uuid",
11174 * in="path",
11175 * description="The uuid for the Patient resource.",
11176 * required=true,
11177 * @OA\Schema(
11178 * type="string"
11180 * ),
11181 * @OA\RequestBody(
11182 * required=true,
11183 * @OA\MediaType(
11184 * mediaType="application/json",
11185 * @OA\Schema(
11186 * description="The json object for the Patient resource.",
11187 * type="object"
11188 * ),
11189 * example={
11190 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11191 * "meta": {
11192 * "versionId": "1",
11193 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11194 * },
11195 * "resourceType": "Patient",
11196 * "text": {
11197 * "status": "generated",
11198 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11199 * },
11200 * "extension": {
11202 * "valueCode": "F",
11203 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11204 * },
11206 * "extension": {
11208 * "valueCoding": {
11209 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11210 * "code": "UNK",
11211 * "display": "Unknown"
11212 * },
11213 * "url": "ombCategory"
11214 * },
11216 * "valueString": "Unknown",
11217 * "url": "text"
11219 * },
11220 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11222 * },
11223 * "identifier": {
11225 * "use": "official",
11226 * "type": {
11227 * "coding": {
11229 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11230 * "code": "PT"
11233 * },
11234 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11235 * "value": "1"
11237 * },
11238 * "active": true,
11239 * "name": {
11241 * "use": "official",
11242 * "family": "Smith",
11243 * "given": {
11244 * "Brenda"
11247 * },
11248 * "gender": "female",
11249 * "birthDate": "2017-03-10",
11250 * "communication": {
11252 * "language": {
11253 * "coding": {
11255 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11256 * "code": "unknown",
11257 * "display": "Unknown"
11265 * ),
11266 * @OA\Response(
11267 * response="201",
11268 * description="Standard Response",
11269 * @OA\MediaType(
11270 * mediaType="application/json",
11271 * @OA\Schema(
11272 * example={
11273 * "id": 2,
11274 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11278 * ),
11279 * @OA\Response(
11280 * response="400",
11281 * ref="#/components/responses/badrequest"
11282 * ),
11283 * @OA\Response(
11284 * response="401",
11285 * ref="#/components/responses/unauthorized"
11286 * ),
11287 * security={{"openemr_auth":{}}}
11290 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11291 RestConfig::authorization_check("patients", "demo");
11292 $data = (array) (json_decode(file_get_contents("php://input"), true));
11293 $return = (new FhirPatientRestController())->put($uuid, $data);
11294 RestConfig::apiLog($return, $data);
11295 return $return;
11299 * @OA\Get(
11300 * path="/fhir/Patient",
11301 * description="Returns a list of Patient resources.",
11302 * tags={"fhir"},
11303 * @OA\Parameter(
11304 * name="_id",
11305 * in="query",
11306 * description="The uuid for the Patient resource.",
11307 * required=false,
11308 * @OA\Schema(
11309 * type="string"
11311 * ),
11312 * @OA\Parameter(
11313 * name="identifier",
11314 * in="query",
11315 * description="The identifier of the Patient resource.",
11316 * required=false,
11317 * @OA\Schema(
11318 * type="string"
11320 * ),
11321 * @OA\Parameter(
11322 * name="name",
11323 * in="query",
11324 * description="The name of the Patient resource.",
11325 * required=false,
11326 * @OA\Schema(
11327 * type="string"
11329 * ),
11330 * @OA\Parameter(
11331 * name="birthdate",
11332 * in="query",
11333 * description="The birthdate of the Patient resource.",
11334 * required=false,
11335 * @OA\Schema(
11336 * type="string"
11338 * ),
11339 * @OA\Parameter(
11340 * name="gender",
11341 * in="query",
11342 * description="The gender of the Patient resource.",
11343 * required=false,
11344 * @OA\Schema(
11345 * type="string"
11347 * ),
11348 * @OA\Parameter(
11349 * name="address",
11350 * in="query",
11351 * description="The address of the Patient resource.",
11352 * required=false,
11353 * @OA\Schema(
11354 * type="string"
11356 * ),
11357 * @OA\Parameter(
11358 * name="address-city",
11359 * in="query",
11360 * description="The address-city of the Patient resource.",
11361 * required=false,
11362 * @OA\Schema(
11363 * type="string"
11365 * ),
11366 * @OA\Parameter(
11367 * name="address-postalcode",
11368 * in="query",
11369 * description="The address-postalcode of the Patient resource.",
11370 * required=false,
11371 * @OA\Schema(
11372 * type="string"
11374 * ),
11375 * @OA\Parameter(
11376 * name="address-state",
11377 * in="query",
11378 * description="The address-state of the Patient resource.",
11379 * required=false,
11380 * @OA\Schema(
11381 * type="string"
11383 * ),
11384 * @OA\Parameter(
11385 * name="email",
11386 * in="query",
11387 * description="The email of the Patient resource.",
11388 * required=false,
11389 * @OA\Schema(
11390 * type="string"
11392 * ),
11393 * @OA\Parameter(
11394 * name="family",
11395 * in="query",
11396 * description="The family name of the Patient resource.",
11397 * required=false,
11398 * @OA\Schema(
11399 * type="string"
11401 * ),
11402 * @OA\Parameter(
11403 * name="given",
11404 * in="query",
11405 * description="The given name of the Patient resource.",
11406 * required=false,
11407 * @OA\Schema(
11408 * type="string"
11410 * ),
11411 * @OA\Parameter(
11412 * name="phone",
11413 * in="query",
11414 * description="The phone number of the Patient resource.",
11415 * required=false,
11416 * @OA\Schema(
11417 * type="string"
11419 * ),
11420 * @OA\Parameter(
11421 * name="telecom",
11422 * in="query",
11423 * description="The fax number of the Patient resource.",
11424 * required=false,
11425 * @OA\Schema(
11426 * type="string"
11428 * ),
11429 * @OA\Response(
11430 * response="200",
11431 * description="Standard Response",
11432 * @OA\MediaType(
11433 * mediaType="application/json",
11434 * @OA\Schema(
11435 * @OA\Property(
11436 * property="json object",
11437 * description="FHIR Json object.",
11438 * type="object"
11439 * ),
11440 * example={
11441 * "meta": {
11442 * "lastUpdated": "2021-09-14T09:13:51"
11443 * },
11444 * "resourceType": "Bundle",
11445 * "type": "collection",
11446 * "total": 0,
11447 * "link": {
11449 * "relation": "self",
11450 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11456 * ),
11457 * @OA\Response(
11458 * response="400",
11459 * ref="#/components/responses/badrequest"
11460 * ),
11461 * @OA\Response(
11462 * response="401",
11463 * ref="#/components/responses/unauthorized"
11464 * ),
11465 * security={{"openemr_auth":{}}}
11468 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11469 $params = $request->getQueryParams();
11470 if ($request->isPatientRequest()) {
11471 // only allow access to data of binded patient
11472 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11473 // need to use getAll rather than getOne)
11474 $params['_id'] = $request->getPatientUUIDString();
11475 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11476 } else {
11477 RestConfig::authorization_check("patients", "demo");
11478 $return = (new FhirPatientRestController())->getAll($params);
11480 RestConfig::apiLog($return);
11481 return $return;
11485 * @OA\Get(
11486 * path="/fhir/Patient/$export",
11487 * 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>",
11488 * tags={"fhir"},
11489 * @OA\Response(
11490 * response="200",
11491 * 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>"
11492 * ),
11493 * @OA\Response(
11494 * response="400",
11495 * ref="#/components/responses/badrequest"
11496 * ),
11497 * @OA\Response(
11498 * response="401",
11499 * ref="#/components/responses/unauthorized"
11500 * ),
11501 * security={{"openemr_auth":{}}}
11504 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11505 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11506 RestConfig::authorization_check("admin", "users");
11507 $fhirExportService = new FhirOperationExportRestController($request);
11508 $return = $fhirExportService->processExport(
11509 $request->getQueryParams(),
11510 'Patient',
11511 $request->getHeader('Accept')[0] ?? '',
11512 $request->getHeader('Prefer')[0] ?? ''
11514 RestConfig::apiLog($return);
11515 return $return;
11519 * @OA\Get(
11520 * path="/fhir/Patient/{uuid}",
11521 * description="Returns a single Patient resource.",
11522 * tags={"fhir"},
11523 * @OA\Parameter(
11524 * name="uuid",
11525 * in="path",
11526 * description="The uuid for the Patient resource.",
11527 * required=true,
11528 * @OA\Schema(
11529 * type="string"
11531 * ),
11532 * @OA\Response(
11533 * response="200",
11534 * description="Standard Response",
11535 * @OA\MediaType(
11536 * mediaType="application/json",
11537 * @OA\Schema(
11538 * @OA\Property(
11539 * property="json object",
11540 * description="FHIR Json object.",
11541 * type="object"
11542 * ),
11543 * example={
11544 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11545 * "meta": {
11546 * "versionId": "1",
11547 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11548 * },
11549 * "resourceType": "Patient",
11550 * "text": {
11551 * "status": "generated",
11552 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11553 * },
11554 * "extension": {
11556 * "valueCode": "F",
11557 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11558 * },
11560 * "extension": {
11562 * "valueCoding": {
11563 * "system": "urn:oid:2.16.840.1.113883.6.238",
11564 * "code": "1006-6",
11565 * "display": "Abenaki"
11566 * },
11567 * "url": "ombCategory"
11568 * },
11570 * "valueString": "Abenaki",
11571 * "url": "text"
11573 * },
11574 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11575 * },
11577 * "extension": {
11579 * "valueString": "Declined To Specify",
11580 * "url": "text"
11582 * },
11583 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11585 * },
11586 * "identifier": {
11588 * "use": "official",
11589 * "type": {
11590 * "coding": {
11592 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11593 * "code": "PT"
11596 * },
11597 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11598 * "value": "1"
11600 * },
11601 * "active": true,
11602 * "name": {
11604 * "use": "official",
11605 * "family": "Von197",
11606 * "given": {
11607 * "Aurore252"
11610 * },
11611 * "gender": "female",
11612 * "birthDate": "1970-07-03",
11613 * "address": {
11615 * "line": {
11616 * "245 Crona Wall"
11617 * },
11618 * "city": "Boston",
11619 * "state": "Massachusetts",
11620 * "postalCode": "02215",
11621 * "period": {
11622 * "start": "2020-09-21T17:08:03.532+00:00"
11625 * },
11626 * "communication": {
11628 * "language": {
11629 * "coding": {
11631 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11632 * "code": "unknown",
11633 * "display": "Unknown"
11642 * ),
11643 * @OA\Response(
11644 * response="400",
11645 * ref="#/components/responses/badrequest"
11646 * ),
11647 * @OA\Response(
11648 * response="401",
11649 * ref="#/components/responses/unauthorized"
11650 * ),
11651 * @OA\Response(
11652 * response="404",
11653 * ref="#/components/responses/uuidnotfound"
11654 * ),
11655 * security={{"openemr_auth":{}}}
11658 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11659 if ($request->isPatientRequest()) {
11660 // only allow access to data of binded patient
11661 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11662 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11664 $uuid = $request->getPatientUUIDString();
11665 } else {
11666 RestConfig::authorization_check("patients", "demo");
11668 $return = (new FhirPatientRestController())->getOne($uuid);
11669 RestConfig::apiLog($return);
11670 return $return;
11674 * @OA\Get(
11675 * path="/fhir/Person",
11676 * description="Returns a list of Person resources.",
11677 * tags={"fhir"},
11678 * @OA\Parameter(
11679 * name="name",
11680 * in="query",
11681 * description="The name of the Person resource.",
11682 * required=false,
11683 * @OA\Schema(
11684 * type="string"
11686 * ),
11687 * @OA\Parameter(
11688 * name="active",
11689 * in="query",
11690 * description="The active status of the Person resource.",
11691 * required=false,
11692 * @OA\Schema(
11693 * type="string"
11695 * ),
11696 * @OA\Parameter(
11697 * name="address",
11698 * in="query",
11699 * description="The address of the Person resource.",
11700 * required=false,
11701 * @OA\Schema(
11702 * type="string"
11704 * ),
11705 * @OA\Parameter(
11706 * name="address-city",
11707 * in="query",
11708 * description="The address-city of the Person resource.",
11709 * required=false,
11710 * @OA\Schema(
11711 * type="string"
11713 * ),
11714 * @OA\Parameter(
11715 * name="address-postalcode",
11716 * in="query",
11717 * description="The address-postalcode of the Person resource.",
11718 * required=false,
11719 * @OA\Schema(
11720 * type="string"
11722 * ),
11723 * @OA\Parameter(
11724 * name="address-state",
11725 * in="query",
11726 * description="The address-state of the Person resource.",
11727 * required=false,
11728 * @OA\Schema(
11729 * type="string"
11731 * ),
11732 * @OA\Parameter(
11733 * name="email",
11734 * in="query",
11735 * description="The email of the Person resource.",
11736 * required=false,
11737 * @OA\Schema(
11738 * type="string"
11740 * ),
11741 * @OA\Parameter(
11742 * name="family",
11743 * in="query",
11744 * description="The family name of the Person resource.",
11745 * required=false,
11746 * @OA\Schema(
11747 * type="string"
11749 * ),
11750 * @OA\Parameter(
11751 * name="given",
11752 * in="query",
11753 * description="The given name of the Person resource.",
11754 * required=false,
11755 * @OA\Schema(
11756 * type="string"
11758 * ),
11759 * @OA\Parameter(
11760 * name="phone",
11761 * in="query",
11762 * description="The phone number of the Person resource.",
11763 * required=false,
11764 * @OA\Schema(
11765 * type="string"
11767 * ),
11768 * @OA\Parameter(
11769 * name="telecom",
11770 * in="query",
11771 * description="The fax number of the Person resource.",
11772 * required=false,
11773 * @OA\Schema(
11774 * type="string"
11776 * ),
11777 * @OA\Response(
11778 * response="200",
11779 * description="Standard Response",
11780 * @OA\MediaType(
11781 * mediaType="application/json",
11782 * @OA\Schema(
11783 * @OA\Property(
11784 * property="json object",
11785 * description="FHIR Json object.",
11786 * type="object"
11787 * ),
11788 * example={
11789 * "meta": {
11790 * "lastUpdated": "2021-09-14T09:13:51"
11791 * },
11792 * "resourceType": "Bundle",
11793 * "type": "collection",
11794 * "total": 0,
11795 * "link": {
11797 * "relation": "self",
11798 * "url": "https://localhost:9300/apis/default/fhir/Person"
11804 * ),
11805 * @OA\Response(
11806 * response="400",
11807 * ref="#/components/responses/badrequest"
11808 * ),
11809 * @OA\Response(
11810 * response="401",
11811 * ref="#/components/responses/unauthorized"
11812 * ),
11813 * security={{"openemr_auth":{}}}
11816 "GET /fhir/Person" => function (HttpRestRequest $request) {
11817 RestConfig::authorization_check("admin", "users");
11818 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11819 RestConfig::apiLog($return);
11820 return $return;
11824 * @OA\Get(
11825 * path="/fhir/Person/{uuid}",
11826 * description="Returns a single Person resource.",
11827 * tags={"fhir"},
11828 * @OA\Parameter(
11829 * name="uuid",
11830 * in="path",
11831 * description="The uuid for the Person resource.",
11832 * required=true,
11833 * @OA\Schema(
11834 * type="string"
11836 * ),
11837 * @OA\Response(
11838 * response="200",
11839 * description="Standard Response",
11840 * @OA\MediaType(
11841 * mediaType="application/json",
11842 * @OA\Schema(
11843 * @OA\Property(
11844 * property="json object",
11845 * description="FHIR Json object.",
11846 * type="object"
11847 * ),
11848 * example={
11849 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11850 * "meta": {
11851 * "versionId": "1",
11852 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11853 * },
11854 * "resourceType": "Person",
11855 * "text": {
11856 * "status": "generated",
11857 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11858 * },
11859 * "name": {
11861 * "use": "official",
11862 * "family": "Administrator",
11863 * "given": {
11864 * "Administrator",
11865 * "Larry"
11868 * },
11869 * "telecom": {
11871 * "system": "phone",
11872 * "value": "1234567890",
11873 * "use": "home"
11874 * },
11876 * "system": "phone",
11877 * "value": "1234567890",
11878 * "use": "work"
11879 * },
11881 * "system": "phone",
11882 * "value": "1234567890",
11883 * "use": "mobile"
11884 * },
11886 * "system": "email",
11887 * "value": "hey@hey.com",
11888 * "use": "home"
11890 * },
11891 * "address": {
11893 * "line": {
11894 * "123 Lane Street"
11895 * },
11896 * "city": "Bellevue",
11897 * "state": "WA",
11898 * "period": {
11899 * "start": "2021-04-13T08:57:32.146+00:00"
11902 * },
11903 * "active": true
11907 * ),
11908 * @OA\Response(
11909 * response="400",
11910 * ref="#/components/responses/badrequest"
11911 * ),
11912 * @OA\Response(
11913 * response="401",
11914 * ref="#/components/responses/unauthorized"
11915 * ),
11916 * @OA\Response(
11917 * response="404",
11918 * ref="#/components/responses/uuidnotfound"
11919 * ),
11920 * security={{"openemr_auth":{}}}
11923 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11924 // if the api user is requesting their own user we need to let it through
11925 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11926 // for the currently logged in user
11927 if ($request->getRequestUserUUIDString() == $uuid) {
11928 $return = (new FhirPersonRestController())->getOne($uuid);
11929 } else if (!$request->isPatientRequest()) {
11930 // not a patient ,make sure we have access to the users ACL
11931 RestConfig::authorization_check("admin", "users");
11932 $return = (new FhirPersonRestController())->getOne($uuid);
11933 } else {
11934 // if we are a patient bound request we need to make sure we are only bound to the patient
11935 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
11938 RestConfig::apiLog($return);
11939 return $return;
11943 * @OA\Get(
11944 * path="/fhir/Practitioner",
11945 * description="Returns a list of Practitioner resources.",
11946 * tags={"fhir"},
11947 * @OA\Parameter(
11948 * name="_id",
11949 * in="query",
11950 * description="The uuid for the Practitioner resource.",
11951 * required=false,
11952 * @OA\Schema(
11953 * type="string"
11955 * ),
11956 * @OA\Parameter(
11957 * name="name",
11958 * in="query",
11959 * description="The name of the Practitioner resource.",
11960 * required=false,
11961 * @OA\Schema(
11962 * type="string"
11964 * ),
11965 * @OA\Parameter(
11966 * name="active",
11967 * in="query",
11968 * description="The active status of the Practitioner resource.",
11969 * required=false,
11970 * @OA\Schema(
11971 * type="string"
11973 * ),
11974 * @OA\Parameter(
11975 * name="address",
11976 * in="query",
11977 * description="The address of the Practitioner resource.",
11978 * required=false,
11979 * @OA\Schema(
11980 * type="string"
11982 * ),
11983 * @OA\Parameter(
11984 * name="address-city",
11985 * in="query",
11986 * description="The address-city of the Practitioner resource.",
11987 * required=false,
11988 * @OA\Schema(
11989 * type="string"
11991 * ),
11992 * @OA\Parameter(
11993 * name="address-postalcode",
11994 * in="query",
11995 * description="The address-postalcode of the Practitioner resource.",
11996 * required=false,
11997 * @OA\Schema(
11998 * type="string"
12000 * ),
12001 * @OA\Parameter(
12002 * name="address-state",
12003 * in="query",
12004 * description="The address-state of the Practitioner resource.",
12005 * required=false,
12006 * @OA\Schema(
12007 * type="string"
12009 * ),
12010 * @OA\Parameter(
12011 * name="email",
12012 * in="query",
12013 * description="The email of the Practitioner resource.",
12014 * required=false,
12015 * @OA\Schema(
12016 * type="string"
12018 * ),
12019 * @OA\Parameter(
12020 * name="family",
12021 * in="query",
12022 * description="The family name of the Practitioner resource.",
12023 * required=false,
12024 * @OA\Schema(
12025 * type="string"
12027 * ),
12028 * @OA\Parameter(
12029 * name="given",
12030 * in="query",
12031 * description="The given name of the Practitioner resource.",
12032 * required=false,
12033 * @OA\Schema(
12034 * type="string"
12036 * ),
12037 * @OA\Parameter(
12038 * name="phone",
12039 * in="query",
12040 * description="The phone number of the Practitioner resource.",
12041 * required=false,
12042 * @OA\Schema(
12043 * type="string"
12045 * ),
12046 * @OA\Parameter(
12047 * name="telecom",
12048 * in="query",
12049 * description="The fax number of the Practitioner resource.",
12050 * required=false,
12051 * @OA\Schema(
12052 * type="string"
12054 * ),
12055 * @OA\Response(
12056 * response="200",
12057 * description="Standard Response",
12058 * @OA\MediaType(
12059 * mediaType="application/json",
12060 * @OA\Schema(
12061 * @OA\Property(
12062 * property="json object",
12063 * description="FHIR Json object.",
12064 * type="object"
12065 * ),
12066 * example={
12067 * "meta": {
12068 * "lastUpdated": "2021-09-14T09:13:51"
12069 * },
12070 * "resourceType": "Bundle",
12071 * "type": "collection",
12072 * "total": 0,
12073 * "link": {
12075 * "relation": "self",
12076 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12082 * ),
12083 * @OA\Response(
12084 * response="400",
12085 * ref="#/components/responses/badrequest"
12086 * ),
12087 * @OA\Response(
12088 * response="401",
12089 * ref="#/components/responses/unauthorized"
12090 * ),
12091 * security={{"openemr_auth":{}}}
12094 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
12096 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12097 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12098 // I don't believe patients are assigned to a particular practitioner
12099 // should we allow just open api access to admin information? Should we restrict particular pieces
12100 // of data in the practitioner side (phone number, address information) based on a permission set?
12101 if (!$request->isPatientRequest()) {
12102 RestConfig::authorization_check("admin", "users");
12104 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12105 RestConfig::apiLog($return);
12106 return $return;
12110 * @OA\Get(
12111 * path="/fhir/Practitioner/{uuid}",
12112 * description="Returns a single Practitioner resource.",
12113 * tags={"fhir"},
12114 * @OA\Parameter(
12115 * name="uuid",
12116 * in="path",
12117 * description="The uuid for the Practitioner resource.",
12118 * required=true,
12119 * @OA\Schema(
12120 * type="string"
12122 * ),
12123 * @OA\Response(
12124 * response="200",
12125 * description="Standard Response",
12126 * @OA\MediaType(
12127 * mediaType="application/json",
12128 * @OA\Schema(
12129 * @OA\Property(
12130 * property="json object",
12131 * description="FHIR Json object.",
12132 * type="object"
12133 * ),
12134 * example={
12135 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12136 * "meta": {
12137 * "versionId": "1",
12138 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12139 * },
12140 * "resourceType": "Practitioner",
12141 * "text": {
12142 * "status": "generated",
12143 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12144 * },
12145 * "identifier": {
12147 * "system": "http://hl7.org/fhir/sid/us-npi",
12148 * "value": "11223344554543"
12150 * },
12151 * "active": true,
12152 * "name": {
12154 * "use": "official",
12155 * "family": "Smith",
12156 * "given": {
12157 * "Billy"
12164 * ),
12165 * @OA\Response(
12166 * response="400",
12167 * ref="#/components/responses/badrequest"
12168 * ),
12169 * @OA\Response(
12170 * response="401",
12171 * ref="#/components/responses/unauthorized"
12172 * ),
12173 * @OA\Response(
12174 * response="404",
12175 * ref="#/components/responses/uuidnotfound"
12176 * ),
12177 * security={{"openemr_auth":{}}}
12180 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12181 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12182 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12183 // I don't believe patients are assigned to a particular practitioner
12184 // should we allow just open api access to admin information? Should we restrict particular pieces
12185 // of data in the practitioner side (phone number, address information) based on a permission set?
12186 if (!$request->isPatientRequest()) {
12187 RestConfig::authorization_check("admin", "users");
12189 $return = (new FhirPractitionerRestController())->getOne($uuid);
12190 RestConfig::apiLog($return);
12191 return $return;
12195 * @OA\Post(
12196 * path="/fhir/Practitioner",
12197 * description="Adds a Practitioner resources.",
12198 * tags={"fhir"},
12199 * @OA\RequestBody(
12200 * required=true,
12201 * @OA\MediaType(
12202 * mediaType="application/json",
12203 * @OA\Schema(
12204 * description="The json object for the Practitioner resource.",
12205 * type="object"
12206 * ),
12207 * example={
12208 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12209 * "meta": {
12210 * "versionId": "1",
12211 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12212 * },
12213 * "resourceType": "Practitioner",
12214 * "text": {
12215 * "status": "generated",
12216 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12217 * },
12218 * "identifier": {
12220 * "system": "http://hl7.org/fhir/sid/us-npi",
12221 * "value": "11223344554543"
12223 * },
12224 * "active": true,
12225 * "name": {
12227 * "use": "official",
12228 * "family": "Smith",
12229 * "given": {
12230 * "Danny"
12236 * ),
12237 * @OA\Response(
12238 * response="200",
12239 * description="Standard Response",
12240 * @OA\MediaType(
12241 * mediaType="application/json",
12242 * @OA\Schema(
12243 * @OA\Property(
12244 * property="json object",
12245 * description="FHIR Json object.",
12246 * type="object"
12247 * ),
12248 * example={
12249 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12250 * "meta": {
12251 * "versionId": "1",
12252 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12253 * },
12254 * "resourceType": "Practitioner",
12255 * "text": {
12256 * "status": "generated",
12257 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12258 * },
12259 * "identifier": {
12261 * "system": "http://hl7.org/fhir/sid/us-npi",
12262 * "value": "11223344554543"
12264 * },
12265 * "active": true,
12266 * "name": {
12268 * "use": "official",
12269 * "family": "Smith",
12270 * "given": {
12271 * "Danny"
12278 * ),
12279 * @OA\Response(
12280 * response="400",
12281 * ref="#/components/responses/badrequest"
12282 * ),
12283 * @OA\Response(
12284 * response="401",
12285 * ref="#/components/responses/unauthorized"
12286 * ),
12287 * security={{"openemr_auth":{}}}
12290 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
12291 RestConfig::authorization_check("admin", "users");
12292 $data = (array) (json_decode(file_get_contents("php://input"), true));
12293 $return = (new FhirPractitionerRestController())->post($data);
12294 RestConfig::apiLog($return, $data);
12295 return $return;
12299 * @OA\Put(
12300 * path="/fhir/Practitioner/{uuid}",
12301 * description="Modify a Practitioner resource.",
12302 * tags={"fhir"},
12303 * @OA\Parameter(
12304 * name="uuid",
12305 * in="path",
12306 * description="The uuid for the Practitioner resource.",
12307 * required=true,
12308 * @OA\Schema(
12309 * type="string"
12311 * ),
12312 * @OA\RequestBody(
12313 * required=true,
12314 * @OA\MediaType(
12315 * mediaType="application/json",
12316 * @OA\Schema(
12317 * description="The json object for the Practitioner resource.",
12318 * type="object"
12319 * ),
12320 * example={
12321 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12322 * "meta": {
12323 * "versionId": "1",
12324 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12325 * },
12326 * "resourceType": "Practitioner",
12327 * "text": {
12328 * "status": "generated",
12329 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12330 * },
12331 * "identifier": {
12333 * "system": "http://hl7.org/fhir/sid/us-npi",
12334 * "value": "11223344554543"
12336 * },
12337 * "active": true,
12338 * "name": {
12340 * "use": "official",
12341 * "family": "Smith",
12342 * "given": {
12343 * "Billy"
12349 * ),
12350 * @OA\Response(
12351 * response="201",
12352 * description="Standard Response",
12353 * @OA\MediaType(
12354 * mediaType="application/json",
12355 * @OA\Schema(
12356 * example={
12357 * "id": 5,
12358 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12362 * ),
12363 * @OA\Response(
12364 * response="400",
12365 * ref="#/components/responses/badrequest"
12366 * ),
12367 * @OA\Response(
12368 * response="401",
12369 * ref="#/components/responses/unauthorized"
12370 * ),
12371 * security={{"openemr_auth":{}}}
12374 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12375 RestConfig::authorization_check("admin", "users");
12376 $data = (array) (json_decode(file_get_contents("php://input"), true));
12377 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12378 RestConfig::apiLog($return, $data);
12379 return $return;
12383 * @OA\Get(
12384 * path="/fhir/PractitionerRole",
12385 * description="Returns a list of PractitionerRole resources.",
12386 * tags={"fhir"},
12387 * @OA\Parameter(
12388 * name="specialty",
12389 * in="query",
12390 * description="The specialty of the PractitionerRole resource.",
12391 * required=false,
12392 * @OA\Schema(
12393 * type="string"
12395 * ),
12396 * @OA\Parameter(
12397 * name="practitioner",
12398 * in="query",
12399 * description="The practitioner of the PractitionerRole resource.",
12400 * required=false,
12401 * @OA\Schema(
12402 * type="string"
12404 * ),
12405 * @OA\Response(
12406 * response="200",
12407 * description="Standard Response",
12408 * @OA\MediaType(
12409 * mediaType="application/json",
12410 * @OA\Schema(
12411 * @OA\Property(
12412 * property="json object",
12413 * description="FHIR Json object.",
12414 * type="object"
12415 * ),
12416 * example={
12417 * "meta": {
12418 * "lastUpdated": "2021-09-14T09:13:51"
12419 * },
12420 * "resourceType": "Bundle",
12421 * "type": "collection",
12422 * "total": 0,
12423 * "link": {
12425 * "relation": "self",
12426 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12432 * ),
12433 * @OA\Response(
12434 * response="400",
12435 * ref="#/components/responses/badrequest"
12436 * ),
12437 * @OA\Response(
12438 * response="401",
12439 * ref="#/components/responses/unauthorized"
12440 * ),
12441 * security={{"openemr_auth":{}}}
12444 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12445 RestConfig::authorization_check("admin", "users");
12446 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12447 RestConfig::apiLog($return);
12448 return $return;
12452 * @OA\Get(
12453 * path="/fhir/PractitionerRole/{uuid}",
12454 * description="Returns a single PractitionerRole resource.",
12455 * tags={"fhir"},
12456 * @OA\Parameter(
12457 * name="uuid",
12458 * in="path",
12459 * description="The uuid for the PractitionerRole resource.",
12460 * required=true,
12461 * @OA\Schema(
12462 * type="string"
12464 * ),
12465 * @OA\Response(
12466 * response="200",
12467 * description="Standard Response",
12468 * @OA\MediaType(
12469 * mediaType="application/json",
12470 * @OA\Schema(
12471 * @OA\Property(
12472 * property="json object",
12473 * description="FHIR Json object.",
12474 * type="object"
12475 * ),
12476 * example={
12477 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12478 * "meta": {
12479 * "versionId": "1",
12480 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12481 * },
12482 * "resourceType": "PractitionerRole",
12483 * "practitioner": {
12484 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12485 * "display": "Administrator Administrator"
12486 * },
12487 * "organization": {
12488 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12489 * "display": "Your Clinic Name Here"
12490 * },
12491 * "code": {
12493 * "coding": {
12494 * "102L00000X"
12495 * },
12496 * "text": "Psychoanalyst"
12497 * },
12499 * "coding": {
12500 * "101Y00000X"
12501 * },
12502 * "text": "Counselor"
12508 * ),
12509 * @OA\Response(
12510 * response="400",
12511 * ref="#/components/responses/badrequest"
12512 * ),
12513 * @OA\Response(
12514 * response="401",
12515 * ref="#/components/responses/unauthorized"
12516 * ),
12517 * @OA\Response(
12518 * response="404",
12519 * ref="#/components/responses/uuidnotfound"
12520 * ),
12521 * security={{"openemr_auth":{}}}
12524 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12525 RestConfig::authorization_check("admin", "users");
12526 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12527 RestConfig::apiLog($return);
12528 return $return;
12532 * @OA\Get(
12533 * path="/fhir/Procedure",
12534 * description="Returns a list of Procedure resources.",
12535 * tags={"fhir"},
12536 * @OA\Parameter(
12537 * name="_id",
12538 * in="query",
12539 * description="The uuid for the Procedure resource.",
12540 * required=false,
12541 * @OA\Schema(
12542 * type="string"
12544 * ),
12545 * @OA\Parameter(
12546 * name="patient",
12547 * in="query",
12548 * description="The uuid for the patient.",
12549 * required=false,
12550 * @OA\Schema(
12551 * type="string"
12553 * ),
12554 * @OA\Parameter(
12555 * name="date",
12556 * in="query",
12557 * description="The datetime of the Procedure resource.",
12558 * required=false,
12559 * @OA\Schema(
12560 * type="string"
12562 * ),
12563 * @OA\Response(
12564 * response="200",
12565 * description="Standard Response",
12566 * @OA\MediaType(
12567 * mediaType="application/json",
12568 * @OA\Schema(
12569 * @OA\Property(
12570 * property="json object",
12571 * description="FHIR Json object.",
12572 * type="object"
12573 * ),
12574 * example={
12575 * "meta": {
12576 * "lastUpdated": "2021-09-14T09:13:51"
12577 * },
12578 * "resourceType": "Bundle",
12579 * "type": "collection",
12580 * "total": 0,
12581 * "link": {
12583 * "relation": "self",
12584 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12590 * ),
12591 * @OA\Response(
12592 * response="400",
12593 * ref="#/components/responses/badrequest"
12594 * ),
12595 * @OA\Response(
12596 * response="401",
12597 * ref="#/components/responses/unauthorized"
12598 * ),
12599 * security={{"openemr_auth":{}}}
12602 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12603 if ($request->isPatientRequest()) {
12604 // only allow access to data of binded patient
12605 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12606 } else {
12607 RestConfig::authorization_check("patients", "med");
12608 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12610 RestConfig::apiLog($return);
12611 return $return;
12615 * @OA\Get(
12616 * path="/fhir/Procedure/{uuid}",
12617 * description="Returns a single Procedure resource.",
12618 * tags={"fhir"},
12619 * @OA\Parameter(
12620 * name="uuid",
12621 * in="path",
12622 * description="The uuid for the Procedure resource.",
12623 * required=true,
12624 * @OA\Schema(
12625 * type="string"
12627 * ),
12628 * @OA\Response(
12629 * response="200",
12630 * description="Standard Response",
12631 * @OA\MediaType(
12632 * mediaType="application/json",
12633 * @OA\Schema(
12634 * @OA\Property(
12635 * property="json object",
12636 * description="FHIR Json object.",
12637 * type="object"
12638 * ),
12639 * example={
12640 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12641 * "meta": {
12642 * "versionId": "1",
12643 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12644 * },
12645 * "resourceType": "Procedure",
12646 * "status": "in-progress",
12647 * "subject": {
12648 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12649 * "type": "Patient"
12654 * ),
12655 * @OA\Response(
12656 * response="400",
12657 * ref="#/components/responses/badrequest"
12658 * ),
12659 * @OA\Response(
12660 * response="401",
12661 * ref="#/components/responses/unauthorized"
12662 * ),
12663 * @OA\Response(
12664 * response="404",
12665 * ref="#/components/responses/uuidnotfound"
12666 * ),
12667 * security={{"openemr_auth":{}}}
12670 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12671 if ($request->isPatientRequest()) {
12672 // only allow access to data of binded patient
12673 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12674 } else {
12675 RestConfig::authorization_check("patients", "med");
12676 $return = (new FhirProcedureRestController())->getOne($uuid);
12678 RestConfig::apiLog($return);
12679 return $return;
12683 * @OA\Get(
12684 * path="/fhir/Provenance/{uuid}",
12685 * description="Returns a single Provenance resource.",
12686 * tags={"fhir"},
12687 * @OA\Parameter(
12688 * name="uuid",
12689 * in="path",
12690 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12691 * required=true,
12692 * @OA\Schema(
12693 * type="string"
12695 * ),
12696 * @OA\Response(
12697 * response="200",
12698 * description="Standard Response",
12699 * @OA\MediaType(
12700 * mediaType="application/json",
12701 * @OA\Schema(
12702 * @OA\Property(
12703 * property="json object",
12704 * description="FHIR Json object.",
12705 * type="object"
12706 * ),
12707 * example={
12708 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12709 * "resourceType": "Provenance",
12710 * "target": {
12712 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12713 * "type": "AllergyIntolerance"
12715 * },
12716 * "recorded": "2022-03-26T22:43:30+00:00",
12717 * "agent": {
12719 * "type": {
12720 * "coding": {
12722 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12723 * "code": "author",
12724 * "display": "Author"
12727 * },
12728 * "who": {
12729 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12730 * "type": "Organization"
12731 * },
12732 * "onBehalfOf": {
12733 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12734 * "type": "Organization"
12736 * },
12738 * "type": {
12739 * "coding": {
12741 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12742 * "code": "transmitter",
12743 * "display": "Transmitter"
12747 * },
12748 * "who": {
12749 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12750 * "type": "Organization"
12751 * },
12752 * "onBehalfOf": {
12753 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12754 * "type": "Organization"
12760 * ),
12761 * @OA\Response(
12762 * response="400",
12763 * ref="#/components/responses/badrequest"
12764 * ),
12765 * @OA\Response(
12766 * response="401",
12767 * ref="#/components/responses/unauthorized"
12768 * ),
12769 * @OA\Response(
12770 * response="404",
12771 * ref="#/components/responses/uuidnotfound"
12772 * ),
12773 * security={{"openemr_auth":{}}}
12776 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12777 if ($request->isPatientRequest()) {
12778 // only allow access to data of binded patient
12779 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12780 } else {
12781 RestConfig::authorization_check("admin", "super");
12782 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12784 RestConfig::apiLog($return);
12785 return $return;
12789 * @OA\Get(
12790 * path="/fhir/Provenance",
12791 * description="Returns a list of Provenance resources.",
12792 * tags={"fhir"},
12793 * @OA\Parameter(
12794 * name="_id",
12795 * in="query",
12796 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12797 * required=false,
12798 * @OA\Schema(
12799 * type="string"
12801 * ),
12802 * @OA\Response(
12803 * response="200",
12804 * description="Standard Response",
12805 * @OA\MediaType(
12806 * mediaType="application/json",
12807 * @OA\Schema(
12808 * @OA\Property(
12809 * property="json object",
12810 * description="FHIR Json object.",
12811 * type="object"
12812 * ),
12813 * example={
12814 * "meta": {
12815 * "lastUpdated": "2021-09-14T09:13:51"
12816 * },
12817 * "resourceType": "Bundle",
12818 * "type": "collection",
12819 * "total": 0,
12820 * "link": {
12822 * "relation": "self",
12823 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12829 * ),
12830 * @OA\Response(
12831 * response="400",
12832 * ref="#/components/responses/badrequest"
12833 * ),
12834 * @OA\Response(
12835 * response="401",
12836 * ref="#/components/responses/unauthorized"
12837 * ),
12838 * security={{"openemr_auth":{}}}
12841 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12842 // property to support which is why this endpoint exists.
12843 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12844 if ($request->isPatientRequest()) {
12845 // only allow access to data of binded patient
12846 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12847 } else {
12848 // TODO: it seems like regular users should be able to grab authorship / provenance information
12849 RestConfig::authorization_check("admin", "super");
12850 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12852 RestConfig::apiLog($return);
12853 return $return;
12856 // other endpoints
12859 * @OA\Get(
12860 * path="/fhir/metadata",
12861 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12862 * tags={"fhir"},
12863 * @OA\Response(
12864 * response="200",
12865 * description="Return CapabilityStatement resource of the fhir server"
12869 "GET /fhir/metadata" => function () {
12870 $return = (new FhirMetaDataRestController())->getMetaData();
12871 RestConfig::apiLog($return);
12872 return $return;
12876 * @OA\Get(
12877 * path="/fhir/.well-known/smart-configuration",
12878 * description="Returns smart configuration of the fhir server.",
12879 * tags={"fhir"},
12880 * @OA\Response(
12881 * response="200",
12882 * description="Return smart configuration of the fhir server"
12886 "GET /fhir/.well-known/smart-configuration" => function () {
12887 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12888 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12889 RestConfig::apiLog($return);
12890 return $return;
12894 * @OA\Get(
12895 * path="/fhir/OperationDefinition",
12896 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
12897 * tags={"fhir"},
12898 * @OA\Response(
12899 * response="200",
12900 * description="Return list of OperationDefinition resources"
12904 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
12905 // for now we will just hard code the custom resources
12906 $operationDefinitionController = new FhirOperationDefinitionRestController();
12907 $return = $operationDefinitionController->getAll($request->getQueryParams());
12908 RestConfig::apiLog($return);
12909 return $return;
12913 * @OA\Get(
12914 * path="/fhir/OperationDefinition/{operation}",
12915 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
12916 * tags={"fhir"},
12917 * @OA\Parameter(
12918 * name="operation",
12919 * in="path",
12920 * description="The name of the operation to query. For example $bulkdata-status",
12921 * required=true,
12922 * @OA\Schema(
12923 * type="string"
12925 * ),
12926 * @OA\Response(
12927 * response="200",
12928 * description="Standard Response",
12929 * @OA\MediaType(
12930 * mediaType="application/json",
12931 * @OA\Schema(
12932 * @OA\Property(
12933 * property="json object",
12934 * description="FHIR Json object.",
12935 * type="object"
12936 * ),
12937 * example={
12938 * "resourceType": "OperationDefinition",
12939 * "name": "$bulkdata-status",
12940 * "status": "active",
12941 * "kind": "operation",
12942 * "parameter": {
12944 * "name": "job",
12945 * "use": "in",
12946 * "min": 1,
12947 * "max": 1,
12948 * "type": {
12949 * "system": "http://hl7.org/fhir/data-types",
12950 * "code": "string",
12951 * "display": "string"
12952 * },
12953 * "searchType": {
12954 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
12955 * "code": "string",
12956 * "display": "string"
12963 * ),
12966 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
12967 // for now we will just hard code the custom resources
12968 $operationDefinitionController = new FhirOperationDefinitionRestController();
12969 $return = $operationDefinitionController->getOne($operation);
12970 RestConfig::apiLog($return);
12971 return $return;
12974 // FHIR root level operations
12977 * @OA\Get(
12978 * path="/fhir/$export",
12979 * 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>",
12980 * tags={"fhir"},
12981 * @OA\Response(
12982 * response="200",
12983 * 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>"
12984 * ),
12985 * @OA\Response(
12986 * response="400",
12987 * ref="#/components/responses/badrequest"
12988 * ),
12989 * @OA\Response(
12990 * response="401",
12991 * ref="#/components/responses/unauthorized"
12992 * ),
12993 * security={{"openemr_auth":{}}}
12996 'GET /fhir/$export' => function (HttpRestRequest $request) {
12997 RestConfig::authorization_check("admin", "users");
12998 $fhirExportService = new FhirOperationExportRestController($request);
12999 $return = $fhirExportService->processExport(
13000 $request->getQueryParams(),
13001 'System',
13002 $request->getHeader('Accept')[0] ?? '',
13003 $request->getHeader('Prefer')[0] ?? ''
13005 RestConfig::apiLog($return);
13006 return $return;
13009 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13010 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13011 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13014 * @OA\Get(
13015 * path="/fhir/$bulkdata-status",
13016 * 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>",
13017 * tags={"fhir"},
13018 * @OA\Response(
13019 * response="200",
13020 * 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>"
13021 * ),
13022 * @OA\Response(
13023 * response="400",
13024 * ref="#/components/responses/badrequest"
13025 * ),
13026 * @OA\Response(
13027 * response="401",
13028 * ref="#/components/responses/unauthorized"
13029 * ),
13030 * security={{"openemr_auth":{}}}
13033 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13034 RestConfig::authorization_check("admin", "users");
13035 $jobUuidString = $request->getQueryParam('job');
13036 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13037 // since OpenEMR data is so small we just return the JSON from the database
13038 $fhirExportService = new FhirOperationExportRestController($request);
13039 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13040 RestConfig::apiLog($return);
13041 return $return;
13045 * @OA\Delete(
13046 * path="/fhir/$bulkdata-status",
13047 * 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>",
13048 * tags={"fhir"},
13049 * @OA\Response(
13050 * response="200",
13051 * 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>"
13052 * ),
13053 * @OA\Response(
13054 * response="400",
13055 * ref="#/components/responses/badrequest"
13056 * ),
13057 * @OA\Response(
13058 * response="401",
13059 * ref="#/components/responses/unauthorized"
13060 * ),
13061 * security={{"openemr_auth":{}}}
13064 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13065 RestConfig::authorization_check("admin", "users");
13066 $job = $request->getQueryParam('job');
13067 $fhirExportService = new FhirOperationExportRestController($request);
13068 $return = $fhirExportService->processDeleteExportForJob($job);
13069 RestConfig::apiLog($return);
13070 return $return;
13074 // Note that the portal (api) route is only for patient role
13075 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13076 RestConfig::$PORTAL_ROUTE_MAP = array(
13078 * @OA\Get(
13079 * path="/portal/patient",
13080 * description="Returns the patient.",
13081 * tags={"standard-patient"},
13082 * @OA\Response(
13083 * response="200",
13084 * description="Standard response",
13085 * @OA\MediaType(
13086 * mediaType="application/json",
13087 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13089 * ),
13090 * @OA\Response(
13091 * response="401",
13092 * ref="#/components/responses/unauthorized"
13093 * ),
13094 * security={{"openemr_auth":{}}}
13097 "GET /portal/patient" => function (HttpRestRequest $request) {
13098 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13099 RestConfig::apiLog($return);
13100 return $return;
13104 * @OA\Get(
13105 * path="/portal/patient/encounter",
13106 * description="Returns encounters for the patient.",
13107 * tags={"standard-patient"},
13108 * @OA\Response(
13109 * response="200",
13110 * ref="#/components/responses/standard"
13111 * ),
13112 * @OA\Response(
13113 * response="400",
13114 * ref="#/components/responses/badrequest"
13115 * ),
13116 * @OA\Response(
13117 * response="401",
13118 * ref="#/components/responses/unauthorized"
13119 * ),
13120 * security={{"openemr_auth":{}}}
13123 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
13124 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13125 RestConfig::apiLog($return);
13126 return $return;
13130 * @OA\Get(
13131 * path="/portal/patient/encounter/{euuid}",
13132 * description="Returns a selected encounter by its uuid.",
13133 * tags={"standard-patient"},
13134 * @OA\Parameter(
13135 * name="euuid",
13136 * in="path",
13137 * description="The uuid for the encounter.",
13138 * required=true,
13139 * @OA\Schema(
13140 * type="string"
13142 * ),
13143 * @OA\Response(
13144 * response="200",
13145 * ref="#/components/responses/standard"
13146 * ),
13147 * @OA\Response(
13148 * response="400",
13149 * ref="#/components/responses/badrequest"
13150 * ),
13151 * @OA\Response(
13152 * response="401",
13153 * ref="#/components/responses/unauthorized"
13154 * ),
13155 * security={{"openemr_auth":{}}}
13158 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
13159 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13160 RestConfig::apiLog($return);
13161 return $return;
13165 * @OA\Get(
13166 * path="/portal/patient/appointment",
13167 * description="Retrieves all appointments for a patient",
13168 * tags={"standard-patient"},
13169 * @OA\Response(
13170 * response="200",
13171 * ref="#/components/responses/standard"
13172 * ),
13173 * @OA\Response(
13174 * response="400",
13175 * ref="#/components/responses/badrequest"
13176 * ),
13177 * @OA\Response(
13178 * response="401",
13179 * ref="#/components/responses/unauthorized"
13180 * ),
13181 * security={{"openemr_auth":{}}}
13184 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
13185 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13186 RestConfig::apiLog($return);
13187 return $return;
13192 * @OA\Get(
13193 * path="/portal/patient/appointment/{auuid}",
13194 * description="Returns a selected appointment by its uuid.",
13195 * tags={"standard-patient"},
13196 * @OA\Parameter(
13197 * name="auuid",
13198 * in="path",
13199 * description="The uuid for the appointment.",
13200 * required=true,
13201 * @OA\Schema(
13202 * type="string"
13204 * ),
13205 * @OA\Response(
13206 * response="200",
13207 * ref="#/components/responses/standard"
13208 * ),
13209 * @OA\Response(
13210 * response="400",
13211 * ref="#/components/responses/badrequest"
13212 * ),
13213 * @OA\Response(
13214 * response="401",
13215 * ref="#/components/responses/unauthorized"
13216 * ),
13217 * security={{"openemr_auth":{}}}
13220 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
13221 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13222 RestConfig::apiLog($return);
13223 return $return;