UI improvements to Messages (#6054)
[openemr.git] / _rest_routes.inc.php
blob3ad7216101fae6447f677a11766539a78d921eba
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/vital.read": "Read vitals the user has access to (api:oemr)",
151 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
152 * "api:port": "Standard Patient Portal OpenEMR API",
153 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
154 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
155 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
159 * @OA\Tag(
160 * name="fhir",
161 * description="FHIR R4 API"
163 * @OA\Tag(
164 * name="standard",
165 * description="Standard OpenEMR API"
167 * @OA\Tag(
168 * name="standard-patient",
169 * description="Standard Patient Portal OpenEMR API"
171 * @OA\Response(
172 * response="standard",
173 * description="Standard Response",
174 * @OA\MediaType(
175 * mediaType="application/json",
176 * @OA\Schema(
177 * @OA\Property(
178 * property="validationErrors",
179 * description="Validation errors.",
180 * type="array",
181 * @OA\Items(
182 * type="object",
183 * ),
184 * ),
185 * @OA\Property(
186 * property="internalErrors",
187 * description="Internal errors.",
188 * type="array",
189 * @OA\Items(
190 * type="object",
191 * ),
192 * ),
193 * @OA\Property(
194 * property="data",
195 * description="Returned data.",
196 * type="array",
197 * @OA\Items(
198 * type="object",
199 * ),
200 * ),
201 * example={
202 * "validationErrors": {},
203 * "error_description": {},
204 * "data": {}
209 * @OA\Response(
210 * response="badrequest",
211 * description="Bad Request",
212 * @OA\MediaType(
213 * mediaType="application/json",
214 * @OA\Schema(
215 * @OA\Property(
216 * property="validationErrors",
217 * description="Validation errors.",
218 * type="object"
219 * ),
220 * example={
221 * "validationErrors":
223 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
229 * @OA\Response(
230 * response="unauthorized",
231 * description="Unauthorized",
232 * @OA\MediaType(
233 * mediaType="application/json",
234 * @OA\Schema(
235 * @OA\Property(
236 * property="error",
237 * description="The error.",
238 * type="string"
239 * ),
240 * @OA\Property(
241 * property="error_description",
242 * description="The description of the error.",
243 * type="string"
244 * ),
245 * @OA\Property(
246 * property="hint",
247 * description="More specific information on the error.",
248 * type="string"
249 * ),
250 * @OA\Property(
251 * property="message",
252 * description="Message regarding the error.",
253 * type="string"
254 * ),
255 * example={
256 * "error": "access_denied",
257 * "error_description": "The resource owner or authorization server denied the request.",
258 * "hint": "Missing ""Authorization"" header",
259 * "message": "The resource owner or authorization server denied the request."
264 * @OA\Response(
265 * response="uuidnotfound",
266 * description="Not Found",
267 * @OA\MediaType(
268 * mediaType="application/json",
269 * @OA\Schema(
270 * @OA\Property(
271 * property="empty",
272 * description="empty",
273 * type="object"
274 * ),
275 * example={}
281 // Lets keep our controller classes with the routes.
283 use OpenEMR\Common\Acl\AccessDeniedException;
284 use OpenEMR\Common\Http\HttpRestRequest;
285 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
286 use OpenEMR\RestControllers\FacilityRestController;
287 use OpenEMR\RestControllers\VersionRestController;
288 use OpenEMR\RestControllers\ProductRegistrationRestController;
289 use OpenEMR\RestControllers\PatientRestController;
290 use OpenEMR\RestControllers\EncounterRestController;
291 use OpenEMR\RestControllers\PractitionerRestController;
292 use OpenEMR\RestControllers\ListRestController;
293 use OpenEMR\RestControllers\InsuranceCompanyRestController;
294 use OpenEMR\RestControllers\AppointmentRestController;
295 use OpenEMR\RestControllers\ConditionRestController;
296 use OpenEMR\RestControllers\ONoteRestController;
297 use OpenEMR\RestControllers\DocumentRestController;
298 use OpenEMR\RestControllers\DrugRestController;
299 use OpenEMR\RestControllers\ImmunizationRestController;
300 use OpenEMR\RestControllers\InsuranceRestController;
301 use OpenEMR\RestControllers\MessageRestController;
302 use OpenEMR\RestControllers\PrescriptionRestController;
303 use OpenEMR\RestControllers\ProcedureRestController;
304 use OpenEMR\RestControllers\TransactionRestController;
306 // Note some Http clients may not send auth as json so a function
307 // is implemented to determine and parse encoding on auth route's.
309 // Note that the api route is only for users role
310 // (there is a mechanism in place to ensure only user role can access the api route)
311 RestConfig::$ROUTE_MAP = array(
313 * @OA\Get(
314 * path="/api/facility",
315 * description="Returns a single facility.",
316 * tags={"standard"},
317 * @OA\Parameter(
318 * name="name",
319 * in="query",
320 * description="The name for the facility.",
321 * required=false,
322 * @OA\Schema(
323 * type="string"
325 * ),
326 * @OA\Parameter(
327 * name="facility_npi",
328 * in="query",
329 * description="The facility_npi for the facility.",
330 * required=false,
331 * @OA\Schema(
332 * type="string"
334 * ),
335 * @OA\Parameter(
336 * name="phone",
337 * in="query",
338 * description="The phone for the facility.",
339 * required=false,
340 * @OA\Schema(
341 * type="string"
343 * ),
344 * @OA\Parameter(
345 * name="fax",
346 * in="query",
347 * description="The fax for the facility.",
348 * required=false,
349 * @OA\Schema(
350 * type="string"
352 * ),
353 * @OA\Parameter(
354 * name="street",
355 * in="query",
356 * description="The street for the facility.",
357 * required=false,
358 * @OA\Schema(
359 * type="string"
361 * ),
362 * @OA\Parameter(
363 * name="city",
364 * in="query",
365 * description="The city for the facility.",
366 * required=false,
367 * @OA\Schema(
368 * type="string"
370 * ),
371 * @OA\Parameter(
372 * name="state",
373 * in="query",
374 * description="The state for the facility.",
375 * required=false,
376 * @OA\Schema(
377 * type="string"
379 * ),
380 * @OA\Parameter(
381 * name="postal_code",
382 * in="query",
383 * description="The postal_code for the facility.",
384 * required=false,
385 * @OA\Schema(
386 * type="string"
388 * ),
389 * @OA\Parameter(
390 * name="country_code",
391 * in="query",
392 * description="The country_code for the facility.",
393 * required=false,
394 * @OA\Schema(
395 * type="string"
397 * ),
398 * @OA\Parameter(
399 * name="federal_ein",
400 * in="query",
401 * description="The federal_ein for the facility.",
402 * required=false,
403 * @OA\Schema(
404 * type="string"
406 * ),
407 * @OA\Parameter(
408 * name="website",
409 * in="query",
410 * description="The website for the facility.",
411 * required=false,
412 * @OA\Schema(
413 * type="string"
415 * ),
416 * @OA\Parameter(
417 * name="email",
418 * in="query",
419 * description="The email for the facility.",
420 * required=false,
421 * @OA\Schema(
422 * type="string"
424 * ),
425 * @OA\Parameter(
426 * name="domain_identifier",
427 * in="query",
428 * description="The domain_identifier for the facility.",
429 * required=false,
430 * @OA\Schema(
431 * type="string"
433 * ),
434 * @OA\Parameter(
435 * name="facility_taxonomy",
436 * in="query",
437 * description="The facility_taxonomy for the facility.",
438 * required=false,
439 * @OA\Schema(
440 * type="string"
442 * ),
443 * @OA\Parameter(
444 * name="facility_code",
445 * in="query",
446 * description="The facility_code for the facility.",
447 * required=false,
448 * @OA\Schema(
449 * type="string"
451 * ),
452 * @OA\Parameter(
453 * name="billing_location",
454 * in="query",
455 * description="The billing_location setting for the facility.",
456 * required=false,
457 * @OA\Schema(
458 * type="string"
460 * ),
461 * @OA\Parameter(
462 * name="accepts_assignment",
463 * in="query",
464 * description="The accepts_assignment setting for the facility.",
465 * required=false,
466 * @OA\Schema(
467 * type="string"
469 * ),
470 * @OA\Parameter(
471 * name="oid",
472 * in="query",
473 * description="The oid for the facility.",
474 * required=false,
475 * @OA\Schema(
476 * type="string"
478 * ),
479 * @OA\Parameter(
480 * name="service_location",
481 * in="query",
482 * description="The service_location setting for the facility.",
483 * required=false,
484 * @OA\Schema(
485 * type="string"
487 * ),
488 * @OA\Response(
489 * response="200",
490 * ref="#/components/responses/standard"
491 * ),
492 * @OA\Response(
493 * response="400",
494 * ref="#/components/responses/badrequest"
495 * ),
496 * @OA\Response(
497 * response="401",
498 * ref="#/components/responses/unauthorized"
499 * ),
500 * security={{"openemr_auth":{}}}
503 "GET /api/facility" => function () {
504 RestConfig::authorization_check("admin", "users");
505 $return = (new FacilityRestController())->getAll($_GET);
506 RestConfig::apiLog($return);
507 return $return;
511 * @OA\Get(
512 * path="/api/facility/{fuuid}",
513 * description="Returns a single facility.",
514 * tags={"standard"},
515 * @OA\Parameter(
516 * name="fuuid",
517 * in="path",
518 * description="The uuid for the facility.",
519 * required=true,
520 * @OA\Schema(
521 * type="string"
523 * ),
524 * @OA\Response(
525 * response="200",
526 * ref="#/components/responses/standard"
527 * ),
528 * @OA\Response(
529 * response="400",
530 * ref="#/components/responses/badrequest"
531 * ),
532 * @OA\Response(
533 * response="401",
534 * ref="#/components/responses/unauthorized"
535 * ),
536 * security={{"openemr_auth":{}}}
539 "GET /api/facility/:fuuid" => function ($fuuid) {
540 RestConfig::authorization_check("admin", "users");
541 $return = (new FacilityRestController())->getOne($fuuid);
542 RestConfig::apiLog($return);
543 return $return;
547 * @OA\Post(
548 * path="/api/facility",
549 * description="Creates a facility in the system",
550 * tags={"standard"},
551 * @OA\RequestBody(
552 * required=true,
553 * @OA\MediaType(
554 * mediaType="application/json",
555 * @OA\Schema(
556 * @OA\Property(
557 * property="name",
558 * description="The name for the facility.",
559 * type="string"
560 * ),
561 * @OA\Property(
562 * property="facility_npi",
563 * description="The facility_npi for the facility.",
564 * type="string"
565 * ),
566 * @OA\Property(
567 * property="phone",
568 * description="The phone for the facility.",
569 * type="string"
570 * ),
571 * @OA\Property(
572 * property="fax",
573 * description="The fax for the facility.",
574 * type="string"
575 * ),
576 * @OA\Property(
577 * property="street",
578 * description="The street for the facility.",
579 * type="string"
580 * ),
581 * @OA\Property(
582 * property="city",
583 * description="The city for the facility.",
584 * type="string"
585 * ),
586 * @OA\Property(
587 * property="state",
588 * description="The state for the facility.",
589 * type="string"
590 * ),
591 * @OA\Property(
592 * property="postal_code",
593 * description="The postal_code for the facility.",
594 * type="string"
595 * ),
596 * @OA\Property(
597 * property="country_code",
598 * description="The country_code for the facility.",
599 * type="string"
600 * ),
601 * @OA\Property(
602 * property="federal_ein",
603 * description="The federal_ein for the facility.",
604 * type="string"
605 * ),
606 * @OA\Property(
607 * property="website",
608 * description="The website for the facility.",
609 * type="string"
610 * ),
611 * @OA\Property(
612 * property="email",
613 * description="The email for the facility.",
614 * type="string"
615 * ),
616 * @OA\Property(
617 * property="domain_identifier",
618 * description="The domain_identifier for the facility.",
619 * type="string"
620 * ),
621 * @OA\Property(
622 * property="facility_taxonomy",
623 * description="The facility_taxonomy for the facility.",
624 * type="string"
625 * ),
626 * @OA\Property(
627 * property="facility_code",
628 * description="The facility_code for the facility.",
629 * type="string"
630 * ),
631 * @OA\Property(
632 * property="billing_location",
633 * description="The billing_location setting for the facility.",
634 * type="string"
635 * ),
636 * @OA\Property(
637 * property="accepts_assignment",
638 * description="The accepts_assignment setting for the facility.",
639 * type="string"
640 * ),
641 * @OA\Property(
642 * property="oid",
643 * description="The oid for the facility.",
644 * type="string"
645 * ),
646 * @OA\Property(
647 * property="service_location",
648 * description="The service_location setting for the facility.",
649 * type="string"
650 * ),
651 * required={"name", "facility_npi"},
652 * example={
653 * "name": "Aquaria",
654 * "facility_npi": "123456789123",
655 * "phone": "808-606-3030",
656 * "fax": "808-606-3031",
657 * "street": "1337 Bit Shifter Ln",
658 * "city": "San Lorenzo",
659 * "state": "ZZ",
660 * "postal_code": "54321",
661 * "country_code": "US",
662 * "federal_ein": "4343434",
663 * "website": "https://example.com",
664 * "email": "foo@bar.com",
665 * "domain_identifier": "",
666 * "facility_taxonomy": "",
667 * "facility_code": "",
668 * "billing_location": "1",
669 * "accepts_assignment": "1",
670 * "oid": "",
671 * "service_location": "1"
675 * ),
676 * @OA\Response(
677 * response="200",
678 * ref="#/components/responses/standard"
679 * ),
680 * @OA\Response(
681 * response="400",
682 * ref="#/components/responses/badrequest"
683 * ),
684 * @OA\Response(
685 * response="401",
686 * ref="#/components/responses/unauthorized"
687 * ),
688 * security={{"openemr_auth":{}}}
691 "POST /api/facility" => function () {
692 RestConfig::authorization_check("admin", "super");
693 $data = (array) (json_decode(file_get_contents("php://input")));
694 $return = (new FacilityRestController())->post($data);
695 RestConfig::apiLog($return, $data);
696 return $return;
700 * @OA\Put(
701 * path="/api/facility/{fuuid}",
702 * description="Updates a facility in the system",
703 * tags={"standard"},
704 * @OA\Parameter(
705 * name="fuuid",
706 * in="path",
707 * description="The uuid for the facility.",
708 * required=true,
709 * @OA\Schema(
710 * type="string"
712 * ),
713 * @OA\RequestBody(
714 * required=true,
715 * @OA\MediaType(
716 * mediaType="application/json",
717 * @OA\Schema(
718 * @OA\Property(
719 * property="name",
720 * description="The name for the facility.",
721 * type="string"
722 * ),
723 * @OA\Property(
724 * property="facility_npi",
725 * description="The facility_npi for the facility.",
726 * type="string"
727 * ),
728 * @OA\Property(
729 * property="phone",
730 * description="The phone for the facility.",
731 * type="string"
732 * ),
733 * @OA\Property(
734 * property="fax",
735 * description="The fax for the facility.",
736 * type="string"
737 * ),
738 * @OA\Property(
739 * property="street",
740 * description="The street for the facility.",
741 * type="string"
742 * ),
743 * @OA\Property(
744 * property="city",
745 * description="The city for the facility.",
746 * type="string"
747 * ),
748 * @OA\Property(
749 * property="state",
750 * description="The state for the facility.",
751 * type="string"
752 * ),
753 * @OA\Property(
754 * property="postal_code",
755 * description="The postal_code for the facility.",
756 * type="string"
757 * ),
758 * @OA\Property(
759 * property="country_code",
760 * description="The country_code for the facility.",
761 * type="string"
762 * ),
763 * @OA\Property(
764 * property="federal_ein",
765 * description="The federal_ein for the facility.",
766 * type="string"
767 * ),
768 * @OA\Property(
769 * property="website",
770 * description="The website for the facility.",
771 * type="string"
772 * ),
773 * @OA\Property(
774 * property="email",
775 * description="The email for the facility.",
776 * type="string"
777 * ),
778 * @OA\Property(
779 * property="domain_identifier",
780 * description="The domain_identifier for the facility.",
781 * type="string"
782 * ),
783 * @OA\Property(
784 * property="facility_taxonomy",
785 * description="The facility_taxonomy for the facility.",
786 * type="string"
787 * ),
788 * @OA\Property(
789 * property="facility_code",
790 * description="The facility_code for the facility.",
791 * type="string"
792 * ),
793 * @OA\Property(
794 * property="billing_location",
795 * description="The billing_location setting for the facility.",
796 * type="string"
797 * ),
798 * @OA\Property(
799 * property="accepts_assignment",
800 * description="The accepts_assignment setting for the facility.",
801 * type="string"
802 * ),
803 * @OA\Property(
804 * property="oid",
805 * description="The oid for the facility.",
806 * type="string"
807 * ),
808 * @OA\Property(
809 * property="service_location",
810 * description="The service_location setting for the facility.",
811 * type="string"
812 * ),
813 * example={
814 * "name": "Aquaria",
815 * "facility_npi": "123456789123",
816 * "phone": "808-606-3030",
817 * "fax": "808-606-3031",
818 * "street": "1337 Bit Shifter Ln",
819 * "city": "San Lorenzo",
820 * "state": "ZZ",
821 * "postal_code": "54321",
822 * "country_code": "US",
823 * "federal_ein": "4343434",
824 * "website": "https://example.com",
825 * "email": "foo@bar.com",
826 * "domain_identifier": "",
827 * "facility_taxonomy": "",
828 * "facility_code": "",
829 * "billing_location": "1",
830 * "accepts_assignment": "1",
831 * "oid": "",
832 * "service_location": "1"
836 * ),
837 * @OA\Response(
838 * response="200",
839 * ref="#/components/responses/standard"
840 * ),
841 * @OA\Response(
842 * response="400",
843 * ref="#/components/responses/badrequest"
844 * ),
845 * @OA\Response(
846 * response="401",
847 * ref="#/components/responses/unauthorized"
848 * ),
849 * security={{"openemr_auth":{}}}
852 "PUT /api/facility/:fuuid" => function ($fuuid) {
853 RestConfig::authorization_check("admin", "super");
854 $data = (array) (json_decode(file_get_contents("php://input")));
855 $return = (new FacilityRestController())->patch($fuuid, $data);
856 RestConfig::apiLog($return, $data);
857 return $return;
861 * @OA\Get(
862 * path="/api/patient",
863 * description="Retrieves a list of patients",
864 * tags={"standard"},
865 * @OA\Parameter(
866 * name="fname",
867 * in="query",
868 * description="The first name for the patient.",
869 * required=false,
870 * @OA\Schema(
871 * type="string"
873 * ),
874 * @OA\Parameter(
875 * name="lname",
876 * in="query",
877 * description="The last name for the patient.",
878 * required=false,
879 * @OA\Schema(
880 * type="string"
882 * ),
883 * @OA\Parameter(
884 * name="ss",
885 * in="query",
886 * description="The social security number for the patient.",
887 * required=false,
888 * @OA\Schema(
889 * type="string"
891 * ),
892 * @OA\Parameter(
893 * name="street",
894 * in="query",
895 * description="The street for the patient.",
896 * required=false,
897 * @OA\Schema(
898 * type="string"
900 * ),
901 * @OA\Parameter(
902 * name="postal_code",
903 * in="query",
904 * description="The postal code for the patient.",
905 * required=false,
906 * @OA\Schema(
907 * type="string"
909 * ),
910 * @OA\Parameter(
911 * name="city",
912 * in="query",
913 * description="The city for the patient.",
914 * required=false,
915 * @OA\Schema(
916 * type="string"
918 * ),
919 * @OA\Parameter(
920 * name="state",
921 * in="query",
922 * description="The state for the patient.",
923 * required=false,
924 * @OA\Schema(
925 * type="string"
927 * ),
928 * @OA\Parameter(
929 * name="phone_home",
930 * in="query",
931 * description="The home phone for the patient.",
932 * required=false,
933 * @OA\Schema(
934 * type="string"
936 * ),
937 * @OA\Parameter(
938 * name="phone_biz",
939 * in="query",
940 * description="The business phone for the patient.",
941 * required=false,
942 * @OA\Schema(
943 * type="string"
945 * ),
946 * @OA\Parameter(
947 * name="phone_cell",
948 * in="query",
949 * description="The cell phone for the patient.",
950 * required=false,
951 * @OA\Schema(
952 * type="string"
954 * ),
955 * @OA\Parameter(
956 * name="postal_contact",
957 * in="query",
958 * description="The postal_contact for the patient.",
959 * required=false,
960 * @OA\Schema(
961 * type="string"
963 * ),
964 * @OA\Parameter(
965 * name="sex",
966 * in="query",
967 * description="The gender for the patient.",
968 * required=false,
969 * @OA\Schema(
970 * type="string"
972 * ),
973 * @OA\Parameter(
974 * name="country_code",
975 * in="query",
976 * description="The country code for the patient.",
977 * required=false,
978 * @OA\Schema(
979 * type="string"
981 * ),
982 * @OA\Parameter(
983 * name="email",
984 * in="query",
985 * description="The email for the patient.",
986 * required=false,
987 * @OA\Schema(
988 * type="string"
990 * ),
991 * @OA\Parameter(
992 * name="DOB",
993 * in="query",
994 * description="The DOB for the patient.",
995 * required=false,
996 * @OA\Schema(
997 * type="string"
999 * ),
1000 * @OA\Response(
1001 * response="200",
1002 * ref="#/components/responses/standard"
1003 * ),
1004 * @OA\Response(
1005 * response="400",
1006 * ref="#/components/responses/badrequest"
1007 * ),
1008 * @OA\Response(
1009 * response="401",
1010 * ref="#/components/responses/unauthorized"
1011 * ),
1012 * security={{"openemr_auth":{}}}
1015 "GET /api/patient" => function () {
1016 RestConfig::authorization_check("patients", "demo");
1017 $return = (new PatientRestController())->getAll($_GET);
1018 RestConfig::apiLog($return);
1019 return $return;
1023 * Schema for the patient request
1025 * @OA\Schema(
1026 * schema="api_patient_request",
1027 * @OA\Property(
1028 * property="title",
1029 * description="The title of patient.",
1030 * type="string"
1031 * ),
1032 * @OA\Property(
1033 * property="fname",
1034 * description="The fname of patient.",
1035 * type="string"
1036 * ),
1037 * @OA\Property(
1038 * property="mname",
1039 * description="The mname of patient.",
1040 * type="string"
1041 * ),
1042 * @OA\Property(
1043 * property="lname",
1044 * description="The lname of patient.",
1045 * type="string"
1046 * ),
1047 * @OA\Property(
1048 * property="street",
1049 * description="The street address of patient.",
1050 * type="string"
1051 * ),
1052 * @OA\Property(
1053 * property="postal_code",
1054 * description="The postal code of patient.",
1055 * type="string"
1056 * ),
1057 * @OA\Property(
1058 * property="city",
1059 * description="The city of patient.",
1060 * type="string"
1061 * ),
1062 * @OA\Property(
1063 * property="state",
1064 * description="The state of patient.",
1065 * type="string"
1066 * ),
1067 * @OA\Property(
1068 * property="country_code",
1069 * description="The country code of patient.",
1070 * type="string"
1071 * ),
1072 * @OA\Property(
1073 * property="phone_contact",
1074 * description="The phone contact of patient.",
1075 * type="string"
1076 * ),
1077 * @OA\Property(
1078 * property="DOB",
1079 * description="The DOB of patient.",
1080 * type="string"
1081 * ),
1082 * @OA\Property(
1083 * property="sex",
1084 * description="The lname of patient.",
1085 * type="string"
1086 * ),
1087 * @OA\Property(
1088 * property="race",
1089 * description="The race of patient.",
1090 * type="string"
1091 * ),
1092 * @OA\Property(
1093 * property="ethnicity",
1094 * description="The ethnicity of patient.",
1095 * type="string"
1096 * ),
1097 * required={"fname", "lname", "DOB", "sex"},
1098 * example={
1099 * "title": "Mr",
1100 * "fname": "Foo",
1101 * "mname": "",
1102 * "lname": "Bar",
1103 * "street": "456 Tree Lane",
1104 * "postal_code": "08642",
1105 * "city": "FooTown",
1106 * "state": "FL",
1107 * "country_code": "US",
1108 * "phone_contact": "123-456-7890",
1109 * "DOB": "1992-02-02",
1110 * "sex": "Male",
1111 * "race": "",
1112 * "ethnicity": ""
1117 * @OA\Post(
1118 * path="/api/patient",
1119 * description="Creates a new patient",
1120 * tags={"standard"},
1121 * @OA\RequestBody(
1122 * required=true,
1123 * @OA\MediaType(
1124 * mediaType="application/json",
1125 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1127 * ),
1128 * @OA\Response(
1129 * response="200",
1130 * description="Standard response",
1131 * @OA\MediaType(
1132 * mediaType="application/json",
1133 * @OA\Schema(
1134 * @OA\Property(
1135 * property="validationErrors",
1136 * description="Validation errors.",
1137 * type="array",
1138 * @OA\Items(
1139 * type="object",
1140 * ),
1141 * ),
1142 * @OA\Property(
1143 * property="internalErrors",
1144 * description="Internal errors.",
1145 * type="array",
1146 * @OA\Items(
1147 * type="object",
1148 * ),
1149 * ),
1150 * @OA\Property(
1151 * property="data",
1152 * description="Returned data.",
1153 * type="array",
1154 * @OA\Items(
1155 * @OA\Property(
1156 * property="pid",
1157 * description="patient pid",
1158 * type="integer",
1160 * ),
1161 * ),
1162 * example={
1163 * "validationErrors": {},
1164 * "error_description": {},
1165 * "data": {
1166 * "pid": 1
1171 * ),
1172 * @OA\Response(
1173 * response="401",
1174 * ref="#/components/responses/unauthorized"
1175 * ),
1176 * security={{"openemr_auth":{}}}
1179 "POST /api/patient" => function () {
1180 RestConfig::authorization_check("patients", "demo");
1181 $data = (array) (json_decode(file_get_contents("php://input")));
1182 $return = (new PatientRestController())->post($data);
1183 RestConfig::apiLog($return, $data);
1184 return $return;
1188 * Schema for the patient response
1190 * @OA\Schema(
1191 * schema="api_patient_response",
1192 * @OA\Property(
1193 * property="validationErrors",
1194 * description="Validation errors.",
1195 * type="array",
1196 * @OA\Items(
1197 * type="object",
1198 * ),
1199 * ),
1200 * @OA\Property(
1201 * property="internalErrors",
1202 * description="Internal errors.",
1203 * type="array",
1204 * @OA\Items(
1205 * type="object",
1206 * ),
1207 * ),
1208 * @OA\Property(
1209 * property="data",
1210 * description="Returned data.",
1211 * type="array",
1212 * @OA\Items(
1213 * @OA\Property(
1214 * property="id",
1215 * description="patient id",
1216 * type="string",
1217 * ),
1218 * @OA\Property(
1219 * property="pid",
1220 * description="patient pid",
1221 * type="string",
1222 * ),
1223 * @OA\Property(
1224 * property="pubpid",
1225 * description="patient public id",
1226 * type="string",
1227 * ),
1228 * @OA\Property(
1229 * property="title",
1230 * description="patient title",
1231 * type="string",
1232 * ),
1233 * @OA\Property(
1234 * property="fname",
1235 * description="patient first name",
1236 * type="string",
1237 * ),
1238 * @OA\Property(
1239 * property="mname",
1240 * description="patient middle name",
1241 * type="string",
1242 * ),
1243 * @OA\Property(
1244 * property="lname",
1245 * description="patient last name",
1246 * type="string",
1247 * ),
1248 * @OA\Property(
1249 * property="ss",
1250 * description="patient social security number",
1251 * type="string",
1252 * ),
1253 * @OA\Property(
1254 * property="street",
1255 * description="patient street address",
1256 * type="string",
1257 * ),
1258 * @OA\Property(
1259 * property="postal_code",
1260 * description="patient postal code",
1261 * type="string",
1262 * ),
1263 * @OA\Property(
1264 * property="city",
1265 * description="patient city",
1266 * type="string",
1267 * ),
1268 * @OA\Property(
1269 * property="state",
1270 * description="patient state",
1271 * type="string",
1272 * ),
1273 * @OA\Property(
1274 * property="county",
1275 * description="patient county",
1276 * type="string",
1277 * ),
1278 * @OA\Property(
1279 * property="country_code",
1280 * description="patient country code",
1281 * type="string",
1282 * ),
1283 * @OA\Property(
1284 * property="drivers_license",
1285 * description="patient drivers license id",
1286 * type="string",
1287 * ),
1288 * @OA\Property(
1289 * property="contact_relationship",
1290 * description="patient contact relationship",
1291 * type="string",
1292 * ),
1293 * @OA\Property(
1294 * property="phone_contact",
1295 * description="patient phone contact",
1296 * type="string",
1297 * ),
1298 * @OA\Property(
1299 * property="phone_home",
1300 * description="patient home phone",
1301 * type="string",
1302 * ),
1303 * @OA\Property(
1304 * property="phone_biz",
1305 * description="patient work phone",
1306 * type="string",
1307 * ),
1308 * @OA\Property(
1309 * property="phone_cell",
1310 * description="patient mobile phone",
1311 * type="string",
1312 * ),
1313 * @OA\Property(
1314 * property="email",
1315 * description="patient email",
1316 * type="string",
1317 * ),
1318 * @OA\Property(
1319 * property="DOB",
1320 * description="patient DOB",
1321 * type="string",
1322 * ),
1323 * @OA\Property(
1324 * property="sex",
1325 * description="patient sex (gender)",
1326 * type="string",
1327 * ),
1328 * @OA\Property(
1329 * property="race",
1330 * description="patient race",
1331 * type="string",
1332 * ),
1333 * @OA\Property(
1334 * property="ethnicity",
1335 * description="patient ethnicity",
1336 * type="string",
1337 * ),
1338 * @OA\Property(
1339 * property="status",
1340 * description="patient status",
1341 * type="string",
1342 * ),
1343 * ),
1344 * ),
1345 * example={
1346 * "validationErrors": {},
1347 * "error_description": {},
1348 * "data": {
1349 * "id": "193",
1350 * "pid": "1",
1351 * "pubpid": "",
1352 * "title": "Mr",
1353 * "fname": "Baz",
1354 * "mname": "",
1355 * "lname": "Bop",
1356 * "ss": "",
1357 * "street": "456 Tree Lane",
1358 * "postal_code": "08642",
1359 * "city": "FooTown",
1360 * "state": "FL",
1361 * "county": "",
1362 * "country_code": "US",
1363 * "drivers_license": "",
1364 * "contact_relationship": "",
1365 * "phone_contact": "123-456-7890",
1366 * "phone_home": "",
1367 * "phone_biz": "",
1368 * "phone_cell": "",
1369 * "email": "",
1370 * "DOB": "1992-02-03",
1371 * "sex": "Male",
1372 * "race": "",
1373 * "ethnicity": "",
1374 * "status": ""
1380 * @OA\Put(
1381 * path="/api/patient/{puuid}",
1382 * description="Updates a patient",
1383 * tags={"standard"},
1384 * @OA\Parameter(
1385 * name="puuid",
1386 * in="path",
1387 * description="The uuid for the patient.",
1388 * required=true,
1389 * @OA\Schema(
1390 * type="string"
1392 * ),
1393 * @OA\RequestBody(
1394 * required=true,
1395 * @OA\MediaType(
1396 * mediaType="application/json",
1397 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1399 * ),
1400 * @OA\Response(
1401 * response="200",
1402 * description="Standard response",
1403 * @OA\MediaType(
1404 * mediaType="application/json",
1405 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1407 * ),
1408 * @OA\Response(
1409 * response="401",
1410 * ref="#/components/responses/unauthorized"
1411 * ),
1412 * security={{"openemr_auth":{}}}
1415 "PUT /api/patient/:puuid" => function ($puuid) {
1416 RestConfig::authorization_check("patients", "demo");
1417 $data = (array) (json_decode(file_get_contents("php://input")));
1418 $return = (new PatientRestController())->put($puuid, $data);
1419 RestConfig::apiLog($return, $data);
1420 return $return;
1424 * @OA\Get(
1425 * path="/api/patient/{puuid}",
1426 * description="Retrieves a single patient by their uuid",
1427 * tags={"standard"},
1428 * @OA\Parameter(
1429 * name="puuid",
1430 * in="path",
1431 * description="The uuid for the patient.",
1432 * required=true,
1433 * @OA\Schema(
1434 * type="string"
1436 * ),
1437 * @OA\Response(
1438 * response="200",
1439 * description="Standard response",
1440 * @OA\MediaType(
1441 * mediaType="application/json",
1442 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1444 * ),
1445 * @OA\Response(
1446 * response="401",
1447 * ref="#/components/responses/unauthorized"
1448 * ),
1449 * security={{"openemr_auth":{}}}
1452 "GET /api/patient/:puuid" => function ($puuid) {
1453 RestConfig::authorization_check("patients", "demo");
1454 $return = (new PatientRestController())->getOne($puuid);
1455 RestConfig::apiLog($return);
1456 return $return;
1460 * @OA\Get(
1461 * path="/api/patient/{puuid}/encounter",
1462 * description="Retrieves a list of encounters for a single patient",
1463 * tags={"standard"},
1464 * @OA\Parameter(
1465 * name="puuid",
1466 * in="path",
1467 * description="The uuid for the patient.",
1468 * required=true,
1469 * @OA\Schema(
1470 * type="string"
1472 * ),
1473 * @OA\Response(
1474 * response="200",
1475 * ref="#/components/responses/standard"
1476 * ),
1477 * @OA\Response(
1478 * response="400",
1479 * ref="#/components/responses/badrequest"
1480 * ),
1481 * @OA\Response(
1482 * response="401",
1483 * ref="#/components/responses/unauthorized"
1484 * ),
1485 * security={{"openemr_auth":{}}}
1488 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1489 RestConfig::authorization_check("encounters", "auth_a");
1490 $return = (new EncounterRestController())->getAll($puuid);
1491 RestConfig::apiLog($return);
1492 return $return;
1496 * Schema for the encounter request
1498 * @OA\Schema(
1499 * schema="api_encounter_request",
1500 * @OA\Property(
1501 * property="date",
1502 * description="The date of encounter.",
1503 * type="string"
1504 * ),
1505 * @OA\Property(
1506 * property="onset_date",
1507 * description="The onset date of encounter.",
1508 * type="string"
1509 * ),
1510 * @OA\Property(
1511 * property="reason",
1512 * description="The reason of encounter.",
1513 * type="string"
1514 * ),
1515 * @OA\Property(
1516 * property="facility",
1517 * description="The facility of encounter.",
1518 * type="string"
1519 * ),
1520 * @OA\Property(
1521 * property="pc_catid",
1522 * description="The pc_catid of encounter.",
1523 * type="string"
1524 * ),
1525 * @OA\Property(
1526 * property="facility_id",
1527 * description="The facility id of encounter.",
1528 * type="string"
1529 * ),
1530 * @OA\Property(
1531 * property="billing_facility",
1532 * description="The billing facility id of encounter.",
1533 * type="string"
1534 * ),
1535 * @OA\Property(
1536 * property="sensitivity",
1537 * description="The sensitivity of encounter.",
1538 * type="string"
1539 * ),
1540 * @OA\Property(
1541 * property="referral_source",
1542 * description="The referral source of encounter.",
1543 * type="string"
1544 * ),
1545 * @OA\Property(
1546 * property="pos_code",
1547 * description="The pos_code of encounter.",
1548 * type="string"
1549 * ),
1550 * @OA\Property(
1551 * property="external_id",
1552 * description="The external id of encounter.",
1553 * type="string"
1554 * ),
1555 * @OA\Property(
1556 * property="provider_id",
1557 * description="The provider id of encounter.",
1558 * type="string"
1559 * ),
1560 * @OA\Property(
1561 * property="class_code",
1562 * description="The class_code of encounter.",
1563 * type="string"
1564 * ),
1565 * required={"pc_catid", "class_code"},
1566 * example={
1567 * "date":"2020-11-10",
1568 * "onset_date": "",
1569 * "reason": "Pregnancy Test",
1570 * "facility": "Owerri General Hospital",
1571 * "pc_catid": "5",
1572 * "facility_id": "3",
1573 * "billing_facility": "3",
1574 * "sensitivity": "normal",
1575 * "referral_source": "",
1576 * "pos_code": "0",
1577 * "external_id": "",
1578 * "provider_id": "1",
1579 * "class_code" : "AMB"
1584 * @OA\Post(
1585 * path="/api/patient/{puuid}/encounter",
1586 * description="Creates a new encounter",
1587 * tags={"standard"},
1588 * @OA\Parameter(
1589 * name="puuid",
1590 * in="path",
1591 * description="The uuid for the patient.",
1592 * required=true,
1593 * @OA\Schema(
1594 * type="string"
1596 * ),
1597 * @OA\RequestBody(
1598 * required=true,
1599 * @OA\MediaType(
1600 * mediaType="application/json",
1601 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1603 * ),
1604 * @OA\Response(
1605 * response="200",
1606 * description="Standard response",
1607 * @OA\MediaType(
1608 * mediaType="application/json",
1609 * @OA\Schema(
1610 * @OA\Property(
1611 * property="validationErrors",
1612 * description="Validation errors.",
1613 * type="array",
1614 * @OA\Items(
1615 * type="object",
1616 * ),
1617 * ),
1618 * @OA\Property(
1619 * property="internalErrors",
1620 * description="Internal errors.",
1621 * type="array",
1622 * @OA\Items(
1623 * type="object",
1624 * ),
1625 * ),
1626 * @OA\Property(
1627 * property="data",
1628 * description="Returned data.",
1629 * type="array",
1630 * @OA\Items(
1631 * @OA\Property(
1632 * property="encounter",
1633 * description="encounter id",
1634 * type="integer",
1635 * ),
1636 * @OA\Property(
1637 * property="uuid",
1638 * description="encounter uuid",
1639 * type="string",
1641 * ),
1642 * ),
1643 * example={
1644 * "validationErrors": {},
1645 * "error_description": {},
1646 * "data": {
1647 * "encounter": 1,
1648 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1653 * ),
1654 * @OA\Response(
1655 * response="401",
1656 * ref="#/components/responses/unauthorized"
1657 * ),
1658 * security={{"openemr_auth":{}}}
1661 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1662 RestConfig::authorization_check("encounters", "auth_a");
1663 $data = (array) (json_decode(file_get_contents("php://input")));
1664 $return = (new EncounterRestController())->post($puuid, $data);
1665 RestConfig::apiLog($return, $data);
1666 return $return;
1670 * Schema for the encounter response
1672 * @OA\Schema(
1673 * schema="api_encounter_response",
1674 * @OA\Property(
1675 * property="validationErrors",
1676 * description="Validation errors.",
1677 * type="array",
1678 * @OA\Items(
1679 * type="object",
1680 * ),
1681 * ),
1682 * @OA\Property(
1683 * property="internalErrors",
1684 * description="Internal errors.",
1685 * type="array",
1686 * @OA\Items(
1687 * type="object",
1688 * ),
1689 * ),
1690 * @OA\Property(
1691 * property="data",
1692 * description="Returned data.",
1693 * type="array",
1694 * @OA\Items(
1695 * @OA\Property(
1696 * property="id",
1697 * description="encounter id",
1698 * type="string",
1699 * ),
1700 * @OA\Property(
1701 * property="uuid",
1702 * description="encounter uuid",
1703 * type="string",
1704 * ),
1705 * @OA\Property(
1706 * property="date",
1707 * description="encounter date",
1708 * type="string",
1709 * ),
1710 * @OA\Property(
1711 * property="reason",
1712 * description="encounter reason",
1713 * type="string",
1714 * ),
1715 * @OA\Property(
1716 * property="facility",
1717 * description="encounter facility name",
1718 * type="string",
1719 * ),
1720 * @OA\Property(
1721 * property="facility_id",
1722 * description="encounter facility id name",
1723 * type="string",
1724 * ),
1725 * @OA\Property(
1726 * property="pid",
1727 * description="encounter for patient pid",
1728 * type="string",
1729 * ),
1730 * @OA\Property(
1731 * property="onset_date",
1732 * description="encounter onset date",
1733 * type="string",
1734 * ),
1735 * @OA\Property(
1736 * property="sensitivity",
1737 * description="encounter sensitivity",
1738 * type="string",
1739 * ),
1740 * @OA\Property(
1741 * property="billing_note",
1742 * description="encounter billing note",
1743 * type="string",
1744 * ),
1745 * @OA\Property(
1746 * property="pc_catid",
1747 * description="encounter pc_catid",
1748 * type="string",
1749 * ),
1750 * @OA\Property(
1751 * property="last_level_billed",
1752 * description="encounter last_level_billed",
1753 * type="string",
1754 * ),
1755 * @OA\Property(
1756 * property="last_level_closed",
1757 * description="encounter last_level_closed",
1758 * type="string",
1759 * ),
1760 * @OA\Property(
1761 * property="last_stmt_date",
1762 * description="encounter last_stmt_date",
1763 * type="string",
1764 * ),
1765 * @OA\Property(
1766 * property="stmt_count",
1767 * description="encounter stmt_count",
1768 * type="string",
1769 * ),
1770 * @OA\Property(
1771 * property="provider_id",
1772 * description="provider id",
1773 * type="string",
1774 * ),
1775 * @OA\Property(
1776 * property="supervisor_id",
1777 * description="encounter supervisor id",
1778 * type="string",
1779 * ),
1780 * @OA\Property(
1781 * property="invoice_refno",
1782 * description="encounter invoice_refno",
1783 * type="string",
1784 * ),
1785 * @OA\Property(
1786 * property="referral_source",
1787 * description="encounter referral source",
1788 * type="string",
1789 * ),
1790 * @OA\Property(
1791 * property="billing_facility",
1792 * description="encounter billing facility id",
1793 * type="string",
1794 * ),
1795 * @OA\Property(
1796 * property="external_id",
1797 * description="encounter external id",
1798 * type="string",
1799 * ),
1800 * @OA\Property(
1801 * property="pos_code",
1802 * description="encounter pos_code",
1803 * type="string",
1804 * ),
1805 * @OA\Property(
1806 * property="class_code",
1807 * description="encounter class_code",
1808 * type="string",
1809 * ),
1810 * @OA\Property(
1811 * property="class_title",
1812 * description="encounter class_title",
1813 * type="string",
1814 * ),
1815 * @OA\Property(
1816 * property="pc_catname",
1817 * description="encounter pc_catname",
1818 * type="string",
1819 * ),
1820 * @OA\Property(
1821 * property="billing_facility_name",
1822 * description="encounter billing facility name",
1823 * type="string",
1824 * ),
1825 * ),
1826 * ),
1827 * example={
1828 * "validationErrors": {},
1829 * "error_description": {},
1830 * "data": {
1831 * "id": "1",
1832 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1833 * "date": "2019-09-14 00:00:00",
1834 * "reason": "Pregnancy Test",
1835 * "facility": "Owerri General Hospital",
1836 * "facility_id": "3",
1837 * "pid": "1",
1838 * "onset_date": "2019-04-20 00:00:00",
1839 * "sensitivity": "normal",
1840 * "billing_note": null,
1841 * "pc_catid": "5",
1842 * "last_level_billed": "0",
1843 * "last_level_closed": "0",
1844 * "last_stmt_date": null,
1845 * "stmt_count": "0",
1846 * "provider_id": "1",
1847 * "supervisor_id": "0",
1848 * "invoice_refno": "",
1849 * "referral_source": "",
1850 * "billing_facility": "3",
1851 * "external_id": "",
1852 * "pos_code": "0",
1853 * "class_code": "AMB",
1854 * "class_title": "ambulatory",
1855 * "pc_catname": "Office Visit",
1856 * "billing_facility_name": "Owerri General Hospital"
1862 * @OA\Put(
1863 * path="/api/patient/{puuid}/encounter/{euuid}",
1864 * description="Modify a encounter",
1865 * tags={"standard"},
1866 * @OA\Parameter(
1867 * name="puuid",
1868 * in="path",
1869 * description="The uuid for the patient.",
1870 * required=true,
1871 * @OA\Schema(
1872 * type="string"
1874 * ),
1875 * @OA\Parameter(
1876 * name="euuid",
1877 * in="path",
1878 * description="The uuid for the encounter.",
1879 * required=true,
1880 * @OA\Schema(
1881 * type="string"
1883 * ),
1884 * @OA\RequestBody(
1885 * required=true,
1886 * @OA\MediaType(
1887 * mediaType="application/json",
1888 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1890 * ),
1891 * @OA\Response(
1892 * response="200",
1893 * description="Standard response",
1894 * @OA\MediaType(
1895 * mediaType="application/json",
1896 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1898 * ),
1899 * @OA\Response(
1900 * response="401",
1901 * ref="#/components/responses/unauthorized"
1902 * ),
1903 * security={{"openemr_auth":{}}}
1906 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1907 RestConfig::authorization_check("encounters", "auth_a");
1908 $data = (array) (json_decode(file_get_contents("php://input")));
1909 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1910 RestConfig::apiLog($return, $data);
1911 return $return;
1915 * @OA\Get(
1916 * path="/api/patient/{puuid}/encounter/{euuid}",
1917 * description="Retrieves a single encounter for a patient",
1918 * tags={"standard"},
1919 * @OA\Parameter(
1920 * name="puuid",
1921 * in="path",
1922 * description="The uuid for the patient.",
1923 * required=true,
1924 * @OA\Schema(
1925 * type="string"
1927 * ),
1928 * @OA\Parameter(
1929 * name="euuid",
1930 * in="path",
1931 * description="The uuid for the encounter.",
1932 * required=true,
1933 * @OA\Schema(
1934 * type="string"
1936 * ),
1937 * @OA\Response(
1938 * response="200",
1939 * description="Standard response",
1940 * @OA\MediaType(
1941 * mediaType="application/json",
1942 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1944 * ),
1945 * @OA\Response(
1946 * response="401",
1947 * ref="#/components/responses/unauthorized"
1948 * ),
1949 * security={{"openemr_auth":{}}}
1952 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1953 RestConfig::authorization_check("encounters", "auth_a");
1954 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1955 RestConfig::apiLog($return);
1956 return $return;
1960 * @OA\Get(
1961 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1962 * description="Retrieves soap notes from an encounter for a patient",
1963 * tags={"standard"},
1964 * @OA\Parameter(
1965 * name="pid",
1966 * in="path",
1967 * description="The pid for the patient.",
1968 * required=true,
1969 * @OA\Schema(
1970 * type="string"
1972 * ),
1973 * @OA\Parameter(
1974 * name="eid",
1975 * in="path",
1976 * description="The id for the encounter.",
1977 * required=true,
1978 * @OA\Schema(
1979 * type="string"
1981 * ),
1982 * @OA\Response(
1983 * response="200",
1984 * ref="#/components/responses/standard"
1985 * ),
1986 * @OA\Response(
1987 * response="400",
1988 * ref="#/components/responses/badrequest"
1989 * ),
1990 * @OA\Response(
1991 * response="401",
1992 * ref="#/components/responses/unauthorized"
1993 * ),
1994 * security={{"openemr_auth":{}}}
1997 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1998 RestConfig::authorization_check("encounters", "notes");
1999 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2000 RestConfig::apiLog($return);
2001 return $return;
2005 * Schema for the vital request
2007 * @OA\Schema(
2008 * schema="api_vital_request",
2009 * @OA\Property(
2010 * property="bps",
2011 * description="The bps of vitals.",
2012 * type="string"
2013 * ),
2014 * @OA\Property(
2015 * property="bpd",
2016 * description="The bpd of vitals.",
2017 * type="string"
2018 * ),
2019 * @OA\Property(
2020 * property="weight",
2021 * description="The weight of vitals. (unit is lb)",
2022 * type="string"
2023 * ),
2024 * @OA\Property(
2025 * property="height",
2026 * description="The height of vitals. (unit is inches)",
2027 * type="string"
2028 * ),
2029 * @OA\Property(
2030 * property="temperature",
2031 * description="The temperature of temperature. (unit is F)",
2032 * type="string"
2033 * ),
2034 * @OA\Property(
2035 * property="temp_method",
2036 * description="The temp_method of vitals.",
2037 * type="string"
2038 * ),
2039 * @OA\Property(
2040 * property="pulse",
2041 * description="The pulse of vitals.",
2042 * type="string"
2043 * ),
2044 * @OA\Property(
2045 * property="respiration",
2046 * description="The respiration of vitals.",
2047 * type="string"
2048 * ),
2049 * @OA\Property(
2050 * property="note",
2051 * description="The note (ie. comments) of vitals.",
2052 * type="string"
2053 * ),
2054 * @OA\Property(
2055 * property="waist_circ",
2056 * description="The waist circumference of vitals. (unit is inches)",
2057 * type="string"
2058 * ),
2059 * @OA\Property(
2060 * property="head_circ",
2061 * description="The head circumference of vitals. (unit is inches)",
2062 * type="string"
2063 * ),
2064 * @OA\Property(
2065 * property="oxygen_saturation",
2066 * description="The oxygen_saturation of vitals.",
2067 * type="string"
2068 * ),
2069 * example={
2070 * "bps": "130",
2071 * "bpd": "80",
2072 * "weight": "220",
2073 * "height": "70",
2074 * "temperature": "98",
2075 * "temp_method": "Oral",
2076 * "pulse": "60",
2077 * "respiration": "20",
2078 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2079 * "waist_circ": "37",
2080 * "head_circ": "22.2",
2081 * "oxygen_saturation": "96"
2086 * @OA\Post(
2087 * path="/api/patient/{pid}/encounter/{eid}/vital",
2088 * description="Submits a new vitals form",
2089 * tags={"standard"},
2090 * @OA\Parameter(
2091 * name="pid",
2092 * in="path",
2093 * description="The id for the patient.",
2094 * required=true,
2095 * @OA\Schema(
2096 * type="string"
2098 * ),
2099 * @OA\Parameter(
2100 * name="eid",
2101 * in="path",
2102 * description="The id for the encounter.",
2103 * required=true,
2104 * @OA\Schema(
2105 * type="string"
2107 * ),
2108 * @OA\RequestBody(
2109 * required=true,
2110 * @OA\MediaType(
2111 * mediaType="application/json",
2112 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2114 * ),
2115 * @OA\Response(
2116 * response="200",
2117 * ref="#/components/responses/standard"
2118 * ),
2119 * @OA\Response(
2120 * response="400",
2121 * ref="#/components/responses/badrequest"
2122 * ),
2123 * @OA\Response(
2124 * response="401",
2125 * ref="#/components/responses/unauthorized"
2126 * ),
2127 * security={{"openemr_auth":{}}}
2130 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2131 RestConfig::authorization_check("encounters", "notes");
2132 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2133 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2134 RestConfig::apiLog($return, $data);
2135 return $return;
2139 * @OA\Put(
2140 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2141 * description="Edit a vitals form",
2142 * tags={"standard"},
2143 * @OA\Parameter(
2144 * name="pid",
2145 * in="path",
2146 * description="The id for the patient.",
2147 * required=true,
2148 * @OA\Schema(
2149 * type="string"
2151 * ),
2152 * @OA\Parameter(
2153 * name="eid",
2154 * in="path",
2155 * description="The id for the encounter.",
2156 * required=true,
2157 * @OA\Schema(
2158 * type="string"
2160 * ),
2161 * @OA\Parameter(
2162 * name="vid",
2163 * in="path",
2164 * description="The id for the vitalss form.",
2165 * required=true,
2166 * @OA\Schema(
2167 * type="string"
2169 * ),
2170 * @OA\RequestBody(
2171 * required=true,
2172 * @OA\MediaType(
2173 * mediaType="application/json",
2174 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2176 * ),
2177 * @OA\Response(
2178 * response="200",
2179 * ref="#/components/responses/standard"
2180 * ),
2181 * @OA\Response(
2182 * response="400",
2183 * ref="#/components/responses/badrequest"
2184 * ),
2185 * @OA\Response(
2186 * response="401",
2187 * ref="#/components/responses/unauthorized"
2188 * ),
2189 * security={{"openemr_auth":{}}}
2192 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2193 RestConfig::authorization_check("encounters", "notes");
2194 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2195 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2196 RestConfig::apiLog($return, $data);
2197 return $return;
2201 * @OA\Get(
2202 * path="/api/patient/{pid}/encounter/{eid}/vital",
2203 * description="Retrieves all vitals from an encounter for a patient",
2204 * tags={"standard"},
2205 * @OA\Parameter(
2206 * name="pid",
2207 * in="path",
2208 * description="The pid for the patient.",
2209 * required=true,
2210 * @OA\Schema(
2211 * type="string"
2213 * ),
2214 * @OA\Parameter(
2215 * name="eid",
2216 * in="path",
2217 * description="The id for the encounter.",
2218 * required=true,
2219 * @OA\Schema(
2220 * type="string"
2222 * ),
2223 * @OA\Response(
2224 * response="200",
2225 * ref="#/components/responses/standard"
2226 * ),
2227 * @OA\Response(
2228 * response="400",
2229 * ref="#/components/responses/badrequest"
2230 * ),
2231 * @OA\Response(
2232 * response="401",
2233 * ref="#/components/responses/unauthorized"
2234 * ),
2235 * security={{"openemr_auth":{}}}
2238 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2239 RestConfig::authorization_check("encounters", "notes");
2240 $return = (new EncounterRestController())->getVitals($pid, $eid);
2241 RestConfig::apiLog($return);
2242 return $return;
2246 * @OA\Get(
2247 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2248 * description="Retrieves a vitals form from an encounter for a patient",
2249 * tags={"standard"},
2250 * @OA\Parameter(
2251 * name="pid",
2252 * in="path",
2253 * description="The pid for the patient.",
2254 * required=true,
2255 * @OA\Schema(
2256 * type="string"
2258 * ),
2259 * @OA\Parameter(
2260 * name="eid",
2261 * in="path",
2262 * description="The id for the encounter.",
2263 * required=true,
2264 * @OA\Schema(
2265 * type="string"
2267 * ),
2268 * @OA\Parameter(
2269 * name="vid",
2270 * in="path",
2271 * description="The id for the vitals form.",
2272 * required=true,
2273 * @OA\Schema(
2274 * type="string"
2276 * ),
2277 * @OA\Response(
2278 * response="200",
2279 * ref="#/components/responses/standard"
2280 * ),
2281 * @OA\Response(
2282 * response="400",
2283 * ref="#/components/responses/badrequest"
2284 * ),
2285 * @OA\Response(
2286 * response="401",
2287 * ref="#/components/responses/unauthorized"
2288 * ),
2289 * security={{"openemr_auth":{}}}
2292 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2293 RestConfig::authorization_check("encounters", "notes");
2294 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2295 RestConfig::apiLog($return);
2296 return $return;
2300 * @OA\Get(
2301 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2302 * description="Retrieves a soap note from an encounter for a patient",
2303 * tags={"standard"},
2304 * @OA\Parameter(
2305 * name="pid",
2306 * in="path",
2307 * description="The pid for the patient.",
2308 * required=true,
2309 * @OA\Schema(
2310 * type="string"
2312 * ),
2313 * @OA\Parameter(
2314 * name="eid",
2315 * in="path",
2316 * description="The id for the encounter.",
2317 * required=true,
2318 * @OA\Schema(
2319 * type="string"
2321 * ),
2322 * @OA\Parameter(
2323 * name="sid",
2324 * in="path",
2325 * description="The id for the soap note.",
2326 * required=true,
2327 * @OA\Schema(
2328 * type="string"
2330 * ),
2331 * @OA\Response(
2332 * response="200",
2333 * ref="#/components/responses/standard"
2334 * ),
2335 * @OA\Response(
2336 * response="400",
2337 * ref="#/components/responses/badrequest"
2338 * ),
2339 * @OA\Response(
2340 * response="401",
2341 * ref="#/components/responses/unauthorized"
2342 * ),
2343 * security={{"openemr_auth":{}}}
2346 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2347 RestConfig::authorization_check("encounters", "notes");
2348 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2349 RestConfig::apiLog($return);
2350 return $return;
2354 * Schema for the soap_note request
2356 * @OA\Schema(
2357 * schema="api_soap_note_request",
2358 * @OA\Property(
2359 * property="subjective",
2360 * description="The subjective of soap note.",
2361 * type="string"
2362 * ),
2363 * @OA\Property(
2364 * property="objective",
2365 * description="The objective of soap note.",
2366 * type="string"
2367 * ),
2368 * @OA\Property(
2369 * property="assessment",
2370 * description="The assessment of soap note.",
2371 * type="string"
2372 * ),
2373 * @OA\Property(
2374 * property="plan",
2375 * description="The plan of soap note.",
2376 * type="string"
2377 * ),
2378 * example={
2379 * "subjective": "The patient with mechanical fall and cut finger.",
2380 * "objective": "The patient with finger laceration on exam.",
2381 * "assessment": "The patient with finger laceration requiring sutures.",
2382 * "plan": "Sutured finger laceration."
2387 * @OA\Post(
2388 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2389 * description="Submits a new soap note",
2390 * tags={"standard"},
2391 * @OA\Parameter(
2392 * name="pid",
2393 * in="path",
2394 * description="The id for the patient.",
2395 * required=true,
2396 * @OA\Schema(
2397 * type="string"
2399 * ),
2400 * @OA\Parameter(
2401 * name="eid",
2402 * in="path",
2403 * description="The id for the encounter.",
2404 * required=true,
2405 * @OA\Schema(
2406 * type="string"
2408 * ),
2409 * @OA\RequestBody(
2410 * required=true,
2411 * @OA\MediaType(
2412 * mediaType="application/json",
2413 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2415 * ),
2416 * @OA\Response(
2417 * response="200",
2418 * ref="#/components/responses/standard"
2419 * ),
2420 * @OA\Response(
2421 * response="400",
2422 * ref="#/components/responses/badrequest"
2423 * ),
2424 * @OA\Response(
2425 * response="401",
2426 * ref="#/components/responses/unauthorized"
2427 * ),
2428 * security={{"openemr_auth":{}}}
2431 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2432 RestConfig::authorization_check("encounters", "notes");
2433 $data = (array) (json_decode(file_get_contents("php://input")));
2434 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2435 RestConfig::apiLog($return, $data);
2436 return $return;
2440 * @OA\Put(
2441 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2442 * description="Edit a soap note",
2443 * tags={"standard"},
2444 * @OA\Parameter(
2445 * name="pid",
2446 * in="path",
2447 * description="The id for the patient.",
2448 * required=true,
2449 * @OA\Schema(
2450 * type="string"
2452 * ),
2453 * @OA\Parameter(
2454 * name="eid",
2455 * in="path",
2456 * description="The id for the encounter.",
2457 * required=true,
2458 * @OA\Schema(
2459 * type="string"
2461 * ),
2462 * @OA\Parameter(
2463 * name="sid",
2464 * in="path",
2465 * description="The id for the soap noted.",
2466 * required=true,
2467 * @OA\Schema(
2468 * type="string"
2470 * ),
2471 * @OA\RequestBody(
2472 * required=true,
2473 * @OA\MediaType(
2474 * mediaType="application/json",
2475 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2477 * ),
2478 * @OA\Response(
2479 * response="200",
2480 * ref="#/components/responses/standard"
2481 * ),
2482 * @OA\Response(
2483 * response="400",
2484 * ref="#/components/responses/badrequest"
2485 * ),
2486 * @OA\Response(
2487 * response="401",
2488 * ref="#/components/responses/unauthorized"
2489 * ),
2490 * security={{"openemr_auth":{}}}
2493 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2494 RestConfig::authorization_check("encounters", "notes");
2495 $data = (array) (json_decode(file_get_contents("php://input")));
2496 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2497 RestConfig::apiLog($return, $data);
2498 return $return;
2503 * @OA\Get(
2504 * path="/api/practitioner",
2505 * description="Retrieves a list of practitioners",
2506 * tags={"standard"},
2507 * @OA\Parameter(
2508 * name="title",
2509 * in="query",
2510 * description="The title for the practitioner.",
2511 * required=false,
2512 * @OA\Schema(
2513 * type="string"
2515 * ),
2516 * @OA\Parameter(
2517 * name="fname",
2518 * in="query",
2519 * description="The first name for the practitioner.",
2520 * required=false,
2521 * @OA\Schema(
2522 * type="string"
2524 * ),
2525 * @OA\Parameter(
2526 * name="lname",
2527 * in="query",
2528 * description="The last name for the practitioner.",
2529 * required=false,
2530 * @OA\Schema(
2531 * type="string"
2533 * ),
2534 * @OA\Parameter(
2535 * name="mname",
2536 * in="query",
2537 * description="The middle name for the practitioner.",
2538 * required=false,
2539 * @OA\Schema(
2540 * type="string"
2542 * ),
2543 * @OA\Parameter(
2544 * name="federaltaxid",
2545 * in="query",
2546 * description="The federal tax id for the practitioner.",
2547 * required=false,
2548 * @OA\Schema(
2549 * type="string"
2551 * ),
2552 * @OA\Parameter(
2553 * name="federaldrugid",
2554 * in="query",
2555 * description="The federal drug id for the practitioner.",
2556 * required=false,
2557 * @OA\Schema(
2558 * type="string"
2560 * ),
2561 * @OA\Parameter(
2562 * name="upin",
2563 * in="query",
2564 * description="The upin for the practitioner.",
2565 * required=false,
2566 * @OA\Schema(
2567 * type="string"
2569 * ),
2570 * @OA\Parameter(
2571 * name="facility_id",
2572 * in="query",
2573 * description="The facility id for the practitioner.",
2574 * required=false,
2575 * @OA\Schema(
2576 * type="string"
2578 * ),
2579 * @OA\Parameter(
2580 * name="facility",
2581 * in="query",
2582 * description="The facility for the practitioner.",
2583 * required=false,
2584 * @OA\Schema(
2585 * type="string"
2587 * ),
2588 * @OA\Parameter(
2589 * name="npi",
2590 * in="query",
2591 * description="The npi for the practitioner.",
2592 * required=false,
2593 * @OA\Schema(
2594 * type="string"
2596 * ),
2597 * @OA\Parameter(
2598 * name="email",
2599 * in="query",
2600 * description="The email for the practitioner.",
2601 * required=false,
2602 * @OA\Schema(
2603 * type="string"
2605 * ),
2606 * @OA\Parameter(
2607 * name="specialty",
2608 * in="query",
2609 * description="The specialty for the practitioner.",
2610 * required=false,
2611 * @OA\Schema(
2612 * type="string"
2614 * ),
2615 * @OA\Parameter(
2616 * name="billname",
2617 * in="query",
2618 * description="The billname for the practitioner.",
2619 * required=false,
2620 * @OA\Schema(
2621 * type="string"
2623 * ),
2624 * @OA\Parameter(
2625 * name="url",
2626 * in="query",
2627 * description="The url for the practitioner.",
2628 * required=false,
2629 * @OA\Schema(
2630 * type="string"
2632 * ),
2633 * @OA\Parameter(
2634 * name="assistant",
2635 * in="query",
2636 * description="The assistant for the practitioner.",
2637 * required=false,
2638 * @OA\Schema(
2639 * type="string"
2641 * ),
2642 * @OA\Parameter(
2643 * name="organization",
2644 * in="query",
2645 * description="The organization for the practitioner.",
2646 * required=false,
2647 * @OA\Schema(
2648 * type="string"
2650 * ),
2651 * @OA\Parameter(
2652 * name="valedictory",
2653 * in="query",
2654 * description="The valedictory for the practitioner.",
2655 * required=false,
2656 * @OA\Schema(
2657 * type="string"
2659 * ),
2660 * @OA\Parameter(
2661 * name="street",
2662 * in="query",
2663 * description="The street for the practitioner.",
2664 * required=false,
2665 * @OA\Schema(
2666 * type="string"
2668 * ),
2669 * @OA\Parameter(
2670 * name="streetb",
2671 * in="query",
2672 * description="The street (line 2) for the practitioner.",
2673 * required=false,
2674 * @OA\Schema(
2675 * type="string"
2677 * ),
2678 * @OA\Parameter(
2679 * name="city",
2680 * in="query",
2681 * description="The city for the practitioner.",
2682 * required=false,
2683 * @OA\Schema(
2684 * type="string"
2686 * ),
2687 * @OA\Parameter(
2688 * name="state",
2689 * in="query",
2690 * description="The state for the practitioner.",
2691 * required=false,
2692 * @OA\Schema(
2693 * type="string"
2695 * ),
2696 * @OA\Parameter(
2697 * name="zip",
2698 * in="query",
2699 * description="The zip for the practitioner.",
2700 * required=false,
2701 * @OA\Schema(
2702 * type="string"
2704 * ),
2705 * @OA\Parameter(
2706 * name="phone",
2707 * in="query",
2708 * description="The phone for the practitioner.",
2709 * required=false,
2710 * @OA\Schema(
2711 * type="string"
2713 * ),
2714 * @OA\Parameter(
2715 * name="fax",
2716 * in="query",
2717 * description="The fax for the practitioner.",
2718 * required=false,
2719 * @OA\Schema(
2720 * type="string"
2722 * ),
2723 * @OA\Parameter(
2724 * name="phonew1",
2725 * in="query",
2726 * description="The phonew1 for the practitioner.",
2727 * required=false,
2728 * @OA\Schema(
2729 * type="string"
2731 * ),
2732 * @OA\Parameter(
2733 * name="phonecell",
2734 * in="query",
2735 * description="The phonecell for the practitioner.",
2736 * required=false,
2737 * @OA\Schema(
2738 * type="string"
2740 * ),
2741 * @OA\Parameter(
2742 * name="notes",
2743 * in="query",
2744 * description="The notes for the practitioner.",
2745 * required=false,
2746 * @OA\Schema(
2747 * type="string"
2749 * ),
2750 * @OA\Parameter(
2751 * name="state_license_number2",
2752 * in="query",
2753 * description="The state license number for the practitioner.",
2754 * required=false,
2755 * @OA\Schema(
2756 * type="string"
2758 * ),
2759 * @OA\Parameter(
2760 * name="username",
2761 * in="query",
2762 * description="The username for the practitioner.",
2763 * required=false,
2764 * @OA\Schema(
2765 * type="string"
2767 * ),
2768 * @OA\Response(
2769 * response="200",
2770 * ref="#/components/responses/standard"
2771 * ),
2772 * @OA\Response(
2773 * response="400",
2774 * ref="#/components/responses/badrequest"
2775 * ),
2776 * @OA\Response(
2777 * response="401",
2778 * ref="#/components/responses/unauthorized"
2779 * ),
2780 * security={{"openemr_auth":{}}}
2783 "GET /api/practitioner" => function () {
2784 RestConfig::authorization_check("admin", "users");
2785 $return = (new PractitionerRestController())->getAll($_GET);
2786 RestConfig::apiLog($return);
2787 return $return;
2791 * @OA\Get(
2792 * path="/api/practitioner/{pruuid}",
2793 * description="Retrieves a single practitioner by their uuid",
2794 * tags={"standard"},
2795 * @OA\Parameter(
2796 * name="pruuid",
2797 * in="path",
2798 * description="The uuid for the practitioner.",
2799 * required=true,
2800 * @OA\Schema(
2801 * type="string"
2803 * ),
2804 * @OA\Response(
2805 * response="200",
2806 * ref="#/components/responses/standard"
2807 * ),
2808 * @OA\Response(
2809 * response="400",
2810 * ref="#/components/responses/badrequest"
2811 * ),
2812 * @OA\Response(
2813 * response="401",
2814 * ref="#/components/responses/unauthorized"
2815 * ),
2816 * security={{"openemr_auth":{}}}
2819 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2820 RestConfig::authorization_check("admin", "users");
2821 $return = (new PractitionerRestController())->getOne($pruuid);
2822 RestConfig::apiLog($return);
2823 return $return;
2827 * @OA\Post(
2828 * path="/api/practitioner",
2829 * description="Submits a new practitioner",
2830 * tags={"standard"},
2831 * @OA\RequestBody(
2832 * required=true,
2833 * @OA\MediaType(
2834 * mediaType="application/json",
2835 * @OA\Schema(
2836 * @OA\Property(
2837 * property="title",
2838 * description="The title for the practitioner.",
2839 * type="string"
2840 * ),
2841 * @OA\Property(
2842 * property="fname",
2843 * description="The first name for the practitioner.",
2844 * type="string"
2845 * ),
2846 * @OA\Property(
2847 * property="mname",
2848 * description="The middle name for the practitioner.",
2849 * type="string"
2850 * ),
2851 * @OA\Property(
2852 * property="lname",
2853 * description="The last name for the practitioner.",
2854 * type="string"
2855 * ),
2856 * @OA\Property(
2857 * property="federaltaxid",
2858 * description="The federal tax id for the practitioner.",
2859 * type="string"
2860 * ),
2861 * @OA\Property(
2862 * property="federaldrugid",
2863 * description="The federal drug id for the practitioner.",
2864 * type="string"
2865 * ),
2866 * @OA\Property(
2867 * property="upin",
2868 * description="The upin for the practitioner.",
2869 * type="string"
2870 * ),
2871 * @OA\Property(
2872 * property="facility_id",
2873 * description="The facility_id for the practitioner.",
2874 * type="string"
2875 * ),
2876 * @OA\Property(
2877 * property="facility",
2878 * description="The facility name for the practitioner.",
2879 * type="string"
2880 * ),
2881 * @OA\Property(
2882 * property="npi",
2883 * description="The npi for the practitioner.",
2884 * type="string"
2885 * ),
2886 * @OA\Property(
2887 * property="email",
2888 * description="The email for the practitioner.",
2889 * type="string"
2890 * ),
2891 * @OA\Property(
2892 * property="specialty",
2893 * description="The specialty for the practitioner.",
2894 * type="string"
2895 * ),
2896 * @OA\Property(
2897 * property="billname",
2898 * description="The billname for the practitioner.",
2899 * type="string"
2900 * ),
2901 * @OA\Property(
2902 * property="url",
2903 * description="The url for the practitioner.",
2904 * type="string"
2905 * ),
2906 * @OA\Property(
2907 * property="assistant",
2908 * description="The assistant for the practitioner.",
2909 * type="string"
2910 * ),
2911 * @OA\Property(
2912 * property="valedictory",
2913 * description="The valedictory for the practitioner.",
2914 * type="string"
2915 * ),
2916 * @OA\Property(
2917 * property="street",
2918 * description="The street address for the practitioner.",
2919 * type="string"
2920 * ),
2921 * @OA\Property(
2922 * property="streetb",
2923 * description="The streetb address for the practitioner.",
2924 * type="string"
2925 * ),
2926 * @OA\Property(
2927 * property="city",
2928 * description="The city for the practitioner.",
2929 * type="string"
2930 * ),
2931 * @OA\Property(
2932 * property="state",
2933 * description="The state for the practitioner.",
2934 * type="string"
2935 * ),
2936 * @OA\Property(
2937 * property="zip",
2938 * description="The zip for the practitioner.",
2939 * type="string"
2940 * ),
2941 * @OA\Property(
2942 * property="phone",
2943 * description="The phone for the practitioner.",
2944 * type="string"
2945 * ),
2946 * @OA\Property(
2947 * property="fax",
2948 * description="The fax for the practitioner.",
2949 * type="string"
2950 * ),
2951 * @OA\Property(
2952 * property="phonew1",
2953 * description="The phonew1 for the practitioner.",
2954 * type="string"
2955 * ),
2956 * @OA\Property(
2957 * property="phonecell",
2958 * description="The phonecell for the practitioner.",
2959 * type="string"
2960 * ),
2961 * @OA\Property(
2962 * property="notes",
2963 * description="The notes for the practitioner.",
2964 * type="string"
2965 * ),
2966 * @OA\Property(
2967 * property="state_license_number",
2968 * description="The state license number for the practitioner.",
2969 * type="string"
2970 * ),
2971 * @OA\Property(
2972 * property="username",
2973 * description="The username for the practitioner.",
2974 * type="string"
2975 * ),
2976 * required={"fname", "lname", "npi"},
2977 * example={
2978 * "title": "Mrs.",
2979 * "fname": "Eduardo",
2980 * "mname": "Kathy",
2981 * "lname": "Perez",
2982 * "federaltaxid": "",
2983 * "federaldrugid": "",
2984 * "upin": "",
2985 * "facility_id": "3",
2986 * "facility": "Your Clinic Name Here",
2987 * "npi": "12345678901",
2988 * "email": "info@pennfirm.com",
2989 * "specialty": "",
2990 * "billname": null,
2991 * "url": null,
2992 * "assistant": null,
2993 * "organization": null,
2994 * "valedictory": null,
2995 * "street": "789 Third Avenue",
2996 * "streetb": "123 Cannaut Street",
2997 * "city": "San Diego",
2998 * "state": "CA",
2999 * "zip": "90210",
3000 * "phone": "(619) 555-9827",
3001 * "fax": null,
3002 * "phonew1": "(619) 555-7822",
3003 * "phonecell": "(619) 555-7821",
3004 * "notes": null,
3005 * "state_license_number": "123456",
3006 * "username": "eduardoperez"
3010 * ),
3011 * @OA\Response(
3012 * response="200",
3013 * description="Standard response",
3014 * @OA\MediaType(
3015 * mediaType="application/json",
3016 * @OA\Schema(
3017 * @OA\Property(
3018 * property="validationErrors",
3019 * description="Validation errors.",
3020 * type="array",
3021 * @OA\Items(
3022 * type="object",
3023 * ),
3024 * ),
3025 * @OA\Property(
3026 * property="internalErrors",
3027 * description="Internal errors.",
3028 * type="array",
3029 * @OA\Items(
3030 * type="object",
3031 * ),
3032 * ),
3033 * @OA\Property(
3034 * property="data",
3035 * description="Returned data.",
3036 * type="array",
3037 * @OA\Items(
3038 * @OA\Property(
3039 * property="id",
3040 * description="practitioner id",
3041 * type="integer",
3042 * ),
3043 * @OA\Property(
3044 * property="uuid",
3045 * description="practitioner uuid",
3046 * type="string",
3047 * ),
3048 * ),
3049 * ),
3050 * example={
3051 * "validationErrors": {},
3052 * "error_description": {},
3053 * "data": {
3054 * "id": 7,
3055 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3060 * ),
3061 * @OA\Response(
3062 * response="401",
3063 * ref="#/components/responses/unauthorized"
3064 * ),
3065 * security={{"openemr_auth":{}}}
3068 "POST /api/practitioner" => function () {
3069 RestConfig::authorization_check("admin", "users");
3070 $data = (array) (json_decode(file_get_contents("php://input")));
3071 $return = (new PractitionerRestController())->post($data);
3072 RestConfig::apiLog($return, $data);
3073 return $return;
3077 * @OA\Put(
3078 * path="/api/practitioner/{pruuid}",
3079 * description="Edit a practitioner",
3080 * tags={"standard"},
3081 * @OA\Parameter(
3082 * name="pruuid",
3083 * in="path",
3084 * description="The uuid for the practitioner.",
3085 * required=true,
3086 * @OA\Schema(
3087 * type="string"
3089 * ),
3090 * @OA\RequestBody(
3091 * required=true,
3092 * @OA\MediaType(
3093 * mediaType="application/json",
3094 * @OA\Schema(
3095 * @OA\Property(
3096 * property="title",
3097 * description="The title for the practitioner.",
3098 * type="string"
3099 * ),
3100 * @OA\Property(
3101 * property="fname",
3102 * description="The first name for the practitioner.",
3103 * type="string"
3104 * ),
3105 * @OA\Property(
3106 * property="mname",
3107 * description="The middle name for the practitioner.",
3108 * type="string"
3109 * ),
3110 * @OA\Property(
3111 * property="lname",
3112 * description="The last name for the practitioner.",
3113 * type="string"
3114 * ),
3115 * @OA\Property(
3116 * property="federaltaxid",
3117 * description="The federal tax id for the practitioner.",
3118 * type="string"
3119 * ),
3120 * @OA\Property(
3121 * property="federaldrugid",
3122 * description="The federal drug id for the practitioner.",
3123 * type="string"
3124 * ),
3125 * @OA\Property(
3126 * property="upin",
3127 * description="The upin for the practitioner.",
3128 * type="string"
3129 * ),
3130 * @OA\Property(
3131 * property="facility_id",
3132 * description="The facility_id for the practitioner.",
3133 * type="string"
3134 * ),
3135 * @OA\Property(
3136 * property="facility",
3137 * description="The facility name for the practitioner.",
3138 * type="string"
3139 * ),
3140 * @OA\Property(
3141 * property="npi",
3142 * description="The npi for the practitioner.",
3143 * type="string"
3144 * ),
3145 * @OA\Property(
3146 * property="email",
3147 * description="The email for the practitioner.",
3148 * type="string"
3149 * ),
3150 * @OA\Property(
3151 * property="specialty",
3152 * description="The specialty for the practitioner.",
3153 * type="string"
3154 * ),
3155 * @OA\Property(
3156 * property="billname",
3157 * description="The billname for the practitioner.",
3158 * type="string"
3159 * ),
3160 * @OA\Property(
3161 * property="url",
3162 * description="The url for the practitioner.",
3163 * type="string"
3164 * ),
3165 * @OA\Property(
3166 * property="assistant",
3167 * description="The assistant for the practitioner.",
3168 * type="string"
3169 * ),
3170 * @OA\Property(
3171 * property="valedictory",
3172 * description="The valedictory for the practitioner.",
3173 * type="string"
3174 * ),
3175 * @OA\Property(
3176 * property="street",
3177 * description="The street address for the practitioner.",
3178 * type="string"
3179 * ),
3180 * @OA\Property(
3181 * property="streetb",
3182 * description="The streetb address for the practitioner.",
3183 * type="string"
3184 * ),
3185 * @OA\Property(
3186 * property="city",
3187 * description="The city for the practitioner.",
3188 * type="string"
3189 * ),
3190 * @OA\Property(
3191 * property="state",
3192 * description="The state for the practitioner.",
3193 * type="string"
3194 * ),
3195 * @OA\Property(
3196 * property="zip",
3197 * description="The zip for the practitioner.",
3198 * type="string"
3199 * ),
3200 * @OA\Property(
3201 * property="phone",
3202 * description="The phone for the practitioner.",
3203 * type="string"
3204 * ),
3205 * @OA\Property(
3206 * property="fax",
3207 * description="The fax for the practitioner.",
3208 * type="string"
3209 * ),
3210 * @OA\Property(
3211 * property="phonew1",
3212 * description="The phonew1 for the practitioner.",
3213 * type="string"
3214 * ),
3215 * @OA\Property(
3216 * property="phonecell",
3217 * description="The phonecell for the practitioner.",
3218 * type="string"
3219 * ),
3220 * @OA\Property(
3221 * property="notes",
3222 * description="The notes for the practitioner.",
3223 * type="string"
3224 * ),
3225 * @OA\Property(
3226 * property="state_license_number",
3227 * description="The state license number for the practitioner.",
3228 * type="string"
3229 * ),
3230 * @OA\Property(
3231 * property="username",
3232 * description="The username for the practitioner.",
3233 * type="string"
3234 * ),
3235 * example={
3236 * "title": "Mr",
3237 * "fname": "Baz",
3238 * "mname": "",
3239 * "lname": "Bop",
3240 * "street": "456 Tree Lane",
3241 * "zip": "08642",
3242 * "city": "FooTown",
3243 * "state": "FL",
3244 * "phone": "123-456-7890"
3248 * ),
3249 * @OA\Response(
3250 * response="200",
3251 * description="Standard response",
3252 * @OA\MediaType(
3253 * mediaType="application/json",
3254 * @OA\Schema(
3255 * @OA\Property(
3256 * property="validationErrors",
3257 * description="Validation errors.",
3258 * type="array",
3259 * @OA\Items(
3260 * type="object",
3261 * ),
3262 * ),
3263 * @OA\Property(
3264 * property="internalErrors",
3265 * description="Internal errors.",
3266 * type="array",
3267 * @OA\Items(
3268 * type="object",
3269 * ),
3270 * ),
3271 * @OA\Property(
3272 * property="data",
3273 * description="Returned data.",
3274 * type="array",
3275 * @OA\Items(
3276 * @OA\Property(
3277 * property="id",
3278 * description="practitioner id",
3279 * type="string",
3280 * ),
3281 * @OA\Property(
3282 * property="uuid",
3283 * description="practitioner uuid",
3284 * type="string",
3285 * ),
3286 * @OA\Property(
3287 * property="title",
3288 * description="practitioner title",
3289 * type="string",
3290 * ),
3291 * @OA\Property(
3292 * property="fname",
3293 * description="practitioner fname",
3294 * type="string",
3295 * ),
3296 * @OA\Property(
3297 * property="lname",
3298 * description="practitioner lname",
3299 * type="string",
3300 * ),
3301 * @OA\Property(
3302 * property="mname",
3303 * description="practitioner mname",
3304 * type="string",
3305 * ),
3306 * @OA\Property(
3307 * property="federaltaxid",
3308 * description="practitioner federaltaxid",
3309 * type="string",
3310 * ),
3311 * @OA\Property(
3312 * property="federaldrugid",
3313 * description="practitioner federaldrugid",
3314 * type="string",
3315 * ),
3316 * @OA\Property(
3317 * property="upin",
3318 * description="practitioner upin",
3319 * type="string",
3320 * ),
3321 * @OA\Property(
3322 * property="facility_id",
3323 * description="practitioner facility_id",
3324 * type="string",
3325 * ),
3326 * @OA\Property(
3327 * property="facility",
3328 * description="practitioner facility",
3329 * type="string",
3330 * ),
3331 * @OA\Property(
3332 * property="npi",
3333 * description="practitioner npi",
3334 * type="string",
3335 * ),
3336 * @OA\Property(
3337 * property="email",
3338 * description="practitioner email",
3339 * type="string",
3340 * ),
3341 * @OA\Property(
3342 * property="active",
3343 * description="practitioner active setting",
3344 * type="string",
3345 * ),
3346 * @OA\Property(
3347 * property="specialty",
3348 * description="practitioner specialty",
3349 * type="string",
3350 * ),
3351 * @OA\Property(
3352 * property="billname",
3353 * description="practitioner billname",
3354 * type="string",
3355 * ),
3356 * @OA\Property(
3357 * property="url",
3358 * description="practitioner url",
3359 * type="string",
3360 * ),
3361 * @OA\Property(
3362 * property="assistant",
3363 * description="practitioner assistant",
3364 * type="string",
3365 * ),
3366 * @OA\Property(
3367 * property="organization",
3368 * description="practitioner organization",
3369 * type="string",
3370 * ),
3371 * @OA\Property(
3372 * property="valedictory",
3373 * description="practitioner valedictory",
3374 * type="string",
3375 * ),
3376 * @OA\Property(
3377 * property="street",
3378 * description="practitioner street",
3379 * type="string",
3380 * ),
3381 * @OA\Property(
3382 * property="streetb",
3383 * description="practitioner streetb",
3384 * type="string",
3385 * ),
3386 * @OA\Property(
3387 * property="city",
3388 * description="practitioner city",
3389 * type="string",
3390 * ),
3391 * @OA\Property(
3392 * property="state",
3393 * description="practitioner state",
3394 * type="string",
3395 * ),
3396 * @OA\Property(
3397 * property="zip",
3398 * description="practitioner zip",
3399 * type="string",
3400 * ),
3401 * @OA\Property(
3402 * property="phone",
3403 * description="practitioner phone",
3404 * type="string",
3405 * ),
3406 * @OA\Property(
3407 * property="fax",
3408 * description="fax",
3409 * type="string",
3410 * ),
3411 * @OA\Property(
3412 * property="phonew1",
3413 * description="practitioner phonew1",
3414 * type="string",
3415 * ),
3416 * @OA\Property(
3417 * property="phonecell",
3418 * description="practitioner phonecell",
3419 * type="string",
3420 * ),
3421 * @OA\Property(
3422 * property="notes",
3423 * description="practitioner notes",
3424 * type="string",
3425 * ),
3426 * @OA\Property(
3427 * property="state_license_number",
3428 * description="practitioner state license number",
3429 * type="string",
3430 * ),
3431 * @OA\Property(
3432 * property="abook_title",
3433 * description="practitioner abook title",
3434 * type="string",
3435 * ),
3436 * @OA\Property(
3437 * property="physician_title",
3438 * description="practitioner physician title",
3439 * type="string",
3440 * ),
3441 * @OA\Property(
3442 * property="physician_code",
3443 * description="practitioner physician code",
3444 * type="string",
3446 * ),
3447 * ),
3448 * example={
3449 * "validationErrors": {},
3450 * "error_description": {},
3451 * "data": {
3452 * "id": 7,
3453 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3454 * "title": "Mr",
3455 * "fname": "Baz",
3456 * "lname": "Bop",
3457 * "mname": "",
3458 * "federaltaxid": "",
3459 * "federaldrugid": "",
3460 * "upin": "",
3461 * "facility_id": "3",
3462 * "facility": "Your Clinic Name Here",
3463 * "npi": "0123456789",
3464 * "email": "info@pennfirm.com",
3465 * "active": "1",
3466 * "specialty": "",
3467 * "billname": "",
3468 * "url": "",
3469 * "assistant": "",
3470 * "organization": "",
3471 * "valedictory": "",
3472 * "street": "456 Tree Lane",
3473 * "streetb": "123 Cannaut Street",
3474 * "city": "FooTown",
3475 * "state": "FL",
3476 * "zip": "08642",
3477 * "phone": "123-456-7890",
3478 * "fax": "",
3479 * "phonew1": "(619) 555-7822",
3480 * "phonecell": "(619) 555-7821",
3481 * "notes": "",
3482 * "state_license_number": "123456",
3483 * "abook_title": null,
3484 * "physician_title": null,
3485 * "physician_code": null
3490 * ),
3491 * @OA\Response(
3492 * response="401",
3493 * ref="#/components/responses/unauthorized"
3494 * ),
3495 * security={{"openemr_auth":{}}}
3498 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3499 RestConfig::authorization_check("admin", "users");
3500 $data = (array) (json_decode(file_get_contents("php://input")));
3501 $return = (new PractitionerRestController())->patch($pruuid, $data);
3502 RestConfig::apiLog($return, $data);
3503 return $return;
3507 * @OA\Get(
3508 * path="/api/medical_problem",
3509 * description="Retrieves a list of medical problems",
3510 * tags={"standard"},
3511 * @OA\Parameter(
3512 * name="puuid",
3513 * in="query",
3514 * description="The uuid for the patient.",
3515 * required=false,
3516 * @OA\Schema(
3517 * type="string"
3519 * ),
3520 * @OA\Parameter(
3521 * name="condition_uuid",
3522 * in="query",
3523 * description="The uuid for the medical problem.",
3524 * required=false,
3525 * @OA\Schema(
3526 * type="string"
3528 * ),
3529 * @OA\Parameter(
3530 * name="title",
3531 * in="query",
3532 * description="The title for the medical problem.",
3533 * required=false,
3534 * @OA\Schema(
3535 * type="string"
3537 * ),
3538 * @OA\Parameter(
3539 * name="begdate",
3540 * in="query",
3541 * description="The start date for the medical problem.",
3542 * required=false,
3543 * @OA\Schema(
3544 * type="string"
3546 * ),
3547 * @OA\Parameter(
3548 * name="enddate",
3549 * in="query",
3550 * description="The end date for the medical problem.",
3551 * required=false,
3552 * @OA\Schema(
3553 * type="string"
3555 * ),
3556 * @OA\Parameter(
3557 * name="diagnosis",
3558 * in="query",
3559 * description="The diagnosis for the medical problem.",
3560 * required=false,
3561 * @OA\Schema(
3562 * type="string"
3564 * ),
3565 * @OA\Response(
3566 * response="200",
3567 * ref="#/components/responses/standard"
3568 * ),
3569 * @OA\Response(
3570 * response="400",
3571 * ref="#/components/responses/badrequest"
3572 * ),
3573 * @OA\Response(
3574 * response="401",
3575 * ref="#/components/responses/unauthorized"
3576 * ),
3577 * security={{"openemr_auth":{}}}
3580 "GET /api/medical_problem" => function () {
3581 RestConfig::authorization_check("encounters", "notes");
3582 $return = (new ConditionRestController())->getAll();
3583 RestConfig::apiLog($return);
3584 return $return;
3588 * @OA\Get(
3589 * path="/api/medical_problem/{muuid}",
3590 * description="Retrieves a single medical problem by their uuid",
3591 * tags={"standard"},
3592 * @OA\Parameter(
3593 * name="muuid",
3594 * in="path",
3595 * description="The uuid for the medical problem.",
3596 * required=true,
3597 * @OA\Schema(
3598 * type="string"
3600 * ),
3601 * @OA\Response(
3602 * response="200",
3603 * ref="#/components/responses/standard"
3604 * ),
3605 * @OA\Response(
3606 * response="400",
3607 * ref="#/components/responses/badrequest"
3608 * ),
3609 * @OA\Response(
3610 * response="401",
3611 * ref="#/components/responses/unauthorized"
3612 * ),
3613 * security={{"openemr_auth":{}}}
3616 "GET /api/medical_problem/:muuid" => function ($muuid) {
3617 RestConfig::authorization_check("encounters", "notes");
3618 $return = (new ConditionRestController())->getOne($muuid);
3619 RestConfig::apiLog($return);
3620 return $return;
3624 * @OA\Get(
3625 * path="/api/patient/{puuid}/medical_problem",
3626 * description="Retrieves all medical problems for a patient",
3627 * tags={"standard"},
3628 * @OA\Parameter(
3629 * name="puuid",
3630 * in="path",
3631 * description="The uuid for the patient.",
3632 * required=true,
3633 * @OA\Schema(
3634 * type="string"
3636 * ),
3637 * @OA\Response(
3638 * response="200",
3639 * ref="#/components/responses/standard"
3640 * ),
3641 * @OA\Response(
3642 * response="400",
3643 * ref="#/components/responses/badrequest"
3644 * ),
3645 * @OA\Response(
3646 * response="401",
3647 * ref="#/components/responses/unauthorized"
3648 * ),
3649 * security={{"openemr_auth":{}}}
3652 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3653 RestConfig::authorization_check("encounters", "notes");
3654 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3655 RestConfig::apiLog($return);
3656 return $return;
3660 * @OA\Get(
3661 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3662 * description="Retrieves a medical problem for a patient",
3663 * tags={"standard"},
3664 * @OA\Parameter(
3665 * name="puuid",
3666 * in="path",
3667 * description="The uuid for the patient.",
3668 * required=true,
3669 * @OA\Schema(
3670 * type="string"
3672 * ),
3673 * @OA\Parameter(
3674 * name="muuid",
3675 * in="path",
3676 * description="The uuid for the medical problem.",
3677 * required=true,
3678 * @OA\Schema(
3679 * type="string"
3681 * ),
3682 * @OA\Response(
3683 * response="200",
3684 * ref="#/components/responses/standard"
3685 * ),
3686 * @OA\Response(
3687 * response="400",
3688 * ref="#/components/responses/badrequest"
3689 * ),
3690 * @OA\Response(
3691 * response="401",
3692 * ref="#/components/responses/unauthorized"
3693 * ),
3694 * security={{"openemr_auth":{}}}
3697 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3698 RestConfig::authorization_check("patients", "med");
3699 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3700 RestConfig::apiLog($return);
3701 return $return;
3705 * Schema for the medical_problem request
3707 * @OA\Schema(
3708 * schema="api_medical_problem_request",
3709 * @OA\Property(
3710 * property="title",
3711 * description="The title of medical problem.",
3712 * type="string"
3713 * ),
3714 * @OA\Property(
3715 * property="begdate",
3716 * description="The beginning date of medical problem.",
3717 * type="string"
3718 * ),
3719 * @OA\Property(
3720 * property="enddate",
3721 * description="The end date of medical problem.",
3722 * type="string"
3723 * ),
3724 * @OA\Property(
3725 * property="diagnosis",
3726 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3727 * type="string"
3728 * ),
3729 * required={"title", "begdate"},
3730 * example={
3731 * "title": "Dermatochalasis",
3732 * "begdate": "2010-10-13",
3733 * "enddate": null,
3734 * "diagnosis": "ICD10:H02.839"
3739 * @OA\Post(
3740 * path="/api/patient/{puuid}/medical_problem",
3741 * description="Submits a new medical problem",
3742 * tags={"standard"},
3743 * @OA\Parameter(
3744 * name="puuid",
3745 * in="path",
3746 * description="The uuid for the patient.",
3747 * required=true,
3748 * @OA\Schema(
3749 * type="string"
3751 * ),
3752 * @OA\RequestBody(
3753 * required=true,
3754 * @OA\MediaType(
3755 * mediaType="application/json",
3756 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3758 * ),
3759 * @OA\Response(
3760 * response="200",
3761 * ref="#/components/responses/standard"
3762 * ),
3763 * @OA\Response(
3764 * response="400",
3765 * ref="#/components/responses/badrequest"
3766 * ),
3767 * @OA\Response(
3768 * response="401",
3769 * ref="#/components/responses/unauthorized"
3770 * ),
3771 * security={{"openemr_auth":{}}}
3774 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3775 RestConfig::authorization_check("patients", "med");
3776 $data = (array) (json_decode(file_get_contents("php://input")));
3777 $return = (new ConditionRestController())->post($puuid, $data);
3778 RestConfig::apiLog($return, $data);
3779 return $return;
3783 * @OA\Put(
3784 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3785 * description="Edit a medical problem",
3786 * tags={"standard"},
3787 * @OA\Parameter(
3788 * name="puuid",
3789 * in="path",
3790 * description="The uuid for the patient.",
3791 * required=true,
3792 * @OA\Schema(
3793 * type="string"
3795 * ),
3796 * @OA\Parameter(
3797 * name="muuid",
3798 * in="path",
3799 * description="The uuid for the medical problem.",
3800 * required=true,
3801 * @OA\Schema(
3802 * type="string"
3804 * ),
3805 * @OA\RequestBody(
3806 * required=true,
3807 * @OA\MediaType(
3808 * mediaType="application/json",
3809 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3811 * ),
3812 * @OA\Response(
3813 * response="200",
3814 * ref="#/components/responses/standard"
3815 * ),
3816 * @OA\Response(
3817 * response="400",
3818 * ref="#/components/responses/badrequest"
3819 * ),
3820 * @OA\Response(
3821 * response="401",
3822 * ref="#/components/responses/unauthorized"
3823 * ),
3824 * security={{"openemr_auth":{}}}
3827 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3828 RestConfig::authorization_check("patients", "med");
3829 $data = (array) (json_decode(file_get_contents("php://input")));
3830 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3831 RestConfig::apiLog($return, $data);
3832 return $return;
3836 * @OA\Delete(
3837 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3838 * description="Delete a medical problem",
3839 * tags={"standard"},
3840 * @OA\Parameter(
3841 * name="puuid",
3842 * in="path",
3843 * description="The uuid for the patient.",
3844 * required=true,
3845 * @OA\Schema(
3846 * type="string"
3848 * ),
3849 * @OA\Parameter(
3850 * name="muuid",
3851 * in="path",
3852 * description="The uuid for the medical problem.",
3853 * required=true,
3854 * @OA\Schema(
3855 * type="string"
3857 * ),
3858 * @OA\Response(
3859 * response="200",
3860 * ref="#/components/responses/standard"
3861 * ),
3862 * @OA\Response(
3863 * response="400",
3864 * ref="#/components/responses/badrequest"
3865 * ),
3866 * @OA\Response(
3867 * response="401",
3868 * ref="#/components/responses/unauthorized"
3869 * ),
3870 * security={{"openemr_auth":{}}}
3873 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3874 RestConfig::authorization_check("patients", "med");
3875 $return = (new ConditionRestController())->delete($puuid, $muuid);
3876 RestConfig::apiLog($return);
3877 return $return;
3881 * @OA\Get(
3882 * path="/api/allergy",
3883 * description="Retrieves a list of allergies",
3884 * tags={"standard"},
3885 * @OA\Parameter(
3886 * name="lists.pid",
3887 * in="query",
3888 * description="The uuid for the patient.",
3889 * required=false,
3890 * @OA\Schema(
3891 * type="string"
3893 * ),
3894 * @OA\Parameter(
3895 * name="lists.id",
3896 * in="query",
3897 * description="The uuid for the allergy.",
3898 * required=false,
3899 * @OA\Schema(
3900 * type="string"
3902 * ),
3903 * @OA\Parameter(
3904 * name="title",
3905 * in="query",
3906 * description="The title for the allergy.",
3907 * required=false,
3908 * @OA\Schema(
3909 * type="string"
3911 * ),
3912 * @OA\Parameter(
3913 * name="begdate",
3914 * in="query",
3915 * description="The start date for the allergy.",
3916 * required=false,
3917 * @OA\Schema(
3918 * type="string"
3920 * ),
3921 * @OA\Parameter(
3922 * name="enddate",
3923 * in="query",
3924 * description="The end date for the allergy.",
3925 * required=false,
3926 * @OA\Schema(
3927 * type="string"
3929 * ),
3930 * @OA\Parameter(
3931 * name="diagnosis",
3932 * in="query",
3933 * description="The diagnosis for the allergy.",
3934 * required=false,
3935 * @OA\Schema(
3936 * type="string"
3938 * ),
3939 * @OA\Response(
3940 * response="200",
3941 * ref="#/components/responses/standard"
3942 * ),
3943 * @OA\Response(
3944 * response="400",
3945 * ref="#/components/responses/badrequest"
3946 * ),
3947 * @OA\Response(
3948 * response="401",
3949 * ref="#/components/responses/unauthorized"
3950 * ),
3951 * security={{"openemr_auth":{}}}
3954 "GET /api/allergy" => function () {
3955 RestConfig::authorization_check("patients", "med");
3956 $return = (new AllergyIntoleranceRestController())->getAll();
3957 RestConfig::apiLog($return);
3958 return $return;
3962 * @OA\Get(
3963 * path="/api/allergy/{auuid}",
3964 * description="Retrieves a single allergy by their uuid",
3965 * tags={"standard"},
3966 * @OA\Parameter(
3967 * name="auuid",
3968 * in="path",
3969 * description="The uuid for the allergy.",
3970 * required=true,
3971 * @OA\Schema(
3972 * type="string"
3974 * ),
3975 * @OA\Response(
3976 * response="200",
3977 * ref="#/components/responses/standard"
3978 * ),
3979 * @OA\Response(
3980 * response="400",
3981 * ref="#/components/responses/badrequest"
3982 * ),
3983 * @OA\Response(
3984 * response="401",
3985 * ref="#/components/responses/unauthorized"
3986 * ),
3987 * security={{"openemr_auth":{}}}
3990 "GET /api/allergy/:auuid" => function ($auuid) {
3991 RestConfig::authorization_check("patients", "med");
3992 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3993 RestConfig::apiLog($return);
3994 return $return;
3998 * @OA\Get(
3999 * path="/api/patient/{puuid}/allergy",
4000 * description="Retrieves all allergies for a patient",
4001 * tags={"standard"},
4002 * @OA\Parameter(
4003 * name="puuid",
4004 * in="path",
4005 * description="The uuid for the patient.",
4006 * required=true,
4007 * @OA\Schema(
4008 * type="string"
4010 * ),
4011 * @OA\Response(
4012 * response="200",
4013 * ref="#/components/responses/standard"
4014 * ),
4015 * @OA\Response(
4016 * response="400",
4017 * ref="#/components/responses/badrequest"
4018 * ),
4019 * @OA\Response(
4020 * response="401",
4021 * ref="#/components/responses/unauthorized"
4022 * ),
4023 * security={{"openemr_auth":{}}}
4026 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4027 RestConfig::authorization_check("patients", "med");
4028 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4029 RestConfig::apiLog($return);
4030 return $return;
4034 * @OA\Get(
4035 * path="/api/patient/{puuid}/allergy/{auuid}",
4036 * description="Retrieves a allergy for a patient",
4037 * tags={"standard"},
4038 * @OA\Parameter(
4039 * name="puuid",
4040 * in="path",
4041 * description="The uuid for the patient.",
4042 * required=true,
4043 * @OA\Schema(
4044 * type="string"
4046 * ),
4047 * @OA\Parameter(
4048 * name="auuid",
4049 * in="path",
4050 * description="The uuid for the allergy.",
4051 * required=true,
4052 * @OA\Schema(
4053 * type="string"
4055 * ),
4056 * @OA\Response(
4057 * response="200",
4058 * ref="#/components/responses/standard"
4059 * ),
4060 * @OA\Response(
4061 * response="400",
4062 * ref="#/components/responses/badrequest"
4063 * ),
4064 * @OA\Response(
4065 * response="401",
4066 * ref="#/components/responses/unauthorized"
4067 * ),
4068 * security={{"openemr_auth":{}}}
4071 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4072 RestConfig::authorization_check("patients", "med");
4073 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4074 RestConfig::apiLog($return);
4075 return $return;
4079 * Schema for the allergy request
4081 * @OA\Schema(
4082 * schema="api_allergy_request",
4083 * @OA\Property(
4084 * property="title",
4085 * description="The title of allergy.",
4086 * type="string"
4087 * ),
4088 * @OA\Property(
4089 * property="begdate",
4090 * description="The beginning date of allergy.",
4091 * type="string"
4092 * ),
4093 * @OA\Property(
4094 * property="enddate",
4095 * description="The end date of allergy.",
4096 * type="string"
4097 * ),
4098 * @OA\Property(
4099 * property="diagnosis",
4100 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4101 * type="string"
4102 * ),
4103 * required={"title", "begdate"},
4104 * example={
4105 * "title": "Iodine",
4106 * "begdate": "2010-10-13",
4107 * "enddate": null
4112 * @OA\Post(
4113 * path="/api/patient/{puuid}/allergy",
4114 * description="Submits a new allergy",
4115 * tags={"standard"},
4116 * @OA\Parameter(
4117 * name="puuid",
4118 * in="path",
4119 * description="The uuid for the patient.",
4120 * required=true,
4121 * @OA\Schema(
4122 * type="string"
4124 * ),
4125 * @OA\RequestBody(
4126 * required=true,
4127 * @OA\MediaType(
4128 * mediaType="application/json",
4129 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4131 * ),
4132 * @OA\Response(
4133 * response="200",
4134 * ref="#/components/responses/standard"
4135 * ),
4136 * @OA\Response(
4137 * response="400",
4138 * ref="#/components/responses/badrequest"
4139 * ),
4140 * @OA\Response(
4141 * response="401",
4142 * ref="#/components/responses/unauthorized"
4143 * ),
4144 * security={{"openemr_auth":{}}}
4147 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4148 RestConfig::authorization_check("patients", "med");
4149 $data = (array) (json_decode(file_get_contents("php://input")));
4150 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4151 RestConfig::apiLog($return, $data);
4152 return $return;
4156 * @OA\Put(
4157 * path="/api/patient/{puuid}/allergy/{auuid}",
4158 * description="Edit a allergy",
4159 * tags={"standard"},
4160 * @OA\Parameter(
4161 * name="puuid",
4162 * in="path",
4163 * description="The uuid for the patient.",
4164 * required=true,
4165 * @OA\Schema(
4166 * type="string"
4168 * ),
4169 * @OA\Parameter(
4170 * name="auuid",
4171 * in="path",
4172 * description="The uuid for the allergy.",
4173 * required=true,
4174 * @OA\Schema(
4175 * type="string"
4177 * ),
4178 * @OA\RequestBody(
4179 * required=true,
4180 * @OA\MediaType(
4181 * mediaType="application/json",
4182 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4184 * ),
4185 * @OA\Response(
4186 * response="200",
4187 * ref="#/components/responses/standard"
4188 * ),
4189 * @OA\Response(
4190 * response="400",
4191 * ref="#/components/responses/badrequest"
4192 * ),
4193 * @OA\Response(
4194 * response="401",
4195 * ref="#/components/responses/unauthorized"
4196 * ),
4197 * security={{"openemr_auth":{}}}
4200 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4201 RestConfig::authorization_check("patients", "med");
4202 $data = (array) (json_decode(file_get_contents("php://input")));
4203 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4204 RestConfig::apiLog($return, $data);
4205 return $return;
4209 * @OA\Delete(
4210 * path="/api/patient/{puuid}/allergy/{auuid}",
4211 * description="Delete a medical problem",
4212 * tags={"standard"},
4213 * @OA\Parameter(
4214 * name="puuid",
4215 * in="path",
4216 * description="The uuid for the patient.",
4217 * required=true,
4218 * @OA\Schema(
4219 * type="string"
4221 * ),
4222 * @OA\Parameter(
4223 * name="auuid",
4224 * in="path",
4225 * description="The uuid for the allergy.",
4226 * required=true,
4227 * @OA\Schema(
4228 * type="string"
4230 * ),
4231 * @OA\Response(
4232 * response="200",
4233 * ref="#/components/responses/standard"
4234 * ),
4235 * @OA\Response(
4236 * response="400",
4237 * ref="#/components/responses/badrequest"
4238 * ),
4239 * @OA\Response(
4240 * response="401",
4241 * ref="#/components/responses/unauthorized"
4242 * ),
4243 * security={{"openemr_auth":{}}}
4246 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4247 RestConfig::authorization_check("patients", "med");
4248 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4249 RestConfig::apiLog($return);
4250 return $return;
4254 * @OA\Get(
4255 * path="/api/patient/{pid}/medication",
4256 * description="Retrieves all medications for a patient",
4257 * tags={"standard"},
4258 * @OA\Parameter(
4259 * name="pid",
4260 * in="path",
4261 * description="The pid for the patient.",
4262 * required=true,
4263 * @OA\Schema(
4264 * type="string"
4266 * ),
4267 * @OA\Response(
4268 * response="200",
4269 * ref="#/components/responses/standard"
4270 * ),
4271 * @OA\Response(
4272 * response="400",
4273 * ref="#/components/responses/badrequest"
4274 * ),
4275 * @OA\Response(
4276 * response="401",
4277 * ref="#/components/responses/unauthorized"
4278 * ),
4279 * security={{"openemr_auth":{}}}
4282 "GET /api/patient/:pid/medication" => function ($pid) {
4283 RestConfig::authorization_check("patients", "med");
4284 $return = (new ListRestController())->getAll($pid, "medication");
4285 RestConfig::apiLog($return);
4286 return $return;
4290 * Schema for the medication request
4292 * @OA\Schema(
4293 * schema="api_medication_request",
4294 * @OA\Property(
4295 * property="title",
4296 * description="The title of medication.",
4297 * type="string"
4298 * ),
4299 * @OA\Property(
4300 * property="begdate",
4301 * description="The beginning date of medication.",
4302 * type="string"
4303 * ),
4304 * @OA\Property(
4305 * property="enddate",
4306 * description="The end date of medication.",
4307 * type="string"
4308 * ),
4309 * @OA\Property(
4310 * property="diagnosis",
4311 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4312 * type="string"
4313 * ),
4314 * required={"title", "begdate"},
4315 * example={
4316 * "title": "Norvasc",
4317 * "begdate": "2013-04-13",
4318 * "enddate": null
4323 * @OA\Post(
4324 * path="/api/patient/{pid}/medication",
4325 * description="Submits a new medication",
4326 * tags={"standard"},
4327 * @OA\Parameter(
4328 * name="pid",
4329 * in="path",
4330 * description="The pid for the patient.",
4331 * required=true,
4332 * @OA\Schema(
4333 * type="string"
4335 * ),
4336 * @OA\RequestBody(
4337 * required=true,
4338 * @OA\MediaType(
4339 * mediaType="application/json",
4340 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4342 * ),
4343 * @OA\Response(
4344 * response="200",
4345 * ref="#/components/responses/standard"
4346 * ),
4347 * @OA\Response(
4348 * response="400",
4349 * ref="#/components/responses/badrequest"
4350 * ),
4351 * @OA\Response(
4352 * response="401",
4353 * ref="#/components/responses/unauthorized"
4354 * ),
4355 * security={{"openemr_auth":{}}}
4358 "POST /api/patient/:pid/medication" => function ($pid) {
4359 RestConfig::authorization_check("patients", "med");
4360 $data = (array) (json_decode(file_get_contents("php://input")));
4361 $return = (new ListRestController())->post($pid, "medication", $data);
4362 RestConfig::apiLog($return, $data);
4363 return $return;
4367 * @OA\Put(
4368 * path="/api/patient/{pid}/medication/{mid}",
4369 * description="Edit a medication",
4370 * tags={"standard"},
4371 * @OA\Parameter(
4372 * name="pid",
4373 * in="path",
4374 * description="The pid for the patient.",
4375 * required=true,
4376 * @OA\Schema(
4377 * type="string"
4379 * ),
4380 * @OA\Parameter(
4381 * name="mid",
4382 * in="path",
4383 * description="The id for the medication.",
4384 * required=true,
4385 * @OA\Schema(
4386 * type="string"
4388 * ),
4389 * @OA\RequestBody(
4390 * required=true,
4391 * @OA\MediaType(
4392 * mediaType="application/json",
4393 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4395 * ),
4396 * @OA\Response(
4397 * response="200",
4398 * ref="#/components/responses/standard"
4399 * ),
4400 * @OA\Response(
4401 * response="400",
4402 * ref="#/components/responses/badrequest"
4403 * ),
4404 * @OA\Response(
4405 * response="401",
4406 * ref="#/components/responses/unauthorized"
4407 * ),
4408 * security={{"openemr_auth":{}}}
4411 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4412 RestConfig::authorization_check("patients", "med");
4413 $data = (array) (json_decode(file_get_contents("php://input")));
4414 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4415 RestConfig::apiLog($return, $data);
4416 return $return;
4420 * @OA\Get(
4421 * path="/api/patient/{pid}/medication/{mid}",
4422 * description="Retrieves a medication for a patient",
4423 * tags={"standard"},
4424 * @OA\Parameter(
4425 * name="pid",
4426 * in="path",
4427 * description="The id for the patient.",
4428 * required=true,
4429 * @OA\Schema(
4430 * type="string"
4432 * ),
4433 * @OA\Parameter(
4434 * name="mid",
4435 * in="path",
4436 * description="The id for the medication.",
4437 * required=true,
4438 * @OA\Schema(
4439 * type="string"
4441 * ),
4442 * @OA\Response(
4443 * response="200",
4444 * ref="#/components/responses/standard"
4445 * ),
4446 * @OA\Response(
4447 * response="400",
4448 * ref="#/components/responses/badrequest"
4449 * ),
4450 * @OA\Response(
4451 * response="401",
4452 * ref="#/components/responses/unauthorized"
4453 * ),
4454 * security={{"openemr_auth":{}}}
4457 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4458 RestConfig::authorization_check("patients", "med");
4459 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4460 RestConfig::apiLog($return);
4461 return $return;
4465 * @OA\Delete(
4466 * path="/api/patient/{pid}/medication/{mid}",
4467 * description="Delete a medication",
4468 * tags={"standard"},
4469 * @OA\Parameter(
4470 * name="pid",
4471 * in="path",
4472 * description="The id for the patient.",
4473 * required=true,
4474 * @OA\Schema(
4475 * type="string"
4477 * ),
4478 * @OA\Parameter(
4479 * name="mid",
4480 * in="path",
4481 * description="The id for the medication.",
4482 * required=true,
4483 * @OA\Schema(
4484 * type="string"
4486 * ),
4487 * @OA\Response(
4488 * response="200",
4489 * ref="#/components/responses/standard"
4490 * ),
4491 * @OA\Response(
4492 * response="400",
4493 * ref="#/components/responses/badrequest"
4494 * ),
4495 * @OA\Response(
4496 * response="401",
4497 * ref="#/components/responses/unauthorized"
4498 * ),
4499 * security={{"openemr_auth":{}}}
4502 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4503 RestConfig::authorization_check("patients", "med");
4504 $return = (new ListRestController())->delete($pid, $mid, "medication");
4505 RestConfig::apiLog($return);
4506 return $return;
4510 * @OA\Get(
4511 * path="/api/patient/{pid}/surgery",
4512 * description="Retrieves all surgeries for a patient",
4513 * tags={"standard"},
4514 * @OA\Parameter(
4515 * name="pid",
4516 * in="path",
4517 * description="The pid for the patient.",
4518 * required=true,
4519 * @OA\Schema(
4520 * type="string"
4522 * ),
4523 * @OA\Response(
4524 * response="200",
4525 * ref="#/components/responses/standard"
4526 * ),
4527 * @OA\Response(
4528 * response="400",
4529 * ref="#/components/responses/badrequest"
4530 * ),
4531 * @OA\Response(
4532 * response="401",
4533 * ref="#/components/responses/unauthorized"
4534 * ),
4535 * security={{"openemr_auth":{}}}
4538 "GET /api/patient/:pid/surgery" => function ($pid) {
4539 RestConfig::authorization_check("patients", "med");
4540 $return = (new ListRestController())->getAll($pid, "surgery");
4541 RestConfig::apiLog($return);
4542 return $return;
4546 * @OA\Get(
4547 * path="/api/patient/{pid}/surgery/{sid}",
4548 * description="Retrieves a surgery for a patient",
4549 * tags={"standard"},
4550 * @OA\Parameter(
4551 * name="pid",
4552 * in="path",
4553 * description="The id for the patient.",
4554 * required=true,
4555 * @OA\Schema(
4556 * type="string"
4558 * ),
4559 * @OA\Parameter(
4560 * name="sid",
4561 * in="path",
4562 * description="The id for the surgery.",
4563 * required=true,
4564 * @OA\Schema(
4565 * type="string"
4567 * ),
4568 * @OA\Response(
4569 * response="200",
4570 * ref="#/components/responses/standard"
4571 * ),
4572 * @OA\Response(
4573 * response="400",
4574 * ref="#/components/responses/badrequest"
4575 * ),
4576 * @OA\Response(
4577 * response="401",
4578 * ref="#/components/responses/unauthorized"
4579 * ),
4580 * security={{"openemr_auth":{}}}
4583 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4584 RestConfig::authorization_check("patients", "med");
4585 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4586 RestConfig::apiLog($return);
4587 return $return;
4591 * @OA\Delete(
4592 * path="/api/patient/{pid}/surgery/{sid}",
4593 * description="Delete a surgery",
4594 * tags={"standard"},
4595 * @OA\Parameter(
4596 * name="pid",
4597 * in="path",
4598 * description="The id for the patient.",
4599 * required=true,
4600 * @OA\Schema(
4601 * type="string"
4603 * ),
4604 * @OA\Parameter(
4605 * name="sid",
4606 * in="path",
4607 * description="The id for the surgery.",
4608 * required=true,
4609 * @OA\Schema(
4610 * type="string"
4612 * ),
4613 * @OA\Response(
4614 * response="200",
4615 * ref="#/components/responses/standard"
4616 * ),
4617 * @OA\Response(
4618 * response="400",
4619 * ref="#/components/responses/badrequest"
4620 * ),
4621 * @OA\Response(
4622 * response="401",
4623 * ref="#/components/responses/unauthorized"
4624 * ),
4625 * security={{"openemr_auth":{}}}
4628 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4629 RestConfig::authorization_check("patients", "med");
4630 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4631 RestConfig::apiLog($return);
4632 return $return;
4636 * Schema for the surgery request
4638 * @OA\Schema(
4639 * schema="api_surgery_request",
4640 * @OA\Property(
4641 * property="title",
4642 * description="The title of surgery.",
4643 * type="string"
4644 * ),
4645 * @OA\Property(
4646 * property="begdate",
4647 * description="The beginning date of surgery.",
4648 * type="string"
4649 * ),
4650 * @OA\Property(
4651 * property="enddate",
4652 * description="The end date of surgery.",
4653 * type="string"
4654 * ),
4655 * @OA\Property(
4656 * property="diagnosis",
4657 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4658 * type="string"
4659 * ),
4660 * required={"title", "begdate"},
4661 * example={
4662 * "title": "Blepharoplasty",
4663 * "begdate": "2013-10-14",
4664 * "enddate": null,
4665 * "diagnosis": "CPT4:15823-50"
4670 * @OA\Post(
4671 * path="/api/patient/{pid}/surgery",
4672 * description="Submits a new surgery",
4673 * tags={"standard"},
4674 * @OA\Parameter(
4675 * name="pid",
4676 * in="path",
4677 * description="The pid for the patient.",
4678 * required=true,
4679 * @OA\Schema(
4680 * type="string"
4682 * ),
4683 * @OA\RequestBody(
4684 * required=true,
4685 * @OA\MediaType(
4686 * mediaType="application/json",
4687 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4689 * ),
4690 * @OA\Response(
4691 * response="200",
4692 * ref="#/components/responses/standard"
4693 * ),
4694 * @OA\Response(
4695 * response="400",
4696 * ref="#/components/responses/badrequest"
4697 * ),
4698 * @OA\Response(
4699 * response="401",
4700 * ref="#/components/responses/unauthorized"
4701 * ),
4702 * security={{"openemr_auth":{}}}
4705 "POST /api/patient/:pid/surgery" => function ($pid) {
4706 RestConfig::authorization_check("patients", "med");
4707 $data = (array) (json_decode(file_get_contents("php://input")));
4708 $return = (new ListRestController())->post($pid, "surgery", $data);
4709 RestConfig::apiLog($return, $data);
4710 return $return;
4714 * @OA\Put(
4715 * path="/api/patient/{pid}/surgery/{sid}",
4716 * description="Edit a surgery",
4717 * tags={"standard"},
4718 * @OA\Parameter(
4719 * name="pid",
4720 * in="path",
4721 * description="The pid for the patient.",
4722 * required=true,
4723 * @OA\Schema(
4724 * type="string"
4726 * ),
4727 * @OA\Parameter(
4728 * name="sid",
4729 * in="path",
4730 * description="The id for the surgery.",
4731 * required=true,
4732 * @OA\Schema(
4733 * type="string"
4735 * ),
4736 * @OA\RequestBody(
4737 * required=true,
4738 * @OA\MediaType(
4739 * mediaType="application/json",
4740 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4742 * ),
4743 * @OA\Response(
4744 * response="200",
4745 * ref="#/components/responses/standard"
4746 * ),
4747 * @OA\Response(
4748 * response="400",
4749 * ref="#/components/responses/badrequest"
4750 * ),
4751 * @OA\Response(
4752 * response="401",
4753 * ref="#/components/responses/unauthorized"
4754 * ),
4755 * security={{"openemr_auth":{}}}
4758 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4759 RestConfig::authorization_check("patients", "med");
4760 $data = (array) (json_decode(file_get_contents("php://input")));
4761 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4762 RestConfig::apiLog($return, $data);
4763 return $return;
4767 * @OA\Get(
4768 * path="/api/patient/{pid}/dental_issue",
4769 * description="Retrieves all dental issues for a patient",
4770 * tags={"standard"},
4771 * @OA\Parameter(
4772 * name="pid",
4773 * in="path",
4774 * description="The pid for the patient.",
4775 * required=true,
4776 * @OA\Schema(
4777 * type="string"
4779 * ),
4780 * @OA\Response(
4781 * response="200",
4782 * ref="#/components/responses/standard"
4783 * ),
4784 * @OA\Response(
4785 * response="400",
4786 * ref="#/components/responses/badrequest"
4787 * ),
4788 * @OA\Response(
4789 * response="401",
4790 * ref="#/components/responses/unauthorized"
4791 * ),
4792 * security={{"openemr_auth":{}}}
4795 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4796 RestConfig::authorization_check("patients", "med");
4797 $return = (new ListRestController())->getAll($pid, "dental");
4798 RestConfig::apiLog($return);
4799 return $return;
4803 * @OA\Get(
4804 * path="/api/patient/{pid}/dental_issue/{did}",
4805 * description="Retrieves a dental issue for a patient",
4806 * tags={"standard"},
4807 * @OA\Parameter(
4808 * name="pid",
4809 * in="path",
4810 * description="The id for the patient.",
4811 * required=true,
4812 * @OA\Schema(
4813 * type="string"
4815 * ),
4816 * @OA\Parameter(
4817 * name="did",
4818 * in="path",
4819 * description="The id for the dental issue.",
4820 * required=true,
4821 * @OA\Schema(
4822 * type="string"
4824 * ),
4825 * @OA\Response(
4826 * response="200",
4827 * ref="#/components/responses/standard"
4828 * ),
4829 * @OA\Response(
4830 * response="400",
4831 * ref="#/components/responses/badrequest"
4832 * ),
4833 * @OA\Response(
4834 * response="401",
4835 * ref="#/components/responses/unauthorized"
4836 * ),
4837 * security={{"openemr_auth":{}}}
4840 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4841 RestConfig::authorization_check("patients", "med");
4842 $return = (new ListRestController())->getOne($pid, "dental", $did);
4843 RestConfig::apiLog($return);
4844 return $return;
4848 * @OA\Delete(
4849 * path="/api/patient/{pid}/dental_issue/{did}",
4850 * description="Delete a dental issue",
4851 * tags={"standard"},
4852 * @OA\Parameter(
4853 * name="pid",
4854 * in="path",
4855 * description="The id for the patient.",
4856 * required=true,
4857 * @OA\Schema(
4858 * type="string"
4860 * ),
4861 * @OA\Parameter(
4862 * name="did",
4863 * in="path",
4864 * description="The id for the dental issue.",
4865 * required=true,
4866 * @OA\Schema(
4867 * type="string"
4869 * ),
4870 * @OA\Response(
4871 * response="200",
4872 * ref="#/components/responses/standard"
4873 * ),
4874 * @OA\Response(
4875 * response="400",
4876 * ref="#/components/responses/badrequest"
4877 * ),
4878 * @OA\Response(
4879 * response="401",
4880 * ref="#/components/responses/unauthorized"
4881 * ),
4882 * security={{"openemr_auth":{}}}
4885 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4886 RestConfig::authorization_check("patients", "med");
4887 $return = (new ListRestController())->delete($pid, $did, "dental");
4888 RestConfig::apiLog($return);
4889 return $return;
4893 * Schema for the dental_issue request
4895 * @OA\Schema(
4896 * schema="api_dental_issue_request",
4897 * @OA\Property(
4898 * property="title",
4899 * description="The title of dental issue.",
4900 * type="string"
4901 * ),
4902 * @OA\Property(
4903 * property="begdate",
4904 * description="The beginning date of dental issue.",
4905 * type="string"
4906 * ),
4907 * @OA\Property(
4908 * property="enddate",
4909 * description="The end date of dental issue.",
4910 * type="string"
4911 * ),
4912 * @OA\Property(
4913 * property="diagnosis",
4914 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4915 * type="string"
4916 * ),
4917 * required={"title", "begdate"},
4918 * example={
4919 * "title": "Halitosis",
4920 * "begdate": "2015-03-17",
4921 * "enddate": null,
4926 * @OA\Post(
4927 * path="/api/patient/{pid}/dental_issue",
4928 * description="Submits a new dental issue",
4929 * tags={"standard"},
4930 * @OA\Parameter(
4931 * name="pid",
4932 * in="path",
4933 * description="The pid for the patient.",
4934 * required=true,
4935 * @OA\Schema(
4936 * type="string"
4938 * ),
4939 * @OA\RequestBody(
4940 * required=true,
4941 * @OA\MediaType(
4942 * mediaType="application/json",
4943 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4945 * ),
4946 * @OA\Response(
4947 * response="200",
4948 * ref="#/components/responses/standard"
4949 * ),
4950 * @OA\Response(
4951 * response="400",
4952 * ref="#/components/responses/badrequest"
4953 * ),
4954 * @OA\Response(
4955 * response="401",
4956 * ref="#/components/responses/unauthorized"
4957 * ),
4958 * security={{"openemr_auth":{}}}
4961 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4962 RestConfig::authorization_check("patients", "med");
4963 $data = (array) (json_decode(file_get_contents("php://input")));
4964 $return = (new ListRestController())->post($pid, "dental", $data);
4965 RestConfig::apiLog($return, $data);
4966 return $return;
4970 * @OA\Put(
4971 * path="/api/patient/{pid}/dental_issue/{did}",
4972 * description="Edit a dental issue",
4973 * tags={"standard"},
4974 * @OA\Parameter(
4975 * name="pid",
4976 * in="path",
4977 * description="The pid for the patient.",
4978 * required=true,
4979 * @OA\Schema(
4980 * type="string"
4982 * ),
4983 * @OA\Parameter(
4984 * name="did",
4985 * in="path",
4986 * description="The id for the dental issue.",
4987 * required=true,
4988 * @OA\Schema(
4989 * type="string"
4991 * ),
4992 * @OA\RequestBody(
4993 * required=true,
4994 * @OA\MediaType(
4995 * mediaType="application/json",
4996 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4998 * ),
4999 * @OA\Response(
5000 * response="200",
5001 * ref="#/components/responses/standard"
5002 * ),
5003 * @OA\Response(
5004 * response="400",
5005 * ref="#/components/responses/badrequest"
5006 * ),
5007 * @OA\Response(
5008 * response="401",
5009 * ref="#/components/responses/unauthorized"
5010 * ),
5011 * security={{"openemr_auth":{}}}
5014 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5015 RestConfig::authorization_check("patients", "med");
5016 $data = (array) (json_decode(file_get_contents("php://input")));
5017 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5018 RestConfig::apiLog($return, $data);
5019 return $return;
5023 * @OA\Get(
5024 * path="/api/patient/{pid}/appointment",
5025 * description="Retrieves all appointments for a patient",
5026 * tags={"standard"},
5027 * @OA\Parameter(
5028 * name="pid",
5029 * in="path",
5030 * description="The pid for the patient.",
5031 * required=true,
5032 * @OA\Schema(
5033 * type="string"
5035 * ),
5036 * @OA\Response(
5037 * response="200",
5038 * ref="#/components/responses/standard"
5039 * ),
5040 * @OA\Response(
5041 * response="400",
5042 * ref="#/components/responses/badrequest"
5043 * ),
5044 * @OA\Response(
5045 * response="401",
5046 * ref="#/components/responses/unauthorized"
5047 * ),
5048 * security={{"openemr_auth":{}}}
5051 "GET /api/patient/:pid/appointment" => function ($pid) {
5052 RestConfig::authorization_check("patients", "appt");
5053 $return = (new AppointmentRestController())->getAllForPatient($pid);
5054 RestConfig::apiLog($return);
5055 return $return;
5059 * @OA\Post(
5060 * path="/api/patient/{pid}/appointment",
5061 * description="Submits a new appointment",
5062 * tags={"standard"},
5063 * @OA\Parameter(
5064 * name="pid",
5065 * in="path",
5066 * description="The id for the patient.",
5067 * required=true,
5068 * @OA\Schema(
5069 * type="string"
5071 * ),
5072 * @OA\RequestBody(
5073 * required=true,
5074 * @OA\MediaType(
5075 * mediaType="application/json",
5076 * @OA\Schema(
5077 * @OA\Property(
5078 * property="pc_catid",
5079 * description="The category of the appointment.",
5080 * type="string"
5081 * ),
5082 * @OA\Property(
5083 * property="pc_title",
5084 * description="The title of the appointment.",
5085 * type="string"
5086 * ),
5087 * @OA\Property(
5088 * property="pc_duration",
5089 * description="The duration of the appointment.",
5090 * type="string"
5091 * ),
5092 * @OA\Property(
5093 * property="pc_hometext",
5094 * description="Comments for the appointment.",
5095 * type="string"
5096 * ),
5097 * @OA\Property(
5098 * property="pc_apptstatus",
5099 * description="use an option from resource=/api/list/apptstat",
5100 * type="string"
5101 * ),
5102 * @OA\Property(
5103 * property="pc_eventDate",
5104 * description="The date of the appointment.",
5105 * type="string"
5106 * ),
5107 * @OA\Property(
5108 * property="pc_startTime",
5109 * description="The time of the appointment.",
5110 * type="string"
5111 * ),
5112 * @OA\Property(
5113 * property="pc_facility",
5114 * description="The facility id of the appointment.",
5115 * type="string"
5116 * ),
5117 * @OA\Property(
5118 * property="pc_billing_location",
5119 * description="The billinag location id of the appointment.",
5120 * type="string"
5121 * ),
5122 * @OA\Property(
5123 * property="pc_aid",
5124 * description="The provider id for the appointment.",
5125 * type="string"
5126 * ),
5127 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5128 * example={
5129 * "pc_catid": "5",
5130 * "pc_title": "Office Visit",
5131 * "pc_duration": "900",
5132 * "pc_hometext": "Test",
5133 * "pc_apptstatus": "-",
5134 * "pc_eventDate": "2018-10-19",
5135 * "pc_startTime": "09:00",
5136 * "pc_facility": "9",
5137 * "pc_billing_location": "10",
5138 * "pc_aid": "1"
5142 * ),
5143 * @OA\Response(
5144 * response="200",
5145 * ref="#/components/responses/standard"
5146 * ),
5147 * @OA\Response(
5148 * response="400",
5149 * ref="#/components/responses/badrequest"
5150 * ),
5151 * @OA\Response(
5152 * response="401",
5153 * ref="#/components/responses/unauthorized"
5154 * ),
5155 * security={{"openemr_auth":{}}}
5158 "POST /api/patient/:pid/appointment" => function ($pid) {
5159 RestConfig::authorization_check("patients", "appt");
5160 $data = (array) (json_decode(file_get_contents("php://input")));
5161 $return = (new AppointmentRestController())->post($pid, $data);
5162 RestConfig::apiLog($return, $data);
5163 return $return;
5167 * @OA\Get(
5168 * path="/api/appointment",
5169 * description="Retrieves all appointments",
5170 * tags={"standard"},
5171 * @OA\Response(
5172 * response="200",
5173 * ref="#/components/responses/standard"
5174 * ),
5175 * @OA\Response(
5176 * response="400",
5177 * ref="#/components/responses/badrequest"
5178 * ),
5179 * @OA\Response(
5180 * response="401",
5181 * ref="#/components/responses/unauthorized"
5182 * ),
5183 * security={{"openemr_auth":{}}}
5186 "GET /api/appointment" => function () {
5187 RestConfig::authorization_check("patients", "appt");
5188 $return = (new AppointmentRestController())->getAll();
5189 RestConfig::apiLog($return);
5190 return $return;
5194 * @OA\Get(
5195 * path="/api/appointment/{eid}",
5196 * description="Retrieves an appointment",
5197 * tags={"standard"},
5198 * @OA\Parameter(
5199 * name="eid",
5200 * in="path",
5201 * description="The eid for the appointment.",
5202 * required=true,
5203 * @OA\Schema(
5204 * type="string"
5206 * ),
5207 * @OA\Response(
5208 * response="200",
5209 * ref="#/components/responses/standard"
5210 * ),
5211 * @OA\Response(
5212 * response="400",
5213 * ref="#/components/responses/badrequest"
5214 * ),
5215 * @OA\Response(
5216 * response="401",
5217 * ref="#/components/responses/unauthorized"
5218 * ),
5219 * security={{"openemr_auth":{}}}
5222 "GET /api/appointment/:eid" => function ($eid) {
5223 RestConfig::authorization_check("patients", "appt");
5224 $return = (new AppointmentRestController())->getOne($eid);
5225 RestConfig::apiLog($return);
5226 return $return;
5230 * @OA\Delete(
5231 * path="/api/patient/{pid}/appointment/{eid}",
5232 * description="Delete a appointment",
5233 * tags={"standard"},
5234 * @OA\Parameter(
5235 * name="pid",
5236 * in="path",
5237 * description="The id for the patient.",
5238 * required=true,
5239 * @OA\Schema(
5240 * type="string"
5242 * ),
5243 * @OA\Parameter(
5244 * name="eid",
5245 * in="path",
5246 * description="The eid for the appointment.",
5247 * required=true,
5248 * @OA\Schema(
5249 * type="string"
5251 * ),
5252 * @OA\Response(
5253 * response="200",
5254 * ref="#/components/responses/standard"
5255 * ),
5256 * @OA\Response(
5257 * response="400",
5258 * ref="#/components/responses/badrequest"
5259 * ),
5260 * @OA\Response(
5261 * response="401",
5262 * ref="#/components/responses/unauthorized"
5263 * ),
5264 * security={{"openemr_auth":{}}}
5267 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5268 RestConfig::authorization_check("patients", "appt");
5269 $return = (new AppointmentRestController())->delete($eid);
5270 RestConfig::apiLog($return);
5271 return $return;
5275 * @OA\Get(
5276 * path="/api/patient/{pid}/appointment/{eid}",
5277 * description="Retrieves a appointment for a patient",
5278 * tags={"standard"},
5279 * @OA\Parameter(
5280 * name="pid",
5281 * in="path",
5282 * description="The id for the patient.",
5283 * required=true,
5284 * @OA\Schema(
5285 * type="string"
5287 * ),
5288 * @OA\Parameter(
5289 * name="eid",
5290 * in="path",
5291 * description="The eid for the appointment.",
5292 * required=true,
5293 * @OA\Schema(
5294 * type="string"
5296 * ),
5297 * @OA\Response(
5298 * response="200",
5299 * ref="#/components/responses/standard"
5300 * ),
5301 * @OA\Response(
5302 * response="400",
5303 * ref="#/components/responses/badrequest"
5304 * ),
5305 * @OA\Response(
5306 * response="401",
5307 * ref="#/components/responses/unauthorized"
5308 * ),
5309 * security={{"openemr_auth":{}}}
5312 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5313 RestConfig::authorization_check("patients", "appt");
5314 $return = (new AppointmentRestController())->getOne($eid);
5315 RestConfig::apiLog($return);
5316 return $return;
5320 * @OA\Get(
5321 * path="/api/list/{list_name}",
5322 * description="Retrieves a list",
5323 * tags={"standard"},
5324 * @OA\Parameter(
5325 * name="list_name",
5326 * in="path",
5327 * description="The list_id of the list.",
5328 * required=true,
5329 * @OA\Schema(
5330 * type="string"
5332 * ),
5333 * @OA\Response(
5334 * response="200",
5335 * ref="#/components/responses/standard"
5336 * ),
5337 * @OA\Response(
5338 * response="400",
5339 * ref="#/components/responses/badrequest"
5340 * ),
5341 * @OA\Response(
5342 * response="401",
5343 * ref="#/components/responses/unauthorized"
5344 * ),
5345 * security={{"openemr_auth":{}}}
5348 "GET /api/list/:list_name" => function ($list_name) {
5349 RestConfig::authorization_check("lists", "default");
5350 $return = (new ListRestController())->getOptions($list_name);
5351 RestConfig::apiLog($return);
5352 return $return;
5356 * @OA\Get(
5357 * path="/api/version",
5358 * description="Retrieves the OpenEMR version information",
5359 * tags={"standard"},
5360 * @OA\Response(
5361 * response="200",
5362 * ref="#/components/responses/standard"
5363 * ),
5364 * @OA\Response(
5365 * response="400",
5366 * ref="#/components/responses/badrequest"
5367 * ),
5368 * @OA\Response(
5369 * response="401",
5370 * ref="#/components/responses/unauthorized"
5371 * ),
5372 * security={{"openemr_auth":{}}}
5375 "GET /api/version" => function () {
5376 $return = (new VersionRestController())->getOne();
5377 RestConfig::apiLog($return);
5378 return $return;
5382 * @OA\Get(
5383 * path="/api/product",
5384 * description="Retrieves the OpenEMR product registration information",
5385 * tags={"standard"},
5386 * @OA\Response(
5387 * response="200",
5388 * ref="#/components/responses/standard"
5389 * ),
5390 * @OA\Response(
5391 * response="400",
5392 * ref="#/components/responses/badrequest"
5393 * ),
5394 * @OA\Response(
5395 * response="401",
5396 * ref="#/components/responses/unauthorized"
5397 * ),
5398 * security={{"openemr_auth":{}}}
5401 "GET /api/product" => function () {
5402 $return = (new ProductRegistrationRestController())->getOne();
5403 RestConfig::apiLog($return);
5404 return $return;
5408 * @OA\Get(
5409 * path="/api/insurance_company",
5410 * description="Retrieves all insurance companies",
5411 * tags={"standard"},
5412 * @OA\Response(
5413 * response="200",
5414 * ref="#/components/responses/standard"
5415 * ),
5416 * @OA\Response(
5417 * response="400",
5418 * ref="#/components/responses/badrequest"
5419 * ),
5420 * @OA\Response(
5421 * response="401",
5422 * ref="#/components/responses/unauthorized"
5423 * ),
5424 * security={{"openemr_auth":{}}}
5427 "GET /api/insurance_company" => function () {
5428 $return = (new InsuranceCompanyRestController())->getAll();
5429 RestConfig::apiLog($return);
5430 return $return;
5434 * @OA\Get(
5435 * path="/api/insurance_company/{iid}",
5436 * description="Retrieves insurance company",
5437 * tags={"standard"},
5438 * @OA\Parameter(
5439 * name="iid",
5440 * in="path",
5441 * description="The id of the insurance company.",
5442 * required=true,
5443 * @OA\Schema(
5444 * type="string"
5446 * ),
5447 * @OA\Response(
5448 * response="200",
5449 * ref="#/components/responses/standard"
5450 * ),
5451 * @OA\Response(
5452 * response="400",
5453 * ref="#/components/responses/badrequest"
5454 * ),
5455 * @OA\Response(
5456 * response="401",
5457 * ref="#/components/responses/unauthorized"
5458 * ),
5459 * security={{"openemr_auth":{}}}
5462 "GET /api/insurance_company/:iid" => function ($iid) {
5463 $return = (new InsuranceCompanyRestController())->getOne($iid);
5464 RestConfig::apiLog($return);
5465 return $return;
5469 * @OA\Get(
5470 * path="/api/insurance_type",
5471 * description="Retrieves all insurance types",
5472 * tags={"standard"},
5473 * @OA\Response(
5474 * response="200",
5475 * ref="#/components/responses/standard"
5476 * ),
5477 * @OA\Response(
5478 * response="400",
5479 * ref="#/components/responses/badrequest"
5480 * ),
5481 * @OA\Response(
5482 * response="401",
5483 * ref="#/components/responses/unauthorized"
5484 * ),
5485 * security={{"openemr_auth":{}}}
5488 "GET /api/insurance_type" => function () {
5489 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5490 RestConfig::apiLog($return);
5491 return $return;
5495 * Schema for the insurance_company request
5497 * @OA\Schema(
5498 * schema="api_insurance_company_request",
5499 * @OA\Property(
5500 * property="name",
5501 * description="The name of insurance company.",
5502 * type="string"
5503 * ),
5504 * @OA\Property(
5505 * property="attn",
5506 * description="The attn of insurance company.",
5507 * type="string"
5508 * ),
5509 * @OA\Property(
5510 * property="cms_id",
5511 * description="The cms id of insurance company.",
5512 * type="string"
5513 * ),
5514 * @OA\Property(
5515 * property="ins_type_code",
5516 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5517 * type="string"
5518 * ),
5519 * @OA\Property(
5520 * property="x12_receiver_id",
5521 * description="The x12 receiver id of insurance company.",
5522 * type="string"
5523 * ),
5524 * @OA\Property(
5525 * property="x12_default_partner_id",
5526 * description="The x12 default partner id of insurance company.",
5527 * type="string"
5528 * ),
5529 * @OA\Property(
5530 * property="alt_cms_id",
5531 * description="The alternate cms id of insurance company.",
5532 * type="string"
5533 * ),
5534 * @OA\Property(
5535 * property="line1",
5536 * description="The line1 address of insurance company.",
5537 * type="string"
5538 * ),
5539 * @OA\Property(
5540 * property="line2",
5541 * description="The line2 address of insurance company.",
5542 * type="string"
5543 * ),
5544 * @OA\Property(
5545 * property="city",
5546 * description="The city of insurance company.",
5547 * type="string"
5548 * ),
5549 * @OA\Property(
5550 * property="state",
5551 * description="The state of insurance company.",
5552 * type="string"
5553 * ),
5554 * @OA\Property(
5555 * property="zip",
5556 * description="The zip of insurance company.",
5557 * type="string"
5558 * ),
5559 * @OA\Property(
5560 * property="country",
5561 * description="The country of insurance company.",
5562 * type="string"
5563 * ),
5564 * required={"name"},
5565 * example={
5566 * "name": "Cool Insurance Company",
5567 * "attn": null,
5568 * "cms_id": null,
5569 * "ins_type_code": "2",
5570 * "x12_receiver_id": null,
5571 * "x12_default_partner_id": null,
5572 * "alt_cms_id": "",
5573 * "line1": "123 Cool Lane",
5574 * "line2": "Suite 123",
5575 * "city": "Cooltown",
5576 * "state": "CA",
5577 * "zip": "12245",
5578 * "country": "USA"
5583 * @OA\Post(
5584 * path="/api/insurance_company",
5585 * description="Submits a new insurance company",
5586 * tags={"standard"},
5587 * @OA\RequestBody(
5588 * required=true,
5589 * @OA\MediaType(
5590 * mediaType="application/json",
5591 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5593 * ),
5594 * @OA\Response(
5595 * response="200",
5596 * ref="#/components/responses/standard"
5597 * ),
5598 * @OA\Response(
5599 * response="400",
5600 * ref="#/components/responses/badrequest"
5601 * ),
5602 * @OA\Response(
5603 * response="401",
5604 * ref="#/components/responses/unauthorized"
5605 * ),
5606 * security={{"openemr_auth":{}}}
5609 "POST /api/insurance_company" => function () {
5610 $data = (array) (json_decode(file_get_contents("php://input")));
5611 $return = (new InsuranceCompanyRestController())->post($data);
5612 RestConfig::apiLog($return, $data);
5613 return $return;
5617 * @OA\Put(
5618 * path="/api/insurance_company/{iid}",
5619 * description="Edit a insurance company",
5620 * tags={"standard"},
5621 * @OA\Parameter(
5622 * name="iid",
5623 * in="path",
5624 * description="The id for the insurance company.",
5625 * required=true,
5626 * @OA\Schema(
5627 * type="string"
5629 * ),
5630 * @OA\RequestBody(
5631 * required=true,
5632 * @OA\MediaType(
5633 * mediaType="application/json",
5634 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5636 * ),
5637 * @OA\Response(
5638 * response="200",
5639 * ref="#/components/responses/standard"
5640 * ),
5641 * @OA\Response(
5642 * response="400",
5643 * ref="#/components/responses/badrequest"
5644 * ),
5645 * @OA\Response(
5646 * response="401",
5647 * ref="#/components/responses/unauthorized"
5648 * ),
5649 * security={{"openemr_auth":{}}}
5652 "PUT /api/insurance_company/:iid" => function ($iid) {
5653 $data = (array) (json_decode(file_get_contents("php://input")));
5654 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5655 RestConfig::apiLog($return, $data);
5656 return $return;
5660 * @OA\Post(
5661 * path="/api/patient/{pid}/document",
5662 * description="Submits a new patient document",
5663 * tags={"standard"},
5664 * @OA\Parameter(
5665 * name="pid",
5666 * in="path",
5667 * description="The pid for the patient.",
5668 * required=true,
5669 * @OA\Schema(
5670 * type="string"
5672 * ),
5673 * @OA\Parameter(
5674 * name="path",
5675 * in="query",
5676 * description="The category of the document.",
5677 * required=true,
5678 * @OA\Schema(
5679 * type="string"
5681 * ),
5682 * @OA\RequestBody(
5683 * required=true,
5684 * @OA\MediaType(
5685 * mediaType="multipart/form-data",
5686 * @OA\Schema(
5687 * @OA\Property(
5688 * property="document",
5689 * description="document",
5690 * type="string",
5691 * format="binary"
5692 * ),
5693 * ),
5694 * ),
5695 * ),
5696 * @OA\Response(
5697 * response="200",
5698 * ref="#/components/responses/standard"
5699 * ),
5700 * @OA\Response(
5701 * response="400",
5702 * ref="#/components/responses/badrequest"
5703 * ),
5704 * @OA\Response(
5705 * response="401",
5706 * ref="#/components/responses/unauthorized"
5707 * ),
5708 * security={{"openemr_auth":{}}}
5711 "POST /api/patient/:pid/document" => function ($pid) {
5712 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5713 RestConfig::apiLog($return);
5714 return $return;
5718 * @OA\Get(
5719 * path="/api/patient/{pid}/document",
5720 * description="Retrieves all file information of documents from a category for a patient",
5721 * tags={"standard"},
5722 * @OA\Parameter(
5723 * name="pid",
5724 * in="path",
5725 * description="The pid for the patient.",
5726 * required=true,
5727 * @OA\Schema(
5728 * type="string"
5730 * ),
5731 * @OA\Parameter(
5732 * name="path",
5733 * in="query",
5734 * description="The category of the documents.",
5735 * required=true,
5736 * @OA\Schema(
5737 * type="string"
5739 * ),
5740 * @OA\Response(
5741 * response="200",
5742 * ref="#/components/responses/standard"
5743 * ),
5744 * @OA\Response(
5745 * response="400",
5746 * ref="#/components/responses/badrequest"
5747 * ),
5748 * @OA\Response(
5749 * response="401",
5750 * ref="#/components/responses/unauthorized"
5751 * ),
5752 * security={{"openemr_auth":{}}}
5755 "GET /api/patient/:pid/document" => function ($pid) {
5756 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5757 RestConfig::apiLog($return);
5758 return $return;
5762 * @OA\Get(
5763 * path="/api/patient/{pid}/document/{did}",
5764 * description="Retrieves a document for a patient",
5765 * tags={"standard"},
5766 * @OA\Parameter(
5767 * name="pid",
5768 * in="path",
5769 * description="The pid for the patient.",
5770 * required=true,
5771 * @OA\Schema(
5772 * type="string"
5774 * ),
5775 * @OA\Parameter(
5776 * name="did",
5777 * in="path",
5778 * description="The id for the patient document.",
5779 * required=true,
5780 * @OA\Schema(
5781 * type="string"
5783 * ),
5784 * @OA\Response(
5785 * response="200",
5786 * ref="#/components/responses/standard"
5787 * ),
5788 * @OA\Response(
5789 * response="400",
5790 * ref="#/components/responses/badrequest"
5791 * ),
5792 * @OA\Response(
5793 * response="401",
5794 * ref="#/components/responses/unauthorized"
5795 * ),
5796 * security={{"openemr_auth":{}}}
5799 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5800 $return = (new DocumentRestController())->downloadFile($pid, $did);
5801 RestConfig::apiLog($return);
5802 return $return;
5806 * @OA\Get(
5807 * path="/api/patient/{pid}/insurance",
5808 * description="Retrieves all insurances for a patient",
5809 * tags={"standard"},
5810 * @OA\Parameter(
5811 * name="pid",
5812 * in="path",
5813 * description="The pid for the patient.",
5814 * required=true,
5815 * @OA\Schema(
5816 * type="string"
5818 * ),
5819 * @OA\Response(
5820 * response="200",
5821 * ref="#/components/responses/standard"
5822 * ),
5823 * @OA\Response(
5824 * response="400",
5825 * ref="#/components/responses/badrequest"
5826 * ),
5827 * @OA\Response(
5828 * response="401",
5829 * ref="#/components/responses/unauthorized"
5830 * ),
5831 * security={{"openemr_auth":{}}}
5834 "GET /api/patient/:pid/insurance" => function ($pid) {
5835 $return = (new InsuranceRestController())->getAll($pid);
5836 RestConfig::apiLog($return);
5837 return $return;
5841 * @OA\Get(
5842 * path="/api/patient/{pid}/insurance/{type}",
5843 * description="Retrieves a insurance (by type) for a patient",
5844 * tags={"standard"},
5845 * @OA\Parameter(
5846 * name="pid",
5847 * in="path",
5848 * description="The pid for the patient.",
5849 * required=true,
5850 * @OA\Schema(
5851 * type="string"
5853 * ),
5854 * @OA\Parameter(
5855 * name="type",
5856 * in="path",
5857 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5858 * required=true,
5859 * @OA\Schema(
5860 * type="string"
5862 * ),
5863 * @OA\Response(
5864 * response="200",
5865 * ref="#/components/responses/standard"
5866 * ),
5867 * @OA\Response(
5868 * response="400",
5869 * ref="#/components/responses/badrequest"
5870 * ),
5871 * @OA\Response(
5872 * response="401",
5873 * ref="#/components/responses/unauthorized"
5874 * ),
5875 * security={{"openemr_auth":{}}}
5878 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5879 $return = (new InsuranceRestController())->getOne($pid, $type);
5880 RestConfig::apiLog($return);
5881 return $return;
5885 * Schema for the insurance request
5887 * @OA\Schema(
5888 * schema="api_insurance_request",
5889 * @OA\Property(
5890 * property="provider",
5891 * description="The insurance company id.",
5892 * type="string"
5893 * ),
5894 * @OA\Property(
5895 * property="plan_name",
5896 * description="The plan name of insurance.",
5897 * type="string"
5898 * ),
5899 * @OA\Property(
5900 * property="policy_number",
5901 * description="The policy number of insurance.",
5902 * type="string"
5903 * ),
5904 * @OA\Property(
5905 * property="group_number",
5906 * description="The group number of insurance.",
5907 * type="string"
5908 * ),
5909 * @OA\Property(
5910 * property="subscriber_lname",
5911 * description="The subscriber last name of insurance.",
5912 * type="string"
5913 * ),
5914 * @OA\Property(
5915 * property="subscriber_mname",
5916 * description="The subscriber middle name of insurance.",
5917 * type="string"
5918 * ),
5919 * @OA\Property(
5920 * property="subscriber_fname",
5921 * description="The subscriber first name of insurance.",
5922 * type="string"
5923 * ),
5924 * @OA\Property(
5925 * property="subscriber_relationship",
5926 * description="The subscriber relationship of insurance.",
5927 * type="string"
5928 * ),
5929 * @OA\Property(
5930 * property="subscriber_ss",
5931 * description="The subscriber ss number of insurance.",
5932 * type="string"
5933 * ),
5934 * @OA\Property(
5935 * property="subscriber_DOB",
5936 * description="The subscriber DOB of insurance.",
5937 * type="string"
5938 * ),
5939 * @OA\Property(
5940 * property="subscriber_street",
5941 * description="The subscriber street address of insurance.",
5942 * type="string"
5943 * ),
5944 * @OA\Property(
5945 * property="subscriber_postal_code",
5946 * description="The subscriber postal code of insurance.",
5947 * type="string"
5948 * ),
5949 * @OA\Property(
5950 * property="subscriber_city",
5951 * description="The subscriber city of insurance.",
5952 * type="string"
5953 * ),
5954 * @OA\Property(
5955 * property="subscriber_state",
5956 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5957 * type="string"
5958 * ),
5959 * @OA\Property(
5960 * property="subscriber_country",
5961 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5962 * type="string"
5963 * ),
5964 * @OA\Property(
5965 * property="subscriber_phone",
5966 * description="The subscriber phone of insurance.",
5967 * type="string"
5968 * ),
5969 * @OA\Property(
5970 * property="subscriber_employer",
5971 * description="The subscriber employer of insurance.",
5972 * type="string"
5973 * ),
5974 * @OA\Property(
5975 * property="subscriber_employer_street",
5976 * description="The subscriber employer street of insurance.",
5977 * type="string"
5978 * ),
5979 * @OA\Property(
5980 * property="subscriber_employer_postal_code",
5981 * description="The subscriber employer postal code of insurance.",
5982 * type="string"
5983 * ),
5984 * @OA\Property(
5985 * property="subscriber_employer_state",
5986 * description="The subscriber employer state of insurance.",
5987 * type="string"
5988 * ),
5989 * @OA\Property(
5990 * property="subscriber_employer_country",
5991 * description="The subscriber employer country of insurance.",
5992 * type="string"
5993 * ),
5994 * @OA\Property(
5995 * property="subscriber_employer_city",
5996 * description="The subscriber employer city of insurance.",
5997 * type="string"
5998 * ),
5999 * @OA\Property(
6000 * property="copay",
6001 * description="The copay of insurance.",
6002 * type="string"
6003 * ),
6004 * @OA\Property(
6005 * property="date",
6006 * description="The date of insurance.",
6007 * type="string"
6008 * ),
6009 * @OA\Property(
6010 * property="subscriber_sex",
6011 * description="The subscriber sex of insurance.",
6012 * type="string"
6013 * ),
6014 * @OA\Property(
6015 * property="accept_assignment",
6016 * description="The accept_assignment of insurance.",
6017 * type="string"
6018 * ),
6019 * @OA\Property(
6020 * property="policy_type",
6021 * description="The policy_type of insurance.",
6022 * type="string"
6023 * ),
6024 * 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"},
6025 * example={
6026 * "provider": "33",
6027 * "plan_name": "Some Plan",
6028 * "policy_number": "12345",
6029 * "group_number": "252412",
6030 * "subscriber_lname": "Tester",
6031 * "subscriber_mname": "Xi",
6032 * "subscriber_fname": "Foo",
6033 * "subscriber_relationship": "other",
6034 * "subscriber_ss": "234231234",
6035 * "subscriber_DOB": "2018-10-03",
6036 * "subscriber_street": "183 Cool St",
6037 * "subscriber_postal_code": "23418",
6038 * "subscriber_city": "Cooltown",
6039 * "subscriber_state": "AZ",
6040 * "subscriber_country": "USA",
6041 * "subscriber_phone": "234-598-2123",
6042 * "subscriber_employer": "Some Employer",
6043 * "subscriber_employer_street": "123 Heather Lane",
6044 * "subscriber_employer_postal_code": "23415",
6045 * "subscriber_employer_state": "AZ",
6046 * "subscriber_employer_country": "USA",
6047 * "subscriber_employer_city": "Cooltown",
6048 * "copay": "35",
6049 * "date": "2018-10-15",
6050 * "subscriber_sex": "Female",
6051 * "accept_assignment": "TRUE",
6052 * "policy_type": "a"
6057 * @OA\Post(
6058 * path="/api/patient/{pid}/insurance/{type}",
6059 * description="Submits a new patient insurance (with type)",
6060 * tags={"standard"},
6061 * @OA\Parameter(
6062 * name="pid",
6063 * in="path",
6064 * description="The pid for the patient.",
6065 * required=true,
6066 * @OA\Schema(
6067 * type="string"
6069 * ),
6070 * @OA\Parameter(
6071 * name="type",
6072 * in="path",
6073 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6074 * required=true,
6075 * @OA\Schema(
6076 * type="string"
6078 * ),
6079 * @OA\RequestBody(
6080 * required=true,
6081 * @OA\MediaType(
6082 * mediaType="application/json",
6083 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6085 * ),
6086 * @OA\Response(
6087 * response="200",
6088 * ref="#/components/responses/standard"
6089 * ),
6090 * @OA\Response(
6091 * response="400",
6092 * ref="#/components/responses/badrequest"
6093 * ),
6094 * @OA\Response(
6095 * response="401",
6096 * ref="#/components/responses/unauthorized"
6097 * ),
6098 * security={{"openemr_auth":{}}}
6101 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6102 $data = (array) (json_decode(file_get_contents("php://input")));
6103 $return = (new InsuranceRestController())->post($pid, $type, $data);
6104 RestConfig::apiLog($return, $data);
6105 return $return;
6109 * @OA\Put(
6110 * path="/api/patient/{pid}/insurance/{type}",
6111 * description="Edit a patient insurance (by type)",
6112 * tags={"standard"},
6113 * @OA\Parameter(
6114 * name="pid",
6115 * in="path",
6116 * description="The pid for the patient.",
6117 * required=true,
6118 * @OA\Schema(
6119 * type="string"
6121 * ),
6122 * @OA\Parameter(
6123 * name="type",
6124 * in="path",
6125 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6126 * required=true,
6127 * @OA\Schema(
6128 * type="string"
6130 * ),
6131 * @OA\RequestBody(
6132 * required=true,
6133 * @OA\MediaType(
6134 * mediaType="application/json",
6135 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6137 * ),
6138 * @OA\Response(
6139 * response="200",
6140 * ref="#/components/responses/standard"
6141 * ),
6142 * @OA\Response(
6143 * response="400",
6144 * ref="#/components/responses/badrequest"
6145 * ),
6146 * @OA\Response(
6147 * response="401",
6148 * ref="#/components/responses/unauthorized"
6149 * ),
6150 * security={{"openemr_auth":{}}}
6153 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6154 $data = (array) (json_decode(file_get_contents("php://input")));
6155 $return = (new InsuranceRestController())->put($pid, $type, $data);
6156 RestConfig::apiLog($return, $data);
6157 return $return;
6161 * Schema for the message request
6163 * @OA\Schema(
6164 * schema="api_message_request",
6165 * @OA\Property(
6166 * property="body",
6167 * description="The body of message.",
6168 * type="string"
6169 * ),
6170 * @OA\Property(
6171 * property="groupname",
6172 * description="The group name (usually is 'Default').",
6173 * type="string"
6174 * ),
6175 * @OA\Property(
6176 * property="from",
6177 * description="The sender of the message.",
6178 * type="string"
6179 * ),
6180 * @OA\Property(
6181 * property="to",
6182 * description="The recipient of the message.",
6183 * type="string"
6184 * ),
6185 * @OA\Property(
6186 * property="title",
6187 * description="use an option from resource=/api/list/note_type",
6188 * type="string"
6189 * ),
6190 * @OA\Property(
6191 * property="message_status",
6192 * description="use an option from resource=/api/list/message_status",
6193 * type="string"
6194 * ),
6195 * required={"body", "groupname", "from", "to", "title", "message_status"},
6196 * example={
6197 * "body": "Test 456",
6198 * "groupname": "Default",
6199 * "from": "Matthew",
6200 * "to": "admin",
6201 * "title": "Other",
6202 * "message_status": "New"
6207 * @OA\Post(
6208 * path="/api/patient/{pid}/message",
6209 * description="Submits a pnote message",
6210 * tags={"standard"},
6211 * @OA\Parameter(
6212 * name="pid",
6213 * in="path",
6214 * description="The id for the patient.",
6215 * required=true,
6216 * @OA\Schema(
6217 * type="string"
6219 * ),
6220 * @OA\RequestBody(
6221 * required=true,
6222 * @OA\MediaType(
6223 * mediaType="application/json",
6224 * @OA\Schema(ref="#/components/schemas/api_message_request")
6226 * ),
6227 * @OA\Response(
6228 * response="200",
6229 * ref="#/components/responses/standard"
6230 * ),
6231 * @OA\Response(
6232 * response="400",
6233 * ref="#/components/responses/badrequest"
6234 * ),
6235 * @OA\Response(
6236 * response="401",
6237 * ref="#/components/responses/unauthorized"
6238 * ),
6239 * security={{"openemr_auth":{}}}
6242 "POST /api/patient/:pid/message" => function ($pid) {
6243 RestConfig::authorization_check("patients", "notes");
6244 $data = (array) (json_decode(file_get_contents("php://input")));
6245 $return = (new MessageRestController())->post($pid, $data);
6246 RestConfig::apiLog($return, $data);
6247 return $return;
6251 * @OA\Get(
6252 * path="/api/patient/{pid}/transaction",
6253 * description="Get Transactions for a patient",
6254 * tags={"standard"},
6255 * @OA\Parameter(
6256 * name="pid",
6257 * in="path",
6258 * description="The pid for the patient",
6259 * required=true,
6260 * @OA\Schema(
6261 * type="string"
6263 * ),
6264 * @OA\Response(
6265 * response="200",
6266 * ref="#/components/responses/standard"
6267 * ),
6268 * @OA\Response(
6269 * response="400",
6270 * ref="#/components/responses/badrequest"
6271 * ),
6272 * @OA\Response(
6273 * response="401",
6274 * ref="#/components/responses/unauthorized"
6275 * ),
6276 * security={{"openemr_auth":{}}}
6280 "GET /api/patient/:pid/transaction" => function ($pid) {
6281 RestConfig::authorization_check("patients", "trans");
6282 $cont = new TransactionRestController();
6283 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6284 RestConfig::apiLog($return);
6285 return $return;
6289 * Schema for the transaction request
6291 * @OA\Schema(
6292 * schema="api_transaction_request",
6293 * @OA\Property(
6294 * property="message",
6295 * description="The message of the transaction.",
6296 * type="string"
6297 * ),
6298 * @OA\Property(
6299 * property="type",
6300 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6301 * type="string"
6302 * ),
6303 * @OA\Property(
6304 * property="groupname",
6305 * description="The group name (usually is 'Default').",
6306 * type="string"
6307 * ),
6308 * @OA\Property(
6309 * property="referByNpi",
6310 * description="NPI of the person creating the referral.",
6311 * type="string"
6312 * ),
6313 * @OA\Property(
6314 * property="referToNpi",
6315 * description="NPI of the person getting the referral.",
6316 * type="string"
6317 * ),
6318 * @OA\Property(
6319 * property="referDiagnosis",
6320 * description="The referral diagnosis.",
6321 * type="string"
6322 * ),
6323 * @OA\Property(
6324 * property="riskLevel",
6325 * description="The risk level. (Low, Medium, High)",
6326 * type="string"
6327 * ),
6328 * @OA\Property(
6329 * property="includeVitals",
6330 * description="Are vitals included (0,1)",
6331 * type="string"
6332 * ),
6333 * @OA\Property(
6334 * property="referralDate",
6335 * description="The date of the referral",
6336 * type="string"
6337 * ),
6338 * @OA\Property(
6339 * property="authorization",
6340 * description="The authorization for the referral",
6341 * type="string"
6342 * ),
6343 * @OA\Property(
6344 * property="visits",
6345 * description="The number of vists for the referral",
6346 * type="string"
6347 * ),
6348 * @OA\Property(
6349 * property="validFrom",
6350 * description="The date the referral is valid from",
6351 * type="string"
6352 * ),
6353 * @OA\Property(
6354 * property="validThrough",
6355 * description="The date the referral is valid through",
6356 * type="string"
6357 * ),
6358 * required={"message", "groupname", "title"},
6359 * example={
6360 * "message": "Message",
6361 * "type": "LBTref",
6362 * "groupname": "Default",
6363 * "referByNpi":"9999999999",
6364 * "referToNpi":"9999999999",
6365 * "referDiagnosis":"Diag 1",
6366 * "riskLevel":"Low",
6367 * "includeVitals":"1",
6368 * "referralDate":"2022-01-01",
6369 * "authorization":"Auth_123",
6370 * "visits": "1",
6371 * "validFrom": "2022-01-02",
6372 * "validThrough": "2022-01-03",
6373 * "body": "Reason 1"
6378 * @OA\Post(
6379 * path="/api/patient/{pid}/transaction",
6380 * description="Submits a transaction",
6381 * tags={"standard"},
6382 * @OA\Parameter(
6383 * name="pid",
6384 * in="path",
6385 * description="The pid for the patient.",
6386 * required=true,
6387 * @OA\Schema(
6388 * type="string"
6390 * ),
6391 * @OA\RequestBody(
6392 * required=true,
6393 * @OA\MediaType(
6394 * mediaType="application/json",
6395 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6397 * ),
6398 * @OA\Response(
6399 * response="200",
6400 * ref="#/components/responses/standard"
6401 * ),
6402 * @OA\Response(
6403 * response="400",
6404 * ref="#/components/responses/badrequest"
6405 * ),
6406 * @OA\Response(
6407 * response="401",
6408 * ref="#/components/responses/unauthorized"
6409 * ),
6410 * security={{"openemr_auth":{}}}
6413 "POST /api/patient/:pid/transaction" => function ($pid) {
6414 RestConfig::authorization_check("patients", "trans");
6415 $data = (array) (json_decode(file_get_contents("php://input")));
6416 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6417 RestConfig::apiLog($return, $data);
6418 return $return;
6422 * @OA\PUT(
6423 * path="/api/transaction/{tid}",
6424 * description="Updates a transaction",
6425 * tags={"standard"},
6426 * @OA\Parameter(
6427 * name="tid",
6428 * in="path",
6429 * description="The id for the transaction.",
6430 * required=true,
6431 * @OA\Schema(
6432 * type="string"
6434 * ),
6435 * @OA\RequestBody(
6436 * required=true,
6437 * @OA\MediaType(
6438 * mediaType="application/json",
6439 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6441 * ),
6442 * @OA\Response(
6443 * response="200",
6444 * ref="#/components/responses/standard"
6445 * ),
6446 * @OA\Response(
6447 * response="400",
6448 * ref="#/components/responses/badrequest"
6449 * ),
6450 * @OA\Response(
6451 * response="401",
6452 * ref="#/components/responses/unauthorized"
6453 * ),
6454 * security={{"openemr_auth":{}}}
6457 "PUT /api/transaction/:tid" => function ($tid) {
6458 RestConfig::authorization_check("patients", "trans");
6459 $data = (array) (json_decode(file_get_contents("php://input")));
6460 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6461 RestConfig::apiLog($return, $data);
6462 return $return;
6466 * @OA\Put(
6467 * path="/api/patient/{pid}/message/{mid}",
6468 * description="Edit a pnote message",
6469 * tags={"standard"},
6470 * @OA\Parameter(
6471 * name="pid",
6472 * in="path",
6473 * description="The id for the patient.",
6474 * required=true,
6475 * @OA\Schema(
6476 * type="string"
6478 * ),
6479 * @OA\Parameter(
6480 * name="mid",
6481 * in="path",
6482 * description="The id for the pnote message.",
6483 * required=true,
6484 * @OA\Schema(
6485 * type="string"
6487 * ),
6488 * @OA\RequestBody(
6489 * required=true,
6490 * @OA\MediaType(
6491 * mediaType="application/json",
6492 * @OA\Schema(ref="#/components/schemas/api_message_request")
6494 * ),
6495 * @OA\Response(
6496 * response="200",
6497 * ref="#/components/responses/standard"
6498 * ),
6499 * @OA\Response(
6500 * response="400",
6501 * ref="#/components/responses/badrequest"
6502 * ),
6503 * @OA\Response(
6504 * response="401",
6505 * ref="#/components/responses/unauthorized"
6506 * ),
6507 * security={{"openemr_auth":{}}}
6510 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6511 RestConfig::authorization_check("patients", "notes");
6512 $data = (array) (json_decode(file_get_contents("php://input")));
6513 $return = (new MessageRestController())->put($pid, $mid, $data);
6514 RestConfig::apiLog($return, $data);
6515 return $return;
6519 * @OA\Delete(
6520 * path="/api/patient/{pid}/message/{mid}",
6521 * description="Delete a pnote message",
6522 * tags={"standard"},
6523 * @OA\Parameter(
6524 * name="pid",
6525 * in="path",
6526 * description="The id for the patient.",
6527 * required=true,
6528 * @OA\Schema(
6529 * type="string"
6531 * ),
6532 * @OA\Parameter(
6533 * name="eid",
6534 * in="path",
6535 * description="The id for the pnote message.",
6536 * required=true,
6537 * @OA\Schema(
6538 * type="string"
6540 * ),
6541 * @OA\Response(
6542 * response="200",
6543 * ref="#/components/responses/standard"
6544 * ),
6545 * @OA\Response(
6546 * response="400",
6547 * ref="#/components/responses/badrequest"
6548 * ),
6549 * @OA\Response(
6550 * response="401",
6551 * ref="#/components/responses/unauthorized"
6552 * ),
6553 * security={{"openemr_auth":{}}}
6556 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6557 RestConfig::authorization_check("patients", "notes");
6558 $return = (new MessageRestController())->delete($pid, $mid);
6559 RestConfig::apiLog($return);
6560 return $return;
6564 * @OA\Get(
6565 * path="/api/immunization",
6566 * description="Retrieves a list of immunizations",
6567 * tags={"standard"},
6568 * @OA\Parameter(
6569 * name="patient_id",
6570 * in="query",
6571 * description="The pid for the patient.",
6572 * required=false,
6573 * @OA\Schema(
6574 * type="string"
6576 * ),
6577 * @OA\Parameter(
6578 * name="id",
6579 * in="query",
6580 * description="The id for the immunization.",
6581 * required=false,
6582 * @OA\Schema(
6583 * type="string"
6585 * ),
6586 * @OA\Parameter(
6587 * name="uuid",
6588 * in="query",
6589 * description="The uuid for the immunization.",
6590 * required=false,
6591 * @OA\Schema(
6592 * type="string"
6594 * ),
6595 * @OA\Parameter(
6596 * name="administered_date",
6597 * in="query",
6598 * description="The administered date for the immunization.",
6599 * required=false,
6600 * @OA\Schema(
6601 * type="string"
6603 * ),
6604 * @OA\Parameter(
6605 * name="immunization_id",
6606 * in="query",
6607 * description="The immunization list_id for the immunization.",
6608 * required=false,
6609 * @OA\Schema(
6610 * type="string"
6612 * ),
6613 * @OA\Parameter(
6614 * name="cvx_code",
6615 * in="query",
6616 * description="The cvx code for the immunization.",
6617 * required=false,
6618 * @OA\Schema(
6619 * type="string"
6621 * ),
6622 * @OA\Parameter(
6623 * name="manufacturer",
6624 * in="query",
6625 * description="The manufacturer for the immunization.",
6626 * required=false,
6627 * @OA\Schema(
6628 * type="string"
6630 * ),
6631 * @OA\Parameter(
6632 * name="lot_number",
6633 * in="query",
6634 * description="The lot number for the immunization.",
6635 * required=false,
6636 * @OA\Schema(
6637 * type="string"
6639 * ),
6640 * @OA\Parameter(
6641 * name="administered_by_id",
6642 * in="query",
6643 * description="The administered by id for the immunization.",
6644 * required=false,
6645 * @OA\Schema(
6646 * type="string"
6648 * ),
6649 * @OA\Parameter(
6650 * name="administered_by",
6651 * in="query",
6652 * description="The administered by for the immunization.",
6653 * required=false,
6654 * @OA\Schema(
6655 * type="string"
6657 * ),
6658 * @OA\Parameter(
6659 * name="education_date",
6660 * in="query",
6661 * description="The education date for the immunization.",
6662 * required=false,
6663 * @OA\Schema(
6664 * type="string"
6666 * ),
6667 * @OA\Parameter(
6668 * name="vis_date",
6669 * in="query",
6670 * description="The vis date for the immunization.",
6671 * required=false,
6672 * @OA\Schema(
6673 * type="string"
6675 * ),
6676 * @OA\Parameter(
6677 * name="note",
6678 * in="query",
6679 * description="The note for the immunization.",
6680 * required=false,
6681 * @OA\Schema(
6682 * type="string"
6684 * ),
6685 * @OA\Parameter(
6686 * name="create_date",
6687 * in="query",
6688 * description="The create date for the immunization.",
6689 * required=false,
6690 * @OA\Schema(
6691 * type="string"
6693 * ),
6694 * @OA\Parameter(
6695 * name="update_date",
6696 * in="query",
6697 * description="The update date for the immunization.",
6698 * required=false,
6699 * @OA\Schema(
6700 * type="string"
6702 * ),
6703 * @OA\Parameter(
6704 * name="created_by",
6705 * in="query",
6706 * description="The created_by for the immunization.",
6707 * required=false,
6708 * @OA\Schema(
6709 * type="string"
6711 * ),
6712 * @OA\Parameter(
6713 * name="updated_by",
6714 * in="query",
6715 * description="The updated_by for the immunization.",
6716 * required=false,
6717 * @OA\Schema(
6718 * type="string"
6720 * ),
6721 * @OA\Parameter(
6722 * name="amount_administered",
6723 * in="query",
6724 * description="The amount administered for the immunization.",
6725 * required=false,
6726 * @OA\Schema(
6727 * type="string"
6729 * ),
6730 * @OA\Parameter(
6731 * name="amount_administered_unit",
6732 * in="query",
6733 * description="The amount administered unit for the immunization.",
6734 * required=false,
6735 * @OA\Schema(
6736 * type="string"
6738 * ),
6739 * @OA\Parameter(
6740 * name="expiration_date",
6741 * in="query",
6742 * description="The expiration date for the immunization.",
6743 * required=false,
6744 * @OA\Schema(
6745 * type="string"
6747 * ),
6748 * @OA\Parameter(
6749 * name="route",
6750 * in="query",
6751 * description="The route for the immunization.",
6752 * required=false,
6753 * @OA\Schema(
6754 * type="string"
6756 * ),
6757 * @OA\Parameter(
6758 * name="administration_site",
6759 * in="query",
6760 * description="The administration site for the immunization.",
6761 * required=false,
6762 * @OA\Schema(
6763 * type="string"
6765 * ),
6766 * @OA\Parameter(
6767 * name="added_erroneously",
6768 * in="query",
6769 * description="The added_erroneously for the immunization.",
6770 * required=false,
6771 * @OA\Schema(
6772 * type="string"
6774 * ),
6775 * @OA\Parameter(
6776 * name="external_id",
6777 * in="query",
6778 * description="The external_id for the immunization.",
6779 * required=false,
6780 * @OA\Schema(
6781 * type="string"
6783 * ),
6784 * @OA\Parameter(
6785 * name="completion_status",
6786 * in="query",
6787 * description="The completion status for the immunization.",
6788 * required=false,
6789 * @OA\Schema(
6790 * type="string"
6792 * ),
6793 * @OA\Parameter(
6794 * name="information_source",
6795 * in="query",
6796 * description="The information source for the immunization.",
6797 * required=false,
6798 * @OA\Schema(
6799 * type="string"
6801 * ),
6802 * @OA\Parameter(
6803 * name="refusal_reason",
6804 * in="query",
6805 * description="The refusal reason for the immunization.",
6806 * required=false,
6807 * @OA\Schema(
6808 * type="string"
6810 * ),
6811 * @OA\Parameter(
6812 * name="ordering_provider",
6813 * in="query",
6814 * description="The ordering provider for the immunization.",
6815 * required=false,
6816 * @OA\Schema(
6817 * type="string"
6819 * ),
6820 * @OA\Response(
6821 * response="200",
6822 * ref="#/components/responses/standard"
6823 * ),
6824 * @OA\Response(
6825 * response="400",
6826 * ref="#/components/responses/badrequest"
6827 * ),
6828 * @OA\Response(
6829 * response="401",
6830 * ref="#/components/responses/unauthorized"
6831 * ),
6832 * security={{"openemr_auth":{}}}
6835 "GET /api/immunization" => function () {
6836 RestConfig::authorization_check("patients", "med");
6837 $return = (new ImmunizationRestController())->getAll($_GET);
6838 RestConfig::apiLog($return);
6839 return $return;
6843 * @OA\Get(
6844 * path="/api/immunization/{uuid}",
6845 * description="Retrieves a immunization",
6846 * tags={"standard"},
6847 * @OA\Parameter(
6848 * name="uuid",
6849 * in="path",
6850 * description="The uuid for the immunization.",
6851 * required=true,
6852 * @OA\Schema(
6853 * type="string"
6855 * ),
6856 * @OA\Response(
6857 * response="200",
6858 * ref="#/components/responses/standard"
6859 * ),
6860 * @OA\Response(
6861 * response="400",
6862 * ref="#/components/responses/badrequest"
6863 * ),
6864 * @OA\Response(
6865 * response="401",
6866 * ref="#/components/responses/unauthorized"
6867 * ),
6868 * security={{"openemr_auth":{}}}
6871 "GET /api/immunization/:uuid" => function ($uuid) {
6872 RestConfig::authorization_check("patients", "med");
6873 $return = (new ImmunizationRestController())->getOne($uuid);
6874 RestConfig::apiLog($return);
6875 return $return;
6879 * @OA\Get(
6880 * path="/api/procedure",
6881 * description="Retrieves a list of all procedures",
6882 * tags={"standard"},
6883 * @OA\Response(
6884 * response="200",
6885 * ref="#/components/responses/standard"
6886 * ),
6887 * @OA\Response(
6888 * response="400",
6889 * ref="#/components/responses/badrequest"
6890 * ),
6891 * @OA\Response(
6892 * response="401",
6893 * ref="#/components/responses/unauthorized"
6894 * ),
6895 * security={{"openemr_auth":{}}}
6898 "GET /api/procedure" => function () {
6899 RestConfig::authorization_check("patients", "med");
6900 $return = (new ProcedureRestController())->getAll();
6901 RestConfig::apiLog($return);
6902 return $return;
6906 * @OA\Get(
6907 * path="/api/procedure/{uuid}",
6908 * description="Retrieves a procedure",
6909 * tags={"standard"},
6910 * @OA\Parameter(
6911 * name="uuid",
6912 * in="path",
6913 * description="The uuid for the procedure.",
6914 * required=true,
6915 * @OA\Schema(
6916 * type="string"
6918 * ),
6919 * @OA\Response(
6920 * response="200",
6921 * ref="#/components/responses/standard"
6922 * ),
6923 * @OA\Response(
6924 * response="400",
6925 * ref="#/components/responses/badrequest"
6926 * ),
6927 * @OA\Response(
6928 * response="401",
6929 * ref="#/components/responses/unauthorized"
6930 * ),
6931 * security={{"openemr_auth":{}}}
6934 "GET /api/procedure/:uuid" => function ($uuid) {
6935 RestConfig::authorization_check("patients", "med");
6936 $return = (new ProcedureRestController())->getOne($uuid);
6937 RestConfig::apiLog($return);
6938 return $return;
6942 * @OA\Get(
6943 * path="/api/drug",
6944 * description="Retrieves a list of all drugs",
6945 * tags={"standard"},
6946 * @OA\Response(
6947 * response="200",
6948 * ref="#/components/responses/standard"
6949 * ),
6950 * @OA\Response(
6951 * response="400",
6952 * ref="#/components/responses/badrequest"
6953 * ),
6954 * @OA\Response(
6955 * response="401",
6956 * ref="#/components/responses/unauthorized"
6957 * ),
6958 * security={{"openemr_auth":{}}}
6961 "GET /api/drug" => function () {
6962 RestConfig::authorization_check("patients", "med");
6963 $return = (new DrugRestController())->getAll();
6964 RestConfig::apiLog($return);
6965 return $return;
6969 * @OA\Get(
6970 * path="/api/drug/{uuid}",
6971 * description="Retrieves a drug",
6972 * tags={"standard"},
6973 * @OA\Parameter(
6974 * name="uuid",
6975 * in="path",
6976 * description="The uuid for the drug.",
6977 * required=true,
6978 * @OA\Schema(
6979 * type="string"
6981 * ),
6982 * @OA\Response(
6983 * response="200",
6984 * ref="#/components/responses/standard"
6985 * ),
6986 * @OA\Response(
6987 * response="400",
6988 * ref="#/components/responses/badrequest"
6989 * ),
6990 * @OA\Response(
6991 * response="401",
6992 * ref="#/components/responses/unauthorized"
6993 * ),
6994 * security={{"openemr_auth":{}}}
6997 "GET /api/drug/:uuid" => function ($uuid) {
6998 RestConfig::authorization_check("patients", "med");
6999 $return = (new DrugRestController())->getOne($uuid);
7000 RestConfig::apiLog($return);
7001 return $return;
7005 * @OA\Get(
7006 * path="/api/prescription",
7007 * description="Retrieves a list of all prescriptions",
7008 * tags={"standard"},
7009 * @OA\Response(
7010 * response="200",
7011 * ref="#/components/responses/standard"
7012 * ),
7013 * @OA\Response(
7014 * response="400",
7015 * ref="#/components/responses/badrequest"
7016 * ),
7017 * @OA\Response(
7018 * response="401",
7019 * ref="#/components/responses/unauthorized"
7020 * ),
7021 * security={{"openemr_auth":{}}}
7024 "GET /api/prescription" => function () {
7025 RestConfig::authorization_check("patients", "med");
7026 $return = (new PrescriptionRestController())->getAll();
7027 RestConfig::apiLog($return);
7028 return $return;
7032 * @OA\Get(
7033 * path="/api/prescription/{uuid}",
7034 * description="Retrieves a prescription",
7035 * tags={"standard"},
7036 * @OA\Parameter(
7037 * name="uuid",
7038 * in="path",
7039 * description="The uuid for the prescription.",
7040 * required=true,
7041 * @OA\Schema(
7042 * type="string"
7044 * ),
7045 * @OA\Response(
7046 * response="200",
7047 * ref="#/components/responses/standard"
7048 * ),
7049 * @OA\Response(
7050 * response="400",
7051 * ref="#/components/responses/badrequest"
7052 * ),
7053 * @OA\Response(
7054 * response="401",
7055 * ref="#/components/responses/unauthorized"
7056 * ),
7057 * security={{"openemr_auth":{}}}
7060 "GET /api/prescription/:uuid" => function ($uuid) {
7061 RestConfig::authorization_check("patients", "med");
7062 $return = (new PrescriptionRestController())->getOne($uuid);
7063 RestConfig::apiLog($return);
7064 return $return;
7068 use OpenEMR\Common\Http\StatusCode;
7069 use OpenEMR\Common\Http\Psr17Factory;
7070 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7071 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController;
7072 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7073 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7074 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7075 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7076 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7077 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7078 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7079 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7080 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7081 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7082 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7083 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7084 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7085 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7086 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7087 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7088 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7089 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7090 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7091 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7092 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7093 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7094 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7095 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7096 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7097 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController;
7099 // Note that the fhir route includes both user role and patient role
7100 // (there is a mechanism in place to ensure patient role is binded
7101 // to only see the data of the one patient)
7102 RestConfig::$FHIR_ROUTE_MAP = array(
7104 * @OA\Get(
7105 * path="/fhir/AllergyIntolerance",
7106 * description="Returns a list of AllergyIntolerance resources.",
7107 * tags={"fhir"},
7108 * @OA\Parameter(
7109 * name="_id",
7110 * in="query",
7111 * description="The uuid for the AllergyIntolerance resource.",
7112 * required=false,
7113 * @OA\Schema(
7114 * type="string"
7116 * ),
7117 * @OA\Parameter(
7118 * name="patient",
7119 * in="query",
7120 * description="The uuid for the patient.",
7121 * required=false,
7122 * @OA\Schema(
7123 * type="string"
7125 * ),
7126 * @OA\Response(
7127 * response="200",
7128 * description="Standard Response",
7129 * @OA\MediaType(
7130 * mediaType="application/json",
7131 * @OA\Schema(
7132 * @OA\Property(
7133 * property="json object",
7134 * description="FHIR Json object.",
7135 * type="object"
7136 * ),
7137 * example={
7138 * "meta": {
7139 * "lastUpdated": "2021-09-14T09:13:51"
7140 * },
7141 * "resourceType": "Bundle",
7142 * "type": "collection",
7143 * "total": 0,
7144 * "link": {
7146 * "relation": "self",
7147 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7153 * ),
7154 * @OA\Response(
7155 * response="400",
7156 * ref="#/components/responses/badrequest"
7157 * ),
7158 * @OA\Response(
7159 * response="401",
7160 * ref="#/components/responses/unauthorized"
7161 * ),
7162 * security={{"openemr_auth":{}}}
7165 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7166 $getParams = $request->getQueryParams();
7167 if ($request->isPatientRequest()) {
7168 // only allow access to data of binded patient
7169 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7170 } else {
7171 RestConfig::authorization_check("patients", "med");
7172 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7174 RestConfig::apiLog($return);
7175 return $return;
7179 * @OA\Get(
7180 * path="/fhir/AllergyIntolerance/{uuid}",
7181 * description="Returns a single AllergyIntolerance resource.",
7182 * tags={"fhir"},
7183 * @OA\Parameter(
7184 * name="uuid",
7185 * in="path",
7186 * description="The uuid for the AllergyIntolerance resource.",
7187 * required=true,
7188 * @OA\Schema(
7189 * type="string"
7191 * ),
7192 * @OA\Response(
7193 * response="200",
7194 * description="Standard Response",
7195 * @OA\MediaType(
7196 * mediaType="application/json",
7197 * @OA\Schema(
7198 * @OA\Property(
7199 * property="json object",
7200 * description="FHIR Json object.",
7201 * type="object"
7202 * ),
7203 * example={
7204 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7205 * "meta": {
7206 * "versionId": "1",
7207 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7208 * },
7209 * "resourceType": "AllergyIntolerance",
7210 * "text": {
7211 * "status": "additional",
7212 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7213 * },
7214 * "clinicalStatus": {
7215 * "coding": {
7217 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7218 * "code": "active",
7219 * "display": "Active"
7222 * },
7223 * "verificationStatus": {
7224 * "coding": {
7226 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7227 * "code": "confirmed",
7228 * "display": "Confirmed"
7231 * },
7232 * "category": {
7233 * "medication"
7234 * },
7235 * "criticality": "low",
7236 * "code": {
7237 * "coding": {
7239 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7240 * "code": "unknown",
7241 * "display": "Unknown"
7244 * },
7245 * "patient": {
7246 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7247 * },
7248 * "reaction": {
7250 * "manifestation": {
7252 * "coding": {
7254 * "system": "http://snomed.info/sct",
7255 * "code": "422587007",
7256 * "display": "Nausea"
7258 * },
7259 * "text": "Nausea"
7267 * ),
7268 * @OA\Response(
7269 * response="400",
7270 * ref="#/components/responses/badrequest"
7271 * ),
7272 * @OA\Response(
7273 * response="401",
7274 * ref="#/components/responses/unauthorized"
7275 * ),
7276 * @OA\Response(
7277 * response="404",
7278 * ref="#/components/responses/uuidnotfound"
7279 * ),
7280 * security={{"openemr_auth":{}}}
7283 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7284 if ($request->isPatientRequest()) {
7285 // only allow access to data of binded patient
7286 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7287 } else {
7288 RestConfig::authorization_check("patients", "med");
7289 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7291 RestConfig::apiLog($return);
7292 return $return;
7296 * @OA\Get(
7297 * path="/fhir/Appointment",
7298 * description="Returns a list of Appointment resources.",
7299 * tags={"fhir"},
7300 * @OA\Parameter(
7301 * name="_id",
7302 * in="query",
7303 * description="The uuid for the Appointment resource.",
7304 * required=false,
7305 * @OA\Schema(
7306 * type="string"
7308 * ),
7309 * @OA\Parameter(
7310 * name="patient",
7311 * in="query",
7312 * description="The uuid for the patient.",
7313 * required=false,
7314 * @OA\Schema(
7315 * type="string"
7317 * ),
7318 * @OA\Response(
7319 * response="200",
7320 * description="Standard Response",
7321 * @OA\MediaType(
7322 * mediaType="application/json",
7323 * @OA\Schema(
7324 * @OA\Property(
7325 * property="json object",
7326 * description="FHIR Json object.",
7327 * type="object"
7328 * ),
7329 * example={
7330 * "meta": {
7331 * "lastUpdated": "2021-09-14T09:13:51"
7332 * },
7333 * "resourceType": "Bundle",
7334 * "type": "collection",
7335 * "total": 0,
7336 * "link": {
7338 * "relation": "self",
7339 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7345 * ),
7346 * @OA\Response(
7347 * response="400",
7348 * ref="#/components/responses/badrequest"
7349 * ),
7350 * @OA\Response(
7351 * response="401",
7352 * ref="#/components/responses/unauthorized"
7353 * ),
7354 * security={{"openemr_auth":{}}}
7357 "GET /fhir/Appointment" => function (HttpRestRequest $request) {
7358 $getParams = $request->getQueryParams();
7359 if ($request->isPatientRequest()) {
7360 // only allow access to data of binded patient
7361 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7362 } else {
7363 RestConfig::authorization_check("patients", "appt");
7364 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7366 RestConfig::apiLog($return);
7367 return $return;
7371 * @OA\Get(
7372 * path="/fhir/Appointment/{uuid}",
7373 * description="Returns a single Appointment resource.",
7374 * tags={"fhir"},
7375 * @OA\Parameter(
7376 * name="uuid",
7377 * in="path",
7378 * description="The uuid for the Appointment resource.",
7379 * required=true,
7380 * @OA\Schema(
7381 * type="string"
7383 * ),
7384 * @OA\Response(
7385 * response="200",
7386 * description="Standard Response",
7387 * @OA\MediaType(
7388 * mediaType="application/json",
7389 * @OA\Schema(
7390 * @OA\Property(
7391 * property="json object",
7392 * description="FHIR Json object.",
7393 * type="object"
7394 * ),
7395 * example={}
7398 * ),
7399 * @OA\Response(
7400 * response="400",
7401 * ref="#/components/responses/badrequest"
7402 * ),
7403 * @OA\Response(
7404 * response="401",
7405 * ref="#/components/responses/unauthorized"
7406 * ),
7407 * @OA\Response(
7408 * response="404",
7409 * ref="#/components/responses/uuidnotfound"
7410 * ),
7411 * security={{"openemr_auth":{}}}
7414 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest $request) {
7415 if ($request->isPatientRequest()) {
7416 // only allow access to data of binded patient
7417 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7418 } else {
7419 RestConfig::authorization_check("patients", "appt");
7420 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7422 RestConfig::apiLog($return);
7423 return $return;
7427 * @OA\Get(
7428 * path="/fhir/CarePlan",
7429 * description="Returns a list of CarePlan resources.",
7430 * tags={"fhir"},
7431 * @OA\Parameter(
7432 * name="_id",
7433 * in="query",
7434 * description="The uuid for the CarePlan resource.",
7435 * required=false,
7436 * @OA\Schema(
7437 * type="string"
7439 * ),
7440 * @OA\Parameter(
7441 * name="patient",
7442 * in="query",
7443 * description="The uuid for the patient.",
7444 * required=false,
7445 * @OA\Schema(
7446 * type="string"
7448 * ),
7449 * @OA\Parameter(
7450 * name="category",
7451 * in="query",
7452 * description="The category of the CarePlan resource.",
7453 * required=false,
7454 * @OA\Schema(
7455 * type="string"
7457 * ),
7458 * @OA\Response(
7459 * response="200",
7460 * description="Standard Response",
7461 * @OA\MediaType(
7462 * mediaType="application/json",
7463 * @OA\Schema(
7464 * @OA\Property(
7465 * property="json object",
7466 * description="FHIR Json object.",
7467 * type="object"
7468 * ),
7469 * example={
7470 * "meta": {
7471 * "lastUpdated": "2021-09-14T09:13:51"
7472 * },
7473 * "resourceType": "Bundle",
7474 * "type": "collection",
7475 * "total": 0,
7476 * "link": {
7478 * "relation": "self",
7479 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7485 * ),
7486 * @OA\Response(
7487 * response="400",
7488 * ref="#/components/responses/badrequest"
7489 * ),
7490 * @OA\Response(
7491 * response="401",
7492 * ref="#/components/responses/unauthorized"
7493 * ),
7494 * security={{"openemr_auth":{}}}
7497 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7498 $getParams = $request->getQueryParams();
7499 if ($request->isPatientRequest()) {
7500 // only allow access to data of binded patient
7501 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7502 } else {
7503 RestConfig::authorization_check("patients", "med");
7504 $return = (new FhirCarePlanRestController())->getAll($getParams);
7506 RestConfig::apiLog($return);
7507 return $return;
7511 * @OA\Get(
7512 * path="/fhir/CarePlan/{uuid}",
7513 * description="Returns a single CarePlan resource.",
7514 * tags={"fhir"},
7515 * @OA\Parameter(
7516 * name="uuid",
7517 * in="path",
7518 * description="The uuid for the CarePlan resource.",
7519 * required=true,
7520 * @OA\Schema(
7521 * type="string"
7523 * ),
7524 * @OA\Response(
7525 * response="200",
7526 * description="Standard Response",
7527 * @OA\MediaType(
7528 * mediaType="application/json",
7529 * @OA\Schema(
7530 * @OA\Property(
7531 * property="json object",
7532 * description="FHIR Json object.",
7533 * type="object"
7534 * ),
7535 * example={
7536 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7537 * "meta": {
7538 * "versionId": "1",
7539 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7540 * },
7541 * "resourceType": "CarePlan",
7542 * "text": {
7543 * "status": "generated",
7544 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7545 * },
7546 * "status": "active",
7547 * "intent": "plan",
7548 * "category": {
7550 * "coding": {
7552 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7553 * "code": "assess-plan"
7557 * },
7558 * "description": "Treat flu.",
7559 * "subject": {
7560 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7561 * "type": "Patient"
7566 * ),
7567 * @OA\Response(
7568 * response="400",
7569 * ref="#/components/responses/badrequest"
7570 * ),
7571 * @OA\Response(
7572 * response="401",
7573 * ref="#/components/responses/unauthorized"
7574 * ),
7575 * @OA\Response(
7576 * response="404",
7577 * ref="#/components/responses/uuidnotfound"
7578 * ),
7579 * security={{"openemr_auth":{}}}
7582 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7583 if ($request->isPatientRequest()) {
7584 // only allow access to data of binded patient
7585 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7586 } else {
7587 RestConfig::authorization_check("patients", "med");
7588 $return = (new FhirCarePlanRestController())->getOne($uuid);
7590 RestConfig::apiLog($return);
7591 return $return;
7595 * @OA\Get(
7596 * path="/fhir/CareTeam",
7597 * description="Returns a list of CareTeam resources.",
7598 * tags={"fhir"},
7599 * @OA\Parameter(
7600 * name="_id",
7601 * in="query",
7602 * description="The uuid for the CareTeam resource.",
7603 * required=false,
7604 * @OA\Schema(
7605 * type="string"
7607 * ),
7608 * @OA\Parameter(
7609 * name="patient",
7610 * in="query",
7611 * description="The uuid for the patient.",
7612 * required=false,
7613 * @OA\Schema(
7614 * type="string"
7616 * ),
7617 * @OA\Parameter(
7618 * name="status",
7619 * in="query",
7620 * description="The status of the CarePlan resource.",
7621 * required=false,
7622 * @OA\Schema(
7623 * type="string"
7625 * ),
7626 * @OA\Response(
7627 * response="200",
7628 * description="Standard Response",
7629 * @OA\MediaType(
7630 * mediaType="application/json",
7631 * @OA\Schema(
7632 * @OA\Property(
7633 * property="json object",
7634 * description="FHIR Json object.",
7635 * type="object"
7636 * ),
7637 * example={
7638 * "meta": {
7639 * "lastUpdated": "2021-09-14T09:13:51"
7640 * },
7641 * "resourceType": "Bundle",
7642 * "type": "collection",
7643 * "total": 0,
7644 * "link": {
7646 * "relation": "self",
7647 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7653 * ),
7654 * @OA\Response(
7655 * response="400",
7656 * ref="#/components/responses/badrequest"
7657 * ),
7658 * @OA\Response(
7659 * response="401",
7660 * ref="#/components/responses/unauthorized"
7661 * ),
7662 * security={{"openemr_auth":{}}}
7665 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
7666 $getParams = $request->getQueryParams();
7667 if ($request->isPatientRequest()) {
7668 // only allow access to data of binded patient
7669 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7670 } else {
7671 RestConfig::authorization_check("patients", "med");
7672 $return = (new FhirCareTeamRestController())->getAll($getParams);
7674 RestConfig::apiLog($return);
7675 return $return;
7679 * @OA\Get(
7680 * path="/fhir/CareTeam/{uuid}",
7681 * description="Returns a single CareTeam resource.",
7682 * tags={"fhir"},
7683 * @OA\Parameter(
7684 * name="uuid",
7685 * in="path",
7686 * description="The uuid for the CareTeam resource.",
7687 * required=true,
7688 * @OA\Schema(
7689 * type="string"
7691 * ),
7692 * @OA\Response(
7693 * response="200",
7694 * description="Standard Response",
7695 * @OA\MediaType(
7696 * mediaType="application/json",
7697 * @OA\Schema(
7698 * @OA\Property(
7699 * property="json object",
7700 * description="FHIR Json object.",
7701 * type="object"
7702 * ),
7703 * example={
7704 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7705 * "meta": {
7706 * "versionId": "1",
7707 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7708 * },
7709 * "resourceType": "CareTeam",
7710 * "status": "active",
7711 * "subject": {
7712 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7713 * "type": "Patient"
7714 * },
7715 * "participant": {
7717 * "role": {
7719 * "coding": {
7721 * "system": "http://nucc.org/provider-taxonomy",
7722 * "code": "102L00000X",
7723 * "display": "Psychoanalyst"
7727 * },
7728 * "member": {
7729 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7730 * "type": "Practitioner"
7731 * },
7732 * "onBehalfOf": {
7733 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7734 * "type": "Organization"
7736 * },
7738 * "role": {
7740 * "coding": {
7742 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7743 * "code": "unknown",
7744 * "display": "Unknown"
7748 * },
7749 * "member": {
7750 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7751 * "type": "Organization"
7758 * ),
7759 * @OA\Response(
7760 * response="400",
7761 * ref="#/components/responses/badrequest"
7762 * ),
7763 * @OA\Response(
7764 * response="401",
7765 * ref="#/components/responses/unauthorized"
7766 * ),
7767 * @OA\Response(
7768 * response="404",
7769 * ref="#/components/responses/uuidnotfound"
7770 * ),
7771 * security={{"openemr_auth":{}}}
7774 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
7775 if ($request->isPatientRequest()) {
7776 // only allow access to data of binded patient
7777 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7778 } else {
7779 RestConfig::authorization_check("patients", "med");
7780 $return = (new FhirCareTeamRestController())->getOne($uuid);
7782 RestConfig::apiLog($return);
7783 return $return;
7787 * @OA\Get(
7788 * path="/fhir/Condition",
7789 * description="Returns a list of Condition resources.",
7790 * tags={"fhir"},
7791 * @OA\Parameter(
7792 * name="_id",
7793 * in="query",
7794 * description="The uuid for the Condition resource.",
7795 * required=false,
7796 * @OA\Schema(
7797 * type="string"
7799 * ),
7800 * @OA\Parameter(
7801 * name="patient",
7802 * in="query",
7803 * description="The uuid for the patient.",
7804 * required=false,
7805 * @OA\Schema(
7806 * type="string"
7808 * ),
7809 * @OA\Response(
7810 * response="200",
7811 * description="Standard Response",
7812 * @OA\MediaType(
7813 * mediaType="application/json",
7814 * @OA\Schema(
7815 * @OA\Property(
7816 * property="json object",
7817 * description="FHIR Json object.",
7818 * type="object"
7819 * ),
7820 * example={
7821 * "meta": {
7822 * "lastUpdated": "2021-09-14T09:13:51"
7823 * },
7824 * "resourceType": "Bundle",
7825 * "type": "collection",
7826 * "total": 0,
7827 * "link": {
7829 * "relation": "self",
7830 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7836 * ),
7837 * @OA\Response(
7838 * response="400",
7839 * ref="#/components/responses/badrequest"
7840 * ),
7841 * @OA\Response(
7842 * response="401",
7843 * ref="#/components/responses/unauthorized"
7844 * ),
7845 * security={{"openemr_auth":{}}}
7848 "GET /fhir/Condition" => function (HttpRestRequest $request) {
7849 $getParams = $request->getQueryParams();
7850 if ($request->isPatientRequest()) {
7851 // only allow access to data of binded patient
7852 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7853 } else {
7854 RestConfig::authorization_check("patients", "med");
7855 $return = (new FhirConditionRestController())->getAll($getParams);
7857 RestConfig::apiLog($return);
7858 return $return;
7862 * @OA\Get(
7863 * path="/fhir/Condition/{uuid}",
7864 * description="Returns a single Condition resource.",
7865 * tags={"fhir"},
7866 * @OA\Parameter(
7867 * name="uuid",
7868 * in="path",
7869 * description="The uuid for the Condition resource.",
7870 * required=true,
7871 * @OA\Schema(
7872 * type="string"
7874 * ),
7875 * @OA\Response(
7876 * response="200",
7877 * description="Standard Response",
7878 * @OA\MediaType(
7879 * mediaType="application/json",
7880 * @OA\Schema(
7881 * @OA\Property(
7882 * property="json object",
7883 * description="FHIR Json object.",
7884 * type="object"
7885 * ),
7886 * example={
7887 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7888 * "meta": {
7889 * "versionId": "1",
7890 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7891 * },
7892 * "resourceType": "Condition",
7893 * "clinicalStatus": {
7894 * "coding": {
7896 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7897 * "code": "inactive",
7898 * "display": "Inactive"
7901 * },
7902 * "verificationStatus": {
7903 * "coding": {
7905 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7906 * "code": "unconfirmed",
7907 * "display": "Unconfirmed"
7910 * },
7911 * "category": {
7913 * "coding": {
7915 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7916 * "code": "problem-list-item",
7917 * "display": "Problem List Item"
7921 * },
7922 * "code": {
7923 * "coding": {
7925 * "system": "http://snomed.info/sct",
7926 * "code": "444814009",
7927 * "display": ""
7930 * },
7931 * "subject": {
7932 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7937 * ),
7938 * @OA\Response(
7939 * response="400",
7940 * ref="#/components/responses/badrequest"
7941 * ),
7942 * @OA\Response(
7943 * response="401",
7944 * ref="#/components/responses/unauthorized"
7945 * ),
7946 * @OA\Response(
7947 * response="404",
7948 * ref="#/components/responses/uuidnotfound"
7949 * ),
7950 * security={{"openemr_auth":{}}}
7953 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
7954 if ($request->isPatientRequest()) {
7955 // only allow access to data of binded patient
7956 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7957 } else {
7958 RestConfig::authorization_check("patients", "med");
7959 $return = (new FhirConditionRestController())->getOne($uuid);
7961 RestConfig::apiLog($return);
7962 return $return;
7966 * @OA\Get(
7967 * path="/fhir/Coverage",
7968 * description="Returns a list of Coverage resources.",
7969 * tags={"fhir"},
7970 * @OA\Parameter(
7971 * name="_id",
7972 * in="query",
7973 * description="The uuid for the Coverage resource.",
7974 * required=false,
7975 * @OA\Schema(
7976 * type="string"
7978 * ),
7979 * @OA\Parameter(
7980 * name="patient",
7981 * in="query",
7982 * description="The uuid for the patient.",
7983 * required=false,
7984 * @OA\Schema(
7985 * type="string"
7987 * ),
7988 * @OA\Parameter(
7989 * name="payor",
7990 * in="query",
7991 * description="The payor of the Coverage resource.",
7992 * required=false,
7993 * @OA\Schema(
7994 * type="string"
7996 * ),
7997 * @OA\Response(
7998 * response="200",
7999 * description="Standard Response",
8000 * @OA\MediaType(
8001 * mediaType="application/json",
8002 * @OA\Schema(
8003 * @OA\Property(
8004 * property="json object",
8005 * description="FHIR Json object.",
8006 * type="object"
8007 * ),
8008 * example={
8009 * "meta": {
8010 * "lastUpdated": "2021-09-14T09:13:51"
8011 * },
8012 * "resourceType": "Bundle",
8013 * "type": "collection",
8014 * "total": 0,
8015 * "link": {
8017 * "relation": "self",
8018 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8024 * ),
8025 * @OA\Response(
8026 * response="400",
8027 * ref="#/components/responses/badrequest"
8028 * ),
8029 * @OA\Response(
8030 * response="401",
8031 * ref="#/components/responses/unauthorized"
8032 * ),
8033 * security={{"openemr_auth":{}}}
8036 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
8037 if ($request->isPatientRequest()) {
8038 // only allow access to data of binded patient
8039 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8040 } else {
8041 RestConfig::authorization_check("admin", "super");
8042 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8044 RestConfig::apiLog($return);
8045 return $return;
8049 * @OA\Get(
8050 * path="/fhir/Coverage/{uuid}",
8051 * description="Returns a single Coverage resource.",
8052 * tags={"fhir"},
8053 * @OA\Parameter(
8054 * name="uuid",
8055 * in="path",
8056 * description="The uuid for the Coverage resource.",
8057 * required=true,
8058 * @OA\Schema(
8059 * type="string"
8061 * ),
8062 * @OA\Response(
8063 * response="200",
8064 * description="Standard Response",
8065 * @OA\MediaType(
8066 * mediaType="application/json",
8067 * @OA\Schema(
8068 * @OA\Property(
8069 * property="json object",
8070 * description="FHIR Json object.",
8071 * type="object"
8072 * ),
8073 * example={
8074 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8075 * "meta": {
8076 * "versionId": "1",
8077 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8078 * },
8079 * "resourceType": "Coverage",
8080 * "status": "active",
8081 * "beneficiary": {
8082 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8083 * },
8084 * "relationship": {
8085 * "coding": {
8087 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8088 * "code": ""
8095 * ),
8096 * @OA\Response(
8097 * response="400",
8098 * ref="#/components/responses/badrequest"
8099 * ),
8100 * @OA\Response(
8101 * response="401",
8102 * ref="#/components/responses/unauthorized"
8103 * ),
8104 * @OA\Response(
8105 * response="404",
8106 * ref="#/components/responses/uuidnotfound"
8107 * ),
8108 * security={{"openemr_auth":{}}}
8111 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
8112 if ($request->isPatientRequest()) {
8113 // only allow access to data of binded patient
8114 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8115 } else {
8116 RestConfig::authorization_check("admin", "super");
8117 $return = (new FhirCoverageRestController())->getOne($uuid);
8119 RestConfig::apiLog($return);
8120 return $return;
8124 * @OA\Get(
8125 * path="/fhir/Device",
8126 * description="Returns a list of Device resources.",
8127 * tags={"fhir"},
8128 * @OA\Parameter(
8129 * name="_id",
8130 * in="query",
8131 * description="The uuid for the Device resource.",
8132 * required=false,
8133 * @OA\Schema(
8134 * type="string"
8136 * ),
8137 * @OA\Parameter(
8138 * name="patient",
8139 * in="query",
8140 * description="The uuid for the patient.",
8141 * required=false,
8142 * @OA\Schema(
8143 * type="string"
8145 * ),
8146 * @OA\Response(
8147 * response="200",
8148 * description="Standard Response",
8149 * @OA\MediaType(
8150 * mediaType="application/json",
8151 * @OA\Schema(
8152 * @OA\Property(
8153 * property="json object",
8154 * description="FHIR Json object.",
8155 * type="object"
8156 * ),
8157 * example={
8158 * "meta": {
8159 * "lastUpdated": "2021-09-14T09:13:51"
8160 * },
8161 * "resourceType": "Bundle",
8162 * "type": "collection",
8163 * "total": 0,
8164 * "link": {
8166 * "relation": "self",
8167 * "url": "https://localhost:9300/apis/default/fhir/Device"
8173 * ),
8174 * @OA\Response(
8175 * response="400",
8176 * ref="#/components/responses/badrequest"
8177 * ),
8178 * @OA\Response(
8179 * response="401",
8180 * ref="#/components/responses/unauthorized"
8181 * ),
8182 * security={{"openemr_auth":{}}}
8185 "GET /fhir/Device" => function (HttpRestRequest $request) {
8186 if ($request->isPatientRequest()) {
8187 // only allow access to data of binded patient
8188 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8189 } else {
8190 RestConfig::authorization_check("admin", "super");
8191 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8193 RestConfig::apiLog($return);
8194 return $return;
8198 * @OA\Get(
8199 * path="/fhir/Device/{uuid}",
8200 * description="Returns a single Device resource.",
8201 * tags={"fhir"},
8202 * @OA\Parameter(
8203 * name="uuid",
8204 * in="path",
8205 * description="The uuid for the Device resource.",
8206 * required=true,
8207 * @OA\Schema(
8208 * type="string"
8210 * ),
8211 * @OA\Response(
8212 * response="200",
8213 * description="Standard Response",
8214 * @OA\MediaType(
8215 * mediaType="application/json",
8216 * @OA\Schema(
8217 * @OA\Property(
8218 * property="json object",
8219 * description="FHIR Json object.",
8220 * type="object"
8221 * ),
8222 * example={
8223 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8224 * "meta": {
8225 * "versionId": "1",
8226 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8227 * },
8228 * "resourceType": "Device",
8229 * "udiCarrier": {
8231 * "deviceIdentifier": "08717648200274",
8232 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8234 * },
8235 * "distinctIdentifier": "A99971312345600",
8236 * "manufactureDate": "2013-02-01",
8237 * "expirationDate": "2014-02-01",
8238 * "lotNumber": "000000000000XYZ123",
8239 * "serialNumber": "000025",
8240 * "type": {
8241 * "extension": {
8243 * "valueCode": "unknown",
8244 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8247 * },
8248 * "patient": {
8249 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8250 * "type": "Patient"
8255 * ),
8256 * @OA\Response(
8257 * response="400",
8258 * ref="#/components/responses/badrequest"
8259 * ),
8260 * @OA\Response(
8261 * response="401",
8262 * ref="#/components/responses/unauthorized"
8263 * ),
8264 * @OA\Response(
8265 * response="404",
8266 * ref="#/components/responses/uuidnotfound"
8267 * ),
8268 * security={{"openemr_auth":{}}}
8271 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8272 if ($request->isPatientRequest()) {
8273 // only allow access to data of binded patient
8274 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8275 } else {
8276 RestConfig::authorization_check("admin", "super");
8277 $return = (new FhirDeviceRestController())->getOne($uuid);
8279 RestConfig::apiLog($return);
8280 return $return;
8284 * @OA\Get(
8285 * path="/fhir/DiagnosticReport",
8286 * description="Returns a list of DiagnosticReport resources.",
8287 * tags={"fhir"},
8288 * @OA\Parameter(
8289 * name="_id",
8290 * in="query",
8291 * description="The uuid for the DiagnosticReport resource.",
8292 * required=false,
8293 * @OA\Schema(
8294 * type="string"
8296 * ),
8297 * @OA\Parameter(
8298 * name="patient",
8299 * in="query",
8300 * description="The uuid for the patient.",
8301 * required=false,
8302 * @OA\Schema(
8303 * type="string"
8305 * ),
8306 * @OA\Parameter(
8307 * name="code",
8308 * in="query",
8309 * description="The code of the DiagnosticReport resource.",
8310 * required=false,
8311 * @OA\Schema(
8312 * type="string"
8314 * ),
8315 * @OA\Parameter(
8316 * name="category",
8317 * in="query",
8318 * description="The category of the DiagnosticReport resource.",
8319 * required=false,
8320 * @OA\Schema(
8321 * type="string"
8323 * ),
8324 * @OA\Parameter(
8325 * name="date",
8326 * in="query",
8327 * description="The datetime of the DiagnosticReport resource.",
8328 * required=false,
8329 * @OA\Schema(
8330 * type="string"
8332 * ),
8333 * @OA\Response(
8334 * response="200",
8335 * description="Standard Response",
8336 * @OA\MediaType(
8337 * mediaType="application/json",
8338 * @OA\Schema(
8339 * @OA\Property(
8340 * property="json object",
8341 * description="FHIR Json object.",
8342 * type="object"
8343 * ),
8344 * example={
8345 * "meta": {
8346 * "lastUpdated": "2021-09-14T09:13:51"
8347 * },
8348 * "resourceType": "Bundle",
8349 * "type": "collection",
8350 * "total": 0,
8351 * "link": {
8353 * "relation": "self",
8354 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8360 * ),
8361 * @OA\Response(
8362 * response="400",
8363 * ref="#/components/responses/badrequest"
8364 * ),
8365 * @OA\Response(
8366 * response="401",
8367 * ref="#/components/responses/unauthorized"
8368 * ),
8369 * security={{"openemr_auth":{}}}
8372 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8373 $getParams = $request->getQueryParams();
8374 if ($request->isPatientRequest()) {
8375 // only allow access to data of binded patient
8376 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8377 } else {
8378 RestConfig::authorization_check("admin", "super");
8379 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8381 RestConfig::apiLog($return);
8382 return $return;
8386 * @OA\Get(
8387 * path="/fhir/DiagnosticReport/{uuid}",
8388 * description="Returns a single DiagnosticReport resource.",
8389 * tags={"fhir"},
8390 * @OA\Parameter(
8391 * name="uuid",
8392 * in="path",
8393 * description="The uuid for the DiagnosticReport resource.",
8394 * required=true,
8395 * @OA\Schema(
8396 * type="string"
8398 * ),
8399 * @OA\Response(
8400 * response="200",
8401 * description="Standard Response",
8402 * @OA\MediaType(
8403 * mediaType="application/json",
8404 * @OA\Schema(
8405 * @OA\Property(
8406 * property="json object",
8407 * description="FHIR Json object.",
8408 * type="object"
8409 * ),
8410 * example={
8411 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8412 * "meta": {
8413 * "versionId": "1",
8414 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8415 * },
8416 * "resourceType": "DiagnosticReport",
8417 * "status": "final",
8418 * "category": {
8420 * "coding": {
8422 * "system": "http://loinc.org",
8423 * "code": "LP7839-6",
8424 * "display": "Pathology"
8428 * },
8429 * "code": {
8430 * "coding": {
8432 * "system": "http://loinc.org",
8433 * "code": "11502-2",
8434 * "display": "Laboratory report"
8437 * },
8438 * "subject": {
8439 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8440 * "type": "Patient"
8441 * },
8442 * "encounter": {
8443 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8444 * "type": "Encounter"
8445 * },
8446 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8447 * "issued": "2015-06-22T00:00:00+00:00",
8448 * "performer": {
8450 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8451 * "type": "Organization"
8453 * },
8454 * "presentedForm": {
8456 * "contentType": "text/plain",
8457 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8463 * ),
8464 * @OA\Response(
8465 * response="400",
8466 * ref="#/components/responses/badrequest"
8467 * ),
8468 * @OA\Response(
8469 * response="401",
8470 * ref="#/components/responses/unauthorized"
8471 * ),
8472 * @OA\Response(
8473 * response="404",
8474 * ref="#/components/responses/uuidnotfound"
8475 * ),
8476 * security={{"openemr_auth":{}}}
8479 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8480 $getParams = $request->getQueryParams();
8481 if ($request->isPatientRequest()) {
8482 // only allow access to data of binded patient
8483 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8484 } else {
8485 RestConfig::authorization_check("admin", "super");
8486 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8488 RestConfig::apiLog($return);
8489 return $return;
8493 * @OA\Get(
8494 * path="/fhir/DocumentReference",
8495 * description="Returns a list of DocumentReference resources.",
8496 * tags={"fhir"},
8497 * @OA\Parameter(
8498 * name="_id",
8499 * in="query",
8500 * description="The uuid for the DocumentReference resource.",
8501 * required=false,
8502 * @OA\Schema(
8503 * type="string"
8505 * ),
8506 * @OA\Parameter(
8507 * name="patient",
8508 * in="query",
8509 * description="The uuid for the patient.",
8510 * required=false,
8511 * @OA\Schema(
8512 * type="string"
8514 * ),
8515 * @OA\Parameter(
8516 * name="type",
8517 * in="query",
8518 * description="The type of the DocumentReference resource.",
8519 * required=false,
8520 * @OA\Schema(
8521 * type="string"
8523 * ),
8524 * @OA\Parameter(
8525 * name="category",
8526 * in="query",
8527 * description="The category of the DocumentReference resource.",
8528 * required=false,
8529 * @OA\Schema(
8530 * type="string"
8532 * ),
8533 * @OA\Parameter(
8534 * name="date",
8535 * in="query",
8536 * description="The datetime of the DocumentReference resource.",
8537 * required=false,
8538 * @OA\Schema(
8539 * type="string"
8541 * ),
8542 * @OA\Response(
8543 * response="200",
8544 * description="Standard Response",
8545 * @OA\MediaType(
8546 * mediaType="application/json",
8547 * @OA\Schema(
8548 * @OA\Property(
8549 * property="json object",
8550 * description="FHIR Json object.",
8551 * type="object"
8552 * ),
8553 * example={
8554 * "meta": {
8555 * "lastUpdated": "2021-09-14T09:13:51"
8556 * },
8557 * "resourceType": "Bundle",
8558 * "type": "collection",
8559 * "total": 0,
8560 * "link": {
8562 * "relation": "self",
8563 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8569 * ),
8570 * @OA\Response(
8571 * response="400",
8572 * ref="#/components/responses/badrequest"
8573 * ),
8574 * @OA\Response(
8575 * response="401",
8576 * ref="#/components/responses/unauthorized"
8577 * ),
8578 * security={{"openemr_auth":{}}}
8581 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8582 $getParams = $request->getQueryParams();
8583 if ($request->isPatientRequest()) {
8584 // only allow access to data of binded patient
8585 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8586 } else {
8587 RestConfig::authorization_check("admin", "super");
8588 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8590 RestConfig::apiLog($return);
8591 return $return;
8595 * @OA\POST(
8596 * path="/fhir/DocumentReference/$docref",
8597 * 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.",
8598 * tags={"fhir"},
8599 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8600 * @OA\Parameter(
8601 * name="patient",
8602 * in="query",
8603 * description="The uuid for the patient.",
8604 * required=true,
8605 * @OA\Schema(
8606 * type="string"
8608 * ),
8609 * @OA\Parameter(
8610 * name="start",
8611 * in="query",
8612 * 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.",
8613 * required=false,
8614 * @OA\Schema(
8615 * type="string"
8617 * ),
8618 * @OA\Parameter(
8619 * name="end",
8620 * in="query",
8621 * 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.",
8622 * required=false,
8623 * @OA\Schema(
8624 * type="string"
8626 * ),
8627 * @OA\Parameter(
8628 * name="type",
8629 * in="query",
8630 * 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).",
8631 * required=false,
8632 * @OA\Schema(
8633 * type="string"
8635 * ),
8636 * @OA\Response(
8637 * response="200",
8638 * description="A search bundle of DocumentReferences is returned"
8639 * ),
8640 * @OA\Response(
8641 * response="400",
8642 * ref="#/components/responses/badrequest"
8643 * ),
8644 * @OA\Response(
8645 * response="401",
8646 * ref="#/components/responses/unauthorized"
8647 * ),
8648 * security={{"openemr_auth":{}}}
8651 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
8653 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
8654 if ($request->isPatientRequest()) {
8655 // only allow access to data of binded patient
8656 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8657 } else {
8658 // TODO: it seems like regular users should be able to grab authorship / provenance information
8659 RestConfig::authorization_check("patients", "demo");
8660 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
8662 RestConfig::apiLog($return);
8663 return $return;
8667 * @OA\Get(
8668 * path="/fhir/DocumentReference/{uuid}",
8669 * description="Returns a single DocumentReference resource.",
8670 * tags={"fhir"},
8671 * @OA\Parameter(
8672 * name="uuid",
8673 * in="path",
8674 * description="The uuid for the DocumentReference resource.",
8675 * required=true,
8676 * @OA\Schema(
8677 * type="string"
8679 * ),
8680 * @OA\Response(
8681 * response="200",
8682 * description="Standard Response",
8683 * @OA\MediaType(
8684 * mediaType="application/json",
8685 * @OA\Schema(
8686 * @OA\Property(
8687 * property="json object",
8688 * description="FHIR Json object.",
8689 * type="object"
8690 * ),
8691 * example={
8692 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8693 * "meta": {
8694 * "versionId": "1",
8695 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8696 * },
8697 * "resourceType": "DocumentReference",
8698 * "identifier": {
8700 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8702 * },
8703 * "status": "current",
8704 * "type": {
8705 * "coding": {
8707 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8708 * "code": "UNK",
8709 * "display": "unknown"
8712 * },
8713 * "category": {
8715 * "coding": {
8717 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8718 * "code": "openemr-document",
8719 * "display": "OpenEMR Document"
8723 * },
8724 * "subject": {
8725 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8726 * "type": "Patient"
8727 * },
8728 * "date": "2021-09-19T03:15:56+00:00",
8729 * "author": {
8730 * null
8731 * },
8732 * "content": {
8734 * "attachment": {
8735 * "contentType": "image/gif",
8736 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
8737 * },
8738 * "format": {
8739 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8740 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8741 * "display": "mimeType Sufficient"
8748 * ),
8749 * @OA\Response(
8750 * response="400",
8751 * ref="#/components/responses/badrequest"
8752 * ),
8753 * @OA\Response(
8754 * response="401",
8755 * ref="#/components/responses/unauthorized"
8756 * ),
8757 * @OA\Response(
8758 * response="404",
8759 * ref="#/components/responses/uuidnotfound"
8760 * ),
8761 * security={{"openemr_auth":{}}}
8764 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
8765 $getParams = $request->getQueryParams();
8766 if ($request->isPatientRequest()) {
8767 // only allow access to data of binded patient
8768 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8769 } else {
8770 RestConfig::authorization_check("admin", "super");
8771 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8773 RestConfig::apiLog($return);
8774 return $return;
8778 * @OA\Get(
8779 * path="/fhir/Binary/{id}",
8780 * 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>",
8781 * tags={"fhir"},
8782 * @OA\Parameter(
8783 * name="id",
8784 * in="path",
8785 * description="The id for the Document.",
8786 * required=true,
8787 * @OA\Schema(
8788 * type="string"
8790 * ),
8791 * @OA\Response(
8792 * response="200",
8793 * 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>"
8794 * ),
8795 * @OA\Response(
8796 * response="400",
8797 * ref="#/components/responses/badrequest"
8798 * ),
8799 * @OA\Response(
8800 * response="401",
8801 * ref="#/components/responses/unauthorized"
8802 * ),
8803 * security={{"openemr_auth":{}}}
8806 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest $request) {
8807 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
8809 if ($request->isPatientRequest()) {
8810 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
8811 } else {
8812 RestConfig::authorization_check("admin", "users");
8813 $response = $docController->downloadDocument($documentId);
8816 return $response;
8820 * @OA\Get(
8821 * path="/fhir/Encounter",
8822 * description="Returns a list of Encounter resources.",
8823 * tags={"fhir"},
8824 * @OA\Parameter(
8825 * name="_id",
8826 * in="query",
8827 * description="The uuid for the Encounter resource.",
8828 * required=false,
8829 * @OA\Schema(
8830 * type="string"
8832 * ),
8833 * @OA\Parameter(
8834 * name="patient",
8835 * in="query",
8836 * description="The uuid for the patient.",
8837 * required=false,
8838 * @OA\Schema(
8839 * type="string"
8841 * ),
8842 * @OA\Parameter(
8843 * name="date",
8844 * in="query",
8845 * description="The datetime of the Encounter resource.",
8846 * required=false,
8847 * @OA\Schema(
8848 * type="string"
8850 * ),
8851 * @OA\Response(
8852 * response="200",
8853 * description="Standard Response",
8854 * @OA\MediaType(
8855 * mediaType="application/json",
8856 * @OA\Schema(
8857 * @OA\Property(
8858 * property="json object",
8859 * description="FHIR Json object.",
8860 * type="object"
8861 * ),
8862 * example={
8863 * "meta": {
8864 * "lastUpdated": "2021-09-14T09:13:51"
8865 * },
8866 * "resourceType": "Bundle",
8867 * "type": "collection",
8868 * "total": 0,
8869 * "link": {
8871 * "relation": "self",
8872 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8878 * ),
8879 * @OA\Response(
8880 * response="400",
8881 * ref="#/components/responses/badrequest"
8882 * ),
8883 * @OA\Response(
8884 * response="401",
8885 * ref="#/components/responses/unauthorized"
8886 * ),
8887 * security={{"openemr_auth":{}}}
8890 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
8891 $getParams = $request->getQueryParams();
8892 if ($request->isPatientRequest()) {
8893 // only allow access to data of binded patient
8894 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8895 } else {
8896 RestConfig::authorization_check("encounters", "auth_a");
8897 $return = (new FhirEncounterRestController())->getAll($getParams);
8899 RestConfig::apiLog($return);
8900 return $return;
8904 * @OA\Get(
8905 * path="/fhir/Encounter/{uuid}",
8906 * description="Returns a single Encounter resource.",
8907 * tags={"fhir"},
8908 * @OA\Parameter(
8909 * name="uuid",
8910 * in="path",
8911 * description="The uuid for the Encounter resource.",
8912 * required=true,
8913 * @OA\Schema(
8914 * type="string"
8916 * ),
8917 * @OA\Response(
8918 * response="200",
8919 * description="Standard Response",
8920 * @OA\MediaType(
8921 * mediaType="application/json",
8922 * @OA\Schema(
8923 * @OA\Property(
8924 * property="json object",
8925 * description="FHIR Json object.",
8926 * type="object"
8927 * ),
8928 * example={
8929 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8930 * "meta": {
8931 * "versionId": "1",
8932 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8933 * },
8934 * "resourceType": "Encounter",
8935 * "identifier": {
8937 * "system": "urn:ietf:rfc:3986",
8938 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8940 * },
8941 * "status": "finished",
8942 * "class": {
8943 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8944 * "code": "AMB",
8945 * "display": "ambulatory"
8946 * },
8947 * "type": {
8949 * "coding": {
8951 * "system": "http://snomed.info/sct",
8952 * "code": "185349003",
8953 * "display": "Encounter for check up (procedure)"
8957 * },
8958 * "subject": {
8959 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8960 * "type": "Patient"
8961 * },
8962 * "participant": {
8964 * "type": {
8966 * "coding": {
8968 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8969 * "code": "PPRF",
8970 * "display": "Primary Performer"
8974 * },
8975 * "period": {
8976 * "start": "2012-08-13T00:00:00+00:00"
8977 * },
8978 * "individual": {
8979 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8980 * "type": "Practitioner"
8983 * },
8984 * "period": {
8985 * "start": "2012-08-13T00:00:00+00:00"
8990 * ),
8991 * @OA\Response(
8992 * response="400",
8993 * ref="#/components/responses/badrequest"
8994 * ),
8995 * @OA\Response(
8996 * response="401",
8997 * ref="#/components/responses/unauthorized"
8998 * ),
8999 * @OA\Response(
9000 * response="404",
9001 * ref="#/components/responses/uuidnotfound"
9002 * ),
9003 * security={{"openemr_auth":{}}}
9006 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
9007 if ($request->isPatientRequest()) {
9008 // only allow access to data of binded patient
9009 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9010 } else {
9011 RestConfig::authorization_check("admin", "super");
9012 $return = (new FhirEncounterRestController())->getOne($uuid);
9014 RestConfig::apiLog($return);
9015 return $return;
9019 * @OA\Get(
9020 * path="/fhir/Goal",
9021 * description="Returns a list of Condition resources.",
9022 * tags={"fhir"},
9023 * @OA\Parameter(
9024 * name="_id",
9025 * in="query",
9026 * description="The uuid for the Goal resource.",
9027 * required=false,
9028 * @OA\Schema(
9029 * type="string"
9031 * ),
9032 * @OA\Parameter(
9033 * name="patient",
9034 * in="query",
9035 * description="The uuid for the patient.",
9036 * required=false,
9037 * @OA\Schema(
9038 * type="string"
9040 * ),
9041 * @OA\Response(
9042 * response="200",
9043 * description="Standard Response",
9044 * @OA\MediaType(
9045 * mediaType="application/json",
9046 * @OA\Schema(
9047 * @OA\Property(
9048 * property="json object",
9049 * description="FHIR Json object.",
9050 * type="object"
9051 * ),
9052 * example={
9053 * "meta": {
9054 * "lastUpdated": "2021-09-14T09:13:51"
9055 * },
9056 * "resourceType": "Bundle",
9057 * "type": "collection",
9058 * "total": 0,
9059 * "link": {
9061 * "relation": "self",
9062 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9068 * ),
9069 * @OA\Response(
9070 * response="400",
9071 * ref="#/components/responses/badrequest"
9072 * ),
9073 * @OA\Response(
9074 * response="401",
9075 * ref="#/components/responses/unauthorized"
9076 * ),
9077 * security={{"openemr_auth":{}}}
9080 "GET /fhir/Goal" => function (HttpRestRequest $request) {
9081 $getParams = $request->getQueryParams();
9082 if ($request->isPatientRequest()) {
9083 // only allow access to data of binded patient
9084 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9085 } else {
9086 RestConfig::authorization_check("admin", "super");
9087 $return = (new FhirGoalRestController())->getAll($getParams);
9089 RestConfig::apiLog($return);
9090 return $return;
9094 * @OA\Get(
9095 * path="/fhir/Goal/{uuid}",
9096 * description="Returns a single Goal resource.",
9097 * tags={"fhir"},
9098 * @OA\Parameter(
9099 * name="uuid",
9100 * in="path",
9101 * description="The uuid for the Goal resource.",
9102 * required=true,
9103 * @OA\Schema(
9104 * type="string"
9106 * ),
9107 * @OA\Response(
9108 * response="200",
9109 * description="Standard Response",
9110 * @OA\MediaType(
9111 * mediaType="application/json",
9112 * @OA\Schema(
9113 * @OA\Property(
9114 * property="json object",
9115 * description="FHIR Json object.",
9116 * type="object"
9117 * ),
9118 * example={
9119 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9120 * "meta": {
9121 * "versionId": "1",
9122 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9123 * },
9124 * "resourceType": "Goal",
9125 * "lifecycleStatus": "active",
9126 * "description": {
9127 * "text": "Eating more vegetables."
9128 * },
9129 * "subject": {
9130 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9131 * "type": "Patient"
9132 * },
9133 * "target": {
9135 * "measure": {
9136 * "extension": {
9138 * "valueCode": "unknown",
9139 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9142 * },
9143 * "detailString": "Eating more vegetables.",
9144 * "dueDate": "2021-09-09"
9150 * ),
9151 * @OA\Response(
9152 * response="400",
9153 * ref="#/components/responses/badrequest"
9154 * ),
9155 * @OA\Response(
9156 * response="401",
9157 * ref="#/components/responses/unauthorized"
9158 * ),
9159 * @OA\Response(
9160 * response="404",
9161 * ref="#/components/responses/uuidnotfound"
9162 * ),
9163 * security={{"openemr_auth":{}}}
9166 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9167 if ($request->isPatientRequest()) {
9168 // only allow access to data of binded patient
9169 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9170 } else {
9171 RestConfig::authorization_check("admin", "super");
9172 $return = (new FhirGoalRestController())->getOne($uuid);
9174 RestConfig::apiLog($return);
9175 return $return;
9179 * @OA\Get(
9180 * path="/fhir/Group",
9181 * 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>",
9182 * tags={"fhir"},
9183 * @OA\Parameter(
9184 * name="_id",
9185 * in="query",
9186 * description="The uuid for the Group resource.",
9187 * required=false,
9188 * @OA\Schema(
9189 * type="string"
9191 * ),
9192 * @OA\Parameter(
9193 * name="patient",
9194 * in="query",
9195 * description="The uuid for the patient.",
9196 * required=false,
9197 * @OA\Schema(
9198 * type="string"
9200 * ),
9201 * @OA\Response(
9202 * response="200",
9203 * description="Standard Response",
9204 * @OA\MediaType(
9205 * mediaType="application/json",
9206 * @OA\Schema(
9207 * @OA\Property(
9208 * property="json object",
9209 * description="FHIR Json object.",
9210 * type="object"
9211 * ),
9212 * example={
9213 * "meta": {
9214 * "lastUpdated": "2021-09-14T09:13:51"
9215 * },
9216 * "resourceType": "Bundle",
9217 * "type": "collection",
9218 * "total": 0,
9219 * "link": {
9221 * "relation": "self",
9222 * "url": "https://localhost:9300/apis/default/fhir/Group"
9228 * ),
9229 * @OA\Response(
9230 * response="400",
9231 * ref="#/components/responses/badrequest"
9232 * ),
9233 * @OA\Response(
9234 * response="401",
9235 * ref="#/components/responses/unauthorized"
9236 * ),
9237 * security={{"openemr_auth":{}}}
9240 'GET /fhir/Group' => function (HttpRestRequest $request) {
9241 RestConfig::authorization_check("admin", "users");
9242 $getParams = $request->getQueryParams();
9243 if ($request->isPatientRequest()) {
9244 // only allow access to data of binded patient
9245 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9246 } else {
9247 $return = (new FhirGroupRestController())->getAll($getParams);
9249 RestConfig::apiLog($return);
9250 return $return;
9254 * @OA\Get(
9255 * path="/fhir/Group/{uuid}",
9256 * 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>",
9257 * tags={"fhir"},
9258 * @OA\Parameter(
9259 * name="uuid",
9260 * in="path",
9261 * description="The uuid for the Group resource.",
9262 * required=true,
9263 * @OA\Schema(
9264 * type="string"
9266 * ),
9267 * @OA\Response(
9268 * response="200",
9269 * 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>"
9270 * ),
9271 * @OA\Response(
9272 * response="400",
9273 * ref="#/components/responses/badrequest"
9274 * ),
9275 * @OA\Response(
9276 * response="401",
9277 * ref="#/components/responses/unauthorized"
9278 * ),
9279 * @OA\Response(
9280 * response="404",
9281 * ref="#/components/responses/uuidnotfound"
9282 * ),
9283 * security={{"openemr_auth":{}}}
9286 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9287 RestConfig::authorization_check("admin", "users");
9288 if ($request->isPatientRequest()) {
9289 // only allow access to data of binded patient
9290 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9291 } else {
9292 $return = (new FhirGroupRestController())->getOne($uuid);
9294 RestConfig::apiLog($return);
9295 return $return;
9299 * @OA\Get(
9300 * path="/fhir/Group/{id}/$export",
9301 * 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>",
9302 * tags={"fhir"},
9303 * @OA\Response(
9304 * response="200",
9305 * 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>"
9306 * ),
9307 * @OA\Response(
9308 * response="400",
9309 * ref="#/components/responses/badrequest"
9310 * ),
9311 * @OA\Response(
9312 * response="401",
9313 * ref="#/components/responses/unauthorized"
9314 * ),
9315 * security={{"openemr_auth":{}}}
9318 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9319 RestConfig::authorization_check("admin", "users");
9320 $fhirExportService = new FhirOperationExportRestController($request);
9321 $exportParams = $request->getQueryParams();
9322 $exportParams['groupId'] = $groupId;
9323 $return = $fhirExportService->processExport(
9324 $exportParams,
9325 'Group',
9326 $request->getHeader('Accept'),
9327 $request->getHeader('Prefer')
9329 RestConfig::apiLog($return);
9330 return $return;
9334 * @OA\Get(
9335 * path="/fhir/Immunization",
9336 * description="Returns a list of Immunization resources.",
9337 * tags={"fhir"},
9338 * @OA\Parameter(
9339 * name="_id",
9340 * in="query",
9341 * description="The uuid for the Immunization resource.",
9342 * required=false,
9343 * @OA\Schema(
9344 * type="string"
9346 * ),
9347 * @OA\Parameter(
9348 * name="patient",
9349 * in="query",
9350 * description="The uuid for the patient.",
9351 * required=false,
9352 * @OA\Schema(
9353 * type="string"
9355 * ),
9356 * @OA\Response(
9357 * response="200",
9358 * description="Standard Response",
9359 * @OA\MediaType(
9360 * mediaType="application/json",
9361 * @OA\Schema(
9362 * @OA\Property(
9363 * property="json object",
9364 * description="FHIR Json object.",
9365 * type="object"
9366 * ),
9367 * example={
9368 * "meta": {
9369 * "lastUpdated": "2021-09-14T09:13:51"
9370 * },
9371 * "resourceType": "Bundle",
9372 * "type": "collection",
9373 * "total": 0,
9374 * "link": {
9376 * "relation": "self",
9377 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9383 * ),
9384 * @OA\Response(
9385 * response="400",
9386 * ref="#/components/responses/badrequest"
9387 * ),
9388 * @OA\Response(
9389 * response="401",
9390 * ref="#/components/responses/unauthorized"
9391 * ),
9392 * security={{"openemr_auth":{}}}
9395 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9396 $getParams = $request->getQueryParams();
9397 if ($request->isPatientRequest()) {
9398 // only allow access to data of binded patient
9399 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9400 } else {
9401 RestConfig::authorization_check("patients", "med");
9402 $return = (new FhirImmunizationRestController())->getAll($getParams);
9404 RestConfig::apiLog($return);
9405 return $return;
9409 * @OA\Get(
9410 * path="/fhir/Immunization/{uuid}",
9411 * description="Returns a single Immunization resource.",
9412 * tags={"fhir"},
9413 * @OA\Parameter(
9414 * name="uuid",
9415 * in="path",
9416 * description="The uuid for the Immunization resource.",
9417 * required=true,
9418 * @OA\Schema(
9419 * type="string"
9421 * ),
9422 * @OA\Response(
9423 * response="200",
9424 * description="Standard Response",
9425 * @OA\MediaType(
9426 * mediaType="application/json",
9427 * @OA\Schema(
9428 * @OA\Property(
9429 * property="json object",
9430 * description="FHIR Json object.",
9431 * type="object"
9432 * ),
9433 * example={
9434 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9435 * "meta": {
9436 * "versionId": "1",
9437 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9438 * },
9439 * "resourceType": "Immunization",
9440 * "status": "completed",
9441 * "vaccineCode": {
9442 * "coding": {
9444 * "system": "http://hl7.org/fhir/sid/cvx",
9445 * "code": "207",
9446 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9449 * },
9450 * "patient": {
9451 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9452 * },
9453 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9454 * "recorded": "2022-03-26T05:42:26+00:00",
9455 * "primarySource": false
9459 * ),
9460 * @OA\Response(
9461 * response="400",
9462 * ref="#/components/responses/badrequest"
9463 * ),
9464 * @OA\Response(
9465 * response="401",
9466 * ref="#/components/responses/unauthorized"
9467 * ),
9468 * @OA\Response(
9469 * response="404",
9470 * ref="#/components/responses/uuidnotfound"
9471 * ),
9472 * security={{"openemr_auth":{}}}
9475 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9476 if ($request->isPatientRequest()) {
9477 // only allow access to data of binded patient
9478 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9479 } else {
9480 RestConfig::authorization_check("patients", "med");
9481 $return = (new FhirImmunizationRestController())->getOne($uuid);
9483 RestConfig::apiLog($return);
9484 return $return;
9488 * @OA\Get(
9489 * path="/fhir/Location",
9490 * description="Returns a list of Location resources.",
9491 * tags={"fhir"},
9492 * @OA\Parameter(
9493 * name="_id",
9494 * in="query",
9495 * description="The uuid for the Location resource.",
9496 * required=false,
9497 * @OA\Schema(
9498 * type="string"
9500 * ),
9501 * @OA\Response(
9502 * response="200",
9503 * description="Standard Response",
9504 * @OA\MediaType(
9505 * mediaType="application/json",
9506 * @OA\Schema(
9507 * @OA\Property(
9508 * property="json object",
9509 * description="FHIR Json object.",
9510 * type="object"
9511 * ),
9512 * example={
9513 * "meta": {
9514 * "lastUpdated": "2021-09-14T09:13:51"
9515 * },
9516 * "resourceType": "Bundle",
9517 * "type": "collection",
9518 * "total": 0,
9519 * "link": {
9521 * "relation": "self",
9522 * "url": "https://localhost:9300/apis/default/fhir/Location"
9528 * ),
9529 * @OA\Response(
9530 * response="400",
9531 * ref="#/components/responses/badrequest"
9532 * ),
9533 * @OA\Response(
9534 * response="401",
9535 * ref="#/components/responses/unauthorized"
9536 * ),
9537 * security={{"openemr_auth":{}}}
9540 "GET /fhir/Location" => function (HttpRestRequest $request) {
9541 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9542 RestConfig::apiLog($return);
9543 return $return;
9547 * @OA\Get(
9548 * path="/fhir/Location/{uuid}",
9549 * description="Returns a single Location resource.",
9550 * tags={"fhir"},
9551 * @OA\Parameter(
9552 * name="uuid",
9553 * in="path",
9554 * description="The uuid for the Location resource.",
9555 * required=true,
9556 * @OA\Schema(
9557 * type="string"
9559 * ),
9560 * @OA\Response(
9561 * response="200",
9562 * description="Standard Response",
9563 * @OA\MediaType(
9564 * mediaType="application/json",
9565 * @OA\Schema(
9566 * @OA\Property(
9567 * property="json object",
9568 * description="FHIR Json object.",
9569 * type="object"
9570 * ),
9571 * example={
9572 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9573 * "meta": {
9574 * "versionId": "1",
9575 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9576 * },
9577 * "resourceType": "Location",
9578 * "status": "active",
9579 * "name": "Your Clinic Name Here",
9580 * "telecom": {
9582 * "system": "phone",
9583 * "value": "000-000-0000"
9584 * },
9586 * "system": "fax",
9587 * "value": "000-000-0000"
9593 * ),
9594 * @OA\Response(
9595 * response="400",
9596 * ref="#/components/responses/badrequest"
9597 * ),
9598 * @OA\Response(
9599 * response="401",
9600 * ref="#/components/responses/unauthorized"
9601 * ),
9602 * @OA\Response(
9603 * response="404",
9604 * ref="#/components/responses/uuidnotfound"
9605 * ),
9606 * security={{"openemr_auth":{}}}
9609 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9610 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9611 RestConfig::apiLog($return);
9612 return $return;
9616 * @OA\Get(
9617 * path="/fhir/Medication",
9618 * description="Returns a list of Medication resources.",
9619 * tags={"fhir"},
9620 * @OA\Response(
9621 * response="200",
9622 * description="Standard Response",
9623 * @OA\MediaType(
9624 * mediaType="application/json",
9625 * @OA\Schema(
9626 * @OA\Property(
9627 * property="json object",
9628 * description="FHIR Json object.",
9629 * type="object"
9630 * ),
9631 * example={
9632 * "meta": {
9633 * "lastUpdated": "2021-09-14T09:13:51"
9634 * },
9635 * "resourceType": "Bundle",
9636 * "type": "collection",
9637 * "total": 0,
9638 * "link": {
9640 * "relation": "self",
9641 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9647 * ),
9648 * @OA\Response(
9649 * response="400",
9650 * ref="#/components/responses/badrequest"
9651 * ),
9652 * @OA\Response(
9653 * response="401",
9654 * ref="#/components/responses/unauthorized"
9655 * ),
9656 * security={{"openemr_auth":{}}}
9659 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9660 RestConfig::authorization_check("patients", "med");
9661 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9662 RestConfig::apiLog($return);
9663 return $return;
9667 * @OA\Get(
9668 * path="/fhir/Medication/{uuid}",
9669 * description="Returns a single Medication resource.",
9670 * tags={"fhir"},
9671 * @OA\Parameter(
9672 * name="uuid",
9673 * in="path",
9674 * description="The uuid for the Medication resource.",
9675 * required=true,
9676 * @OA\Schema(
9677 * type="string"
9679 * ),
9680 * @OA\Response(
9681 * response="200",
9682 * description="Standard Response",
9683 * @OA\MediaType(
9684 * mediaType="application/json",
9685 * @OA\Schema(
9686 * @OA\Property(
9687 * property="json object",
9688 * description="FHIR Json object.",
9689 * type="object"
9690 * ),
9691 * example={
9692 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
9693 * "meta": {
9694 * "versionId": "1",
9695 * "lastUpdated": "2022-04-19T23:42:14+00:00"
9696 * },
9697 * "resourceType": "Medication",
9698 * "code": {
9699 * "coding": {
9701 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9702 * "code": 153165
9705 * },
9706 * "status": "active",
9707 * "batch": {
9708 * "lotNumber": "132",
9709 * "expirationDate": "0000-00-00"
9714 * ),
9715 * @OA\Response(
9716 * response="400",
9717 * ref="#/components/responses/badrequest"
9718 * ),
9719 * @OA\Response(
9720 * response="401",
9721 * ref="#/components/responses/unauthorized"
9722 * ),
9723 * @OA\Response(
9724 * response="404",
9725 * ref="#/components/responses/uuidnotfound"
9726 * ),
9727 * security={{"openemr_auth":{}}}
9730 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
9731 if ($request->isPatientRequest()) {
9732 // only allow access to data of binded patient
9733 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
9734 } else {
9735 RestConfig::authorization_check("patients", "med");
9736 $return = (new FhirMedicationRestController())->getOne($uuid);
9738 RestConfig::apiLog($return);
9739 return $return;
9743 * @OA\Get(
9744 * path="/fhir/MedicationRequest",
9745 * description="Returns a list of MedicationRequest resources.",
9746 * tags={"fhir"},
9747 * @OA\Parameter(
9748 * name="_id",
9749 * in="query",
9750 * description="The uuid for the MedicationRequest resource.",
9751 * required=false,
9752 * @OA\Schema(
9753 * type="string"
9755 * ),
9756 * @OA\Parameter(
9757 * name="patient",
9758 * in="query",
9759 * description="The uuid for the patient.",
9760 * required=false,
9761 * @OA\Schema(
9762 * type="string"
9764 * ),
9765 * @OA\Parameter(
9766 * name="intent",
9767 * in="query",
9768 * description="The intent of the MedicationRequest resource.",
9769 * required=false,
9770 * @OA\Schema(
9771 * type="string"
9773 * ),
9774 * @OA\Parameter(
9775 * name="status",
9776 * in="query",
9777 * description="The status of the MedicationRequest resource.",
9778 * required=false,
9779 * @OA\Schema(
9780 * type="string"
9782 * ),
9783 * @OA\Response(
9784 * response="200",
9785 * description="Standard Response",
9786 * @OA\MediaType(
9787 * mediaType="application/json",
9788 * @OA\Schema(
9789 * @OA\Property(
9790 * property="json object",
9791 * description="FHIR Json object.",
9792 * type="object"
9793 * ),
9794 * example={
9795 * "meta": {
9796 * "lastUpdated": "2021-09-14T09:13:51"
9797 * },
9798 * "resourceType": "Bundle",
9799 * "type": "collection",
9800 * "total": 0,
9801 * "link": {
9803 * "relation": "self",
9804 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9810 * ),
9811 * @OA\Response(
9812 * response="400",
9813 * ref="#/components/responses/badrequest"
9814 * ),
9815 * @OA\Response(
9816 * response="401",
9817 * ref="#/components/responses/unauthorized"
9818 * ),
9819 * security={{"openemr_auth":{}}}
9822 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
9823 $getParams = $request->getQueryParams();
9824 if ($request->isPatientRequest()) {
9825 // only allow access to data of binded patient
9826 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9827 } else {
9828 RestConfig::authorization_check("patients", "med");
9829 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9831 RestConfig::apiLog($return);
9832 return $return;
9836 * @OA\Get(
9837 * path="/fhir/MedicationRequest/{uuid}",
9838 * description="Returns a single MedicationRequest resource.",
9839 * tags={"fhir"},
9840 * @OA\Parameter(
9841 * name="uuid",
9842 * in="path",
9843 * description="The uuid for the MedicationRequest resource.",
9844 * required=true,
9845 * @OA\Schema(
9846 * type="string"
9848 * ),
9849 * @OA\Response(
9850 * response="200",
9851 * description="Standard Response",
9852 * @OA\MediaType(
9853 * mediaType="application/json",
9854 * @OA\Schema(
9855 * @OA\Property(
9856 * property="json object",
9857 * description="FHIR Json object.",
9858 * type="object"
9859 * ),
9860 * example={
9861 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9862 * "meta": {
9863 * "versionId": "1",
9864 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9865 * },
9866 * "resourceType": "MedicationRequest",
9867 * "status": "active",
9868 * "intent": "order",
9869 * "category": {
9871 * "coding": {
9873 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9874 * "code": "community",
9875 * "display": "Home/Community"
9879 * },
9880 * "reportedBoolean": false,
9881 * "medicationCodeableConcept": {
9882 * "coding": {
9884 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9885 * "code": "1738139",
9886 * "display": "Acetaminophen 325 MG Oral Tablet"
9889 * },
9890 * "subject": {
9891 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9892 * "type": "Patient"
9893 * },
9894 * "authoredOn": "2021-09-18T00:00:00+00:00",
9895 * "requester": {
9896 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9897 * "type": "Practitioner"
9902 * ),
9903 * @OA\Response(
9904 * response="400",
9905 * ref="#/components/responses/badrequest"
9906 * ),
9907 * @OA\Response(
9908 * response="401",
9909 * ref="#/components/responses/unauthorized"
9910 * ),
9911 * @OA\Response(
9912 * response="404",
9913 * ref="#/components/responses/uuidnotfound"
9914 * ),
9915 * security={{"openemr_auth":{}}}
9918 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
9919 if ($request->isPatientRequest()) {
9920 // only allow access to data of binded patient
9921 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9922 } else {
9923 RestConfig::authorization_check("patients", "med");
9924 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9926 RestConfig::apiLog($return);
9927 return $return;
9931 * @OA\Get(
9932 * path="/fhir/Observation",
9933 * description="Returns a list of Observation resources.",
9934 * tags={"fhir"},
9935 * @OA\Parameter(
9936 * name="_id",
9937 * in="query",
9938 * description="The uuid for the Observation resource.",
9939 * required=false,
9940 * @OA\Schema(
9941 * type="string"
9943 * ),
9944 * @OA\Parameter(
9945 * name="patient",
9946 * in="query",
9947 * description="The uuid for the patient.",
9948 * required=false,
9949 * @OA\Schema(
9950 * type="string"
9952 * ),
9953 * @OA\Parameter(
9954 * name="code",
9955 * in="query",
9956 * description="The code of the Observation resource.",
9957 * required=false,
9958 * @OA\Schema(
9959 * type="string"
9961 * ),
9962 * @OA\Parameter(
9963 * name="category",
9964 * in="query",
9965 * description="The category of the Observation resource.",
9966 * required=false,
9967 * @OA\Schema(
9968 * type="string"
9970 * ),
9971 * @OA\Parameter(
9972 * name="date",
9973 * in="query",
9974 * description="The datetime of the Observation resource.",
9975 * required=false,
9976 * @OA\Schema(
9977 * type="string"
9979 * ),
9980 * @OA\Response(
9981 * response="200",
9982 * description="Standard Response",
9983 * @OA\MediaType(
9984 * mediaType="application/json",
9985 * @OA\Schema(
9986 * @OA\Property(
9987 * property="json object",
9988 * description="FHIR Json object.",
9989 * type="object"
9990 * ),
9991 * example={
9992 * "meta": {
9993 * "lastUpdated": "2021-09-14T09:13:51"
9994 * },
9995 * "resourceType": "Bundle",
9996 * "type": "collection",
9997 * "total": 0,
9998 * "link": {
10000 * "relation": "self",
10001 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10007 * ),
10008 * @OA\Response(
10009 * response="400",
10010 * ref="#/components/responses/badrequest"
10011 * ),
10012 * @OA\Response(
10013 * response="401",
10014 * ref="#/components/responses/unauthorized"
10015 * ),
10016 * security={{"openemr_auth":{}}}
10019 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10020 $getParams = $request->getQueryParams();
10021 if ($request->isPatientRequest()) {
10022 // only allow access to data of binded patient
10023 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10024 } else {
10025 RestConfig::authorization_check("patients", "med");
10026 $return = (new FhirObservationRestController())->getAll($getParams);
10028 RestConfig::apiLog($return);
10029 return $return;
10033 * @OA\Get(
10034 * path="/fhir/Observation/{uuid}",
10035 * description="Returns a single Observation resource.",
10036 * tags={"fhir"},
10037 * @OA\Parameter(
10038 * name="uuid",
10039 * in="path",
10040 * description="The uuid for the Observation resource.",
10041 * required=true,
10042 * @OA\Schema(
10043 * type="string"
10045 * ),
10046 * @OA\Response(
10047 * response="200",
10048 * description="Standard Response",
10049 * @OA\MediaType(
10050 * mediaType="application/json",
10051 * @OA\Schema(
10052 * @OA\Property(
10053 * property="json object",
10054 * description="FHIR Json object.",
10055 * type="object"
10056 * ),
10057 * example={
10058 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10059 * "meta": {
10060 * "versionId": "1",
10061 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10062 * },
10063 * "resourceType": "Observation",
10064 * "status": "final",
10065 * "category": {
10067 * "coding": {
10069 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10070 * "code": "vital-signs"
10074 * },
10075 * "code": {
10076 * "coding": {
10078 * "system": "http://loinc.org",
10079 * "code": "85354-9",
10080 * "display": "Blood pressure systolic and diastolic"
10083 * },
10084 * "subject": {
10085 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10086 * "type": "Patient"
10087 * },
10088 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10089 * "component": {
10091 * "code": {
10092 * "coding": {
10094 * "system": "http://loinc.org",
10095 * "code": "8480-6",
10096 * "display": "Systolic blood pressure"
10099 * },
10100 * "valueQuantity": {
10101 * "value": 122,
10102 * "unit": "mm[Hg]",
10103 * "system": "http://unitsofmeasure.org",
10104 * "code": "mm[Hg]"
10106 * },
10108 * "code": {
10109 * "coding": {
10111 * "system": "http://loinc.org",
10112 * "code": "8462-4",
10113 * "display": "Diastolic blood pressure"
10116 * },
10117 * "valueQuantity": {
10118 * "value": 77,
10119 * "unit": "mm[Hg]",
10120 * "system": "http://unitsofmeasure.org",
10121 * "code": "mm[Hg]"
10128 * ),
10129 * @OA\Response(
10130 * response="400",
10131 * ref="#/components/responses/badrequest"
10132 * ),
10133 * @OA\Response(
10134 * response="401",
10135 * ref="#/components/responses/unauthorized"
10136 * ),
10137 * @OA\Response(
10138 * response="404",
10139 * ref="#/components/responses/uuidnotfound"
10140 * ),
10141 * security={{"openemr_auth":{}}}
10144 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10145 if ($request->isPatientRequest()) {
10146 // only allow access to data of binded patient
10147 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10148 } else {
10149 RestConfig::authorization_check("patients", "med");
10150 $return = (new FhirObservationRestController())->getOne($uuid);
10152 RestConfig::apiLog($return);
10153 return $return;
10157 * @OA\Get(
10158 * path="/fhir/Organization",
10159 * description="Returns a list of Organization resources.",
10160 * tags={"fhir"},
10161 * @OA\Parameter(
10162 * name="_id",
10163 * in="query",
10164 * description="The uuid for the Organization resource.",
10165 * required=false,
10166 * @OA\Schema(
10167 * type="string"
10169 * ),
10170 * @OA\Parameter(
10171 * name="name",
10172 * in="query",
10173 * description="The name of the Organization resource.",
10174 * required=false,
10175 * @OA\Schema(
10176 * type="string"
10178 * ),
10179 * @OA\Parameter(
10180 * name="email",
10181 * in="query",
10182 * description="The email of the Organization resource.",
10183 * required=false,
10184 * @OA\Schema(
10185 * type="string"
10187 * ),
10188 * @OA\Parameter(
10189 * name="phone",
10190 * in="query",
10191 * description="The phone of the Organization resource.",
10192 * required=false,
10193 * @OA\Schema(
10194 * type="string"
10196 * ),
10197 * @OA\Parameter(
10198 * name="telecom",
10199 * in="query",
10200 * description="The telecom of the Organization resource.",
10201 * required=false,
10202 * @OA\Schema(
10203 * type="string"
10205 * ),
10206 * @OA\Parameter(
10207 * name="address",
10208 * in="query",
10209 * description="The address of the Organization resource.",
10210 * required=false,
10211 * @OA\Schema(
10212 * type="string"
10214 * ),
10215 * @OA\Parameter(
10216 * name="address-city",
10217 * in="query",
10218 * description="The address-city of the Organization resource.",
10219 * required=false,
10220 * @OA\Schema(
10221 * type="string"
10223 * ),
10224 * @OA\Parameter(
10225 * name="address-postalcode",
10226 * in="query",
10227 * description="The address-postalcode of the Organization resource.",
10228 * required=false,
10229 * @OA\Schema(
10230 * type="string"
10232 * ),
10233 * @OA\Parameter(
10234 * name="address-state",
10235 * in="query",
10236 * description="The address-state of the Organization resource.",
10237 * required=false,
10238 * @OA\Schema(
10239 * type="string"
10241 * ),
10242 * @OA\Response(
10243 * response="200",
10244 * description="Standard Response",
10245 * @OA\MediaType(
10246 * mediaType="application/json",
10247 * @OA\Schema(
10248 * @OA\Property(
10249 * property="json object",
10250 * description="FHIR Json object.",
10251 * type="object"
10252 * ),
10253 * example={
10254 * "meta": {
10255 * "lastUpdated": "2021-09-14T09:13:51"
10256 * },
10257 * "resourceType": "Bundle",
10258 * "type": "collection",
10259 * "total": 0,
10260 * "link": {
10262 * "relation": "self",
10263 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10269 * ),
10270 * @OA\Response(
10271 * response="400",
10272 * ref="#/components/responses/badrequest"
10273 * ),
10274 * @OA\Response(
10275 * response="401",
10276 * ref="#/components/responses/unauthorized"
10277 * ),
10278 * security={{"openemr_auth":{}}}
10281 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10282 if (!$request->isPatientRequest()) {
10283 RestConfig::authorization_check("admin", "users");
10285 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10286 RestConfig::apiLog($return);
10287 return $return;
10291 * @OA\Get(
10292 * path="/fhir/Organization/{uuid}",
10293 * description="Returns a single Organization resource.",
10294 * tags={"fhir"},
10295 * @OA\Parameter(
10296 * name="uuid",
10297 * in="path",
10298 * description="The uuid for the Organization resource.",
10299 * required=true,
10300 * @OA\Schema(
10301 * type="string"
10303 * ),
10304 * @OA\Response(
10305 * response="200",
10306 * description="Standard Response",
10307 * @OA\MediaType(
10308 * mediaType="application/json",
10309 * @OA\Schema(
10310 * @OA\Property(
10311 * property="json object",
10312 * description="FHIR Json object.",
10313 * type="object"
10314 * ),
10315 * example={
10316 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10317 * "meta": {
10318 * "versionId": "1",
10319 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10320 * },
10321 * "resourceType": "Organization",
10322 * "text": {
10323 * "status": "generated",
10324 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10325 * },
10326 * "identifier": {
10328 * "system": "http://hl7.org/fhir/sid/us-npi",
10329 * "value": "1234567890"
10331 * },
10332 * "active": true,
10333 * "type": {
10335 * "coding": {
10337 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10338 * "code": "prov",
10339 * "display": "Healthcare Provider"
10343 * },
10344 * "name": "Your Clinic Name Here",
10345 * "telecom": {
10347 * "system": "phone",
10348 * "value": "000-000-0000",
10349 * "use": "work"
10350 * },
10352 * "system": "fax",
10353 * "value": "000-000-0000",
10354 * "use": "work"
10356 * },
10357 * "address": {
10358 * null
10363 * ),
10364 * @OA\Response(
10365 * response="400",
10366 * ref="#/components/responses/badrequest"
10367 * ),
10368 * @OA\Response(
10369 * response="401",
10370 * ref="#/components/responses/unauthorized"
10371 * ),
10372 * @OA\Response(
10373 * response="404",
10374 * ref="#/components/responses/uuidnotfound"
10375 * ),
10376 * security={{"openemr_auth":{}}}
10379 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10380 $patientUUID = null;
10381 if (!$request->isPatientRequest()) {
10382 RestConfig::authorization_check("admin", "users");
10383 } else {
10384 $patientUUID = $request->getPatientUUIDString();
10386 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10388 RestConfig::apiLog($return);
10389 return $return;
10393 * @OA\Post(
10394 * path="/fhir/Organization",
10395 * description="Adds a Organization resource.",
10396 * tags={"fhir"},
10397 * @OA\RequestBody(
10398 * required=true,
10399 * @OA\MediaType(
10400 * mediaType="application/json",
10401 * @OA\Schema(
10402 * description="The json object for the Organization resource.",
10403 * type="object"
10404 * ),
10405 * example={
10406 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10407 * "meta": {
10408 * "versionId": "1",
10409 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10410 * },
10411 * "resourceType": "Organization",
10412 * "text": {
10413 * "status": "generated",
10414 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10415 * },
10416 * "identifier": {
10418 * "system": "http://hl7.org/fhir/sid/us-npi",
10419 * "value": "1234567890"
10421 * },
10422 * "active": true,
10423 * "type": {
10425 * "coding": {
10427 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10428 * "code": "prov",
10429 * "display": "Healthcare Provider"
10433 * },
10434 * "name": "Your Clinic Name Here Hey",
10435 * "telecom": {
10437 * "system": "phone",
10438 * "value": "000-000-0000",
10439 * "use": "work"
10440 * },
10442 * "system": "fax",
10443 * "value": "000-000-0000",
10444 * "use": "work"
10446 * },
10447 * "address": {
10448 * null
10452 * ),
10453 * @OA\Response(
10454 * response="200",
10455 * description="Standard Response",
10456 * @OA\MediaType(
10457 * mediaType="application/json",
10458 * @OA\Schema(
10459 * @OA\Property(
10460 * property="json object",
10461 * description="FHIR Json object.",
10462 * type="object"
10463 * ),
10464 * example={
10465 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10466 * "meta": {
10467 * "versionId": "1",
10468 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10469 * },
10470 * "resourceType": "Organization",
10471 * "text": {
10472 * "status": "generated",
10473 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10474 * },
10475 * "identifier": {
10477 * "system": "http://hl7.org/fhir/sid/us-npi",
10478 * "value": "1234567890"
10480 * },
10481 * "active": true,
10482 * "type": {
10484 * "coding": {
10486 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10487 * "code": "prov",
10488 * "display": "Healthcare Provider"
10492 * },
10493 * "name": "Your Clinic Name Here Now",
10494 * "telecom": {
10496 * "system": "phone",
10497 * "value": "000-000-0000",
10498 * "use": "work"
10499 * },
10501 * "system": "fax",
10502 * "value": "000-000-0000",
10503 * "use": "work"
10505 * },
10506 * "address": {
10507 * null
10512 * ),
10513 * @OA\Response(
10514 * response="400",
10515 * ref="#/components/responses/badrequest"
10516 * ),
10517 * @OA\Response(
10518 * response="401",
10519 * ref="#/components/responses/unauthorized"
10520 * ),
10521 * security={{"openemr_auth":{}}}
10524 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10525 RestConfig::authorization_check("admin", "super");
10526 $data = (array) (json_decode(file_get_contents("php://input"), true));
10527 $return = (new FhirOrganizationRestController())->post($data);
10528 RestConfig::apiLog($return, $data);
10529 return $return;
10533 * @OA\Put(
10534 * path="/fhir/Organization/{uuid}",
10535 * description="Modifies a Organization resource.",
10536 * tags={"fhir"},
10537 * @OA\Parameter(
10538 * name="uuid",
10539 * in="path",
10540 * description="The uuid for the organization.",
10541 * required=true,
10542 * @OA\Schema(
10543 * type="string"
10545 * ),
10546 * @OA\RequestBody(
10547 * required=true,
10548 * @OA\MediaType(
10549 * mediaType="application/json",
10550 * @OA\Schema(
10551 * description="The json object for the Organization resource.",
10552 * type="object"
10553 * ),
10554 * example={
10555 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10556 * "meta": {
10557 * "versionId": "1",
10558 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10559 * },
10560 * "resourceType": "Organization",
10561 * "text": {
10562 * "status": "generated",
10563 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10564 * },
10565 * "identifier": {
10567 * "system": "http://hl7.org/fhir/sid/us-npi",
10568 * "value": "1234567890"
10570 * },
10571 * "active": true,
10572 * "type": {
10574 * "coding": {
10576 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10577 * "code": "prov",
10578 * "display": "Healthcare Provider"
10582 * },
10583 * "name": "Your Clinic Name Here",
10584 * "telecom": {
10586 * "system": "phone",
10587 * "value": "000-000-0000",
10588 * "use": "work"
10589 * },
10591 * "system": "fax",
10592 * "value": "000-000-0000",
10593 * "use": "work"
10595 * },
10596 * "address": {
10597 * null
10601 * ),
10602 * @OA\Response(
10603 * response="201",
10604 * description="Standard Response",
10605 * @OA\MediaType(
10606 * mediaType="application/json",
10607 * @OA\Schema(
10608 * example={
10609 * "id": 14,
10610 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
10614 * ),
10615 * @OA\Response(
10616 * response="400",
10617 * ref="#/components/responses/badrequest"
10618 * ),
10619 * @OA\Response(
10620 * response="401",
10621 * ref="#/components/responses/unauthorized"
10622 * ),
10623 * security={{"openemr_auth":{}}}
10626 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10627 RestConfig::authorization_check("admin", "super");
10628 $data = (array) (json_decode(file_get_contents("php://input"), true));
10629 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
10630 RestConfig::apiLog($return, $data);
10631 return $return;
10635 * @OA\Post(
10636 * path="/fhir/Patient",
10637 * description="Adds a Patient resource.",
10638 * tags={"fhir"},
10639 * @OA\RequestBody(
10640 * required=true,
10641 * @OA\MediaType(
10642 * mediaType="application/json",
10643 * @OA\Schema(
10644 * description="The json object for the Patient resource.",
10645 * type="object"
10646 * ),
10647 * example={
10648 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10649 * "meta": {
10650 * "versionId": "1",
10651 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10652 * },
10653 * "resourceType": "Patient",
10654 * "text": {
10655 * "status": "generated",
10656 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10657 * },
10658 * "extension": {
10660 * "valueCode": "F",
10661 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10662 * },
10664 * "extension": {
10666 * "valueCoding": {
10667 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10668 * "code": "UNK",
10669 * "display": "Unknown"
10670 * },
10671 * "url": "ombCategory"
10672 * },
10674 * "valueString": "Unknown",
10675 * "url": "text"
10677 * },
10678 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10680 * },
10681 * "identifier": {
10683 * "use": "official",
10684 * "type": {
10685 * "coding": {
10687 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10688 * "code": "PT"
10691 * },
10692 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10693 * "value": "1"
10695 * },
10696 * "active": true,
10697 * "name": {
10699 * "use": "official",
10700 * "family": "Smith",
10701 * "given": {
10702 * "Brenda"
10705 * },
10706 * "gender": "female",
10707 * "birthDate": "2017-03-10",
10708 * "communication": {
10710 * "language": {
10711 * "coding": {
10713 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10714 * "code": "unknown",
10715 * "display": "Unknown"
10723 * ),
10724 * @OA\Response(
10725 * response="200",
10726 * description="Standard Response",
10727 * @OA\MediaType(
10728 * mediaType="application/json",
10729 * @OA\Schema(
10730 * @OA\Property(
10731 * property="json object",
10732 * description="FHIR Json object.",
10733 * type="object"
10734 * ),
10735 * example={
10736 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10737 * "meta": {
10738 * "versionId": "1",
10739 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10740 * },
10741 * "resourceType": "Patient",
10742 * "text": {
10743 * "status": "generated",
10744 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10745 * },
10746 * "extension": {
10748 * "valueCode": "F",
10749 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10750 * },
10752 * "extension": {
10754 * "valueCoding": {
10755 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10756 * "code": "UNK",
10757 * "display": "Unknown"
10758 * },
10759 * "url": "ombCategory"
10760 * },
10762 * "valueString": "Unknown",
10763 * "url": "text"
10765 * },
10766 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10768 * },
10769 * "identifier": {
10771 * "use": "official",
10772 * "type": {
10773 * "coding": {
10775 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10776 * "code": "PT"
10779 * },
10780 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10781 * "value": "1"
10783 * },
10784 * "active": true,
10785 * "name": {
10787 * "use": "official",
10788 * "family": "Smith",
10789 * "given": {
10790 * "Brenda"
10793 * },
10794 * "gender": "female",
10795 * "birthDate": "2017-03-10",
10796 * "communication": {
10798 * "language": {
10799 * "coding": {
10801 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10802 * "code": "unknown",
10803 * "display": "Unknown"
10812 * ),
10813 * @OA\Response(
10814 * response="400",
10815 * ref="#/components/responses/badrequest"
10816 * ),
10817 * @OA\Response(
10818 * response="401",
10819 * ref="#/components/responses/unauthorized"
10820 * ),
10821 * security={{"openemr_auth":{}}}
10824 "POST /fhir/Patient" => function (HttpRestRequest $request) {
10825 RestConfig::authorization_check("patients", "demo");
10826 $data = (array) (json_decode(file_get_contents("php://input"), true));
10827 $return = (new FhirPatientRestController())->post($data);
10828 RestConfig::apiLog($return, $data);
10829 return $return;
10833 * @OA\Put(
10834 * path="/fhir/Patient/{uuid}",
10835 * description="Modifies a Patient resource.",
10836 * tags={"fhir"},
10837 * @OA\Parameter(
10838 * name="uuid",
10839 * in="path",
10840 * description="The uuid for the Patient resource.",
10841 * required=true,
10842 * @OA\Schema(
10843 * type="string"
10845 * ),
10846 * @OA\RequestBody(
10847 * required=true,
10848 * @OA\MediaType(
10849 * mediaType="application/json",
10850 * @OA\Schema(
10851 * description="The json object for the Patient resource.",
10852 * type="object"
10853 * ),
10854 * example={
10855 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10856 * "meta": {
10857 * "versionId": "1",
10858 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10859 * },
10860 * "resourceType": "Patient",
10861 * "text": {
10862 * "status": "generated",
10863 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10864 * },
10865 * "extension": {
10867 * "valueCode": "F",
10868 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10869 * },
10871 * "extension": {
10873 * "valueCoding": {
10874 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10875 * "code": "UNK",
10876 * "display": "Unknown"
10877 * },
10878 * "url": "ombCategory"
10879 * },
10881 * "valueString": "Unknown",
10882 * "url": "text"
10884 * },
10885 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10887 * },
10888 * "identifier": {
10890 * "use": "official",
10891 * "type": {
10892 * "coding": {
10894 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10895 * "code": "PT"
10898 * },
10899 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10900 * "value": "1"
10902 * },
10903 * "active": true,
10904 * "name": {
10906 * "use": "official",
10907 * "family": "Smith",
10908 * "given": {
10909 * "Brenda"
10912 * },
10913 * "gender": "female",
10914 * "birthDate": "2017-03-10",
10915 * "communication": {
10917 * "language": {
10918 * "coding": {
10920 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10921 * "code": "unknown",
10922 * "display": "Unknown"
10930 * ),
10931 * @OA\Response(
10932 * response="201",
10933 * description="Standard Response",
10934 * @OA\MediaType(
10935 * mediaType="application/json",
10936 * @OA\Schema(
10937 * example={
10938 * "id": 2,
10939 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
10943 * ),
10944 * @OA\Response(
10945 * response="400",
10946 * ref="#/components/responses/badrequest"
10947 * ),
10948 * @OA\Response(
10949 * response="401",
10950 * ref="#/components/responses/unauthorized"
10951 * ),
10952 * security={{"openemr_auth":{}}}
10955 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10956 RestConfig::authorization_check("patients", "demo");
10957 $data = (array) (json_decode(file_get_contents("php://input"), true));
10958 $return = (new FhirPatientRestController())->put($uuid, $data);
10959 RestConfig::apiLog($return, $data);
10960 return $return;
10964 * @OA\Get(
10965 * path="/fhir/Patient",
10966 * description="Returns a list of Patient resources.",
10967 * tags={"fhir"},
10968 * @OA\Parameter(
10969 * name="_id",
10970 * in="query",
10971 * description="The uuid for the Patient resource.",
10972 * required=false,
10973 * @OA\Schema(
10974 * type="string"
10976 * ),
10977 * @OA\Parameter(
10978 * name="identifier",
10979 * in="query",
10980 * description="The identifier of the Patient resource.",
10981 * required=false,
10982 * @OA\Schema(
10983 * type="string"
10985 * ),
10986 * @OA\Parameter(
10987 * name="name",
10988 * in="query",
10989 * description="The name of the Patient resource.",
10990 * required=false,
10991 * @OA\Schema(
10992 * type="string"
10994 * ),
10995 * @OA\Parameter(
10996 * name="birthdate",
10997 * in="query",
10998 * description="The birthdate of the Patient resource.",
10999 * required=false,
11000 * @OA\Schema(
11001 * type="string"
11003 * ),
11004 * @OA\Parameter(
11005 * name="gender",
11006 * in="query",
11007 * description="The gender of the Patient resource.",
11008 * required=false,
11009 * @OA\Schema(
11010 * type="string"
11012 * ),
11013 * @OA\Parameter(
11014 * name="address",
11015 * in="query",
11016 * description="The address of the Patient resource.",
11017 * required=false,
11018 * @OA\Schema(
11019 * type="string"
11021 * ),
11022 * @OA\Parameter(
11023 * name="address-city",
11024 * in="query",
11025 * description="The address-city of the Patient resource.",
11026 * required=false,
11027 * @OA\Schema(
11028 * type="string"
11030 * ),
11031 * @OA\Parameter(
11032 * name="address-postalcode",
11033 * in="query",
11034 * description="The address-postalcode of the Patient resource.",
11035 * required=false,
11036 * @OA\Schema(
11037 * type="string"
11039 * ),
11040 * @OA\Parameter(
11041 * name="address-state",
11042 * in="query",
11043 * description="The address-state of the Patient resource.",
11044 * required=false,
11045 * @OA\Schema(
11046 * type="string"
11048 * ),
11049 * @OA\Parameter(
11050 * name="email",
11051 * in="query",
11052 * description="The email of the Patient resource.",
11053 * required=false,
11054 * @OA\Schema(
11055 * type="string"
11057 * ),
11058 * @OA\Parameter(
11059 * name="family",
11060 * in="query",
11061 * description="The family name of the Patient resource.",
11062 * required=false,
11063 * @OA\Schema(
11064 * type="string"
11066 * ),
11067 * @OA\Parameter(
11068 * name="given",
11069 * in="query",
11070 * description="The given name of the Patient resource.",
11071 * required=false,
11072 * @OA\Schema(
11073 * type="string"
11075 * ),
11076 * @OA\Parameter(
11077 * name="phone",
11078 * in="query",
11079 * description="The phone number of the Patient resource.",
11080 * required=false,
11081 * @OA\Schema(
11082 * type="string"
11084 * ),
11085 * @OA\Parameter(
11086 * name="telecom",
11087 * in="query",
11088 * description="The fax number of the Patient resource.",
11089 * required=false,
11090 * @OA\Schema(
11091 * type="string"
11093 * ),
11094 * @OA\Response(
11095 * response="200",
11096 * description="Standard Response",
11097 * @OA\MediaType(
11098 * mediaType="application/json",
11099 * @OA\Schema(
11100 * @OA\Property(
11101 * property="json object",
11102 * description="FHIR Json object.",
11103 * type="object"
11104 * ),
11105 * example={
11106 * "meta": {
11107 * "lastUpdated": "2021-09-14T09:13:51"
11108 * },
11109 * "resourceType": "Bundle",
11110 * "type": "collection",
11111 * "total": 0,
11112 * "link": {
11114 * "relation": "self",
11115 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11121 * ),
11122 * @OA\Response(
11123 * response="400",
11124 * ref="#/components/responses/badrequest"
11125 * ),
11126 * @OA\Response(
11127 * response="401",
11128 * ref="#/components/responses/unauthorized"
11129 * ),
11130 * security={{"openemr_auth":{}}}
11133 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11134 $params = $request->getQueryParams();
11135 if ($request->isPatientRequest()) {
11136 // only allow access to data of binded patient
11137 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11138 // need to use getAll rather than getOne)
11139 $params['_id'] = $request->getPatientUUIDString();
11140 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11141 } else {
11142 RestConfig::authorization_check("patients", "demo");
11143 $return = (new FhirPatientRestController())->getAll($params);
11145 RestConfig::apiLog($return);
11146 return $return;
11150 * @OA\Get(
11151 * path="/fhir/Patient/$export",
11152 * 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>",
11153 * tags={"fhir"},
11154 * @OA\Response(
11155 * response="200",
11156 * 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>"
11157 * ),
11158 * @OA\Response(
11159 * response="400",
11160 * ref="#/components/responses/badrequest"
11161 * ),
11162 * @OA\Response(
11163 * response="401",
11164 * ref="#/components/responses/unauthorized"
11165 * ),
11166 * security={{"openemr_auth":{}}}
11169 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11170 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11171 RestConfig::authorization_check("admin", "users");
11172 $fhirExportService = new FhirOperationExportRestController($request);
11173 $return = $fhirExportService->processExport(
11174 $request->getQueryParams(),
11175 'Patient',
11176 $request->getHeader('Accept'),
11177 $request->getHeader('Prefer')
11179 RestConfig::apiLog($return);
11180 return $return;
11184 * @OA\Get(
11185 * path="/fhir/Patient/{uuid}",
11186 * description="Returns a single Patient resource.",
11187 * tags={"fhir"},
11188 * @OA\Parameter(
11189 * name="uuid",
11190 * in="path",
11191 * description="The uuid for the Patient resource.",
11192 * required=true,
11193 * @OA\Schema(
11194 * type="string"
11196 * ),
11197 * @OA\Response(
11198 * response="200",
11199 * description="Standard Response",
11200 * @OA\MediaType(
11201 * mediaType="application/json",
11202 * @OA\Schema(
11203 * @OA\Property(
11204 * property="json object",
11205 * description="FHIR Json object.",
11206 * type="object"
11207 * ),
11208 * example={
11209 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11210 * "meta": {
11211 * "versionId": "1",
11212 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11213 * },
11214 * "resourceType": "Patient",
11215 * "text": {
11216 * "status": "generated",
11217 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11218 * },
11219 * "extension": {
11221 * "valueCode": "F",
11222 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11223 * },
11225 * "extension": {
11227 * "valueCoding": {
11228 * "system": "urn:oid:2.16.840.1.113883.6.238",
11229 * "code": "1006-6",
11230 * "display": "Abenaki"
11231 * },
11232 * "url": "ombCategory"
11233 * },
11235 * "valueString": "Abenaki",
11236 * "url": "text"
11238 * },
11239 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11240 * },
11242 * "extension": {
11244 * "valueString": "Declined To Specify",
11245 * "url": "text"
11247 * },
11248 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11250 * },
11251 * "identifier": {
11253 * "use": "official",
11254 * "type": {
11255 * "coding": {
11257 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11258 * "code": "PT"
11261 * },
11262 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11263 * "value": "1"
11265 * },
11266 * "active": true,
11267 * "name": {
11269 * "use": "official",
11270 * "family": "Von197",
11271 * "given": {
11272 * "Aurore252"
11275 * },
11276 * "gender": "female",
11277 * "birthDate": "1970-07-03",
11278 * "address": {
11280 * "line": {
11281 * "245 Crona Wall"
11282 * },
11283 * "city": "Boston",
11284 * "state": "Massachusetts",
11285 * "postalCode": "02215",
11286 * "period": {
11287 * "start": "2020-09-21T17:08:03.532+00:00"
11290 * },
11291 * "communication": {
11293 * "language": {
11294 * "coding": {
11296 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11297 * "code": "unknown",
11298 * "display": "Unknown"
11307 * ),
11308 * @OA\Response(
11309 * response="400",
11310 * ref="#/components/responses/badrequest"
11311 * ),
11312 * @OA\Response(
11313 * response="401",
11314 * ref="#/components/responses/unauthorized"
11315 * ),
11316 * @OA\Response(
11317 * response="404",
11318 * ref="#/components/responses/uuidnotfound"
11319 * ),
11320 * security={{"openemr_auth":{}}}
11323 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11324 if ($request->isPatientRequest()) {
11325 // only allow access to data of binded patient
11326 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11327 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11329 $uuid = $request->getPatientUUIDString();
11330 } else {
11331 RestConfig::authorization_check("patients", "demo");
11333 $return = (new FhirPatientRestController())->getOne($uuid);
11334 RestConfig::apiLog($return);
11335 return $return;
11339 * @OA\Get(
11340 * path="/fhir/Person",
11341 * description="Returns a list of Person resources.",
11342 * tags={"fhir"},
11343 * @OA\Parameter(
11344 * name="name",
11345 * in="query",
11346 * description="The name of the Person resource.",
11347 * required=false,
11348 * @OA\Schema(
11349 * type="string"
11351 * ),
11352 * @OA\Parameter(
11353 * name="active",
11354 * in="query",
11355 * description="The active status of the Person resource.",
11356 * required=false,
11357 * @OA\Schema(
11358 * type="string"
11360 * ),
11361 * @OA\Parameter(
11362 * name="address",
11363 * in="query",
11364 * description="The address of the Person resource.",
11365 * required=false,
11366 * @OA\Schema(
11367 * type="string"
11369 * ),
11370 * @OA\Parameter(
11371 * name="address-city",
11372 * in="query",
11373 * description="The address-city of the Person resource.",
11374 * required=false,
11375 * @OA\Schema(
11376 * type="string"
11378 * ),
11379 * @OA\Parameter(
11380 * name="address-postalcode",
11381 * in="query",
11382 * description="The address-postalcode of the Person resource.",
11383 * required=false,
11384 * @OA\Schema(
11385 * type="string"
11387 * ),
11388 * @OA\Parameter(
11389 * name="address-state",
11390 * in="query",
11391 * description="The address-state of the Person resource.",
11392 * required=false,
11393 * @OA\Schema(
11394 * type="string"
11396 * ),
11397 * @OA\Parameter(
11398 * name="email",
11399 * in="query",
11400 * description="The email of the Person resource.",
11401 * required=false,
11402 * @OA\Schema(
11403 * type="string"
11405 * ),
11406 * @OA\Parameter(
11407 * name="family",
11408 * in="query",
11409 * description="The family name of the Person resource.",
11410 * required=false,
11411 * @OA\Schema(
11412 * type="string"
11414 * ),
11415 * @OA\Parameter(
11416 * name="given",
11417 * in="query",
11418 * description="The given name of the Person resource.",
11419 * required=false,
11420 * @OA\Schema(
11421 * type="string"
11423 * ),
11424 * @OA\Parameter(
11425 * name="phone",
11426 * in="query",
11427 * description="The phone number of the Person resource.",
11428 * required=false,
11429 * @OA\Schema(
11430 * type="string"
11432 * ),
11433 * @OA\Parameter(
11434 * name="telecom",
11435 * in="query",
11436 * description="The fax number of the Person resource.",
11437 * required=false,
11438 * @OA\Schema(
11439 * type="string"
11441 * ),
11442 * @OA\Response(
11443 * response="200",
11444 * description="Standard Response",
11445 * @OA\MediaType(
11446 * mediaType="application/json",
11447 * @OA\Schema(
11448 * @OA\Property(
11449 * property="json object",
11450 * description="FHIR Json object.",
11451 * type="object"
11452 * ),
11453 * example={
11454 * "meta": {
11455 * "lastUpdated": "2021-09-14T09:13:51"
11456 * },
11457 * "resourceType": "Bundle",
11458 * "type": "collection",
11459 * "total": 0,
11460 * "link": {
11462 * "relation": "self",
11463 * "url": "https://localhost:9300/apis/default/fhir/Person"
11469 * ),
11470 * @OA\Response(
11471 * response="400",
11472 * ref="#/components/responses/badrequest"
11473 * ),
11474 * @OA\Response(
11475 * response="401",
11476 * ref="#/components/responses/unauthorized"
11477 * ),
11478 * security={{"openemr_auth":{}}}
11481 "GET /fhir/Person" => function (HttpRestRequest $request) {
11482 RestConfig::authorization_check("admin", "users");
11483 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11484 RestConfig::apiLog($return);
11485 return $return;
11489 * @OA\Get(
11490 * path="/fhir/Person/{uuid}",
11491 * description="Returns a single Person resource.",
11492 * tags={"fhir"},
11493 * @OA\Parameter(
11494 * name="uuid",
11495 * in="path",
11496 * description="The uuid for the Person resource.",
11497 * required=true,
11498 * @OA\Schema(
11499 * type="string"
11501 * ),
11502 * @OA\Response(
11503 * response="200",
11504 * description="Standard Response",
11505 * @OA\MediaType(
11506 * mediaType="application/json",
11507 * @OA\Schema(
11508 * @OA\Property(
11509 * property="json object",
11510 * description="FHIR Json object.",
11511 * type="object"
11512 * ),
11513 * example={
11514 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11515 * "meta": {
11516 * "versionId": "1",
11517 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11518 * },
11519 * "resourceType": "Person",
11520 * "text": {
11521 * "status": "generated",
11522 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11523 * },
11524 * "name": {
11526 * "use": "official",
11527 * "family": "Administrator",
11528 * "given": {
11529 * "Administrator",
11530 * "Larry"
11533 * },
11534 * "telecom": {
11536 * "system": "phone",
11537 * "value": "1234567890",
11538 * "use": "home"
11539 * },
11541 * "system": "phone",
11542 * "value": "1234567890",
11543 * "use": "work"
11544 * },
11546 * "system": "phone",
11547 * "value": "1234567890",
11548 * "use": "mobile"
11549 * },
11551 * "system": "email",
11552 * "value": "hey@hey.com",
11553 * "use": "home"
11555 * },
11556 * "address": {
11558 * "line": {
11559 * "123 Lane Street"
11560 * },
11561 * "city": "Bellevue",
11562 * "state": "WA",
11563 * "period": {
11564 * "start": "2021-04-13T08:57:32.146+00:00"
11567 * },
11568 * "active": true
11572 * ),
11573 * @OA\Response(
11574 * response="400",
11575 * ref="#/components/responses/badrequest"
11576 * ),
11577 * @OA\Response(
11578 * response="401",
11579 * ref="#/components/responses/unauthorized"
11580 * ),
11581 * @OA\Response(
11582 * response="404",
11583 * ref="#/components/responses/uuidnotfound"
11584 * ),
11585 * security={{"openemr_auth":{}}}
11588 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11589 // if the api user is requesting their own user we need to let it through
11590 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11591 // for the currently logged in user
11592 if ($request->getRequestUserUUIDString() == $uuid) {
11593 $return = (new FhirPersonRestController())->getOne($uuid);
11594 } else if (!$request->isPatientRequest()) {
11595 // not a patient ,make sure we have access to the users ACL
11596 RestConfig::authorization_check("admin", "users");
11597 $return = (new FhirPersonRestController())->getOne($uuid);
11598 } else {
11599 // if we are a patient bound request we need to make sure we are only bound to the patient
11600 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
11603 RestConfig::apiLog($return);
11604 return $return;
11608 * @OA\Get(
11609 * path="/fhir/Practitioner",
11610 * description="Returns a list of Practitioner resources.",
11611 * tags={"fhir"},
11612 * @OA\Parameter(
11613 * name="_id",
11614 * in="query",
11615 * description="The uuid for the Practitioner resource.",
11616 * required=false,
11617 * @OA\Schema(
11618 * type="string"
11620 * ),
11621 * @OA\Parameter(
11622 * name="name",
11623 * in="query",
11624 * description="The name of the Practitioner resource.",
11625 * required=false,
11626 * @OA\Schema(
11627 * type="string"
11629 * ),
11630 * @OA\Parameter(
11631 * name="active",
11632 * in="query",
11633 * description="The active status of the Practitioner resource.",
11634 * required=false,
11635 * @OA\Schema(
11636 * type="string"
11638 * ),
11639 * @OA\Parameter(
11640 * name="address",
11641 * in="query",
11642 * description="The address of the Practitioner resource.",
11643 * required=false,
11644 * @OA\Schema(
11645 * type="string"
11647 * ),
11648 * @OA\Parameter(
11649 * name="address-city",
11650 * in="query",
11651 * description="The address-city of the Practitioner resource.",
11652 * required=false,
11653 * @OA\Schema(
11654 * type="string"
11656 * ),
11657 * @OA\Parameter(
11658 * name="address-postalcode",
11659 * in="query",
11660 * description="The address-postalcode of the Practitioner resource.",
11661 * required=false,
11662 * @OA\Schema(
11663 * type="string"
11665 * ),
11666 * @OA\Parameter(
11667 * name="address-state",
11668 * in="query",
11669 * description="The address-state of the Practitioner resource.",
11670 * required=false,
11671 * @OA\Schema(
11672 * type="string"
11674 * ),
11675 * @OA\Parameter(
11676 * name="email",
11677 * in="query",
11678 * description="The email of the Practitioner resource.",
11679 * required=false,
11680 * @OA\Schema(
11681 * type="string"
11683 * ),
11684 * @OA\Parameter(
11685 * name="family",
11686 * in="query",
11687 * description="The family name of the Practitioner resource.",
11688 * required=false,
11689 * @OA\Schema(
11690 * type="string"
11692 * ),
11693 * @OA\Parameter(
11694 * name="given",
11695 * in="query",
11696 * description="The given name of the Practitioner resource.",
11697 * required=false,
11698 * @OA\Schema(
11699 * type="string"
11701 * ),
11702 * @OA\Parameter(
11703 * name="phone",
11704 * in="query",
11705 * description="The phone number of the Practitioner resource.",
11706 * required=false,
11707 * @OA\Schema(
11708 * type="string"
11710 * ),
11711 * @OA\Parameter(
11712 * name="telecom",
11713 * in="query",
11714 * description="The fax number of the Practitioner resource.",
11715 * required=false,
11716 * @OA\Schema(
11717 * type="string"
11719 * ),
11720 * @OA\Response(
11721 * response="200",
11722 * description="Standard Response",
11723 * @OA\MediaType(
11724 * mediaType="application/json",
11725 * @OA\Schema(
11726 * @OA\Property(
11727 * property="json object",
11728 * description="FHIR Json object.",
11729 * type="object"
11730 * ),
11731 * example={
11732 * "meta": {
11733 * "lastUpdated": "2021-09-14T09:13:51"
11734 * },
11735 * "resourceType": "Bundle",
11736 * "type": "collection",
11737 * "total": 0,
11738 * "link": {
11740 * "relation": "self",
11741 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
11747 * ),
11748 * @OA\Response(
11749 * response="400",
11750 * ref="#/components/responses/badrequest"
11751 * ),
11752 * @OA\Response(
11753 * response="401",
11754 * ref="#/components/responses/unauthorized"
11755 * ),
11756 * security={{"openemr_auth":{}}}
11759 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
11761 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11762 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11763 // I don't believe patients are assigned to a particular practitioner
11764 // should we allow just open api access to admin information? Should we restrict particular pieces
11765 // of data in the practitioner side (phone number, address information) based on a permission set?
11766 if (!$request->isPatientRequest()) {
11767 RestConfig::authorization_check("admin", "users");
11769 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
11770 RestConfig::apiLog($return);
11771 return $return;
11775 * @OA\Get(
11776 * path="/fhir/Practitioner/{uuid}",
11777 * description="Returns a single Practitioner resource.",
11778 * tags={"fhir"},
11779 * @OA\Parameter(
11780 * name="uuid",
11781 * in="path",
11782 * description="The uuid for the Practitioner resource.",
11783 * required=true,
11784 * @OA\Schema(
11785 * type="string"
11787 * ),
11788 * @OA\Response(
11789 * response="200",
11790 * description="Standard Response",
11791 * @OA\MediaType(
11792 * mediaType="application/json",
11793 * @OA\Schema(
11794 * @OA\Property(
11795 * property="json object",
11796 * description="FHIR Json object.",
11797 * type="object"
11798 * ),
11799 * example={
11800 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11801 * "meta": {
11802 * "versionId": "1",
11803 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11804 * },
11805 * "resourceType": "Practitioner",
11806 * "text": {
11807 * "status": "generated",
11808 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11809 * },
11810 * "identifier": {
11812 * "system": "http://hl7.org/fhir/sid/us-npi",
11813 * "value": "11223344554543"
11815 * },
11816 * "active": true,
11817 * "name": {
11819 * "use": "official",
11820 * "family": "Smith",
11821 * "given": {
11822 * "Billy"
11829 * ),
11830 * @OA\Response(
11831 * response="400",
11832 * ref="#/components/responses/badrequest"
11833 * ),
11834 * @OA\Response(
11835 * response="401",
11836 * ref="#/components/responses/unauthorized"
11837 * ),
11838 * @OA\Response(
11839 * response="404",
11840 * ref="#/components/responses/uuidnotfound"
11841 * ),
11842 * security={{"openemr_auth":{}}}
11845 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
11846 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11847 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11848 // I don't believe patients are assigned to a particular practitioner
11849 // should we allow just open api access to admin information? Should we restrict particular pieces
11850 // of data in the practitioner side (phone number, address information) based on a permission set?
11851 if (!$request->isPatientRequest()) {
11852 RestConfig::authorization_check("admin", "users");
11854 $return = (new FhirPractitionerRestController())->getOne($uuid);
11855 RestConfig::apiLog($return);
11856 return $return;
11860 * @OA\Post(
11861 * path="/fhir/Practitioner",
11862 * description="Adds a Practitioner resources.",
11863 * tags={"fhir"},
11864 * @OA\RequestBody(
11865 * required=true,
11866 * @OA\MediaType(
11867 * mediaType="application/json",
11868 * @OA\Schema(
11869 * description="The json object for the Practitioner resource.",
11870 * type="object"
11871 * ),
11872 * example={
11873 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11874 * "meta": {
11875 * "versionId": "1",
11876 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11877 * },
11878 * "resourceType": "Practitioner",
11879 * "text": {
11880 * "status": "generated",
11881 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11882 * },
11883 * "identifier": {
11885 * "system": "http://hl7.org/fhir/sid/us-npi",
11886 * "value": "11223344554543"
11888 * },
11889 * "active": true,
11890 * "name": {
11892 * "use": "official",
11893 * "family": "Smith",
11894 * "given": {
11895 * "Danny"
11901 * ),
11902 * @OA\Response(
11903 * response="200",
11904 * description="Standard Response",
11905 * @OA\MediaType(
11906 * mediaType="application/json",
11907 * @OA\Schema(
11908 * @OA\Property(
11909 * property="json object",
11910 * description="FHIR Json object.",
11911 * type="object"
11912 * ),
11913 * example={
11914 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11915 * "meta": {
11916 * "versionId": "1",
11917 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11918 * },
11919 * "resourceType": "Practitioner",
11920 * "text": {
11921 * "status": "generated",
11922 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11923 * },
11924 * "identifier": {
11926 * "system": "http://hl7.org/fhir/sid/us-npi",
11927 * "value": "11223344554543"
11929 * },
11930 * "active": true,
11931 * "name": {
11933 * "use": "official",
11934 * "family": "Smith",
11935 * "given": {
11936 * "Danny"
11943 * ),
11944 * @OA\Response(
11945 * response="400",
11946 * ref="#/components/responses/badrequest"
11947 * ),
11948 * @OA\Response(
11949 * response="401",
11950 * ref="#/components/responses/unauthorized"
11951 * ),
11952 * security={{"openemr_auth":{}}}
11955 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
11956 RestConfig::authorization_check("admin", "users");
11957 $data = (array) (json_decode(file_get_contents("php://input"), true));
11958 $return = (new FhirPractitionerRestController())->post($data);
11959 RestConfig::apiLog($return, $data);
11960 return $return;
11964 * @OA\Put(
11965 * path="/fhir/Practitioner/{uuid}",
11966 * description="Modify a Practitioner resource.",
11967 * tags={"fhir"},
11968 * @OA\Parameter(
11969 * name="uuid",
11970 * in="path",
11971 * description="The uuid for the Practitioner resource.",
11972 * required=true,
11973 * @OA\Schema(
11974 * type="string"
11976 * ),
11977 * @OA\RequestBody(
11978 * required=true,
11979 * @OA\MediaType(
11980 * mediaType="application/json",
11981 * @OA\Schema(
11982 * description="The json object for the Practitioner resource.",
11983 * type="object"
11984 * ),
11985 * example={
11986 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11987 * "meta": {
11988 * "versionId": "1",
11989 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11990 * },
11991 * "resourceType": "Practitioner",
11992 * "text": {
11993 * "status": "generated",
11994 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11995 * },
11996 * "identifier": {
11998 * "system": "http://hl7.org/fhir/sid/us-npi",
11999 * "value": "11223344554543"
12001 * },
12002 * "active": true,
12003 * "name": {
12005 * "use": "official",
12006 * "family": "Smith",
12007 * "given": {
12008 * "Billy"
12014 * ),
12015 * @OA\Response(
12016 * response="201",
12017 * description="Standard Response",
12018 * @OA\MediaType(
12019 * mediaType="application/json",
12020 * @OA\Schema(
12021 * example={
12022 * "id": 5,
12023 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12027 * ),
12028 * @OA\Response(
12029 * response="400",
12030 * ref="#/components/responses/badrequest"
12031 * ),
12032 * @OA\Response(
12033 * response="401",
12034 * ref="#/components/responses/unauthorized"
12035 * ),
12036 * security={{"openemr_auth":{}}}
12039 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12040 RestConfig::authorization_check("admin", "users");
12041 $data = (array) (json_decode(file_get_contents("php://input"), true));
12042 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12043 RestConfig::apiLog($return, $data);
12044 return $return;
12048 * @OA\Get(
12049 * path="/fhir/PractitionerRole",
12050 * description="Returns a list of PractitionerRole resources.",
12051 * tags={"fhir"},
12052 * @OA\Parameter(
12053 * name="specialty",
12054 * in="query",
12055 * description="The specialty of the PractitionerRole resource.",
12056 * required=false,
12057 * @OA\Schema(
12058 * type="string"
12060 * ),
12061 * @OA\Parameter(
12062 * name="practitioner",
12063 * in="query",
12064 * description="The practitioner of the PractitionerRole resource.",
12065 * required=false,
12066 * @OA\Schema(
12067 * type="string"
12069 * ),
12070 * @OA\Response(
12071 * response="200",
12072 * description="Standard Response",
12073 * @OA\MediaType(
12074 * mediaType="application/json",
12075 * @OA\Schema(
12076 * @OA\Property(
12077 * property="json object",
12078 * description="FHIR Json object.",
12079 * type="object"
12080 * ),
12081 * example={
12082 * "meta": {
12083 * "lastUpdated": "2021-09-14T09:13:51"
12084 * },
12085 * "resourceType": "Bundle",
12086 * "type": "collection",
12087 * "total": 0,
12088 * "link": {
12090 * "relation": "self",
12091 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12097 * ),
12098 * @OA\Response(
12099 * response="400",
12100 * ref="#/components/responses/badrequest"
12101 * ),
12102 * @OA\Response(
12103 * response="401",
12104 * ref="#/components/responses/unauthorized"
12105 * ),
12106 * security={{"openemr_auth":{}}}
12109 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12110 RestConfig::authorization_check("admin", "users");
12111 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12112 RestConfig::apiLog($return);
12113 return $return;
12117 * @OA\Get(
12118 * path="/fhir/PractitionerRole/{uuid}",
12119 * description="Returns a single PractitionerRole resource.",
12120 * tags={"fhir"},
12121 * @OA\Parameter(
12122 * name="uuid",
12123 * in="path",
12124 * description="The uuid for the PractitionerRole resource.",
12125 * required=true,
12126 * @OA\Schema(
12127 * type="string"
12129 * ),
12130 * @OA\Response(
12131 * response="200",
12132 * description="Standard Response",
12133 * @OA\MediaType(
12134 * mediaType="application/json",
12135 * @OA\Schema(
12136 * @OA\Property(
12137 * property="json object",
12138 * description="FHIR Json object.",
12139 * type="object"
12140 * ),
12141 * example={
12142 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12143 * "meta": {
12144 * "versionId": "1",
12145 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12146 * },
12147 * "resourceType": "PractitionerRole",
12148 * "practitioner": {
12149 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12150 * "display": "Administrator Administrator"
12151 * },
12152 * "organization": {
12153 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12154 * "display": "Your Clinic Name Here"
12155 * },
12156 * "code": {
12158 * "coding": {
12159 * "102L00000X"
12160 * },
12161 * "text": "Psychoanalyst"
12162 * },
12164 * "coding": {
12165 * "101Y00000X"
12166 * },
12167 * "text": "Counselor"
12173 * ),
12174 * @OA\Response(
12175 * response="400",
12176 * ref="#/components/responses/badrequest"
12177 * ),
12178 * @OA\Response(
12179 * response="401",
12180 * ref="#/components/responses/unauthorized"
12181 * ),
12182 * @OA\Response(
12183 * response="404",
12184 * ref="#/components/responses/uuidnotfound"
12185 * ),
12186 * security={{"openemr_auth":{}}}
12189 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12190 RestConfig::authorization_check("admin", "users");
12191 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12192 RestConfig::apiLog($return);
12193 return $return;
12197 * @OA\Get(
12198 * path="/fhir/Procedure",
12199 * description="Returns a list of Procedure resources.",
12200 * tags={"fhir"},
12201 * @OA\Parameter(
12202 * name="_id",
12203 * in="query",
12204 * description="The uuid for the Procedure resource.",
12205 * required=false,
12206 * @OA\Schema(
12207 * type="string"
12209 * ),
12210 * @OA\Parameter(
12211 * name="patient",
12212 * in="query",
12213 * description="The uuid for the patient.",
12214 * required=false,
12215 * @OA\Schema(
12216 * type="string"
12218 * ),
12219 * @OA\Parameter(
12220 * name="date",
12221 * in="query",
12222 * description="The datetime of the Procedure resource.",
12223 * required=false,
12224 * @OA\Schema(
12225 * type="string"
12227 * ),
12228 * @OA\Response(
12229 * response="200",
12230 * description="Standard Response",
12231 * @OA\MediaType(
12232 * mediaType="application/json",
12233 * @OA\Schema(
12234 * @OA\Property(
12235 * property="json object",
12236 * description="FHIR Json object.",
12237 * type="object"
12238 * ),
12239 * example={
12240 * "meta": {
12241 * "lastUpdated": "2021-09-14T09:13:51"
12242 * },
12243 * "resourceType": "Bundle",
12244 * "type": "collection",
12245 * "total": 0,
12246 * "link": {
12248 * "relation": "self",
12249 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12255 * ),
12256 * @OA\Response(
12257 * response="400",
12258 * ref="#/components/responses/badrequest"
12259 * ),
12260 * @OA\Response(
12261 * response="401",
12262 * ref="#/components/responses/unauthorized"
12263 * ),
12264 * security={{"openemr_auth":{}}}
12267 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12268 if ($request->isPatientRequest()) {
12269 // only allow access to data of binded patient
12270 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12271 } else {
12272 RestConfig::authorization_check("patients", "med");
12273 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12275 RestConfig::apiLog($return);
12276 return $return;
12280 * @OA\Get(
12281 * path="/fhir/Procedure/{uuid}",
12282 * description="Returns a single Procedure resource.",
12283 * tags={"fhir"},
12284 * @OA\Parameter(
12285 * name="uuid",
12286 * in="path",
12287 * description="The uuid for the Procedure resource.",
12288 * required=true,
12289 * @OA\Schema(
12290 * type="string"
12292 * ),
12293 * @OA\Response(
12294 * response="200",
12295 * description="Standard Response",
12296 * @OA\MediaType(
12297 * mediaType="application/json",
12298 * @OA\Schema(
12299 * @OA\Property(
12300 * property="json object",
12301 * description="FHIR Json object.",
12302 * type="object"
12303 * ),
12304 * example={
12305 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12306 * "meta": {
12307 * "versionId": "1",
12308 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12309 * },
12310 * "resourceType": "Procedure",
12311 * "status": "in-progress",
12312 * "subject": {
12313 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12314 * "type": "Patient"
12319 * ),
12320 * @OA\Response(
12321 * response="400",
12322 * ref="#/components/responses/badrequest"
12323 * ),
12324 * @OA\Response(
12325 * response="401",
12326 * ref="#/components/responses/unauthorized"
12327 * ),
12328 * @OA\Response(
12329 * response="404",
12330 * ref="#/components/responses/uuidnotfound"
12331 * ),
12332 * security={{"openemr_auth":{}}}
12335 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12336 if ($request->isPatientRequest()) {
12337 // only allow access to data of binded patient
12338 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12339 } else {
12340 RestConfig::authorization_check("patients", "med");
12341 $return = (new FhirProcedureRestController())->getOne($uuid);
12343 RestConfig::apiLog($return);
12344 return $return;
12348 * @OA\Get(
12349 * path="/fhir/Provenance/{uuid}",
12350 * description="Returns a single Provenance resource.",
12351 * tags={"fhir"},
12352 * @OA\Parameter(
12353 * name="uuid",
12354 * in="path",
12355 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12356 * required=true,
12357 * @OA\Schema(
12358 * type="string"
12360 * ),
12361 * @OA\Response(
12362 * response="200",
12363 * description="Standard Response",
12364 * @OA\MediaType(
12365 * mediaType="application/json",
12366 * @OA\Schema(
12367 * @OA\Property(
12368 * property="json object",
12369 * description="FHIR Json object.",
12370 * type="object"
12371 * ),
12372 * example={
12373 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12374 * "resourceType": "Provenance",
12375 * "target": {
12377 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12378 * "type": "AllergyIntolerance"
12380 * },
12381 * "recorded": "2022-03-26T22:43:30+00:00",
12382 * "agent": {
12384 * "type": {
12385 * "coding": {
12387 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12388 * "code": "author",
12389 * "display": "Author"
12392 * },
12393 * "who": {
12394 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12395 * "type": "Organization"
12396 * },
12397 * "onBehalfOf": {
12398 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12399 * "type": "Organization"
12401 * },
12403 * "type": {
12404 * "coding": {
12406 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12407 * "code": "transmitter",
12408 * "display": "Transmitter"
12412 * },
12413 * "who": {
12414 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12415 * "type": "Organization"
12416 * },
12417 * "onBehalfOf": {
12418 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12419 * "type": "Organization"
12425 * ),
12426 * @OA\Response(
12427 * response="400",
12428 * ref="#/components/responses/badrequest"
12429 * ),
12430 * @OA\Response(
12431 * response="401",
12432 * ref="#/components/responses/unauthorized"
12433 * ),
12434 * @OA\Response(
12435 * response="404",
12436 * ref="#/components/responses/uuidnotfound"
12437 * ),
12438 * security={{"openemr_auth":{}}}
12441 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12442 if ($request->isPatientRequest()) {
12443 // only allow access to data of binded patient
12444 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12445 } else {
12446 RestConfig::authorization_check("admin", "super");
12447 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12449 RestConfig::apiLog($return);
12450 return $return;
12454 * @OA\Get(
12455 * path="/fhir/Provenance",
12456 * description="Returns a list of Provenance resources.",
12457 * tags={"fhir"},
12458 * @OA\Parameter(
12459 * name="_id",
12460 * in="query",
12461 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12462 * required=false,
12463 * @OA\Schema(
12464 * type="string"
12466 * ),
12467 * @OA\Response(
12468 * response="200",
12469 * description="Standard Response",
12470 * @OA\MediaType(
12471 * mediaType="application/json",
12472 * @OA\Schema(
12473 * @OA\Property(
12474 * property="json object",
12475 * description="FHIR Json object.",
12476 * type="object"
12477 * ),
12478 * example={
12479 * "meta": {
12480 * "lastUpdated": "2021-09-14T09:13:51"
12481 * },
12482 * "resourceType": "Bundle",
12483 * "type": "collection",
12484 * "total": 0,
12485 * "link": {
12487 * "relation": "self",
12488 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12494 * ),
12495 * @OA\Response(
12496 * response="400",
12497 * ref="#/components/responses/badrequest"
12498 * ),
12499 * @OA\Response(
12500 * response="401",
12501 * ref="#/components/responses/unauthorized"
12502 * ),
12503 * security={{"openemr_auth":{}}}
12506 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12507 // property to support which is why this endpoint exists.
12508 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12509 if ($request->isPatientRequest()) {
12510 // only allow access to data of binded patient
12511 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12512 } else {
12513 // TODO: it seems like regular users should be able to grab authorship / provenance information
12514 RestConfig::authorization_check("admin", "super");
12515 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12517 RestConfig::apiLog($return);
12518 return $return;
12521 // other endpoints
12524 * @OA\Get(
12525 * path="/fhir/metadata",
12526 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12527 * tags={"fhir"},
12528 * @OA\Response(
12529 * response="200",
12530 * description="Return CapabilityStatement resource of the fhir server"
12534 "GET /fhir/metadata" => function () {
12535 $return = (new FhirMetaDataRestController())->getMetaData();
12536 RestConfig::apiLog($return);
12537 return $return;
12541 * @OA\Get(
12542 * path="/fhir/.well-known/smart-configuration",
12543 * description="Returns smart configuration of the fhir server.",
12544 * tags={"fhir"},
12545 * @OA\Response(
12546 * response="200",
12547 * description="Return smart configuration of the fhir server"
12551 "GET /fhir/.well-known/smart-configuration" => function () {
12552 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12553 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12554 RestConfig::apiLog($return);
12555 return $return;
12559 * @OA\Get(
12560 * path="/fhir/OperationDefinition",
12561 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
12562 * tags={"fhir"},
12563 * @OA\Response(
12564 * response="200",
12565 * description="Return list of OperationDefinition resources"
12569 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
12570 // for now we will just hard code the custom resources
12571 $operationDefinitionController = new FhirOperationDefinitionRestController();
12572 $return = $operationDefinitionController->getAll($request->getQueryParams());
12573 RestConfig::apiLog($return);
12574 return $return;
12578 * @OA\Get(
12579 * path="/fhir/OperationDefinition/{operation}",
12580 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
12581 * tags={"fhir"},
12582 * @OA\Parameter(
12583 * name="operation",
12584 * in="path",
12585 * description="The name of the operation to query. For example $bulkdata-status",
12586 * required=true,
12587 * @OA\Schema(
12588 * type="string"
12590 * ),
12591 * @OA\Response(
12592 * response="200",
12593 * description="Standard Response",
12594 * @OA\MediaType(
12595 * mediaType="application/json",
12596 * @OA\Schema(
12597 * @OA\Property(
12598 * property="json object",
12599 * description="FHIR Json object.",
12600 * type="object"
12601 * ),
12602 * example={
12603 * "resourceType": "OperationDefinition",
12604 * "name": "$bulkdata-status",
12605 * "status": "active",
12606 * "kind": "operation",
12607 * "parameter": {
12609 * "name": "job",
12610 * "use": "in",
12611 * "min": 1,
12612 * "max": 1,
12613 * "type": {
12614 * "system": "http://hl7.org/fhir/data-types",
12615 * "code": "string",
12616 * "display": "string"
12617 * },
12618 * "searchType": {
12619 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
12620 * "code": "string",
12621 * "display": "string"
12628 * ),
12631 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
12632 // for now we will just hard code the custom resources
12633 $operationDefinitionController = new FhirOperationDefinitionRestController();
12634 $return = $operationDefinitionController->getOne($operation);
12635 RestConfig::apiLog($return);
12636 return $return;
12639 // FHIR root level operations
12642 * @OA\Get(
12643 * path="/fhir/$export",
12644 * 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>",
12645 * tags={"fhir"},
12646 * @OA\Response(
12647 * response="200",
12648 * 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>"
12649 * ),
12650 * @OA\Response(
12651 * response="400",
12652 * ref="#/components/responses/badrequest"
12653 * ),
12654 * @OA\Response(
12655 * response="401",
12656 * ref="#/components/responses/unauthorized"
12657 * ),
12658 * security={{"openemr_auth":{}}}
12661 'GET /fhir/$export' => function (HttpRestRequest $request) {
12662 RestConfig::authorization_check("admin", "users");
12663 $fhirExportService = new FhirOperationExportRestController($request);
12664 $return = $fhirExportService->processExport(
12665 $request->getQueryParams(),
12666 'System',
12667 $request->getHeader('Accept'),
12668 $request->getHeader('Prefer')
12670 RestConfig::apiLog($return);
12671 return $return;
12674 // these two operations are adopted based on the documentation used in the IBM FHIR Server
12675 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
12676 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
12679 * @OA\Get(
12680 * path="/fhir/$bulkdata-status",
12681 * 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>",
12682 * tags={"fhir"},
12683 * @OA\Response(
12684 * response="200",
12685 * 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>"
12686 * ),
12687 * @OA\Response(
12688 * response="400",
12689 * ref="#/components/responses/badrequest"
12690 * ),
12691 * @OA\Response(
12692 * response="401",
12693 * ref="#/components/responses/unauthorized"
12694 * ),
12695 * security={{"openemr_auth":{}}}
12698 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12699 RestConfig::authorization_check("admin", "users");
12700 $jobUuidString = $request->getQueryParam('job');
12701 // if we were truly async we would return 202 here to say we are in progress with a JSON response
12702 // since OpenEMR data is so small we just return the JSON from the database
12703 $fhirExportService = new FhirOperationExportRestController($request);
12704 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
12705 RestConfig::apiLog($return);
12706 return $return;
12710 * @OA\Delete(
12711 * path="/fhir/$bulkdata-status",
12712 * 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>",
12713 * tags={"fhir"},
12714 * @OA\Response(
12715 * response="200",
12716 * 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>"
12717 * ),
12718 * @OA\Response(
12719 * response="400",
12720 * ref="#/components/responses/badrequest"
12721 * ),
12722 * @OA\Response(
12723 * response="401",
12724 * ref="#/components/responses/unauthorized"
12725 * ),
12726 * security={{"openemr_auth":{}}}
12729 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
12730 RestConfig::authorization_check("admin", "users");
12731 $job = $request->getQueryParam('job');
12732 $fhirExportService = new FhirOperationExportRestController($request);
12733 $return = $fhirExportService->processDeleteExportForJob($job);
12734 RestConfig::apiLog($return);
12735 return $return;
12739 // Note that the portal (api) route is only for patient role
12740 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
12741 RestConfig::$PORTAL_ROUTE_MAP = array(
12743 * @OA\Get(
12744 * path="/portal/patient",
12745 * description="Returns the patient.",
12746 * tags={"standard-patient"},
12747 * @OA\Response(
12748 * response="200",
12749 * description="Standard response",
12750 * @OA\MediaType(
12751 * mediaType="application/json",
12752 * @OA\Schema(ref="#/components/schemas/api_patient_response")
12754 * ),
12755 * @OA\Response(
12756 * response="401",
12757 * ref="#/components/responses/unauthorized"
12758 * ),
12759 * security={{"openemr_auth":{}}}
12762 "GET /portal/patient" => function (HttpRestRequest $request) {
12763 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
12764 RestConfig::apiLog($return);
12765 return $return;
12769 * @OA\Get(
12770 * path="/portal/patient/encounter",
12771 * description="Returns encounters for the patient.",
12772 * tags={"standard-patient"},
12773 * @OA\Response(
12774 * response="200",
12775 * ref="#/components/responses/standard"
12776 * ),
12777 * @OA\Response(
12778 * response="400",
12779 * ref="#/components/responses/badrequest"
12780 * ),
12781 * @OA\Response(
12782 * response="401",
12783 * ref="#/components/responses/unauthorized"
12784 * ),
12785 * security={{"openemr_auth":{}}}
12788 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
12789 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
12790 RestConfig::apiLog($return);
12791 return $return;
12795 * @OA\Get(
12796 * path="/portal/patient/encounter/{euuid}",
12797 * description="Returns a selected encounter by its uuid.",
12798 * tags={"standard-patient"},
12799 * @OA\Parameter(
12800 * name="euuid",
12801 * in="path",
12802 * description="The uuid for the encounter.",
12803 * required=true,
12804 * @OA\Schema(
12805 * type="string"
12807 * ),
12808 * @OA\Response(
12809 * response="200",
12810 * ref="#/components/responses/standard"
12811 * ),
12812 * @OA\Response(
12813 * response="400",
12814 * ref="#/components/responses/badrequest"
12815 * ),
12816 * @OA\Response(
12817 * response="401",
12818 * ref="#/components/responses/unauthorized"
12819 * ),
12820 * security={{"openemr_auth":{}}}
12823 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
12824 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
12825 RestConfig::apiLog($return);
12826 return $return;
12830 * @OA\Get(
12831 * path="/portal/patient/appointment",
12832 * description="Retrieves all appointments for a patient",
12833 * tags={"standard-patient"},
12834 * @OA\Response(
12835 * response="200",
12836 * ref="#/components/responses/standard"
12837 * ),
12838 * @OA\Response(
12839 * response="400",
12840 * ref="#/components/responses/badrequest"
12841 * ),
12842 * @OA\Response(
12843 * response="401",
12844 * ref="#/components/responses/unauthorized"
12845 * ),
12846 * security={{"openemr_auth":{}}}
12849 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
12850 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
12851 RestConfig::apiLog($return);
12852 return $return;
12857 * @OA\Get(
12858 * path="/portal/patient/appointment/{auuid}",
12859 * description="Returns a selected appointment by its uuid.",
12860 * tags={"standard-patient"},
12861 * @OA\Parameter(
12862 * name="auuid",
12863 * in="path",
12864 * description="The uuid for the appointment.",
12865 * required=true,
12866 * @OA\Schema(
12867 * type="string"
12869 * ),
12870 * @OA\Response(
12871 * response="200",
12872 * ref="#/components/responses/standard"
12873 * ),
12874 * @OA\Response(
12875 * response="400",
12876 * ref="#/components/responses/badrequest"
12877 * ),
12878 * @OA\Response(
12879 * response="401",
12880 * ref="#/components/responses/unauthorized"
12881 * ),
12882 * security={{"openemr_auth":{}}}
12885 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
12886 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
12887 RestConfig::apiLog($return);
12888 return $return;