chore: increment v_js_includes (#7029)
[openemr.git] / _rest_routes.inc.php
blobf5e05cb0129b62f15549ce38375417d9a08ba20c
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.3")
22 * @OA\Server(url="/apis/default/")
23 * @OA\SecurityScheme(
24 * securityScheme="openemr_auth",
25 * type="oauth2",
26 * @OA\Flow(
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
31 * scopes={
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
35 * "api:fhir": "FHIR R4 API",
36 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
37 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
38 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
39 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
40 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
41 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
42 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
43 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
44 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
46 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
47 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
48 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
49 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
50 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
51 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
52 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
53 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
54 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
55 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
56 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
57 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
58 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
59 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
60 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
61 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
62 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
63 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
64 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
65 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
66 * "system/Device.read": "Read all device resources in the system (api:fhir)",
67 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
68 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
69 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
70 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
71 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
72 * "system/Group.read": "Read all group resources in the system (api:fhir)",
73 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
74 * "system/Location.read": "Read all location resources in the system (api:fhir)",
75 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
76 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
77 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
78 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
79 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
80 * "system/Person.read": "Read all person resources in the system (api:fhir)",
81 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
82 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
83 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
84 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
85 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
86 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
87 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
88 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
89 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
90 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
91 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
92 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
93 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
94 * "user/DocumentReference.$docref" : "Generate a document for any patient the user has access to or returns the most current Clinical Summary of Care Document (CCD) (api:fhir)",
95 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
96 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
97 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
98 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
99 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
100 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
101 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
102 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
103 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
104 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
105 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
106 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
107 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
108 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
109 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
110 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
111 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
112 * "api:oemr": "Standard OpenEMR API",
113 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
114 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
115 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
116 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
117 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
118 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
119 * "user/document.read": "Read documents the user has access to (api:oemr)",
120 * "user/document.write": "Write documents the user has access to (api:oemr)",
121 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
122 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
123 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
124 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
125 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
126 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
127 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
128 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
129 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
130 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
131 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
132 * "user/list.read": "Read lists the user has access to (api:oemr)",
133 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
134 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
135 * "user/medication.read": "Read medications the user has access to (api:oemr)",
136 * "user/medication.write": "Write medications the user has access to (api:oemr)",
137 * "user/message.write": "Read messages the user has access to (api:oemr)",
138 * "user/patient.read": "Read patients the user has access to (api:oemr)",
139 * "user/patient.write": "Write patients the user has access to (api:oemr)",
140 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
141 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
142 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
143 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
144 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
145 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
146 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
147 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
148 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
149 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
150 * "user/user.read": "Read users the current user has access to (api:oemr)",
151 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
152 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
153 * "api:port": "Standard Patient Portal OpenEMR API",
154 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
155 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
156 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
160 * @OA\Tag(
161 * name="fhir",
162 * description="FHIR R4 API"
164 * @OA\Tag(
165 * name="standard",
166 * description="Standard OpenEMR API"
168 * @OA\Tag(
169 * name="standard-patient",
170 * description="Standard Patient Portal OpenEMR API"
172 * @OA\Parameter(
173 * name="_sort",
174 * in="query",
175 * parameter="_sort",
176 * description="The sort criteria specified in comma separated order with Descending order being specified by a dash before the search parameter name. (Example: name,-category)",
177 * required=false,
178 * @OA\Schema(
179 * type="string"
182 * @OA\Parameter(
183 * name="_lastUpdated",
184 * in="query",
185 * parameter="_lastUpdated",
186 * description="The date the resource was last updated.",
187 * required=false,
188 * @OA\Schema(
189 * type="string"
192 * @OA\Response(
193 * response="standard",
194 * description="Standard Response",
195 * @OA\MediaType(
196 * mediaType="application/json",
197 * @OA\Schema(
198 * @OA\Property(
199 * property="validationErrors",
200 * description="Validation errors.",
201 * type="array",
202 * @OA\Items(
203 * type="object",
204 * ),
205 * ),
206 * @OA\Property(
207 * property="internalErrors",
208 * description="Internal errors.",
209 * type="array",
210 * @OA\Items(
211 * type="object",
212 * ),
213 * ),
214 * @OA\Property(
215 * property="data",
216 * description="Returned data.",
217 * type="array",
218 * @OA\Items(
219 * type="object",
220 * ),
221 * ),
222 * example={
223 * "validationErrors": {},
224 * "error_description": {},
225 * "data": {}
230 * @OA\Response(
231 * response="badrequest",
232 * description="Bad Request",
233 * @OA\MediaType(
234 * mediaType="application/json",
235 * @OA\Schema(
236 * @OA\Property(
237 * property="validationErrors",
238 * description="Validation errors.",
239 * type="object"
240 * ),
241 * example={
242 * "validationErrors":
244 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
250 * @OA\Response(
251 * response="unauthorized",
252 * description="Unauthorized",
253 * @OA\MediaType(
254 * mediaType="application/json",
255 * @OA\Schema(
256 * @OA\Property(
257 * property="error",
258 * description="The error.",
259 * type="string"
260 * ),
261 * @OA\Property(
262 * property="error_description",
263 * description="The description of the error.",
264 * type="string"
265 * ),
266 * @OA\Property(
267 * property="hint",
268 * description="More specific information on the error.",
269 * type="string"
270 * ),
271 * @OA\Property(
272 * property="message",
273 * description="Message regarding the error.",
274 * type="string"
275 * ),
276 * example={
277 * "error": "access_denied",
278 * "error_description": "The resource owner or authorization server denied the request.",
279 * "hint": "Missing ""Authorization"" header",
280 * "message": "The resource owner or authorization server denied the request."
285 * @OA\Response(
286 * response="uuidnotfound",
287 * description="Not Found",
288 * @OA\MediaType(
289 * mediaType="application/json",
290 * @OA\Schema(
291 * @OA\Property(
292 * property="empty",
293 * description="empty",
294 * type="object"
295 * ),
296 * example={}
302 // Lets keep our controller classes with the routes.
304 use OpenEMR\Common\Acl\AccessDeniedException;
305 use OpenEMR\Common\Http\HttpRestRequest;
306 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
307 use OpenEMR\RestControllers\FacilityRestController;
308 use OpenEMR\RestControllers\VersionRestController;
309 use OpenEMR\RestControllers\ProductRegistrationRestController;
310 use OpenEMR\RestControllers\PatientRestController;
311 use OpenEMR\RestControllers\EncounterRestController;
312 use OpenEMR\RestControllers\PractitionerRestController;
313 use OpenEMR\RestControllers\ListRestController;
314 use OpenEMR\RestControllers\InsuranceCompanyRestController;
315 use OpenEMR\RestControllers\AppointmentRestController;
316 use OpenEMR\RestControllers\ConditionRestController;
317 use OpenEMR\RestControllers\ONoteRestController;
318 use OpenEMR\RestControllers\DocumentRestController;
319 use OpenEMR\RestControllers\DrugRestController;
320 use OpenEMR\RestControllers\ImmunizationRestController;
321 use OpenEMR\RestControllers\InsuranceRestController;
322 use OpenEMR\RestControllers\MessageRestController;
323 use OpenEMR\RestControllers\PrescriptionRestController;
324 use OpenEMR\RestControllers\ProcedureRestController;
325 use OpenEMR\RestControllers\TransactionRestController;
326 use OpenEMR\RestControllers\UserRestController;
327 use OpenEMR\Services\Search\SearchQueryConfig;
329 // Note some Http clients may not send auth as json so a function
330 // is implemented to determine and parse encoding on auth route's.
332 // Note that the api route is only for users role
333 // (there is a mechanism in place to ensure only user role can access the api route)
334 RestConfig::$ROUTE_MAP = array(
336 * @OA\Get(
337 * path="/api/facility",
338 * description="Returns a single facility.",
339 * tags={"standard"},
340 * @OA\Parameter(
341 * name="name",
342 * in="query",
343 * description="The name for the facility.",
344 * required=false,
345 * @OA\Schema(
346 * type="string"
348 * ),
349 * @OA\Parameter(
350 * name="facility_npi",
351 * in="query",
352 * description="The facility_npi for the facility.",
353 * required=false,
354 * @OA\Schema(
355 * type="string"
357 * ),
358 * @OA\Parameter(
359 * name="phone",
360 * in="query",
361 * description="The phone for the facility.",
362 * required=false,
363 * @OA\Schema(
364 * type="string"
366 * ),
367 * @OA\Parameter(
368 * name="fax",
369 * in="query",
370 * description="The fax for the facility.",
371 * required=false,
372 * @OA\Schema(
373 * type="string"
375 * ),
376 * @OA\Parameter(
377 * name="street",
378 * in="query",
379 * description="The street for the facility.",
380 * required=false,
381 * @OA\Schema(
382 * type="string"
384 * ),
385 * @OA\Parameter(
386 * name="city",
387 * in="query",
388 * description="The city for the facility.",
389 * required=false,
390 * @OA\Schema(
391 * type="string"
393 * ),
394 * @OA\Parameter(
395 * name="state",
396 * in="query",
397 * description="The state for the facility.",
398 * required=false,
399 * @OA\Schema(
400 * type="string"
402 * ),
403 * @OA\Parameter(
404 * name="postal_code",
405 * in="query",
406 * description="The postal_code for the facility.",
407 * required=false,
408 * @OA\Schema(
409 * type="string"
411 * ),
412 * @OA\Parameter(
413 * name="country_code",
414 * in="query",
415 * description="The country_code for the facility.",
416 * required=false,
417 * @OA\Schema(
418 * type="string"
420 * ),
421 * @OA\Parameter(
422 * name="federal_ein",
423 * in="query",
424 * description="The federal_ein for the facility.",
425 * required=false,
426 * @OA\Schema(
427 * type="string"
429 * ),
430 * @OA\Parameter(
431 * name="website",
432 * in="query",
433 * description="The website for the facility.",
434 * required=false,
435 * @OA\Schema(
436 * type="string"
438 * ),
439 * @OA\Parameter(
440 * name="email",
441 * in="query",
442 * description="The email for the facility.",
443 * required=false,
444 * @OA\Schema(
445 * type="string"
447 * ),
448 * @OA\Parameter(
449 * name="domain_identifier",
450 * in="query",
451 * description="The domain_identifier for the facility.",
452 * required=false,
453 * @OA\Schema(
454 * type="string"
456 * ),
457 * @OA\Parameter(
458 * name="facility_taxonomy",
459 * in="query",
460 * description="The facility_taxonomy for the facility.",
461 * required=false,
462 * @OA\Schema(
463 * type="string"
465 * ),
466 * @OA\Parameter(
467 * name="facility_code",
468 * in="query",
469 * description="The facility_code for the facility.",
470 * required=false,
471 * @OA\Schema(
472 * type="string"
474 * ),
475 * @OA\Parameter(
476 * name="billing_location",
477 * in="query",
478 * description="The billing_location setting for the facility.",
479 * required=false,
480 * @OA\Schema(
481 * type="string"
483 * ),
484 * @OA\Parameter(
485 * name="accepts_assignment",
486 * in="query",
487 * description="The accepts_assignment setting for the facility.",
488 * required=false,
489 * @OA\Schema(
490 * type="string"
492 * ),
493 * @OA\Parameter(
494 * name="oid",
495 * in="query",
496 * description="The oid for the facility.",
497 * required=false,
498 * @OA\Schema(
499 * type="string"
501 * ),
502 * @OA\Parameter(
503 * name="service_location",
504 * in="query",
505 * description="The service_location setting for the facility.",
506 * required=false,
507 * @OA\Schema(
508 * type="string"
510 * ),
511 * @OA\Response(
512 * response="200",
513 * ref="#/components/responses/standard"
514 * ),
515 * @OA\Response(
516 * response="400",
517 * ref="#/components/responses/badrequest"
518 * ),
519 * @OA\Response(
520 * response="401",
521 * ref="#/components/responses/unauthorized"
522 * ),
523 * security={{"openemr_auth":{}}}
526 "GET /api/facility" => function () {
527 RestConfig::authorization_check("admin", "users");
528 $return = (new FacilityRestController())->getAll($_GET);
529 RestConfig::apiLog($return);
530 return $return;
534 * @OA\Get(
535 * path="/api/facility/{fuuid}",
536 * description="Returns a single facility.",
537 * tags={"standard"},
538 * @OA\Parameter(
539 * name="fuuid",
540 * in="path",
541 * description="The uuid for the facility.",
542 * required=true,
543 * @OA\Schema(
544 * type="string"
546 * ),
547 * @OA\Response(
548 * response="200",
549 * ref="#/components/responses/standard"
550 * ),
551 * @OA\Response(
552 * response="400",
553 * ref="#/components/responses/badrequest"
554 * ),
555 * @OA\Response(
556 * response="401",
557 * ref="#/components/responses/unauthorized"
558 * ),
559 * security={{"openemr_auth":{}}}
562 "GET /api/facility/:fuuid" => function ($fuuid) {
563 RestConfig::authorization_check("admin", "users");
564 $return = (new FacilityRestController())->getOne($fuuid);
565 RestConfig::apiLog($return);
566 return $return;
570 * @OA\Post(
571 * path="/api/facility",
572 * description="Creates a facility in the system",
573 * tags={"standard"},
574 * @OA\RequestBody(
575 * required=true,
576 * @OA\MediaType(
577 * mediaType="application/json",
578 * @OA\Schema(
579 * @OA\Property(
580 * property="name",
581 * description="The name for the facility.",
582 * type="string"
583 * ),
584 * @OA\Property(
585 * property="facility_npi",
586 * description="The facility_npi for the facility.",
587 * type="string"
588 * ),
589 * @OA\Property(
590 * property="phone",
591 * description="The phone for the facility.",
592 * type="string"
593 * ),
594 * @OA\Property(
595 * property="fax",
596 * description="The fax for the facility.",
597 * type="string"
598 * ),
599 * @OA\Property(
600 * property="street",
601 * description="The street for the facility.",
602 * type="string"
603 * ),
604 * @OA\Property(
605 * property="city",
606 * description="The city for the facility.",
607 * type="string"
608 * ),
609 * @OA\Property(
610 * property="state",
611 * description="The state for the facility.",
612 * type="string"
613 * ),
614 * @OA\Property(
615 * property="postal_code",
616 * description="The postal_code for the facility.",
617 * type="string"
618 * ),
619 * @OA\Property(
620 * property="country_code",
621 * description="The country_code for the facility.",
622 * type="string"
623 * ),
624 * @OA\Property(
625 * property="federal_ein",
626 * description="The federal_ein for the facility.",
627 * type="string"
628 * ),
629 * @OA\Property(
630 * property="website",
631 * description="The website for the facility.",
632 * type="string"
633 * ),
634 * @OA\Property(
635 * property="email",
636 * description="The email for the facility.",
637 * type="string"
638 * ),
639 * @OA\Property(
640 * property="domain_identifier",
641 * description="The domain_identifier for the facility.",
642 * type="string"
643 * ),
644 * @OA\Property(
645 * property="facility_taxonomy",
646 * description="The facility_taxonomy for the facility.",
647 * type="string"
648 * ),
649 * @OA\Property(
650 * property="facility_code",
651 * description="The facility_code for the facility.",
652 * type="string"
653 * ),
654 * @OA\Property(
655 * property="billing_location",
656 * description="The billing_location setting for the facility.",
657 * type="string"
658 * ),
659 * @OA\Property(
660 * property="accepts_assignment",
661 * description="The accepts_assignment setting for the facility.",
662 * type="string"
663 * ),
664 * @OA\Property(
665 * property="oid",
666 * description="The oid for the facility.",
667 * type="string"
668 * ),
669 * @OA\Property(
670 * property="service_location",
671 * description="The service_location setting for the facility.",
672 * type="string"
673 * ),
674 * required={"name", "facility_npi"},
675 * example={
676 * "name": "Aquaria",
677 * "facility_npi": "123456789123",
678 * "phone": "808-606-3030",
679 * "fax": "808-606-3031",
680 * "street": "1337 Bit Shifter Ln",
681 * "city": "San Lorenzo",
682 * "state": "ZZ",
683 * "postal_code": "54321",
684 * "country_code": "US",
685 * "federal_ein": "4343434",
686 * "website": "https://example.com",
687 * "email": "foo@bar.com",
688 * "domain_identifier": "",
689 * "facility_taxonomy": "",
690 * "facility_code": "",
691 * "billing_location": "1",
692 * "accepts_assignment": "1",
693 * "oid": "",
694 * "service_location": "1"
698 * ),
699 * @OA\Response(
700 * response="200",
701 * ref="#/components/responses/standard"
702 * ),
703 * @OA\Response(
704 * response="400",
705 * ref="#/components/responses/badrequest"
706 * ),
707 * @OA\Response(
708 * response="401",
709 * ref="#/components/responses/unauthorized"
710 * ),
711 * security={{"openemr_auth":{}}}
714 "POST /api/facility" => function () {
715 RestConfig::authorization_check("admin", "super");
716 $data = (array) (json_decode(file_get_contents("php://input")));
717 $return = (new FacilityRestController())->post($data);
718 RestConfig::apiLog($return, $data);
719 return $return;
723 * @OA\Put(
724 * path="/api/facility/{fuuid}",
725 * description="Updates a facility in the system",
726 * tags={"standard"},
727 * @OA\Parameter(
728 * name="fuuid",
729 * in="path",
730 * description="The uuid for the facility.",
731 * required=true,
732 * @OA\Schema(
733 * type="string"
735 * ),
736 * @OA\RequestBody(
737 * required=true,
738 * @OA\MediaType(
739 * mediaType="application/json",
740 * @OA\Schema(
741 * @OA\Property(
742 * property="name",
743 * description="The name for the facility.",
744 * type="string"
745 * ),
746 * @OA\Property(
747 * property="facility_npi",
748 * description="The facility_npi for the facility.",
749 * type="string"
750 * ),
751 * @OA\Property(
752 * property="phone",
753 * description="The phone for the facility.",
754 * type="string"
755 * ),
756 * @OA\Property(
757 * property="fax",
758 * description="The fax for the facility.",
759 * type="string"
760 * ),
761 * @OA\Property(
762 * property="street",
763 * description="The street for the facility.",
764 * type="string"
765 * ),
766 * @OA\Property(
767 * property="city",
768 * description="The city for the facility.",
769 * type="string"
770 * ),
771 * @OA\Property(
772 * property="state",
773 * description="The state for the facility.",
774 * type="string"
775 * ),
776 * @OA\Property(
777 * property="postal_code",
778 * description="The postal_code for the facility.",
779 * type="string"
780 * ),
781 * @OA\Property(
782 * property="country_code",
783 * description="The country_code for the facility.",
784 * type="string"
785 * ),
786 * @OA\Property(
787 * property="federal_ein",
788 * description="The federal_ein for the facility.",
789 * type="string"
790 * ),
791 * @OA\Property(
792 * property="website",
793 * description="The website for the facility.",
794 * type="string"
795 * ),
796 * @OA\Property(
797 * property="email",
798 * description="The email for the facility.",
799 * type="string"
800 * ),
801 * @OA\Property(
802 * property="domain_identifier",
803 * description="The domain_identifier for the facility.",
804 * type="string"
805 * ),
806 * @OA\Property(
807 * property="facility_taxonomy",
808 * description="The facility_taxonomy for the facility.",
809 * type="string"
810 * ),
811 * @OA\Property(
812 * property="facility_code",
813 * description="The facility_code for the facility.",
814 * type="string"
815 * ),
816 * @OA\Property(
817 * property="billing_location",
818 * description="The billing_location setting for the facility.",
819 * type="string"
820 * ),
821 * @OA\Property(
822 * property="accepts_assignment",
823 * description="The accepts_assignment setting for the facility.",
824 * type="string"
825 * ),
826 * @OA\Property(
827 * property="oid",
828 * description="The oid for the facility.",
829 * type="string"
830 * ),
831 * @OA\Property(
832 * property="service_location",
833 * description="The service_location setting for the facility.",
834 * type="string"
835 * ),
836 * example={
837 * "name": "Aquaria",
838 * "facility_npi": "123456789123",
839 * "phone": "808-606-3030",
840 * "fax": "808-606-3031",
841 * "street": "1337 Bit Shifter Ln",
842 * "city": "San Lorenzo",
843 * "state": "ZZ",
844 * "postal_code": "54321",
845 * "country_code": "US",
846 * "federal_ein": "4343434",
847 * "website": "https://example.com",
848 * "email": "foo@bar.com",
849 * "domain_identifier": "",
850 * "facility_taxonomy": "",
851 * "facility_code": "",
852 * "billing_location": "1",
853 * "accepts_assignment": "1",
854 * "oid": "",
855 * "service_location": "1"
859 * ),
860 * @OA\Response(
861 * response="200",
862 * ref="#/components/responses/standard"
863 * ),
864 * @OA\Response(
865 * response="400",
866 * ref="#/components/responses/badrequest"
867 * ),
868 * @OA\Response(
869 * response="401",
870 * ref="#/components/responses/unauthorized"
871 * ),
872 * security={{"openemr_auth":{}}}
875 "PUT /api/facility/:fuuid" => function ($fuuid) {
876 RestConfig::authorization_check("admin", "super");
877 $data = (array) (json_decode(file_get_contents("php://input")));
878 $return = (new FacilityRestController())->patch($fuuid, $data);
879 RestConfig::apiLog($return, $data);
880 return $return;
884 * @OA\Get(
885 * path="/api/patient",
886 * description="Retrieves a list of patients",
887 * tags={"standard"},
888 * @OA\Parameter(
889 * ref="#/components/parameters/_sort"
890 * ),
891 * @OA\Parameter(
892 * name="fname",
893 * in="query",
894 * description="The first name for the patient.",
895 * required=false,
896 * @OA\Schema(
897 * type="string"
899 * ),
900 * @OA\Parameter(
901 * name="lname",
902 * in="query",
903 * description="The last name for the patient.",
904 * required=false,
905 * @OA\Schema(
906 * type="string"
908 * ),
909 * @OA\Parameter(
910 * name="ss",
911 * in="query",
912 * description="The social security number for the patient.",
913 * required=false,
914 * @OA\Schema(
915 * type="string"
917 * ),
918 * @OA\Parameter(
919 * name="street",
920 * in="query",
921 * description="The street for the patient.",
922 * required=false,
923 * @OA\Schema(
924 * type="string"
926 * ),
927 * @OA\Parameter(
928 * name="postal_code",
929 * in="query",
930 * description="The postal code for the patient.",
931 * required=false,
932 * @OA\Schema(
933 * type="string"
935 * ),
936 * @OA\Parameter(
937 * name="city",
938 * in="query",
939 * description="The city for the patient.",
940 * required=false,
941 * @OA\Schema(
942 * type="string"
944 * ),
945 * @OA\Parameter(
946 * name="state",
947 * in="query",
948 * description="The state for the patient.",
949 * required=false,
950 * @OA\Schema(
951 * type="string"
953 * ),
954 * @OA\Parameter(
955 * name="phone_home",
956 * in="query",
957 * description="The home phone for the patient.",
958 * required=false,
959 * @OA\Schema(
960 * type="string"
962 * ),
963 * @OA\Parameter(
964 * name="phone_biz",
965 * in="query",
966 * description="The business phone for the patient.",
967 * required=false,
968 * @OA\Schema(
969 * type="string"
971 * ),
972 * @OA\Parameter(
973 * name="phone_cell",
974 * in="query",
975 * description="The cell phone for the patient.",
976 * required=false,
977 * @OA\Schema(
978 * type="string"
980 * ),
981 * @OA\Parameter(
982 * name="postal_contact",
983 * in="query",
984 * description="The postal_contact for the patient.",
985 * required=false,
986 * @OA\Schema(
987 * type="string"
989 * ),
990 * @OA\Parameter(
991 * name="sex",
992 * in="query",
993 * description="The gender for the patient.",
994 * required=false,
995 * @OA\Schema(
996 * type="string"
998 * ),
999 * @OA\Parameter(
1000 * name="country_code",
1001 * in="query",
1002 * description="The country code for the patient.",
1003 * required=false,
1004 * @OA\Schema(
1005 * type="string"
1007 * ),
1008 * @OA\Parameter(
1009 * name="email",
1010 * in="query",
1011 * description="The email for the patient.",
1012 * required=false,
1013 * @OA\Schema(
1014 * type="string"
1016 * ),
1017 * @OA\Parameter(
1018 * name="DOB",
1019 * in="query",
1020 * description="The DOB for the patient.",
1021 * required=false,
1022 * @OA\Schema(
1023 * type="string"
1025 * ),
1026 * @OA\Parameter(
1027 * name="date",
1028 * in="query",
1029 * description="The date this patient resource was last modified.",
1030 * required=false,
1031 * @OA\Schema(
1032 * type="string"
1034 * ),
1035 * @OA\Parameter(
1036 * name="_offset",
1037 * in="query",
1038 * description="The number of records to offset from this index in the search result.",
1039 * required=false,
1040 * @OA\Schema(
1041 * type="integer"
1043 * ),
1044 * @OA\Parameter(
1045 * name="_limit",
1046 * in="query",
1047 * description="The maximum number of resources to return in the result set. 0 means unlimited.",
1048 * required=false,
1049 * @OA\Schema(
1050 * type="integer"
1051 * ,minimum=0
1052 * ,maximum=200
1054 * ),
1055 * @OA\Response(
1056 * response="200",
1057 * ref="#/components/responses/standard"
1058 * ),
1059 * @OA\Response(
1060 * response="400",
1061 * ref="#/components/responses/badrequest"
1062 * ),
1063 * @OA\Response(
1064 * response="401",
1065 * ref="#/components/responses/unauthorized"
1066 * ),
1067 * security={{"openemr_auth":{}}}
1070 "GET /api/patient" => function () {
1071 RestConfig::authorization_check("patients", "demo");
1072 $config = SearchQueryConfig::createConfigFromQueryParams($_GET);
1073 $return = (new PatientRestController())->getAll($_GET, $config);
1074 RestConfig::apiLog($return);
1075 return $return;
1079 * Schema for the patient request
1081 * @OA\Schema(
1082 * schema="api_patient_request",
1083 * @OA\Property(
1084 * property="title",
1085 * description="The title of patient.",
1086 * type="string"
1087 * ),
1088 * @OA\Property(
1089 * property="fname",
1090 * description="The fname of patient.",
1091 * type="string"
1092 * ),
1093 * @OA\Property(
1094 * property="mname",
1095 * description="The mname of patient.",
1096 * type="string"
1097 * ),
1098 * @OA\Property(
1099 * property="lname",
1100 * description="The lname of patient.",
1101 * type="string"
1102 * ),
1103 * @OA\Property(
1104 * property="street",
1105 * description="The street address of patient.",
1106 * type="string"
1107 * ),
1108 * @OA\Property(
1109 * property="postal_code",
1110 * description="The postal code of patient.",
1111 * type="string"
1112 * ),
1113 * @OA\Property(
1114 * property="city",
1115 * description="The city of patient.",
1116 * type="string"
1117 * ),
1118 * @OA\Property(
1119 * property="state",
1120 * description="The state of patient.",
1121 * type="string"
1122 * ),
1123 * @OA\Property(
1124 * property="country_code",
1125 * description="The country code of patient.",
1126 * type="string"
1127 * ),
1128 * @OA\Property(
1129 * property="phone_contact",
1130 * description="The phone contact of patient.",
1131 * type="string"
1132 * ),
1133 * @OA\Property(
1134 * property="DOB",
1135 * description="The DOB of patient.",
1136 * type="string"
1137 * ),
1138 * @OA\Property(
1139 * property="sex",
1140 * description="The lname of patient.",
1141 * type="string"
1142 * ),
1143 * @OA\Property(
1144 * property="race",
1145 * description="The race of patient.",
1146 * type="string"
1147 * ),
1148 * @OA\Property(
1149 * property="ethnicity",
1150 * description="The ethnicity of patient.",
1151 * type="string"
1152 * ),
1153 * required={"fname", "lname", "DOB", "sex"},
1154 * example={
1155 * "title": "Mr",
1156 * "fname": "Foo",
1157 * "mname": "",
1158 * "lname": "Bar",
1159 * "street": "456 Tree Lane",
1160 * "postal_code": "08642",
1161 * "city": "FooTown",
1162 * "state": "FL",
1163 * "country_code": "US",
1164 * "phone_contact": "123-456-7890",
1165 * "DOB": "1992-02-02",
1166 * "sex": "Male",
1167 * "race": "",
1168 * "ethnicity": ""
1173 * @OA\Post(
1174 * path="/api/patient",
1175 * description="Creates a new patient",
1176 * tags={"standard"},
1177 * @OA\RequestBody(
1178 * required=true,
1179 * @OA\MediaType(
1180 * mediaType="application/json",
1181 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1183 * ),
1184 * @OA\Response(
1185 * response="200",
1186 * description="Standard response",
1187 * @OA\MediaType(
1188 * mediaType="application/json",
1189 * @OA\Schema(
1190 * @OA\Property(
1191 * property="validationErrors",
1192 * description="Validation errors.",
1193 * type="array",
1194 * @OA\Items(
1195 * type="object",
1196 * ),
1197 * ),
1198 * @OA\Property(
1199 * property="internalErrors",
1200 * description="Internal errors.",
1201 * type="array",
1202 * @OA\Items(
1203 * type="object",
1204 * ),
1205 * ),
1206 * @OA\Property(
1207 * property="data",
1208 * description="Returned data.",
1209 * type="array",
1210 * @OA\Items(
1211 * @OA\Property(
1212 * property="pid",
1213 * description="patient pid",
1214 * type="integer",
1216 * ),
1217 * ),
1218 * example={
1219 * "validationErrors": {},
1220 * "error_description": {},
1221 * "data": {
1222 * "pid": 1
1227 * ),
1228 * @OA\Response(
1229 * response="401",
1230 * ref="#/components/responses/unauthorized"
1231 * ),
1232 * security={{"openemr_auth":{}}}
1235 "POST /api/patient" => function () {
1236 RestConfig::authorization_check("patients", "demo");
1237 $data = (array) (json_decode(file_get_contents("php://input")));
1238 $return = (new PatientRestController())->post($data);
1239 RestConfig::apiLog($return, $data);
1240 return $return;
1244 * Schema for the patient response
1246 * @OA\Schema(
1247 * schema="api_patient_response",
1248 * @OA\Property(
1249 * property="validationErrors",
1250 * description="Validation errors.",
1251 * type="array",
1252 * @OA\Items(
1253 * type="object",
1254 * ),
1255 * ),
1256 * @OA\Property(
1257 * property="internalErrors",
1258 * description="Internal errors.",
1259 * type="array",
1260 * @OA\Items(
1261 * type="object",
1262 * ),
1263 * ),
1264 * @OA\Property(
1265 * property="data",
1266 * description="Returned data.",
1267 * type="array",
1268 * @OA\Items(
1269 * @OA\Property(
1270 * property="id",
1271 * description="patient id",
1272 * type="string",
1273 * ),
1274 * @OA\Property(
1275 * property="pid",
1276 * description="patient pid",
1277 * type="string",
1278 * ),
1279 * @OA\Property(
1280 * property="pubpid",
1281 * description="patient public id",
1282 * type="string",
1283 * ),
1284 * @OA\Property(
1285 * property="title",
1286 * description="patient title",
1287 * type="string",
1288 * ),
1289 * @OA\Property(
1290 * property="fname",
1291 * description="patient first name",
1292 * type="string",
1293 * ),
1294 * @OA\Property(
1295 * property="mname",
1296 * description="patient middle name",
1297 * type="string",
1298 * ),
1299 * @OA\Property(
1300 * property="lname",
1301 * description="patient last name",
1302 * type="string",
1303 * ),
1304 * @OA\Property(
1305 * property="ss",
1306 * description="patient social security number",
1307 * type="string",
1308 * ),
1309 * @OA\Property(
1310 * property="street",
1311 * description="patient street address",
1312 * type="string",
1313 * ),
1314 * @OA\Property(
1315 * property="postal_code",
1316 * description="patient postal code",
1317 * type="string",
1318 * ),
1319 * @OA\Property(
1320 * property="city",
1321 * description="patient city",
1322 * type="string",
1323 * ),
1324 * @OA\Property(
1325 * property="state",
1326 * description="patient state",
1327 * type="string",
1328 * ),
1329 * @OA\Property(
1330 * property="county",
1331 * description="patient county",
1332 * type="string",
1333 * ),
1334 * @OA\Property(
1335 * property="country_code",
1336 * description="patient country code",
1337 * type="string",
1338 * ),
1339 * @OA\Property(
1340 * property="drivers_license",
1341 * description="patient drivers license id",
1342 * type="string",
1343 * ),
1344 * @OA\Property(
1345 * property="contact_relationship",
1346 * description="patient contact relationship",
1347 * type="string",
1348 * ),
1349 * @OA\Property(
1350 * property="phone_contact",
1351 * description="patient phone contact",
1352 * type="string",
1353 * ),
1354 * @OA\Property(
1355 * property="phone_home",
1356 * description="patient home phone",
1357 * type="string",
1358 * ),
1359 * @OA\Property(
1360 * property="phone_biz",
1361 * description="patient work phone",
1362 * type="string",
1363 * ),
1364 * @OA\Property(
1365 * property="phone_cell",
1366 * description="patient mobile phone",
1367 * type="string",
1368 * ),
1369 * @OA\Property(
1370 * property="email",
1371 * description="patient email",
1372 * type="string",
1373 * ),
1374 * @OA\Property(
1375 * property="DOB",
1376 * description="patient DOB",
1377 * type="string",
1378 * ),
1379 * @OA\Property(
1380 * property="sex",
1381 * description="patient sex (gender)",
1382 * type="string",
1383 * ),
1384 * @OA\Property(
1385 * property="race",
1386 * description="patient race",
1387 * type="string",
1388 * ),
1389 * @OA\Property(
1390 * property="ethnicity",
1391 * description="patient ethnicity",
1392 * type="string",
1393 * ),
1394 * @OA\Property(
1395 * property="status",
1396 * description="patient status",
1397 * type="string",
1398 * ),
1399 * ),
1400 * ),
1401 * example={
1402 * "validationErrors": {},
1403 * "error_description": {},
1404 * "data": {
1405 * "id": "193",
1406 * "pid": "1",
1407 * "pubpid": "",
1408 * "title": "Mr",
1409 * "fname": "Baz",
1410 * "mname": "",
1411 * "lname": "Bop",
1412 * "ss": "",
1413 * "street": "456 Tree Lane",
1414 * "postal_code": "08642",
1415 * "city": "FooTown",
1416 * "state": "FL",
1417 * "county": "",
1418 * "country_code": "US",
1419 * "drivers_license": "",
1420 * "contact_relationship": "",
1421 * "phone_contact": "123-456-7890",
1422 * "phone_home": "",
1423 * "phone_biz": "",
1424 * "phone_cell": "",
1425 * "email": "",
1426 * "DOB": "1992-02-03",
1427 * "sex": "Male",
1428 * "race": "",
1429 * "ethnicity": "",
1430 * "status": ""
1436 * @OA\Put(
1437 * path="/api/patient/{puuid}",
1438 * description="Updates a patient",
1439 * tags={"standard"},
1440 * @OA\Parameter(
1441 * name="puuid",
1442 * in="path",
1443 * description="The uuid for the patient.",
1444 * required=true,
1445 * @OA\Schema(
1446 * type="string"
1448 * ),
1449 * @OA\RequestBody(
1450 * required=true,
1451 * @OA\MediaType(
1452 * mediaType="application/json",
1453 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1455 * ),
1456 * @OA\Response(
1457 * response="200",
1458 * description="Standard response",
1459 * @OA\MediaType(
1460 * mediaType="application/json",
1461 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1463 * ),
1464 * @OA\Response(
1465 * response="401",
1466 * ref="#/components/responses/unauthorized"
1467 * ),
1468 * security={{"openemr_auth":{}}}
1471 "PUT /api/patient/:puuid" => function ($puuid) {
1472 RestConfig::authorization_check("patients", "demo");
1473 $data = (array) (json_decode(file_get_contents("php://input")));
1474 $return = (new PatientRestController())->put($puuid, $data);
1475 RestConfig::apiLog($return, $data);
1476 return $return;
1480 * @OA\Get(
1481 * path="/api/patient/{puuid}",
1482 * description="Retrieves a single patient by their uuid",
1483 * tags={"standard"},
1484 * @OA\Parameter(
1485 * name="puuid",
1486 * in="path",
1487 * description="The uuid for the patient.",
1488 * required=true,
1489 * @OA\Schema(
1490 * type="string"
1492 * ),
1493 * @OA\Response(
1494 * response="200",
1495 * description="Standard response",
1496 * @OA\MediaType(
1497 * mediaType="application/json",
1498 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1500 * ),
1501 * @OA\Response(
1502 * response="401",
1503 * ref="#/components/responses/unauthorized"
1504 * ),
1505 * security={{"openemr_auth":{}}}
1508 "GET /api/patient/:puuid" => function ($puuid) {
1509 RestConfig::authorization_check("patients", "demo");
1510 $return = (new PatientRestController())->getOne($puuid);
1511 RestConfig::apiLog($return);
1512 return $return;
1516 * @OA\Get(
1517 * path="/api/patient/{puuid}/encounter",
1518 * description="Retrieves a list of encounters for a single patient",
1519 * tags={"standard"},
1520 * @OA\Parameter(
1521 * name="puuid",
1522 * in="path",
1523 * description="The uuid for the patient.",
1524 * required=true,
1525 * @OA\Schema(
1526 * type="string"
1528 * ),
1529 * @OA\Response(
1530 * response="200",
1531 * ref="#/components/responses/standard"
1532 * ),
1533 * @OA\Response(
1534 * response="400",
1535 * ref="#/components/responses/badrequest"
1536 * ),
1537 * @OA\Response(
1538 * response="401",
1539 * ref="#/components/responses/unauthorized"
1540 * ),
1541 * security={{"openemr_auth":{}}}
1544 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1545 RestConfig::authorization_check("encounters", "auth_a");
1546 $return = (new EncounterRestController())->getAll($puuid);
1547 RestConfig::apiLog($return);
1548 return $return;
1552 * Schema for the encounter request
1554 * @OA\Schema(
1555 * schema="api_encounter_request",
1556 * @OA\Property(
1557 * property="date",
1558 * description="The date of encounter.",
1559 * type="string"
1560 * ),
1561 * @OA\Property(
1562 * property="onset_date",
1563 * description="The onset date of encounter.",
1564 * type="string"
1565 * ),
1566 * @OA\Property(
1567 * property="reason",
1568 * description="The reason of encounter.",
1569 * type="string"
1570 * ),
1571 * @OA\Property(
1572 * property="facility",
1573 * description="The facility of encounter.",
1574 * type="string"
1575 * ),
1576 * @OA\Property(
1577 * property="pc_catid",
1578 * description="The pc_catid of encounter.",
1579 * type="string"
1580 * ),
1581 * @OA\Property(
1582 * property="facility_id",
1583 * description="The facility id of encounter.",
1584 * type="string"
1585 * ),
1586 * @OA\Property(
1587 * property="billing_facility",
1588 * description="The billing facility id of encounter.",
1589 * type="string"
1590 * ),
1591 * @OA\Property(
1592 * property="sensitivity",
1593 * description="The sensitivity of encounter.",
1594 * type="string"
1595 * ),
1596 * @OA\Property(
1597 * property="referral_source",
1598 * description="The referral source of encounter.",
1599 * type="string"
1600 * ),
1601 * @OA\Property(
1602 * property="pos_code",
1603 * description="The pos_code of encounter.",
1604 * type="string"
1605 * ),
1606 * @OA\Property(
1607 * property="external_id",
1608 * description="The external id of encounter.",
1609 * type="string"
1610 * ),
1611 * @OA\Property(
1612 * property="provider_id",
1613 * description="The provider id of encounter.",
1614 * type="string"
1615 * ),
1616 * @OA\Property(
1617 * property="class_code",
1618 * description="The class_code of encounter.",
1619 * type="string"
1620 * ),
1621 * required={"pc_catid", "class_code"},
1622 * example={
1623 * "date":"2020-11-10",
1624 * "onset_date": "",
1625 * "reason": "Pregnancy Test",
1626 * "facility": "Owerri General Hospital",
1627 * "pc_catid": "5",
1628 * "facility_id": "3",
1629 * "billing_facility": "3",
1630 * "sensitivity": "normal",
1631 * "referral_source": "",
1632 * "pos_code": "0",
1633 * "external_id": "",
1634 * "provider_id": "1",
1635 * "class_code" : "AMB"
1640 * @OA\Post(
1641 * path="/api/patient/{puuid}/encounter",
1642 * description="Creates a new encounter",
1643 * tags={"standard"},
1644 * @OA\Parameter(
1645 * name="puuid",
1646 * in="path",
1647 * description="The uuid for the patient.",
1648 * required=true,
1649 * @OA\Schema(
1650 * type="string"
1652 * ),
1653 * @OA\RequestBody(
1654 * required=true,
1655 * @OA\MediaType(
1656 * mediaType="application/json",
1657 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1659 * ),
1660 * @OA\Response(
1661 * response="200",
1662 * description="Standard response",
1663 * @OA\MediaType(
1664 * mediaType="application/json",
1665 * @OA\Schema(
1666 * @OA\Property(
1667 * property="validationErrors",
1668 * description="Validation errors.",
1669 * type="array",
1670 * @OA\Items(
1671 * type="object",
1672 * ),
1673 * ),
1674 * @OA\Property(
1675 * property="internalErrors",
1676 * description="Internal errors.",
1677 * type="array",
1678 * @OA\Items(
1679 * type="object",
1680 * ),
1681 * ),
1682 * @OA\Property(
1683 * property="data",
1684 * description="Returned data.",
1685 * type="array",
1686 * @OA\Items(
1687 * @OA\Property(
1688 * property="encounter",
1689 * description="encounter id",
1690 * type="integer",
1691 * ),
1692 * @OA\Property(
1693 * property="uuid",
1694 * description="encounter uuid",
1695 * type="string",
1697 * ),
1698 * ),
1699 * example={
1700 * "validationErrors": {},
1701 * "error_description": {},
1702 * "data": {
1703 * "encounter": 1,
1704 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1709 * ),
1710 * @OA\Response(
1711 * response="401",
1712 * ref="#/components/responses/unauthorized"
1713 * ),
1714 * security={{"openemr_auth":{}}}
1717 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1718 RestConfig::authorization_check("encounters", "auth_a");
1719 $data = (array) (json_decode(file_get_contents("php://input")));
1720 $return = (new EncounterRestController())->post($puuid, $data);
1721 RestConfig::apiLog($return, $data);
1722 return $return;
1726 * Schema for the encounter response
1728 * @OA\Schema(
1729 * schema="api_encounter_response",
1730 * @OA\Property(
1731 * property="validationErrors",
1732 * description="Validation errors.",
1733 * type="array",
1734 * @OA\Items(
1735 * type="object",
1736 * ),
1737 * ),
1738 * @OA\Property(
1739 * property="internalErrors",
1740 * description="Internal errors.",
1741 * type="array",
1742 * @OA\Items(
1743 * type="object",
1744 * ),
1745 * ),
1746 * @OA\Property(
1747 * property="data",
1748 * description="Returned data.",
1749 * type="array",
1750 * @OA\Items(
1751 * @OA\Property(
1752 * property="id",
1753 * description="encounter id",
1754 * type="string",
1755 * ),
1756 * @OA\Property(
1757 * property="uuid",
1758 * description="encounter uuid",
1759 * type="string",
1760 * ),
1761 * @OA\Property(
1762 * property="date",
1763 * description="encounter date",
1764 * type="string",
1765 * ),
1766 * @OA\Property(
1767 * property="reason",
1768 * description="encounter reason",
1769 * type="string",
1770 * ),
1771 * @OA\Property(
1772 * property="facility",
1773 * description="encounter facility name",
1774 * type="string",
1775 * ),
1776 * @OA\Property(
1777 * property="facility_id",
1778 * description="encounter facility id name",
1779 * type="string",
1780 * ),
1781 * @OA\Property(
1782 * property="pid",
1783 * description="encounter for patient pid",
1784 * type="string",
1785 * ),
1786 * @OA\Property(
1787 * property="onset_date",
1788 * description="encounter onset date",
1789 * type="string",
1790 * ),
1791 * @OA\Property(
1792 * property="sensitivity",
1793 * description="encounter sensitivity",
1794 * type="string",
1795 * ),
1796 * @OA\Property(
1797 * property="billing_note",
1798 * description="encounter billing note",
1799 * type="string",
1800 * ),
1801 * @OA\Property(
1802 * property="pc_catid",
1803 * description="encounter pc_catid",
1804 * type="string",
1805 * ),
1806 * @OA\Property(
1807 * property="last_level_billed",
1808 * description="encounter last_level_billed",
1809 * type="string",
1810 * ),
1811 * @OA\Property(
1812 * property="last_level_closed",
1813 * description="encounter last_level_closed",
1814 * type="string",
1815 * ),
1816 * @OA\Property(
1817 * property="last_stmt_date",
1818 * description="encounter last_stmt_date",
1819 * type="string",
1820 * ),
1821 * @OA\Property(
1822 * property="stmt_count",
1823 * description="encounter stmt_count",
1824 * type="string",
1825 * ),
1826 * @OA\Property(
1827 * property="provider_id",
1828 * description="provider id",
1829 * type="string",
1830 * ),
1831 * @OA\Property(
1832 * property="supervisor_id",
1833 * description="encounter supervisor id",
1834 * type="string",
1835 * ),
1836 * @OA\Property(
1837 * property="invoice_refno",
1838 * description="encounter invoice_refno",
1839 * type="string",
1840 * ),
1841 * @OA\Property(
1842 * property="referral_source",
1843 * description="encounter referral source",
1844 * type="string",
1845 * ),
1846 * @OA\Property(
1847 * property="billing_facility",
1848 * description="encounter billing facility id",
1849 * type="string",
1850 * ),
1851 * @OA\Property(
1852 * property="external_id",
1853 * description="encounter external id",
1854 * type="string",
1855 * ),
1856 * @OA\Property(
1857 * property="pos_code",
1858 * description="encounter pos_code",
1859 * type="string",
1860 * ),
1861 * @OA\Property(
1862 * property="class_code",
1863 * description="encounter class_code",
1864 * type="string",
1865 * ),
1866 * @OA\Property(
1867 * property="class_title",
1868 * description="encounter class_title",
1869 * type="string",
1870 * ),
1871 * @OA\Property(
1872 * property="pc_catname",
1873 * description="encounter pc_catname",
1874 * type="string",
1875 * ),
1876 * @OA\Property(
1877 * property="billing_facility_name",
1878 * description="encounter billing facility name",
1879 * type="string",
1880 * ),
1881 * ),
1882 * ),
1883 * example={
1884 * "validationErrors": {},
1885 * "error_description": {},
1886 * "data": {
1887 * "id": "1",
1888 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1889 * "date": "2019-09-14 00:00:00",
1890 * "reason": "Pregnancy Test",
1891 * "facility": "Owerri General Hospital",
1892 * "facility_id": "3",
1893 * "pid": "1",
1894 * "onset_date": "2019-04-20 00:00:00",
1895 * "sensitivity": "normal",
1896 * "billing_note": null,
1897 * "pc_catid": "5",
1898 * "last_level_billed": "0",
1899 * "last_level_closed": "0",
1900 * "last_stmt_date": null,
1901 * "stmt_count": "0",
1902 * "provider_id": "1",
1903 * "supervisor_id": "0",
1904 * "invoice_refno": "",
1905 * "referral_source": "",
1906 * "billing_facility": "3",
1907 * "external_id": "",
1908 * "pos_code": "0",
1909 * "class_code": "AMB",
1910 * "class_title": "ambulatory",
1911 * "pc_catname": "Office Visit",
1912 * "billing_facility_name": "Owerri General Hospital"
1918 * @OA\Put(
1919 * path="/api/patient/{puuid}/encounter/{euuid}",
1920 * description="Modify a encounter",
1921 * tags={"standard"},
1922 * @OA\Parameter(
1923 * name="puuid",
1924 * in="path",
1925 * description="The uuid for the patient.",
1926 * required=true,
1927 * @OA\Schema(
1928 * type="string"
1930 * ),
1931 * @OA\Parameter(
1932 * name="euuid",
1933 * in="path",
1934 * description="The uuid for the encounter.",
1935 * required=true,
1936 * @OA\Schema(
1937 * type="string"
1939 * ),
1940 * @OA\RequestBody(
1941 * required=true,
1942 * @OA\MediaType(
1943 * mediaType="application/json",
1944 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1946 * ),
1947 * @OA\Response(
1948 * response="200",
1949 * description="Standard response",
1950 * @OA\MediaType(
1951 * mediaType="application/json",
1952 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1954 * ),
1955 * @OA\Response(
1956 * response="401",
1957 * ref="#/components/responses/unauthorized"
1958 * ),
1959 * security={{"openemr_auth":{}}}
1962 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1963 RestConfig::authorization_check("encounters", "auth_a");
1964 $data = (array) (json_decode(file_get_contents("php://input")));
1965 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1966 RestConfig::apiLog($return, $data);
1967 return $return;
1971 * @OA\Get(
1972 * path="/api/patient/{puuid}/encounter/{euuid}",
1973 * description="Retrieves a single encounter for a patient",
1974 * tags={"standard"},
1975 * @OA\Parameter(
1976 * name="puuid",
1977 * in="path",
1978 * description="The uuid for the patient.",
1979 * required=true,
1980 * @OA\Schema(
1981 * type="string"
1983 * ),
1984 * @OA\Parameter(
1985 * name="euuid",
1986 * in="path",
1987 * description="The uuid for the encounter.",
1988 * required=true,
1989 * @OA\Schema(
1990 * type="string"
1992 * ),
1993 * @OA\Response(
1994 * response="200",
1995 * description="Standard response",
1996 * @OA\MediaType(
1997 * mediaType="application/json",
1998 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
2000 * ),
2001 * @OA\Response(
2002 * response="401",
2003 * ref="#/components/responses/unauthorized"
2004 * ),
2005 * security={{"openemr_auth":{}}}
2008 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
2009 RestConfig::authorization_check("encounters", "auth_a");
2010 $return = (new EncounterRestController())->getOne($puuid, $euuid);
2011 RestConfig::apiLog($return);
2012 return $return;
2016 * @OA\Get(
2017 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2018 * description="Retrieves soap notes from an encounter for a patient",
2019 * tags={"standard"},
2020 * @OA\Parameter(
2021 * name="pid",
2022 * in="path",
2023 * description="The pid for the patient.",
2024 * required=true,
2025 * @OA\Schema(
2026 * type="string"
2028 * ),
2029 * @OA\Parameter(
2030 * name="eid",
2031 * in="path",
2032 * description="The id for the encounter.",
2033 * required=true,
2034 * @OA\Schema(
2035 * type="string"
2037 * ),
2038 * @OA\Response(
2039 * response="200",
2040 * ref="#/components/responses/standard"
2041 * ),
2042 * @OA\Response(
2043 * response="400",
2044 * ref="#/components/responses/badrequest"
2045 * ),
2046 * @OA\Response(
2047 * response="401",
2048 * ref="#/components/responses/unauthorized"
2049 * ),
2050 * security={{"openemr_auth":{}}}
2053 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2054 RestConfig::authorization_check("encounters", "notes");
2055 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2056 RestConfig::apiLog($return);
2057 return $return;
2061 * Schema for the vital request
2063 * @OA\Schema(
2064 * schema="api_vital_request",
2065 * @OA\Property(
2066 * property="bps",
2067 * description="The bps of vitals.",
2068 * type="string"
2069 * ),
2070 * @OA\Property(
2071 * property="bpd",
2072 * description="The bpd of vitals.",
2073 * type="string"
2074 * ),
2075 * @OA\Property(
2076 * property="weight",
2077 * description="The weight of vitals. (unit is lb)",
2078 * type="string"
2079 * ),
2080 * @OA\Property(
2081 * property="height",
2082 * description="The height of vitals. (unit is inches)",
2083 * type="string"
2084 * ),
2085 * @OA\Property(
2086 * property="temperature",
2087 * description="The temperature of temperature. (unit is F)",
2088 * type="string"
2089 * ),
2090 * @OA\Property(
2091 * property="temp_method",
2092 * description="The temp_method of vitals.",
2093 * type="string"
2094 * ),
2095 * @OA\Property(
2096 * property="pulse",
2097 * description="The pulse of vitals.",
2098 * type="string"
2099 * ),
2100 * @OA\Property(
2101 * property="respiration",
2102 * description="The respiration of vitals.",
2103 * type="string"
2104 * ),
2105 * @OA\Property(
2106 * property="note",
2107 * description="The note (ie. comments) of vitals.",
2108 * type="string"
2109 * ),
2110 * @OA\Property(
2111 * property="waist_circ",
2112 * description="The waist circumference of vitals. (unit is inches)",
2113 * type="string"
2114 * ),
2115 * @OA\Property(
2116 * property="head_circ",
2117 * description="The head circumference of vitals. (unit is inches)",
2118 * type="string"
2119 * ),
2120 * @OA\Property(
2121 * property="oxygen_saturation",
2122 * description="The oxygen_saturation of vitals.",
2123 * type="string"
2124 * ),
2125 * example={
2126 * "bps": "130",
2127 * "bpd": "80",
2128 * "weight": "220",
2129 * "height": "70",
2130 * "temperature": "98",
2131 * "temp_method": "Oral",
2132 * "pulse": "60",
2133 * "respiration": "20",
2134 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2135 * "waist_circ": "37",
2136 * "head_circ": "22.2",
2137 * "oxygen_saturation": "96"
2142 * @OA\Post(
2143 * path="/api/patient/{pid}/encounter/{eid}/vital",
2144 * description="Submits a new vitals form",
2145 * tags={"standard"},
2146 * @OA\Parameter(
2147 * name="pid",
2148 * in="path",
2149 * description="The id for the patient.",
2150 * required=true,
2151 * @OA\Schema(
2152 * type="string"
2154 * ),
2155 * @OA\Parameter(
2156 * name="eid",
2157 * in="path",
2158 * description="The id for the encounter.",
2159 * required=true,
2160 * @OA\Schema(
2161 * type="string"
2163 * ),
2164 * @OA\RequestBody(
2165 * required=true,
2166 * @OA\MediaType(
2167 * mediaType="application/json",
2168 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2170 * ),
2171 * @OA\Response(
2172 * response="200",
2173 * ref="#/components/responses/standard"
2174 * ),
2175 * @OA\Response(
2176 * response="400",
2177 * ref="#/components/responses/badrequest"
2178 * ),
2179 * @OA\Response(
2180 * response="401",
2181 * ref="#/components/responses/unauthorized"
2182 * ),
2183 * security={{"openemr_auth":{}}}
2186 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2187 RestConfig::authorization_check("encounters", "notes");
2188 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2189 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2190 RestConfig::apiLog($return, $data);
2191 return $return;
2195 * @OA\Put(
2196 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2197 * description="Edit a vitals form",
2198 * tags={"standard"},
2199 * @OA\Parameter(
2200 * name="pid",
2201 * in="path",
2202 * description="The id for the patient.",
2203 * required=true,
2204 * @OA\Schema(
2205 * type="string"
2207 * ),
2208 * @OA\Parameter(
2209 * name="eid",
2210 * in="path",
2211 * description="The id for the encounter.",
2212 * required=true,
2213 * @OA\Schema(
2214 * type="string"
2216 * ),
2217 * @OA\Parameter(
2218 * name="vid",
2219 * in="path",
2220 * description="The id for the vitalss form.",
2221 * required=true,
2222 * @OA\Schema(
2223 * type="string"
2225 * ),
2226 * @OA\RequestBody(
2227 * required=true,
2228 * @OA\MediaType(
2229 * mediaType="application/json",
2230 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2232 * ),
2233 * @OA\Response(
2234 * response="200",
2235 * ref="#/components/responses/standard"
2236 * ),
2237 * @OA\Response(
2238 * response="400",
2239 * ref="#/components/responses/badrequest"
2240 * ),
2241 * @OA\Response(
2242 * response="401",
2243 * ref="#/components/responses/unauthorized"
2244 * ),
2245 * security={{"openemr_auth":{}}}
2248 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2249 RestConfig::authorization_check("encounters", "notes");
2250 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2251 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2252 RestConfig::apiLog($return, $data);
2253 return $return;
2257 * @OA\Get(
2258 * path="/api/patient/{pid}/encounter/{eid}/vital",
2259 * description="Retrieves all vitals from an encounter for a patient",
2260 * tags={"standard"},
2261 * @OA\Parameter(
2262 * name="pid",
2263 * in="path",
2264 * description="The pid for the patient.",
2265 * required=true,
2266 * @OA\Schema(
2267 * type="string"
2269 * ),
2270 * @OA\Parameter(
2271 * name="eid",
2272 * in="path",
2273 * description="The id for the encounter.",
2274 * required=true,
2275 * @OA\Schema(
2276 * type="string"
2278 * ),
2279 * @OA\Response(
2280 * response="200",
2281 * ref="#/components/responses/standard"
2282 * ),
2283 * @OA\Response(
2284 * response="400",
2285 * ref="#/components/responses/badrequest"
2286 * ),
2287 * @OA\Response(
2288 * response="401",
2289 * ref="#/components/responses/unauthorized"
2290 * ),
2291 * security={{"openemr_auth":{}}}
2294 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2295 RestConfig::authorization_check("encounters", "notes");
2296 $return = (new EncounterRestController())->getVitals($pid, $eid);
2297 RestConfig::apiLog($return);
2298 return $return;
2302 * @OA\Get(
2303 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2304 * description="Retrieves a vitals form from an encounter for a patient",
2305 * tags={"standard"},
2306 * @OA\Parameter(
2307 * name="pid",
2308 * in="path",
2309 * description="The pid for the patient.",
2310 * required=true,
2311 * @OA\Schema(
2312 * type="string"
2314 * ),
2315 * @OA\Parameter(
2316 * name="eid",
2317 * in="path",
2318 * description="The id for the encounter.",
2319 * required=true,
2320 * @OA\Schema(
2321 * type="string"
2323 * ),
2324 * @OA\Parameter(
2325 * name="vid",
2326 * in="path",
2327 * description="The id for the vitals form.",
2328 * required=true,
2329 * @OA\Schema(
2330 * type="string"
2332 * ),
2333 * @OA\Response(
2334 * response="200",
2335 * ref="#/components/responses/standard"
2336 * ),
2337 * @OA\Response(
2338 * response="400",
2339 * ref="#/components/responses/badrequest"
2340 * ),
2341 * @OA\Response(
2342 * response="401",
2343 * ref="#/components/responses/unauthorized"
2344 * ),
2345 * security={{"openemr_auth":{}}}
2348 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2349 RestConfig::authorization_check("encounters", "notes");
2350 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2351 RestConfig::apiLog($return);
2352 return $return;
2356 * @OA\Get(
2357 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2358 * description="Retrieves a soap note from an encounter for a patient",
2359 * tags={"standard"},
2360 * @OA\Parameter(
2361 * name="pid",
2362 * in="path",
2363 * description="The pid for the patient.",
2364 * required=true,
2365 * @OA\Schema(
2366 * type="string"
2368 * ),
2369 * @OA\Parameter(
2370 * name="eid",
2371 * in="path",
2372 * description="The id for the encounter.",
2373 * required=true,
2374 * @OA\Schema(
2375 * type="string"
2377 * ),
2378 * @OA\Parameter(
2379 * name="sid",
2380 * in="path",
2381 * description="The id for the soap note.",
2382 * required=true,
2383 * @OA\Schema(
2384 * type="string"
2386 * ),
2387 * @OA\Response(
2388 * response="200",
2389 * ref="#/components/responses/standard"
2390 * ),
2391 * @OA\Response(
2392 * response="400",
2393 * ref="#/components/responses/badrequest"
2394 * ),
2395 * @OA\Response(
2396 * response="401",
2397 * ref="#/components/responses/unauthorized"
2398 * ),
2399 * security={{"openemr_auth":{}}}
2402 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2403 RestConfig::authorization_check("encounters", "notes");
2404 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2405 RestConfig::apiLog($return);
2406 return $return;
2410 * Schema for the soap_note request
2412 * @OA\Schema(
2413 * schema="api_soap_note_request",
2414 * @OA\Property(
2415 * property="subjective",
2416 * description="The subjective of soap note.",
2417 * type="string"
2418 * ),
2419 * @OA\Property(
2420 * property="objective",
2421 * description="The objective of soap note.",
2422 * type="string"
2423 * ),
2424 * @OA\Property(
2425 * property="assessment",
2426 * description="The assessment of soap note.",
2427 * type="string"
2428 * ),
2429 * @OA\Property(
2430 * property="plan",
2431 * description="The plan of soap note.",
2432 * type="string"
2433 * ),
2434 * example={
2435 * "subjective": "The patient with mechanical fall and cut finger.",
2436 * "objective": "The patient with finger laceration on exam.",
2437 * "assessment": "The patient with finger laceration requiring sutures.",
2438 * "plan": "Sutured finger laceration."
2443 * @OA\Post(
2444 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2445 * description="Submits a new soap note",
2446 * tags={"standard"},
2447 * @OA\Parameter(
2448 * name="pid",
2449 * in="path",
2450 * description="The id for the patient.",
2451 * required=true,
2452 * @OA\Schema(
2453 * type="string"
2455 * ),
2456 * @OA\Parameter(
2457 * name="eid",
2458 * in="path",
2459 * description="The id for the encounter.",
2460 * required=true,
2461 * @OA\Schema(
2462 * type="string"
2464 * ),
2465 * @OA\RequestBody(
2466 * required=true,
2467 * @OA\MediaType(
2468 * mediaType="application/json",
2469 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2471 * ),
2472 * @OA\Response(
2473 * response="200",
2474 * ref="#/components/responses/standard"
2475 * ),
2476 * @OA\Response(
2477 * response="400",
2478 * ref="#/components/responses/badrequest"
2479 * ),
2480 * @OA\Response(
2481 * response="401",
2482 * ref="#/components/responses/unauthorized"
2483 * ),
2484 * security={{"openemr_auth":{}}}
2487 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2488 RestConfig::authorization_check("encounters", "notes");
2489 $data = (array) (json_decode(file_get_contents("php://input")));
2490 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2491 RestConfig::apiLog($return, $data);
2492 return $return;
2496 * @OA\Put(
2497 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2498 * description="Edit a soap note",
2499 * tags={"standard"},
2500 * @OA\Parameter(
2501 * name="pid",
2502 * in="path",
2503 * description="The id for the patient.",
2504 * required=true,
2505 * @OA\Schema(
2506 * type="string"
2508 * ),
2509 * @OA\Parameter(
2510 * name="eid",
2511 * in="path",
2512 * description="The id for the encounter.",
2513 * required=true,
2514 * @OA\Schema(
2515 * type="string"
2517 * ),
2518 * @OA\Parameter(
2519 * name="sid",
2520 * in="path",
2521 * description="The id for the soap noted.",
2522 * required=true,
2523 * @OA\Schema(
2524 * type="string"
2526 * ),
2527 * @OA\RequestBody(
2528 * required=true,
2529 * @OA\MediaType(
2530 * mediaType="application/json",
2531 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2533 * ),
2534 * @OA\Response(
2535 * response="200",
2536 * ref="#/components/responses/standard"
2537 * ),
2538 * @OA\Response(
2539 * response="400",
2540 * ref="#/components/responses/badrequest"
2541 * ),
2542 * @OA\Response(
2543 * response="401",
2544 * ref="#/components/responses/unauthorized"
2545 * ),
2546 * security={{"openemr_auth":{}}}
2549 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2550 RestConfig::authorization_check("encounters", "notes");
2551 $data = (array) (json_decode(file_get_contents("php://input")));
2552 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2553 RestConfig::apiLog($return, $data);
2554 return $return;
2559 * @OA\Get(
2560 * path="/api/practitioner",
2561 * description="Retrieves a list of practitioners",
2562 * tags={"standard"},
2563 * @OA\Parameter(
2564 * name="title",
2565 * in="query",
2566 * description="The title for the practitioner.",
2567 * required=false,
2568 * @OA\Schema(
2569 * type="string"
2571 * ),
2572 * @OA\Parameter(
2573 * name="fname",
2574 * in="query",
2575 * description="The first name for the practitioner.",
2576 * required=false,
2577 * @OA\Schema(
2578 * type="string"
2580 * ),
2581 * @OA\Parameter(
2582 * name="lname",
2583 * in="query",
2584 * description="The last name for the practitioner.",
2585 * required=false,
2586 * @OA\Schema(
2587 * type="string"
2589 * ),
2590 * @OA\Parameter(
2591 * name="mname",
2592 * in="query",
2593 * description="The middle name for the practitioner.",
2594 * required=false,
2595 * @OA\Schema(
2596 * type="string"
2598 * ),
2599 * @OA\Parameter(
2600 * name="federaltaxid",
2601 * in="query",
2602 * description="The federal tax id for the practitioner.",
2603 * required=false,
2604 * @OA\Schema(
2605 * type="string"
2607 * ),
2608 * @OA\Parameter(
2609 * name="federaldrugid",
2610 * in="query",
2611 * description="The federal drug id for the practitioner.",
2612 * required=false,
2613 * @OA\Schema(
2614 * type="string"
2616 * ),
2617 * @OA\Parameter(
2618 * name="upin",
2619 * in="query",
2620 * description="The upin for the practitioner.",
2621 * required=false,
2622 * @OA\Schema(
2623 * type="string"
2625 * ),
2626 * @OA\Parameter(
2627 * name="facility_id",
2628 * in="query",
2629 * description="The facility id for the practitioner.",
2630 * required=false,
2631 * @OA\Schema(
2632 * type="string"
2634 * ),
2635 * @OA\Parameter(
2636 * name="facility",
2637 * in="query",
2638 * description="The facility for the practitioner.",
2639 * required=false,
2640 * @OA\Schema(
2641 * type="string"
2643 * ),
2644 * @OA\Parameter(
2645 * name="npi",
2646 * in="query",
2647 * description="The npi for the practitioner.",
2648 * required=false,
2649 * @OA\Schema(
2650 * type="string"
2652 * ),
2653 * @OA\Parameter(
2654 * name="email",
2655 * in="query",
2656 * description="The email for the practitioner.",
2657 * required=false,
2658 * @OA\Schema(
2659 * type="string"
2661 * ),
2662 * @OA\Parameter(
2663 * name="specialty",
2664 * in="query",
2665 * description="The specialty for the practitioner.",
2666 * required=false,
2667 * @OA\Schema(
2668 * type="string"
2670 * ),
2671 * @OA\Parameter(
2672 * name="billname",
2673 * in="query",
2674 * description="The billname for the practitioner.",
2675 * required=false,
2676 * @OA\Schema(
2677 * type="string"
2679 * ),
2680 * @OA\Parameter(
2681 * name="url",
2682 * in="query",
2683 * description="The url for the practitioner.",
2684 * required=false,
2685 * @OA\Schema(
2686 * type="string"
2688 * ),
2689 * @OA\Parameter(
2690 * name="assistant",
2691 * in="query",
2692 * description="The assistant for the practitioner.",
2693 * required=false,
2694 * @OA\Schema(
2695 * type="string"
2697 * ),
2698 * @OA\Parameter(
2699 * name="organization",
2700 * in="query",
2701 * description="The organization for the practitioner.",
2702 * required=false,
2703 * @OA\Schema(
2704 * type="string"
2706 * ),
2707 * @OA\Parameter(
2708 * name="valedictory",
2709 * in="query",
2710 * description="The valedictory for the practitioner.",
2711 * required=false,
2712 * @OA\Schema(
2713 * type="string"
2715 * ),
2716 * @OA\Parameter(
2717 * name="street",
2718 * in="query",
2719 * description="The street for the practitioner.",
2720 * required=false,
2721 * @OA\Schema(
2722 * type="string"
2724 * ),
2725 * @OA\Parameter(
2726 * name="streetb",
2727 * in="query",
2728 * description="The street (line 2) for the practitioner.",
2729 * required=false,
2730 * @OA\Schema(
2731 * type="string"
2733 * ),
2734 * @OA\Parameter(
2735 * name="city",
2736 * in="query",
2737 * description="The city for the practitioner.",
2738 * required=false,
2739 * @OA\Schema(
2740 * type="string"
2742 * ),
2743 * @OA\Parameter(
2744 * name="state",
2745 * in="query",
2746 * description="The state for the practitioner.",
2747 * required=false,
2748 * @OA\Schema(
2749 * type="string"
2751 * ),
2752 * @OA\Parameter(
2753 * name="zip",
2754 * in="query",
2755 * description="The zip for the practitioner.",
2756 * required=false,
2757 * @OA\Schema(
2758 * type="string"
2760 * ),
2761 * @OA\Parameter(
2762 * name="phone",
2763 * in="query",
2764 * description="The phone for the practitioner.",
2765 * required=false,
2766 * @OA\Schema(
2767 * type="string"
2769 * ),
2770 * @OA\Parameter(
2771 * name="fax",
2772 * in="query",
2773 * description="The fax for the practitioner.",
2774 * required=false,
2775 * @OA\Schema(
2776 * type="string"
2778 * ),
2779 * @OA\Parameter(
2780 * name="phonew1",
2781 * in="query",
2782 * description="The phonew1 for the practitioner.",
2783 * required=false,
2784 * @OA\Schema(
2785 * type="string"
2787 * ),
2788 * @OA\Parameter(
2789 * name="phonecell",
2790 * in="query",
2791 * description="The phonecell for the practitioner.",
2792 * required=false,
2793 * @OA\Schema(
2794 * type="string"
2796 * ),
2797 * @OA\Parameter(
2798 * name="notes",
2799 * in="query",
2800 * description="The notes for the practitioner.",
2801 * required=false,
2802 * @OA\Schema(
2803 * type="string"
2805 * ),
2806 * @OA\Parameter(
2807 * name="state_license_number2",
2808 * in="query",
2809 * description="The state license number for the practitioner.",
2810 * required=false,
2811 * @OA\Schema(
2812 * type="string"
2814 * ),
2815 * @OA\Parameter(
2816 * name="username",
2817 * in="query",
2818 * description="The username for the practitioner.",
2819 * required=false,
2820 * @OA\Schema(
2821 * type="string"
2823 * ),
2824 * @OA\Response(
2825 * response="200",
2826 * ref="#/components/responses/standard"
2827 * ),
2828 * @OA\Response(
2829 * response="400",
2830 * ref="#/components/responses/badrequest"
2831 * ),
2832 * @OA\Response(
2833 * response="401",
2834 * ref="#/components/responses/unauthorized"
2835 * ),
2836 * security={{"openemr_auth":{}}}
2839 "GET /api/practitioner" => function () {
2840 RestConfig::authorization_check("admin", "users");
2841 $return = (new PractitionerRestController())->getAll($_GET);
2842 RestConfig::apiLog($return);
2843 return $return;
2847 * @OA\Get(
2848 * path="/api/practitioner/{pruuid}",
2849 * description="Retrieves a single practitioner by their uuid",
2850 * tags={"standard"},
2851 * @OA\Parameter(
2852 * name="pruuid",
2853 * in="path",
2854 * description="The uuid for the practitioner.",
2855 * required=true,
2856 * @OA\Schema(
2857 * type="string"
2859 * ),
2860 * @OA\Response(
2861 * response="200",
2862 * ref="#/components/responses/standard"
2863 * ),
2864 * @OA\Response(
2865 * response="400",
2866 * ref="#/components/responses/badrequest"
2867 * ),
2868 * @OA\Response(
2869 * response="401",
2870 * ref="#/components/responses/unauthorized"
2871 * ),
2872 * security={{"openemr_auth":{}}}
2875 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2876 RestConfig::authorization_check("admin", "users");
2877 $return = (new PractitionerRestController())->getOne($pruuid);
2878 RestConfig::apiLog($return);
2879 return $return;
2883 * @OA\Post(
2884 * path="/api/practitioner",
2885 * description="Submits a new practitioner",
2886 * tags={"standard"},
2887 * @OA\RequestBody(
2888 * required=true,
2889 * @OA\MediaType(
2890 * mediaType="application/json",
2891 * @OA\Schema(
2892 * @OA\Property(
2893 * property="title",
2894 * description="The title for the practitioner.",
2895 * type="string"
2896 * ),
2897 * @OA\Property(
2898 * property="fname",
2899 * description="The first name for the practitioner.",
2900 * type="string"
2901 * ),
2902 * @OA\Property(
2903 * property="mname",
2904 * description="The middle name for the practitioner.",
2905 * type="string"
2906 * ),
2907 * @OA\Property(
2908 * property="lname",
2909 * description="The last name for the practitioner.",
2910 * type="string"
2911 * ),
2912 * @OA\Property(
2913 * property="federaltaxid",
2914 * description="The federal tax id for the practitioner.",
2915 * type="string"
2916 * ),
2917 * @OA\Property(
2918 * property="federaldrugid",
2919 * description="The federal drug id for the practitioner.",
2920 * type="string"
2921 * ),
2922 * @OA\Property(
2923 * property="upin",
2924 * description="The upin for the practitioner.",
2925 * type="string"
2926 * ),
2927 * @OA\Property(
2928 * property="facility_id",
2929 * description="The facility_id for the practitioner.",
2930 * type="string"
2931 * ),
2932 * @OA\Property(
2933 * property="facility",
2934 * description="The facility name for the practitioner.",
2935 * type="string"
2936 * ),
2937 * @OA\Property(
2938 * property="npi",
2939 * description="The npi for the practitioner.",
2940 * type="string"
2941 * ),
2942 * @OA\Property(
2943 * property="email",
2944 * description="The email for the practitioner.",
2945 * type="string"
2946 * ),
2947 * @OA\Property(
2948 * property="specialty",
2949 * description="The specialty for the practitioner.",
2950 * type="string"
2951 * ),
2952 * @OA\Property(
2953 * property="billname",
2954 * description="The billname for the practitioner.",
2955 * type="string"
2956 * ),
2957 * @OA\Property(
2958 * property="url",
2959 * description="The url for the practitioner.",
2960 * type="string"
2961 * ),
2962 * @OA\Property(
2963 * property="assistant",
2964 * description="The assistant for the practitioner.",
2965 * type="string"
2966 * ),
2967 * @OA\Property(
2968 * property="valedictory",
2969 * description="The valedictory for the practitioner.",
2970 * type="string"
2971 * ),
2972 * @OA\Property(
2973 * property="street",
2974 * description="The street address for the practitioner.",
2975 * type="string"
2976 * ),
2977 * @OA\Property(
2978 * property="streetb",
2979 * description="The streetb address for the practitioner.",
2980 * type="string"
2981 * ),
2982 * @OA\Property(
2983 * property="city",
2984 * description="The city for the practitioner.",
2985 * type="string"
2986 * ),
2987 * @OA\Property(
2988 * property="state",
2989 * description="The state for the practitioner.",
2990 * type="string"
2991 * ),
2992 * @OA\Property(
2993 * property="zip",
2994 * description="The zip for the practitioner.",
2995 * type="string"
2996 * ),
2997 * @OA\Property(
2998 * property="phone",
2999 * description="The phone for the practitioner.",
3000 * type="string"
3001 * ),
3002 * @OA\Property(
3003 * property="fax",
3004 * description="The fax for the practitioner.",
3005 * type="string"
3006 * ),
3007 * @OA\Property(
3008 * property="phonew1",
3009 * description="The phonew1 for the practitioner.",
3010 * type="string"
3011 * ),
3012 * @OA\Property(
3013 * property="phonecell",
3014 * description="The phonecell for the practitioner.",
3015 * type="string"
3016 * ),
3017 * @OA\Property(
3018 * property="notes",
3019 * description="The notes for the practitioner.",
3020 * type="string"
3021 * ),
3022 * @OA\Property(
3023 * property="state_license_number",
3024 * description="The state license number for the practitioner.",
3025 * type="string"
3026 * ),
3027 * @OA\Property(
3028 * property="username",
3029 * description="The username for the practitioner.",
3030 * type="string"
3031 * ),
3032 * required={"fname", "lname", "npi"},
3033 * example={
3034 * "title": "Mrs.",
3035 * "fname": "Eduardo",
3036 * "mname": "Kathy",
3037 * "lname": "Perez",
3038 * "federaltaxid": "",
3039 * "federaldrugid": "",
3040 * "upin": "",
3041 * "facility_id": "3",
3042 * "facility": "Your Clinic Name Here",
3043 * "npi": "12345678901",
3044 * "email": "info@pennfirm.com",
3045 * "specialty": "",
3046 * "billname": null,
3047 * "url": null,
3048 * "assistant": null,
3049 * "organization": null,
3050 * "valedictory": null,
3051 * "street": "789 Third Avenue",
3052 * "streetb": "123 Cannaut Street",
3053 * "city": "San Diego",
3054 * "state": "CA",
3055 * "zip": "90210",
3056 * "phone": "(619) 555-9827",
3057 * "fax": null,
3058 * "phonew1": "(619) 555-7822",
3059 * "phonecell": "(619) 555-7821",
3060 * "notes": null,
3061 * "state_license_number": "123456",
3062 * "username": "eduardoperez"
3066 * ),
3067 * @OA\Response(
3068 * response="200",
3069 * description="Standard response",
3070 * @OA\MediaType(
3071 * mediaType="application/json",
3072 * @OA\Schema(
3073 * @OA\Property(
3074 * property="validationErrors",
3075 * description="Validation errors.",
3076 * type="array",
3077 * @OA\Items(
3078 * type="object",
3079 * ),
3080 * ),
3081 * @OA\Property(
3082 * property="internalErrors",
3083 * description="Internal errors.",
3084 * type="array",
3085 * @OA\Items(
3086 * type="object",
3087 * ),
3088 * ),
3089 * @OA\Property(
3090 * property="data",
3091 * description="Returned data.",
3092 * type="array",
3093 * @OA\Items(
3094 * @OA\Property(
3095 * property="id",
3096 * description="practitioner id",
3097 * type="integer",
3098 * ),
3099 * @OA\Property(
3100 * property="uuid",
3101 * description="practitioner uuid",
3102 * type="string",
3103 * ),
3104 * ),
3105 * ),
3106 * example={
3107 * "validationErrors": {},
3108 * "error_description": {},
3109 * "data": {
3110 * "id": 7,
3111 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3116 * ),
3117 * @OA\Response(
3118 * response="401",
3119 * ref="#/components/responses/unauthorized"
3120 * ),
3121 * security={{"openemr_auth":{}}}
3124 "POST /api/practitioner" => function () {
3125 RestConfig::authorization_check("admin", "users");
3126 $data = (array) (json_decode(file_get_contents("php://input")));
3127 $return = (new PractitionerRestController())->post($data);
3128 RestConfig::apiLog($return, $data);
3129 return $return;
3133 * @OA\Put(
3134 * path="/api/practitioner/{pruuid}",
3135 * description="Edit a practitioner",
3136 * tags={"standard"},
3137 * @OA\Parameter(
3138 * name="pruuid",
3139 * in="path",
3140 * description="The uuid for the practitioner.",
3141 * required=true,
3142 * @OA\Schema(
3143 * type="string"
3145 * ),
3146 * @OA\RequestBody(
3147 * required=true,
3148 * @OA\MediaType(
3149 * mediaType="application/json",
3150 * @OA\Schema(
3151 * @OA\Property(
3152 * property="title",
3153 * description="The title for the practitioner.",
3154 * type="string"
3155 * ),
3156 * @OA\Property(
3157 * property="fname",
3158 * description="The first name for the practitioner.",
3159 * type="string"
3160 * ),
3161 * @OA\Property(
3162 * property="mname",
3163 * description="The middle name for the practitioner.",
3164 * type="string"
3165 * ),
3166 * @OA\Property(
3167 * property="lname",
3168 * description="The last name for the practitioner.",
3169 * type="string"
3170 * ),
3171 * @OA\Property(
3172 * property="federaltaxid",
3173 * description="The federal tax id for the practitioner.",
3174 * type="string"
3175 * ),
3176 * @OA\Property(
3177 * property="federaldrugid",
3178 * description="The federal drug id for the practitioner.",
3179 * type="string"
3180 * ),
3181 * @OA\Property(
3182 * property="upin",
3183 * description="The upin for the practitioner.",
3184 * type="string"
3185 * ),
3186 * @OA\Property(
3187 * property="facility_id",
3188 * description="The facility_id for the practitioner.",
3189 * type="string"
3190 * ),
3191 * @OA\Property(
3192 * property="facility",
3193 * description="The facility name for the practitioner.",
3194 * type="string"
3195 * ),
3196 * @OA\Property(
3197 * property="npi",
3198 * description="The npi for the practitioner.",
3199 * type="string"
3200 * ),
3201 * @OA\Property(
3202 * property="email",
3203 * description="The email for the practitioner.",
3204 * type="string"
3205 * ),
3206 * @OA\Property(
3207 * property="specialty",
3208 * description="The specialty for the practitioner.",
3209 * type="string"
3210 * ),
3211 * @OA\Property(
3212 * property="billname",
3213 * description="The billname for the practitioner.",
3214 * type="string"
3215 * ),
3216 * @OA\Property(
3217 * property="url",
3218 * description="The url for the practitioner.",
3219 * type="string"
3220 * ),
3221 * @OA\Property(
3222 * property="assistant",
3223 * description="The assistant for the practitioner.",
3224 * type="string"
3225 * ),
3226 * @OA\Property(
3227 * property="valedictory",
3228 * description="The valedictory for the practitioner.",
3229 * type="string"
3230 * ),
3231 * @OA\Property(
3232 * property="street",
3233 * description="The street address for the practitioner.",
3234 * type="string"
3235 * ),
3236 * @OA\Property(
3237 * property="streetb",
3238 * description="The streetb address for the practitioner.",
3239 * type="string"
3240 * ),
3241 * @OA\Property(
3242 * property="city",
3243 * description="The city for the practitioner.",
3244 * type="string"
3245 * ),
3246 * @OA\Property(
3247 * property="state",
3248 * description="The state for the practitioner.",
3249 * type="string"
3250 * ),
3251 * @OA\Property(
3252 * property="zip",
3253 * description="The zip for the practitioner.",
3254 * type="string"
3255 * ),
3256 * @OA\Property(
3257 * property="phone",
3258 * description="The phone for the practitioner.",
3259 * type="string"
3260 * ),
3261 * @OA\Property(
3262 * property="fax",
3263 * description="The fax for the practitioner.",
3264 * type="string"
3265 * ),
3266 * @OA\Property(
3267 * property="phonew1",
3268 * description="The phonew1 for the practitioner.",
3269 * type="string"
3270 * ),
3271 * @OA\Property(
3272 * property="phonecell",
3273 * description="The phonecell for the practitioner.",
3274 * type="string"
3275 * ),
3276 * @OA\Property(
3277 * property="notes",
3278 * description="The notes for the practitioner.",
3279 * type="string"
3280 * ),
3281 * @OA\Property(
3282 * property="state_license_number",
3283 * description="The state license number for the practitioner.",
3284 * type="string"
3285 * ),
3286 * @OA\Property(
3287 * property="username",
3288 * description="The username for the practitioner.",
3289 * type="string"
3290 * ),
3291 * example={
3292 * "title": "Mr",
3293 * "fname": "Baz",
3294 * "mname": "",
3295 * "lname": "Bop",
3296 * "street": "456 Tree Lane",
3297 * "zip": "08642",
3298 * "city": "FooTown",
3299 * "state": "FL",
3300 * "phone": "123-456-7890"
3304 * ),
3305 * @OA\Response(
3306 * response="200",
3307 * description="Standard response",
3308 * @OA\MediaType(
3309 * mediaType="application/json",
3310 * @OA\Schema(
3311 * @OA\Property(
3312 * property="validationErrors",
3313 * description="Validation errors.",
3314 * type="array",
3315 * @OA\Items(
3316 * type="object",
3317 * ),
3318 * ),
3319 * @OA\Property(
3320 * property="internalErrors",
3321 * description="Internal errors.",
3322 * type="array",
3323 * @OA\Items(
3324 * type="object",
3325 * ),
3326 * ),
3327 * @OA\Property(
3328 * property="data",
3329 * description="Returned data.",
3330 * type="array",
3331 * @OA\Items(
3332 * @OA\Property(
3333 * property="id",
3334 * description="practitioner id",
3335 * type="string",
3336 * ),
3337 * @OA\Property(
3338 * property="uuid",
3339 * description="practitioner uuid",
3340 * type="string",
3341 * ),
3342 * @OA\Property(
3343 * property="title",
3344 * description="practitioner title",
3345 * type="string",
3346 * ),
3347 * @OA\Property(
3348 * property="fname",
3349 * description="practitioner fname",
3350 * type="string",
3351 * ),
3352 * @OA\Property(
3353 * property="lname",
3354 * description="practitioner lname",
3355 * type="string",
3356 * ),
3357 * @OA\Property(
3358 * property="mname",
3359 * description="practitioner mname",
3360 * type="string",
3361 * ),
3362 * @OA\Property(
3363 * property="federaltaxid",
3364 * description="practitioner federaltaxid",
3365 * type="string",
3366 * ),
3367 * @OA\Property(
3368 * property="federaldrugid",
3369 * description="practitioner federaldrugid",
3370 * type="string",
3371 * ),
3372 * @OA\Property(
3373 * property="upin",
3374 * description="practitioner upin",
3375 * type="string",
3376 * ),
3377 * @OA\Property(
3378 * property="facility_id",
3379 * description="practitioner facility_id",
3380 * type="string",
3381 * ),
3382 * @OA\Property(
3383 * property="facility",
3384 * description="practitioner facility",
3385 * type="string",
3386 * ),
3387 * @OA\Property(
3388 * property="npi",
3389 * description="practitioner npi",
3390 * type="string",
3391 * ),
3392 * @OA\Property(
3393 * property="email",
3394 * description="practitioner email",
3395 * type="string",
3396 * ),
3397 * @OA\Property(
3398 * property="active",
3399 * description="practitioner active setting",
3400 * type="string",
3401 * ),
3402 * @OA\Property(
3403 * property="specialty",
3404 * description="practitioner specialty",
3405 * type="string",
3406 * ),
3407 * @OA\Property(
3408 * property="billname",
3409 * description="practitioner billname",
3410 * type="string",
3411 * ),
3412 * @OA\Property(
3413 * property="url",
3414 * description="practitioner url",
3415 * type="string",
3416 * ),
3417 * @OA\Property(
3418 * property="assistant",
3419 * description="practitioner assistant",
3420 * type="string",
3421 * ),
3422 * @OA\Property(
3423 * property="organization",
3424 * description="practitioner organization",
3425 * type="string",
3426 * ),
3427 * @OA\Property(
3428 * property="valedictory",
3429 * description="practitioner valedictory",
3430 * type="string",
3431 * ),
3432 * @OA\Property(
3433 * property="street",
3434 * description="practitioner street",
3435 * type="string",
3436 * ),
3437 * @OA\Property(
3438 * property="streetb",
3439 * description="practitioner streetb",
3440 * type="string",
3441 * ),
3442 * @OA\Property(
3443 * property="city",
3444 * description="practitioner city",
3445 * type="string",
3446 * ),
3447 * @OA\Property(
3448 * property="state",
3449 * description="practitioner state",
3450 * type="string",
3451 * ),
3452 * @OA\Property(
3453 * property="zip",
3454 * description="practitioner zip",
3455 * type="string",
3456 * ),
3457 * @OA\Property(
3458 * property="phone",
3459 * description="practitioner phone",
3460 * type="string",
3461 * ),
3462 * @OA\Property(
3463 * property="fax",
3464 * description="fax",
3465 * type="string",
3466 * ),
3467 * @OA\Property(
3468 * property="phonew1",
3469 * description="practitioner phonew1",
3470 * type="string",
3471 * ),
3472 * @OA\Property(
3473 * property="phonecell",
3474 * description="practitioner phonecell",
3475 * type="string",
3476 * ),
3477 * @OA\Property(
3478 * property="notes",
3479 * description="practitioner notes",
3480 * type="string",
3481 * ),
3482 * @OA\Property(
3483 * property="state_license_number",
3484 * description="practitioner state license number",
3485 * type="string",
3486 * ),
3487 * @OA\Property(
3488 * property="abook_title",
3489 * description="practitioner abook title",
3490 * type="string",
3491 * ),
3492 * @OA\Property(
3493 * property="physician_title",
3494 * description="practitioner physician title",
3495 * type="string",
3496 * ),
3497 * @OA\Property(
3498 * property="physician_code",
3499 * description="practitioner physician code",
3500 * type="string",
3502 * ),
3503 * ),
3504 * example={
3505 * "validationErrors": {},
3506 * "error_description": {},
3507 * "data": {
3508 * "id": 7,
3509 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3510 * "title": "Mr",
3511 * "fname": "Baz",
3512 * "lname": "Bop",
3513 * "mname": "",
3514 * "federaltaxid": "",
3515 * "federaldrugid": "",
3516 * "upin": "",
3517 * "facility_id": "3",
3518 * "facility": "Your Clinic Name Here",
3519 * "npi": "0123456789",
3520 * "email": "info@pennfirm.com",
3521 * "active": "1",
3522 * "specialty": "",
3523 * "billname": "",
3524 * "url": "",
3525 * "assistant": "",
3526 * "organization": "",
3527 * "valedictory": "",
3528 * "street": "456 Tree Lane",
3529 * "streetb": "123 Cannaut Street",
3530 * "city": "FooTown",
3531 * "state": "FL",
3532 * "zip": "08642",
3533 * "phone": "123-456-7890",
3534 * "fax": "",
3535 * "phonew1": "(619) 555-7822",
3536 * "phonecell": "(619) 555-7821",
3537 * "notes": "",
3538 * "state_license_number": "123456",
3539 * "abook_title": null,
3540 * "physician_title": null,
3541 * "physician_code": null
3546 * ),
3547 * @OA\Response(
3548 * response="401",
3549 * ref="#/components/responses/unauthorized"
3550 * ),
3551 * security={{"openemr_auth":{}}}
3554 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3555 RestConfig::authorization_check("admin", "users");
3556 $data = (array) (json_decode(file_get_contents("php://input")));
3557 $return = (new PractitionerRestController())->patch($pruuid, $data);
3558 RestConfig::apiLog($return, $data);
3559 return $return;
3563 * @OA\Get(
3564 * path="/api/medical_problem",
3565 * description="Retrieves a list of medical problems",
3566 * tags={"standard"},
3567 * @OA\Parameter(
3568 * name="puuid",
3569 * in="query",
3570 * description="The uuid for the patient.",
3571 * required=false,
3572 * @OA\Schema(
3573 * type="string"
3575 * ),
3576 * @OA\Parameter(
3577 * name="condition_uuid",
3578 * in="query",
3579 * description="The uuid for the medical problem.",
3580 * required=false,
3581 * @OA\Schema(
3582 * type="string"
3584 * ),
3585 * @OA\Parameter(
3586 * name="title",
3587 * in="query",
3588 * description="The title for the medical problem.",
3589 * required=false,
3590 * @OA\Schema(
3591 * type="string"
3593 * ),
3594 * @OA\Parameter(
3595 * name="begdate",
3596 * in="query",
3597 * description="The start date for the medical problem.",
3598 * required=false,
3599 * @OA\Schema(
3600 * type="string"
3602 * ),
3603 * @OA\Parameter(
3604 * name="enddate",
3605 * in="query",
3606 * description="The end date for the medical problem.",
3607 * required=false,
3608 * @OA\Schema(
3609 * type="string"
3611 * ),
3612 * @OA\Parameter(
3613 * name="diagnosis",
3614 * in="query",
3615 * description="The diagnosis for the medical problem.",
3616 * required=false,
3617 * @OA\Schema(
3618 * type="string"
3620 * ),
3621 * @OA\Response(
3622 * response="200",
3623 * ref="#/components/responses/standard"
3624 * ),
3625 * @OA\Response(
3626 * response="400",
3627 * ref="#/components/responses/badrequest"
3628 * ),
3629 * @OA\Response(
3630 * response="401",
3631 * ref="#/components/responses/unauthorized"
3632 * ),
3633 * security={{"openemr_auth":{}}}
3636 "GET /api/medical_problem" => function () {
3637 RestConfig::authorization_check("encounters", "notes");
3638 $return = (new ConditionRestController())->getAll();
3639 RestConfig::apiLog($return);
3640 return $return;
3644 * @OA\Get(
3645 * path="/api/medical_problem/{muuid}",
3646 * description="Retrieves a single medical problem by their uuid",
3647 * tags={"standard"},
3648 * @OA\Parameter(
3649 * name="muuid",
3650 * in="path",
3651 * description="The uuid for the medical problem.",
3652 * required=true,
3653 * @OA\Schema(
3654 * type="string"
3656 * ),
3657 * @OA\Response(
3658 * response="200",
3659 * ref="#/components/responses/standard"
3660 * ),
3661 * @OA\Response(
3662 * response="400",
3663 * ref="#/components/responses/badrequest"
3664 * ),
3665 * @OA\Response(
3666 * response="401",
3667 * ref="#/components/responses/unauthorized"
3668 * ),
3669 * security={{"openemr_auth":{}}}
3672 "GET /api/medical_problem/:muuid" => function ($muuid) {
3673 RestConfig::authorization_check("encounters", "notes");
3674 $return = (new ConditionRestController())->getOne($muuid);
3675 RestConfig::apiLog($return);
3676 return $return;
3680 * @OA\Get(
3681 * path="/api/patient/{puuid}/medical_problem",
3682 * description="Retrieves all medical problems for a patient",
3683 * tags={"standard"},
3684 * @OA\Parameter(
3685 * name="puuid",
3686 * in="path",
3687 * description="The uuid for the patient.",
3688 * required=true,
3689 * @OA\Schema(
3690 * type="string"
3692 * ),
3693 * @OA\Response(
3694 * response="200",
3695 * ref="#/components/responses/standard"
3696 * ),
3697 * @OA\Response(
3698 * response="400",
3699 * ref="#/components/responses/badrequest"
3700 * ),
3701 * @OA\Response(
3702 * response="401",
3703 * ref="#/components/responses/unauthorized"
3704 * ),
3705 * security={{"openemr_auth":{}}}
3708 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3709 RestConfig::authorization_check("encounters", "notes");
3710 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3711 RestConfig::apiLog($return);
3712 return $return;
3716 * @OA\Get(
3717 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3718 * description="Retrieves a medical problem for a patient",
3719 * tags={"standard"},
3720 * @OA\Parameter(
3721 * name="puuid",
3722 * in="path",
3723 * description="The uuid for the patient.",
3724 * required=true,
3725 * @OA\Schema(
3726 * type="string"
3728 * ),
3729 * @OA\Parameter(
3730 * name="muuid",
3731 * in="path",
3732 * description="The uuid for the medical problem.",
3733 * required=true,
3734 * @OA\Schema(
3735 * type="string"
3737 * ),
3738 * @OA\Response(
3739 * response="200",
3740 * ref="#/components/responses/standard"
3741 * ),
3742 * @OA\Response(
3743 * response="400",
3744 * ref="#/components/responses/badrequest"
3745 * ),
3746 * @OA\Response(
3747 * response="401",
3748 * ref="#/components/responses/unauthorized"
3749 * ),
3750 * security={{"openemr_auth":{}}}
3753 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3754 RestConfig::authorization_check("patients", "med");
3755 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3756 RestConfig::apiLog($return);
3757 return $return;
3761 * Schema for the medical_problem request
3763 * @OA\Schema(
3764 * schema="api_medical_problem_request",
3765 * @OA\Property(
3766 * property="title",
3767 * description="The title of medical problem.",
3768 * type="string"
3769 * ),
3770 * @OA\Property(
3771 * property="begdate",
3772 * description="The beginning date of medical problem.",
3773 * type="string"
3774 * ),
3775 * @OA\Property(
3776 * property="enddate",
3777 * description="The end date of medical problem.",
3778 * type="string"
3779 * ),
3780 * @OA\Property(
3781 * property="diagnosis",
3782 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3783 * type="string"
3784 * ),
3785 * required={"title", "begdate"},
3786 * example={
3787 * "title": "Dermatochalasis",
3788 * "begdate": "2010-10-13",
3789 * "enddate": null,
3790 * "diagnosis": "ICD10:H02.839"
3795 * @OA\Post(
3796 * path="/api/patient/{puuid}/medical_problem",
3797 * description="Submits a new medical problem",
3798 * tags={"standard"},
3799 * @OA\Parameter(
3800 * name="puuid",
3801 * in="path",
3802 * description="The uuid for the patient.",
3803 * required=true,
3804 * @OA\Schema(
3805 * type="string"
3807 * ),
3808 * @OA\RequestBody(
3809 * required=true,
3810 * @OA\MediaType(
3811 * mediaType="application/json",
3812 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3814 * ),
3815 * @OA\Response(
3816 * response="200",
3817 * ref="#/components/responses/standard"
3818 * ),
3819 * @OA\Response(
3820 * response="400",
3821 * ref="#/components/responses/badrequest"
3822 * ),
3823 * @OA\Response(
3824 * response="401",
3825 * ref="#/components/responses/unauthorized"
3826 * ),
3827 * security={{"openemr_auth":{}}}
3830 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3831 RestConfig::authorization_check("patients", "med");
3832 $data = (array) (json_decode(file_get_contents("php://input")));
3833 $return = (new ConditionRestController())->post($puuid, $data);
3834 RestConfig::apiLog($return, $data);
3835 return $return;
3839 * @OA\Put(
3840 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3841 * description="Edit a medical problem",
3842 * tags={"standard"},
3843 * @OA\Parameter(
3844 * name="puuid",
3845 * in="path",
3846 * description="The uuid for the patient.",
3847 * required=true,
3848 * @OA\Schema(
3849 * type="string"
3851 * ),
3852 * @OA\Parameter(
3853 * name="muuid",
3854 * in="path",
3855 * description="The uuid for the medical problem.",
3856 * required=true,
3857 * @OA\Schema(
3858 * type="string"
3860 * ),
3861 * @OA\RequestBody(
3862 * required=true,
3863 * @OA\MediaType(
3864 * mediaType="application/json",
3865 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3867 * ),
3868 * @OA\Response(
3869 * response="200",
3870 * ref="#/components/responses/standard"
3871 * ),
3872 * @OA\Response(
3873 * response="400",
3874 * ref="#/components/responses/badrequest"
3875 * ),
3876 * @OA\Response(
3877 * response="401",
3878 * ref="#/components/responses/unauthorized"
3879 * ),
3880 * security={{"openemr_auth":{}}}
3883 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3884 RestConfig::authorization_check("patients", "med");
3885 $data = (array) (json_decode(file_get_contents("php://input")));
3886 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3887 RestConfig::apiLog($return, $data);
3888 return $return;
3892 * @OA\Delete(
3893 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3894 * description="Delete a medical problem",
3895 * tags={"standard"},
3896 * @OA\Parameter(
3897 * name="puuid",
3898 * in="path",
3899 * description="The uuid for the patient.",
3900 * required=true,
3901 * @OA\Schema(
3902 * type="string"
3904 * ),
3905 * @OA\Parameter(
3906 * name="muuid",
3907 * in="path",
3908 * description="The uuid for the medical problem.",
3909 * required=true,
3910 * @OA\Schema(
3911 * type="string"
3913 * ),
3914 * @OA\Response(
3915 * response="200",
3916 * ref="#/components/responses/standard"
3917 * ),
3918 * @OA\Response(
3919 * response="400",
3920 * ref="#/components/responses/badrequest"
3921 * ),
3922 * @OA\Response(
3923 * response="401",
3924 * ref="#/components/responses/unauthorized"
3925 * ),
3926 * security={{"openemr_auth":{}}}
3929 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3930 RestConfig::authorization_check("patients", "med");
3931 $return = (new ConditionRestController())->delete($puuid, $muuid);
3932 RestConfig::apiLog($return);
3933 return $return;
3937 * @OA\Get(
3938 * path="/api/allergy",
3939 * description="Retrieves a list of allergies",
3940 * tags={"standard"},
3941 * @OA\Parameter(
3942 * name="lists.pid",
3943 * in="query",
3944 * description="The uuid for the patient.",
3945 * required=false,
3946 * @OA\Schema(
3947 * type="string"
3949 * ),
3950 * @OA\Parameter(
3951 * name="lists.id",
3952 * in="query",
3953 * description="The uuid for the allergy.",
3954 * required=false,
3955 * @OA\Schema(
3956 * type="string"
3958 * ),
3959 * @OA\Parameter(
3960 * name="title",
3961 * in="query",
3962 * description="The title for the allergy.",
3963 * required=false,
3964 * @OA\Schema(
3965 * type="string"
3967 * ),
3968 * @OA\Parameter(
3969 * name="begdate",
3970 * in="query",
3971 * description="The start date for the allergy.",
3972 * required=false,
3973 * @OA\Schema(
3974 * type="string"
3976 * ),
3977 * @OA\Parameter(
3978 * name="enddate",
3979 * in="query",
3980 * description="The end date for the allergy.",
3981 * required=false,
3982 * @OA\Schema(
3983 * type="string"
3985 * ),
3986 * @OA\Parameter(
3987 * name="diagnosis",
3988 * in="query",
3989 * description="The diagnosis for the allergy.",
3990 * required=false,
3991 * @OA\Schema(
3992 * type="string"
3994 * ),
3995 * @OA\Response(
3996 * response="200",
3997 * ref="#/components/responses/standard"
3998 * ),
3999 * @OA\Response(
4000 * response="400",
4001 * ref="#/components/responses/badrequest"
4002 * ),
4003 * @OA\Response(
4004 * response="401",
4005 * ref="#/components/responses/unauthorized"
4006 * ),
4007 * security={{"openemr_auth":{}}}
4010 "GET /api/allergy" => function () {
4011 RestConfig::authorization_check("patients", "med");
4012 $return = (new AllergyIntoleranceRestController())->getAll();
4013 RestConfig::apiLog($return);
4014 return $return;
4018 * @OA\Get(
4019 * path="/api/allergy/{auuid}",
4020 * description="Retrieves a single allergy by their uuid",
4021 * tags={"standard"},
4022 * @OA\Parameter(
4023 * name="auuid",
4024 * in="path",
4025 * description="The uuid for the allergy.",
4026 * required=true,
4027 * @OA\Schema(
4028 * type="string"
4030 * ),
4031 * @OA\Response(
4032 * response="200",
4033 * ref="#/components/responses/standard"
4034 * ),
4035 * @OA\Response(
4036 * response="400",
4037 * ref="#/components/responses/badrequest"
4038 * ),
4039 * @OA\Response(
4040 * response="401",
4041 * ref="#/components/responses/unauthorized"
4042 * ),
4043 * security={{"openemr_auth":{}}}
4046 "GET /api/allergy/:auuid" => function ($auuid) {
4047 RestConfig::authorization_check("patients", "med");
4048 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
4049 RestConfig::apiLog($return);
4050 return $return;
4054 * @OA\Get(
4055 * path="/api/patient/{puuid}/allergy",
4056 * description="Retrieves all allergies for a patient",
4057 * tags={"standard"},
4058 * @OA\Parameter(
4059 * name="puuid",
4060 * in="path",
4061 * description="The uuid for the patient.",
4062 * required=true,
4063 * @OA\Schema(
4064 * type="string"
4066 * ),
4067 * @OA\Response(
4068 * response="200",
4069 * ref="#/components/responses/standard"
4070 * ),
4071 * @OA\Response(
4072 * response="400",
4073 * ref="#/components/responses/badrequest"
4074 * ),
4075 * @OA\Response(
4076 * response="401",
4077 * ref="#/components/responses/unauthorized"
4078 * ),
4079 * security={{"openemr_auth":{}}}
4082 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4083 RestConfig::authorization_check("patients", "med");
4084 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4085 RestConfig::apiLog($return);
4086 return $return;
4090 * @OA\Get(
4091 * path="/api/patient/{puuid}/allergy/{auuid}",
4092 * description="Retrieves a allergy for a patient",
4093 * tags={"standard"},
4094 * @OA\Parameter(
4095 * name="puuid",
4096 * in="path",
4097 * description="The uuid for the patient.",
4098 * required=true,
4099 * @OA\Schema(
4100 * type="string"
4102 * ),
4103 * @OA\Parameter(
4104 * name="auuid",
4105 * in="path",
4106 * description="The uuid for the allergy.",
4107 * required=true,
4108 * @OA\Schema(
4109 * type="string"
4111 * ),
4112 * @OA\Response(
4113 * response="200",
4114 * ref="#/components/responses/standard"
4115 * ),
4116 * @OA\Response(
4117 * response="400",
4118 * ref="#/components/responses/badrequest"
4119 * ),
4120 * @OA\Response(
4121 * response="401",
4122 * ref="#/components/responses/unauthorized"
4123 * ),
4124 * security={{"openemr_auth":{}}}
4127 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4128 RestConfig::authorization_check("patients", "med");
4129 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4130 RestConfig::apiLog($return);
4131 return $return;
4135 * Schema for the allergy request
4137 * @OA\Schema(
4138 * schema="api_allergy_request",
4139 * @OA\Property(
4140 * property="title",
4141 * description="The title of allergy.",
4142 * type="string"
4143 * ),
4144 * @OA\Property(
4145 * property="begdate",
4146 * description="The beginning date of allergy.",
4147 * type="string"
4148 * ),
4149 * @OA\Property(
4150 * property="enddate",
4151 * description="The end date of allergy.",
4152 * type="string"
4153 * ),
4154 * @OA\Property(
4155 * property="diagnosis",
4156 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4157 * type="string"
4158 * ),
4159 * required={"title", "begdate"},
4160 * example={
4161 * "title": "Iodine",
4162 * "begdate": "2010-10-13",
4163 * "enddate": null
4168 * @OA\Post(
4169 * path="/api/patient/{puuid}/allergy",
4170 * description="Submits a new allergy",
4171 * tags={"standard"},
4172 * @OA\Parameter(
4173 * name="puuid",
4174 * in="path",
4175 * description="The uuid for the patient.",
4176 * required=true,
4177 * @OA\Schema(
4178 * type="string"
4180 * ),
4181 * @OA\RequestBody(
4182 * required=true,
4183 * @OA\MediaType(
4184 * mediaType="application/json",
4185 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4187 * ),
4188 * @OA\Response(
4189 * response="200",
4190 * ref="#/components/responses/standard"
4191 * ),
4192 * @OA\Response(
4193 * response="400",
4194 * ref="#/components/responses/badrequest"
4195 * ),
4196 * @OA\Response(
4197 * response="401",
4198 * ref="#/components/responses/unauthorized"
4199 * ),
4200 * security={{"openemr_auth":{}}}
4203 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4204 RestConfig::authorization_check("patients", "med");
4205 $data = (array) (json_decode(file_get_contents("php://input")));
4206 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4207 RestConfig::apiLog($return, $data);
4208 return $return;
4212 * @OA\Put(
4213 * path="/api/patient/{puuid}/allergy/{auuid}",
4214 * description="Edit a allergy",
4215 * tags={"standard"},
4216 * @OA\Parameter(
4217 * name="puuid",
4218 * in="path",
4219 * description="The uuid for the patient.",
4220 * required=true,
4221 * @OA\Schema(
4222 * type="string"
4224 * ),
4225 * @OA\Parameter(
4226 * name="auuid",
4227 * in="path",
4228 * description="The uuid for the allergy.",
4229 * required=true,
4230 * @OA\Schema(
4231 * type="string"
4233 * ),
4234 * @OA\RequestBody(
4235 * required=true,
4236 * @OA\MediaType(
4237 * mediaType="application/json",
4238 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4240 * ),
4241 * @OA\Response(
4242 * response="200",
4243 * ref="#/components/responses/standard"
4244 * ),
4245 * @OA\Response(
4246 * response="400",
4247 * ref="#/components/responses/badrequest"
4248 * ),
4249 * @OA\Response(
4250 * response="401",
4251 * ref="#/components/responses/unauthorized"
4252 * ),
4253 * security={{"openemr_auth":{}}}
4256 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4257 RestConfig::authorization_check("patients", "med");
4258 $data = (array) (json_decode(file_get_contents("php://input")));
4259 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4260 RestConfig::apiLog($return, $data);
4261 return $return;
4265 * @OA\Delete(
4266 * path="/api/patient/{puuid}/allergy/{auuid}",
4267 * description="Delete a medical problem",
4268 * tags={"standard"},
4269 * @OA\Parameter(
4270 * name="puuid",
4271 * in="path",
4272 * description="The uuid for the patient.",
4273 * required=true,
4274 * @OA\Schema(
4275 * type="string"
4277 * ),
4278 * @OA\Parameter(
4279 * name="auuid",
4280 * in="path",
4281 * description="The uuid for the allergy.",
4282 * required=true,
4283 * @OA\Schema(
4284 * type="string"
4286 * ),
4287 * @OA\Response(
4288 * response="200",
4289 * ref="#/components/responses/standard"
4290 * ),
4291 * @OA\Response(
4292 * response="400",
4293 * ref="#/components/responses/badrequest"
4294 * ),
4295 * @OA\Response(
4296 * response="401",
4297 * ref="#/components/responses/unauthorized"
4298 * ),
4299 * security={{"openemr_auth":{}}}
4302 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4303 RestConfig::authorization_check("patients", "med");
4304 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4305 RestConfig::apiLog($return);
4306 return $return;
4310 * @OA\Get(
4311 * path="/api/patient/{pid}/medication",
4312 * description="Retrieves all medications for a patient",
4313 * tags={"standard"},
4314 * @OA\Parameter(
4315 * name="pid",
4316 * in="path",
4317 * description="The pid for the patient.",
4318 * required=true,
4319 * @OA\Schema(
4320 * type="string"
4322 * ),
4323 * @OA\Response(
4324 * response="200",
4325 * ref="#/components/responses/standard"
4326 * ),
4327 * @OA\Response(
4328 * response="400",
4329 * ref="#/components/responses/badrequest"
4330 * ),
4331 * @OA\Response(
4332 * response="401",
4333 * ref="#/components/responses/unauthorized"
4334 * ),
4335 * security={{"openemr_auth":{}}}
4338 "GET /api/patient/:pid/medication" => function ($pid) {
4339 RestConfig::authorization_check("patients", "med");
4340 $return = (new ListRestController())->getAll($pid, "medication");
4341 RestConfig::apiLog($return);
4342 return $return;
4346 * Schema for the medication request
4348 * @OA\Schema(
4349 * schema="api_medication_request",
4350 * @OA\Property(
4351 * property="title",
4352 * description="The title of medication.",
4353 * type="string"
4354 * ),
4355 * @OA\Property(
4356 * property="begdate",
4357 * description="The beginning date of medication.",
4358 * type="string"
4359 * ),
4360 * @OA\Property(
4361 * property="enddate",
4362 * description="The end date of medication.",
4363 * type="string"
4364 * ),
4365 * @OA\Property(
4366 * property="diagnosis",
4367 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4368 * type="string"
4369 * ),
4370 * required={"title", "begdate"},
4371 * example={
4372 * "title": "Norvasc",
4373 * "begdate": "2013-04-13",
4374 * "enddate": null
4379 * @OA\Post(
4380 * path="/api/patient/{pid}/medication",
4381 * description="Submits a new medication",
4382 * tags={"standard"},
4383 * @OA\Parameter(
4384 * name="pid",
4385 * in="path",
4386 * description="The pid for the patient.",
4387 * required=true,
4388 * @OA\Schema(
4389 * type="string"
4391 * ),
4392 * @OA\RequestBody(
4393 * required=true,
4394 * @OA\MediaType(
4395 * mediaType="application/json",
4396 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4398 * ),
4399 * @OA\Response(
4400 * response="200",
4401 * ref="#/components/responses/standard"
4402 * ),
4403 * @OA\Response(
4404 * response="400",
4405 * ref="#/components/responses/badrequest"
4406 * ),
4407 * @OA\Response(
4408 * response="401",
4409 * ref="#/components/responses/unauthorized"
4410 * ),
4411 * security={{"openemr_auth":{}}}
4414 "POST /api/patient/:pid/medication" => function ($pid) {
4415 RestConfig::authorization_check("patients", "med");
4416 $data = (array) (json_decode(file_get_contents("php://input")));
4417 $return = (new ListRestController())->post($pid, "medication", $data);
4418 RestConfig::apiLog($return, $data);
4419 return $return;
4423 * @OA\Put(
4424 * path="/api/patient/{pid}/medication/{mid}",
4425 * description="Edit a medication",
4426 * tags={"standard"},
4427 * @OA\Parameter(
4428 * name="pid",
4429 * in="path",
4430 * description="The pid for the patient.",
4431 * required=true,
4432 * @OA\Schema(
4433 * type="string"
4435 * ),
4436 * @OA\Parameter(
4437 * name="mid",
4438 * in="path",
4439 * description="The id for the medication.",
4440 * required=true,
4441 * @OA\Schema(
4442 * type="string"
4444 * ),
4445 * @OA\RequestBody(
4446 * required=true,
4447 * @OA\MediaType(
4448 * mediaType="application/json",
4449 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4451 * ),
4452 * @OA\Response(
4453 * response="200",
4454 * ref="#/components/responses/standard"
4455 * ),
4456 * @OA\Response(
4457 * response="400",
4458 * ref="#/components/responses/badrequest"
4459 * ),
4460 * @OA\Response(
4461 * response="401",
4462 * ref="#/components/responses/unauthorized"
4463 * ),
4464 * security={{"openemr_auth":{}}}
4467 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4468 RestConfig::authorization_check("patients", "med");
4469 $data = (array) (json_decode(file_get_contents("php://input")));
4470 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4471 RestConfig::apiLog($return, $data);
4472 return $return;
4476 * @OA\Get(
4477 * path="/api/patient/{pid}/medication/{mid}",
4478 * description="Retrieves a medication for a patient",
4479 * tags={"standard"},
4480 * @OA\Parameter(
4481 * name="pid",
4482 * in="path",
4483 * description="The id for the patient.",
4484 * required=true,
4485 * @OA\Schema(
4486 * type="string"
4488 * ),
4489 * @OA\Parameter(
4490 * name="mid",
4491 * in="path",
4492 * description="The id for the medication.",
4493 * required=true,
4494 * @OA\Schema(
4495 * type="string"
4497 * ),
4498 * @OA\Response(
4499 * response="200",
4500 * ref="#/components/responses/standard"
4501 * ),
4502 * @OA\Response(
4503 * response="400",
4504 * ref="#/components/responses/badrequest"
4505 * ),
4506 * @OA\Response(
4507 * response="401",
4508 * ref="#/components/responses/unauthorized"
4509 * ),
4510 * security={{"openemr_auth":{}}}
4513 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4514 RestConfig::authorization_check("patients", "med");
4515 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4516 RestConfig::apiLog($return);
4517 return $return;
4521 * @OA\Delete(
4522 * path="/api/patient/{pid}/medication/{mid}",
4523 * description="Delete a medication",
4524 * tags={"standard"},
4525 * @OA\Parameter(
4526 * name="pid",
4527 * in="path",
4528 * description="The id for the patient.",
4529 * required=true,
4530 * @OA\Schema(
4531 * type="string"
4533 * ),
4534 * @OA\Parameter(
4535 * name="mid",
4536 * in="path",
4537 * description="The id for the medication.",
4538 * required=true,
4539 * @OA\Schema(
4540 * type="string"
4542 * ),
4543 * @OA\Response(
4544 * response="200",
4545 * ref="#/components/responses/standard"
4546 * ),
4547 * @OA\Response(
4548 * response="400",
4549 * ref="#/components/responses/badrequest"
4550 * ),
4551 * @OA\Response(
4552 * response="401",
4553 * ref="#/components/responses/unauthorized"
4554 * ),
4555 * security={{"openemr_auth":{}}}
4558 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4559 RestConfig::authorization_check("patients", "med");
4560 $return = (new ListRestController())->delete($pid, $mid, "medication");
4561 RestConfig::apiLog($return);
4562 return $return;
4566 * @OA\Get(
4567 * path="/api/patient/{pid}/surgery",
4568 * description="Retrieves all surgeries for a patient",
4569 * tags={"standard"},
4570 * @OA\Parameter(
4571 * name="pid",
4572 * in="path",
4573 * description="The pid for the patient.",
4574 * required=true,
4575 * @OA\Schema(
4576 * type="string"
4578 * ),
4579 * @OA\Response(
4580 * response="200",
4581 * ref="#/components/responses/standard"
4582 * ),
4583 * @OA\Response(
4584 * response="400",
4585 * ref="#/components/responses/badrequest"
4586 * ),
4587 * @OA\Response(
4588 * response="401",
4589 * ref="#/components/responses/unauthorized"
4590 * ),
4591 * security={{"openemr_auth":{}}}
4594 "GET /api/patient/:pid/surgery" => function ($pid) {
4595 RestConfig::authorization_check("patients", "med");
4596 $return = (new ListRestController())->getAll($pid, "surgery");
4597 RestConfig::apiLog($return);
4598 return $return;
4602 * @OA\Get(
4603 * path="/api/patient/{pid}/surgery/{sid}",
4604 * description="Retrieves a surgery for a patient",
4605 * tags={"standard"},
4606 * @OA\Parameter(
4607 * name="pid",
4608 * in="path",
4609 * description="The id for the patient.",
4610 * required=true,
4611 * @OA\Schema(
4612 * type="string"
4614 * ),
4615 * @OA\Parameter(
4616 * name="sid",
4617 * in="path",
4618 * description="The id for the surgery.",
4619 * required=true,
4620 * @OA\Schema(
4621 * type="string"
4623 * ),
4624 * @OA\Response(
4625 * response="200",
4626 * ref="#/components/responses/standard"
4627 * ),
4628 * @OA\Response(
4629 * response="400",
4630 * ref="#/components/responses/badrequest"
4631 * ),
4632 * @OA\Response(
4633 * response="401",
4634 * ref="#/components/responses/unauthorized"
4635 * ),
4636 * security={{"openemr_auth":{}}}
4639 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4640 RestConfig::authorization_check("patients", "med");
4641 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4642 RestConfig::apiLog($return);
4643 return $return;
4647 * @OA\Delete(
4648 * path="/api/patient/{pid}/surgery/{sid}",
4649 * description="Delete a surgery",
4650 * tags={"standard"},
4651 * @OA\Parameter(
4652 * name="pid",
4653 * in="path",
4654 * description="The id for the patient.",
4655 * required=true,
4656 * @OA\Schema(
4657 * type="string"
4659 * ),
4660 * @OA\Parameter(
4661 * name="sid",
4662 * in="path",
4663 * description="The id for the surgery.",
4664 * required=true,
4665 * @OA\Schema(
4666 * type="string"
4668 * ),
4669 * @OA\Response(
4670 * response="200",
4671 * ref="#/components/responses/standard"
4672 * ),
4673 * @OA\Response(
4674 * response="400",
4675 * ref="#/components/responses/badrequest"
4676 * ),
4677 * @OA\Response(
4678 * response="401",
4679 * ref="#/components/responses/unauthorized"
4680 * ),
4681 * security={{"openemr_auth":{}}}
4684 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4685 RestConfig::authorization_check("patients", "med");
4686 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4687 RestConfig::apiLog($return);
4688 return $return;
4692 * Schema for the surgery request
4694 * @OA\Schema(
4695 * schema="api_surgery_request",
4696 * @OA\Property(
4697 * property="title",
4698 * description="The title of surgery.",
4699 * type="string"
4700 * ),
4701 * @OA\Property(
4702 * property="begdate",
4703 * description="The beginning date of surgery.",
4704 * type="string"
4705 * ),
4706 * @OA\Property(
4707 * property="enddate",
4708 * description="The end date of surgery.",
4709 * type="string"
4710 * ),
4711 * @OA\Property(
4712 * property="diagnosis",
4713 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4714 * type="string"
4715 * ),
4716 * required={"title", "begdate"},
4717 * example={
4718 * "title": "Blepharoplasty",
4719 * "begdate": "2013-10-14",
4720 * "enddate": null,
4721 * "diagnosis": "CPT4:15823-50"
4726 * @OA\Post(
4727 * path="/api/patient/{pid}/surgery",
4728 * description="Submits a new surgery",
4729 * tags={"standard"},
4730 * @OA\Parameter(
4731 * name="pid",
4732 * in="path",
4733 * description="The pid for the patient.",
4734 * required=true,
4735 * @OA\Schema(
4736 * type="string"
4738 * ),
4739 * @OA\RequestBody(
4740 * required=true,
4741 * @OA\MediaType(
4742 * mediaType="application/json",
4743 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4745 * ),
4746 * @OA\Response(
4747 * response="200",
4748 * ref="#/components/responses/standard"
4749 * ),
4750 * @OA\Response(
4751 * response="400",
4752 * ref="#/components/responses/badrequest"
4753 * ),
4754 * @OA\Response(
4755 * response="401",
4756 * ref="#/components/responses/unauthorized"
4757 * ),
4758 * security={{"openemr_auth":{}}}
4761 "POST /api/patient/:pid/surgery" => function ($pid) {
4762 RestConfig::authorization_check("patients", "med");
4763 $data = (array) (json_decode(file_get_contents("php://input")));
4764 $return = (new ListRestController())->post($pid, "surgery", $data);
4765 RestConfig::apiLog($return, $data);
4766 return $return;
4770 * @OA\Put(
4771 * path="/api/patient/{pid}/surgery/{sid}",
4772 * description="Edit a surgery",
4773 * tags={"standard"},
4774 * @OA\Parameter(
4775 * name="pid",
4776 * in="path",
4777 * description="The pid for the patient.",
4778 * required=true,
4779 * @OA\Schema(
4780 * type="string"
4782 * ),
4783 * @OA\Parameter(
4784 * name="sid",
4785 * in="path",
4786 * description="The id for the surgery.",
4787 * required=true,
4788 * @OA\Schema(
4789 * type="string"
4791 * ),
4792 * @OA\RequestBody(
4793 * required=true,
4794 * @OA\MediaType(
4795 * mediaType="application/json",
4796 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4798 * ),
4799 * @OA\Response(
4800 * response="200",
4801 * ref="#/components/responses/standard"
4802 * ),
4803 * @OA\Response(
4804 * response="400",
4805 * ref="#/components/responses/badrequest"
4806 * ),
4807 * @OA\Response(
4808 * response="401",
4809 * ref="#/components/responses/unauthorized"
4810 * ),
4811 * security={{"openemr_auth":{}}}
4814 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4815 RestConfig::authorization_check("patients", "med");
4816 $data = (array) (json_decode(file_get_contents("php://input")));
4817 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4818 RestConfig::apiLog($return, $data);
4819 return $return;
4823 * @OA\Get(
4824 * path="/api/patient/{pid}/dental_issue",
4825 * description="Retrieves all dental issues for a patient",
4826 * tags={"standard"},
4827 * @OA\Parameter(
4828 * name="pid",
4829 * in="path",
4830 * description="The pid for the patient.",
4831 * required=true,
4832 * @OA\Schema(
4833 * type="string"
4835 * ),
4836 * @OA\Response(
4837 * response="200",
4838 * ref="#/components/responses/standard"
4839 * ),
4840 * @OA\Response(
4841 * response="400",
4842 * ref="#/components/responses/badrequest"
4843 * ),
4844 * @OA\Response(
4845 * response="401",
4846 * ref="#/components/responses/unauthorized"
4847 * ),
4848 * security={{"openemr_auth":{}}}
4851 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4852 RestConfig::authorization_check("patients", "med");
4853 $return = (new ListRestController())->getAll($pid, "dental");
4854 RestConfig::apiLog($return);
4855 return $return;
4859 * @OA\Get(
4860 * path="/api/patient/{pid}/dental_issue/{did}",
4861 * description="Retrieves a dental issue for a patient",
4862 * tags={"standard"},
4863 * @OA\Parameter(
4864 * name="pid",
4865 * in="path",
4866 * description="The id for the patient.",
4867 * required=true,
4868 * @OA\Schema(
4869 * type="string"
4871 * ),
4872 * @OA\Parameter(
4873 * name="did",
4874 * in="path",
4875 * description="The id for the dental issue.",
4876 * required=true,
4877 * @OA\Schema(
4878 * type="string"
4880 * ),
4881 * @OA\Response(
4882 * response="200",
4883 * ref="#/components/responses/standard"
4884 * ),
4885 * @OA\Response(
4886 * response="400",
4887 * ref="#/components/responses/badrequest"
4888 * ),
4889 * @OA\Response(
4890 * response="401",
4891 * ref="#/components/responses/unauthorized"
4892 * ),
4893 * security={{"openemr_auth":{}}}
4896 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4897 RestConfig::authorization_check("patients", "med");
4898 $return = (new ListRestController())->getOne($pid, "dental", $did);
4899 RestConfig::apiLog($return);
4900 return $return;
4904 * @OA\Delete(
4905 * path="/api/patient/{pid}/dental_issue/{did}",
4906 * description="Delete a dental issue",
4907 * tags={"standard"},
4908 * @OA\Parameter(
4909 * name="pid",
4910 * in="path",
4911 * description="The id for the patient.",
4912 * required=true,
4913 * @OA\Schema(
4914 * type="string"
4916 * ),
4917 * @OA\Parameter(
4918 * name="did",
4919 * in="path",
4920 * description="The id for the dental issue.",
4921 * required=true,
4922 * @OA\Schema(
4923 * type="string"
4925 * ),
4926 * @OA\Response(
4927 * response="200",
4928 * ref="#/components/responses/standard"
4929 * ),
4930 * @OA\Response(
4931 * response="400",
4932 * ref="#/components/responses/badrequest"
4933 * ),
4934 * @OA\Response(
4935 * response="401",
4936 * ref="#/components/responses/unauthorized"
4937 * ),
4938 * security={{"openemr_auth":{}}}
4941 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4942 RestConfig::authorization_check("patients", "med");
4943 $return = (new ListRestController())->delete($pid, $did, "dental");
4944 RestConfig::apiLog($return);
4945 return $return;
4949 * Schema for the dental_issue request
4951 * @OA\Schema(
4952 * schema="api_dental_issue_request",
4953 * @OA\Property(
4954 * property="title",
4955 * description="The title of dental issue.",
4956 * type="string"
4957 * ),
4958 * @OA\Property(
4959 * property="begdate",
4960 * description="The beginning date of dental issue.",
4961 * type="string"
4962 * ),
4963 * @OA\Property(
4964 * property="enddate",
4965 * description="The end date of dental issue.",
4966 * type="string"
4967 * ),
4968 * @OA\Property(
4969 * property="diagnosis",
4970 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4971 * type="string"
4972 * ),
4973 * required={"title", "begdate"},
4974 * example={
4975 * "title": "Halitosis",
4976 * "begdate": "2015-03-17",
4977 * "enddate": null,
4982 * @OA\Post(
4983 * path="/api/patient/{pid}/dental_issue",
4984 * description="Submits a new dental issue",
4985 * tags={"standard"},
4986 * @OA\Parameter(
4987 * name="pid",
4988 * in="path",
4989 * description="The pid for the patient.",
4990 * required=true,
4991 * @OA\Schema(
4992 * type="string"
4994 * ),
4995 * @OA\RequestBody(
4996 * required=true,
4997 * @OA\MediaType(
4998 * mediaType="application/json",
4999 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5001 * ),
5002 * @OA\Response(
5003 * response="200",
5004 * ref="#/components/responses/standard"
5005 * ),
5006 * @OA\Response(
5007 * response="400",
5008 * ref="#/components/responses/badrequest"
5009 * ),
5010 * @OA\Response(
5011 * response="401",
5012 * ref="#/components/responses/unauthorized"
5013 * ),
5014 * security={{"openemr_auth":{}}}
5017 "POST /api/patient/:pid/dental_issue" => function ($pid) {
5018 RestConfig::authorization_check("patients", "med");
5019 $data = (array) (json_decode(file_get_contents("php://input")));
5020 $return = (new ListRestController())->post($pid, "dental", $data);
5021 RestConfig::apiLog($return, $data);
5022 return $return;
5026 * @OA\Put(
5027 * path="/api/patient/{pid}/dental_issue/{did}",
5028 * description="Edit a dental issue",
5029 * tags={"standard"},
5030 * @OA\Parameter(
5031 * name="pid",
5032 * in="path",
5033 * description="The pid for the patient.",
5034 * required=true,
5035 * @OA\Schema(
5036 * type="string"
5038 * ),
5039 * @OA\Parameter(
5040 * name="did",
5041 * in="path",
5042 * description="The id for the dental issue.",
5043 * required=true,
5044 * @OA\Schema(
5045 * type="string"
5047 * ),
5048 * @OA\RequestBody(
5049 * required=true,
5050 * @OA\MediaType(
5051 * mediaType="application/json",
5052 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5054 * ),
5055 * @OA\Response(
5056 * response="200",
5057 * ref="#/components/responses/standard"
5058 * ),
5059 * @OA\Response(
5060 * response="400",
5061 * ref="#/components/responses/badrequest"
5062 * ),
5063 * @OA\Response(
5064 * response="401",
5065 * ref="#/components/responses/unauthorized"
5066 * ),
5067 * security={{"openemr_auth":{}}}
5070 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5071 RestConfig::authorization_check("patients", "med");
5072 $data = (array) (json_decode(file_get_contents("php://input")));
5073 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5074 RestConfig::apiLog($return, $data);
5075 return $return;
5079 * @OA\Get(
5080 * path="/api/patient/{pid}/appointment",
5081 * description="Retrieves all appointments for a patient",
5082 * tags={"standard"},
5083 * @OA\Parameter(
5084 * name="pid",
5085 * in="path",
5086 * description="The pid for the patient.",
5087 * required=true,
5088 * @OA\Schema(
5089 * type="string"
5091 * ),
5092 * @OA\Response(
5093 * response="200",
5094 * ref="#/components/responses/standard"
5095 * ),
5096 * @OA\Response(
5097 * response="400",
5098 * ref="#/components/responses/badrequest"
5099 * ),
5100 * @OA\Response(
5101 * response="401",
5102 * ref="#/components/responses/unauthorized"
5103 * ),
5104 * security={{"openemr_auth":{}}}
5107 "GET /api/patient/:pid/appointment" => function ($pid) {
5108 RestConfig::authorization_check("patients", "appt");
5109 $return = (new AppointmentRestController())->getAllForPatient($pid);
5110 RestConfig::apiLog($return);
5111 return $return;
5115 * @OA\Post(
5116 * path="/api/patient/{pid}/appointment",
5117 * description="Submits a new appointment",
5118 * tags={"standard"},
5119 * @OA\Parameter(
5120 * name="pid",
5121 * in="path",
5122 * description="The id for the patient.",
5123 * required=true,
5124 * @OA\Schema(
5125 * type="string"
5127 * ),
5128 * @OA\RequestBody(
5129 * required=true,
5130 * @OA\MediaType(
5131 * mediaType="application/json",
5132 * @OA\Schema(
5133 * @OA\Property(
5134 * property="pc_catid",
5135 * description="The category of the appointment.",
5136 * type="string"
5137 * ),
5138 * @OA\Property(
5139 * property="pc_title",
5140 * description="The title of the appointment.",
5141 * type="string"
5142 * ),
5143 * @OA\Property(
5144 * property="pc_duration",
5145 * description="The duration of the appointment.",
5146 * type="string"
5147 * ),
5148 * @OA\Property(
5149 * property="pc_hometext",
5150 * description="Comments for the appointment.",
5151 * type="string"
5152 * ),
5153 * @OA\Property(
5154 * property="pc_apptstatus",
5155 * description="use an option from resource=/api/list/apptstat",
5156 * type="string"
5157 * ),
5158 * @OA\Property(
5159 * property="pc_eventDate",
5160 * description="The date of the appointment.",
5161 * type="string"
5162 * ),
5163 * @OA\Property(
5164 * property="pc_startTime",
5165 * description="The time of the appointment.",
5166 * type="string"
5167 * ),
5168 * @OA\Property(
5169 * property="pc_facility",
5170 * description="The facility id of the appointment.",
5171 * type="string"
5172 * ),
5173 * @OA\Property(
5174 * property="pc_billing_location",
5175 * description="The billinag location id of the appointment.",
5176 * type="string"
5177 * ),
5178 * @OA\Property(
5179 * property="pc_aid",
5180 * description="The provider id for the appointment.",
5181 * type="string"
5182 * ),
5183 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5184 * example={
5185 * "pc_catid": "5",
5186 * "pc_title": "Office Visit",
5187 * "pc_duration": "900",
5188 * "pc_hometext": "Test",
5189 * "pc_apptstatus": "-",
5190 * "pc_eventDate": "2018-10-19",
5191 * "pc_startTime": "09:00",
5192 * "pc_facility": "9",
5193 * "pc_billing_location": "10",
5194 * "pc_aid": "1"
5198 * ),
5199 * @OA\Response(
5200 * response="200",
5201 * ref="#/components/responses/standard"
5202 * ),
5203 * @OA\Response(
5204 * response="400",
5205 * ref="#/components/responses/badrequest"
5206 * ),
5207 * @OA\Response(
5208 * response="401",
5209 * ref="#/components/responses/unauthorized"
5210 * ),
5211 * security={{"openemr_auth":{}}}
5214 "POST /api/patient/:pid/appointment" => function ($pid) {
5215 RestConfig::authorization_check("patients", "appt");
5216 $data = (array) (json_decode(file_get_contents("php://input")));
5217 $return = (new AppointmentRestController())->post($pid, $data);
5218 RestConfig::apiLog($return, $data);
5219 return $return;
5223 * @OA\Get(
5224 * path="/api/appointment",
5225 * description="Retrieves all appointments",
5226 * tags={"standard"},
5227 * @OA\Response(
5228 * response="200",
5229 * ref="#/components/responses/standard"
5230 * ),
5231 * @OA\Response(
5232 * response="400",
5233 * ref="#/components/responses/badrequest"
5234 * ),
5235 * @OA\Response(
5236 * response="401",
5237 * ref="#/components/responses/unauthorized"
5238 * ),
5239 * security={{"openemr_auth":{}}}
5242 "GET /api/appointment" => function () {
5243 RestConfig::authorization_check("patients", "appt");
5244 $return = (new AppointmentRestController())->getAll();
5245 RestConfig::apiLog($return);
5246 return $return;
5250 * @OA\Get(
5251 * path="/api/appointment/{eid}",
5252 * description="Retrieves an appointment",
5253 * tags={"standard"},
5254 * @OA\Parameter(
5255 * name="eid",
5256 * in="path",
5257 * description="The eid for the appointment.",
5258 * required=true,
5259 * @OA\Schema(
5260 * type="string"
5262 * ),
5263 * @OA\Response(
5264 * response="200",
5265 * ref="#/components/responses/standard"
5266 * ),
5267 * @OA\Response(
5268 * response="400",
5269 * ref="#/components/responses/badrequest"
5270 * ),
5271 * @OA\Response(
5272 * response="401",
5273 * ref="#/components/responses/unauthorized"
5274 * ),
5275 * security={{"openemr_auth":{}}}
5278 "GET /api/appointment/:eid" => function ($eid) {
5279 RestConfig::authorization_check("patients", "appt");
5280 $return = (new AppointmentRestController())->getOne($eid);
5281 RestConfig::apiLog($return);
5282 return $return;
5286 * @OA\Delete(
5287 * path="/api/patient/{pid}/appointment/{eid}",
5288 * description="Delete a appointment",
5289 * tags={"standard"},
5290 * @OA\Parameter(
5291 * name="pid",
5292 * in="path",
5293 * description="The id for the patient.",
5294 * required=true,
5295 * @OA\Schema(
5296 * type="string"
5298 * ),
5299 * @OA\Parameter(
5300 * name="eid",
5301 * in="path",
5302 * description="The eid for the appointment.",
5303 * required=true,
5304 * @OA\Schema(
5305 * type="string"
5307 * ),
5308 * @OA\Response(
5309 * response="200",
5310 * ref="#/components/responses/standard"
5311 * ),
5312 * @OA\Response(
5313 * response="400",
5314 * ref="#/components/responses/badrequest"
5315 * ),
5316 * @OA\Response(
5317 * response="401",
5318 * ref="#/components/responses/unauthorized"
5319 * ),
5320 * security={{"openemr_auth":{}}}
5323 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5324 RestConfig::authorization_check("patients", "appt");
5325 $return = (new AppointmentRestController())->delete($eid);
5326 RestConfig::apiLog($return);
5327 return $return;
5331 * @OA\Get(
5332 * path="/api/patient/{pid}/appointment/{eid}",
5333 * description="Retrieves a appointment for a patient",
5334 * tags={"standard"},
5335 * @OA\Parameter(
5336 * name="pid",
5337 * in="path",
5338 * description="The id for the patient.",
5339 * required=true,
5340 * @OA\Schema(
5341 * type="string"
5343 * ),
5344 * @OA\Parameter(
5345 * name="eid",
5346 * in="path",
5347 * description="The eid for the appointment.",
5348 * required=true,
5349 * @OA\Schema(
5350 * type="string"
5352 * ),
5353 * @OA\Response(
5354 * response="200",
5355 * ref="#/components/responses/standard"
5356 * ),
5357 * @OA\Response(
5358 * response="400",
5359 * ref="#/components/responses/badrequest"
5360 * ),
5361 * @OA\Response(
5362 * response="401",
5363 * ref="#/components/responses/unauthorized"
5364 * ),
5365 * security={{"openemr_auth":{}}}
5368 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5369 RestConfig::authorization_check("patients", "appt");
5370 $return = (new AppointmentRestController())->getOne($eid);
5371 RestConfig::apiLog($return);
5372 return $return;
5376 * @OA\Get(
5377 * path="/api/list/{list_name}",
5378 * description="Retrieves a list",
5379 * tags={"standard"},
5380 * @OA\Parameter(
5381 * name="list_name",
5382 * in="path",
5383 * description="The list_id of the list.",
5384 * required=true,
5385 * @OA\Schema(
5386 * type="string"
5388 * ),
5389 * @OA\Response(
5390 * response="200",
5391 * ref="#/components/responses/standard"
5392 * ),
5393 * @OA\Response(
5394 * response="400",
5395 * ref="#/components/responses/badrequest"
5396 * ),
5397 * @OA\Response(
5398 * response="401",
5399 * ref="#/components/responses/unauthorized"
5400 * ),
5401 * security={{"openemr_auth":{}}}
5404 "GET /api/list/:list_name" => function ($list_name) {
5405 RestConfig::authorization_check("lists", "default");
5406 $return = (new ListRestController())->getOptions($list_name);
5407 RestConfig::apiLog($return);
5408 return $return;
5412 * @OA\Get(
5413 * path="/api/user",
5414 * description="Retrieves a list of users",
5415 * tags={"standard"},
5416 * @OA\Parameter(
5417 * name="id",
5418 * in="query",
5419 * description="The id for the user.",
5420 * required=false,
5421 * @OA\Schema(
5422 * type="string"
5424 * ),
5425 * @OA\Parameter(
5426 * name="title",
5427 * in="query",
5428 * description="The title for the user.",
5429 * required=false,
5430 * @OA\Schema(
5431 * type="string"
5433 * ),
5434 * @OA\Parameter(
5435 * name="fname",
5436 * in="query",
5437 * description="The first name for the user.",
5438 * required=false,
5439 * @OA\Schema(
5440 * type="string"
5442 * ),
5443 * @OA\Parameter(
5444 * name="lname",
5445 * in="query",
5446 * description="The last name for the user.",
5447 * required=false,
5448 * @OA\Schema(
5449 * type="string"
5451 * ),
5452 * @OA\Parameter(
5453 * name="mname",
5454 * in="query",
5455 * description="The middle name for the user.",
5456 * required=false,
5457 * @OA\Schema(
5458 * type="string"
5460 * ),
5461 * @OA\Parameter(
5462 * name="federaltaxid",
5463 * in="query",
5464 * description="The federal tax id for the user.",
5465 * required=false,
5466 * @OA\Schema(
5467 * type="string"
5469 * ),
5470 * @OA\Parameter(
5471 * name="federaldrugid",
5472 * in="query",
5473 * description="The federal drug id for the user.",
5474 * required=false,
5475 * @OA\Schema(
5476 * type="string"
5478 * ),
5479 * @OA\Parameter(
5480 * name="upin",
5481 * in="query",
5482 * description="The upin for the user.",
5483 * required=false,
5484 * @OA\Schema(
5485 * type="string"
5487 * ),
5488 * @OA\Parameter(
5489 * name="facility_id",
5490 * in="query",
5491 * description="The facility id for the user.",
5492 * required=false,
5493 * @OA\Schema(
5494 * type="string"
5496 * ),
5497 * @OA\Parameter(
5498 * name="facility",
5499 * in="query",
5500 * description="The facility for the user.",
5501 * required=false,
5502 * @OA\Schema(
5503 * type="string"
5505 * ),
5506 * @OA\Parameter(
5507 * name="npi",
5508 * in="query",
5509 * description="The npi for the user.",
5510 * required=false,
5511 * @OA\Schema(
5512 * type="string"
5514 * ),
5515 * @OA\Parameter(
5516 * name="email",
5517 * in="query",
5518 * description="The email for the user.",
5519 * required=false,
5520 * @OA\Schema(
5521 * type="string"
5523 * ),
5524 * @OA\Parameter(
5525 * name="specialty",
5526 * in="query",
5527 * description="The specialty for the user.",
5528 * required=false,
5529 * @OA\Schema(
5530 * type="string"
5532 * ),
5533 * @OA\Parameter(
5534 * name="billname",
5535 * in="query",
5536 * description="The billname for the user.",
5537 * required=false,
5538 * @OA\Schema(
5539 * type="string"
5541 * ),
5542 * @OA\Parameter(
5543 * name="url",
5544 * in="query",
5545 * description="The url for the user.",
5546 * required=false,
5547 * @OA\Schema(
5548 * type="string"
5550 * ),
5551 * @OA\Parameter(
5552 * name="assistant",
5553 * in="query",
5554 * description="The assistant for the user.",
5555 * required=false,
5556 * @OA\Schema(
5557 * type="string"
5559 * ),
5560 * @OA\Parameter(
5561 * name="organization",
5562 * in="query",
5563 * description="The organization for the user.",
5564 * required=false,
5565 * @OA\Schema(
5566 * type="string"
5568 * ),
5569 * @OA\Parameter(
5570 * name="valedictory",
5571 * in="query",
5572 * description="The valedictory for the user.",
5573 * required=false,
5574 * @OA\Schema(
5575 * type="string"
5577 * ),
5578 * @OA\Parameter(
5579 * name="street",
5580 * in="query",
5581 * description="The street for the user.",
5582 * required=false,
5583 * @OA\Schema(
5584 * type="string"
5586 * ),
5587 * @OA\Parameter(
5588 * name="streetb",
5589 * in="query",
5590 * description="The street (line 2) for the user.",
5591 * required=false,
5592 * @OA\Schema(
5593 * type="string"
5595 * ),
5596 * @OA\Parameter(
5597 * name="city",
5598 * in="query",
5599 * description="The city for the user.",
5600 * required=false,
5601 * @OA\Schema(
5602 * type="string"
5604 * ),
5605 * @OA\Parameter(
5606 * name="state",
5607 * in="query",
5608 * description="The state for the user.",
5609 * required=false,
5610 * @OA\Schema(
5611 * type="string"
5613 * ),
5614 * @OA\Parameter(
5615 * name="zip",
5616 * in="query",
5617 * description="The zip for the user.",
5618 * required=false,
5619 * @OA\Schema(
5620 * type="string"
5622 * ),
5623 * @OA\Parameter(
5624 * name="phone",
5625 * in="query",
5626 * description="The phone for the user.",
5627 * required=false,
5628 * @OA\Schema(
5629 * type="string"
5631 * ),
5632 * @OA\Parameter(
5633 * name="fax",
5634 * in="query",
5635 * description="The fax for the user.",
5636 * required=false,
5637 * @OA\Schema(
5638 * type="string"
5640 * ),
5641 * @OA\Parameter(
5642 * name="phonew1",
5643 * in="query",
5644 * description="The phonew1 for the user.",
5645 * required=false,
5646 * @OA\Schema(
5647 * type="string"
5649 * ),
5650 * @OA\Parameter(
5651 * name="phonecell",
5652 * in="query",
5653 * description="The phonecell for the user.",
5654 * required=false,
5655 * @OA\Schema(
5656 * type="string"
5658 * ),
5659 * @OA\Parameter(
5660 * name="notes",
5661 * in="query",
5662 * description="The notes for the user.",
5663 * required=false,
5664 * @OA\Schema(
5665 * type="string"
5667 * ),
5668 * @OA\Parameter(
5669 * name="state_license_number2",
5670 * in="query",
5671 * description="The state license number for the user.",
5672 * required=false,
5673 * @OA\Schema(
5674 * type="string"
5676 * ),
5677 * @OA\Parameter(
5678 * name="username",
5679 * in="query",
5680 * description="The username for the user.",
5681 * required=false,
5682 * @OA\Schema(
5683 * type="string"
5685 * ),
5686 * @OA\Response(
5687 * response="200",
5688 * ref="#/components/responses/standard"
5689 * ),
5690 * @OA\Response(
5691 * response="400",
5692 * ref="#/components/responses/badrequest"
5693 * ),
5694 * @OA\Response(
5695 * response="401",
5696 * ref="#/components/responses/unauthorized"
5697 * ),
5698 * security={{"openemr_auth":{}}}
5701 "GET /api/user" => function () {
5702 RestConfig::authorization_check("admin", "users");
5703 $return = (new UserRestController())->getAll($_GET);
5704 RestConfig::apiLog($return);
5705 return $return;
5709 * @OA\Get(
5710 * path="/api/user/{uuid}",
5711 * description="Retrieves a single user by their uuid",
5712 * tags={"standard"},
5713 * @OA\Parameter(
5714 * name="uuid",
5715 * in="path",
5716 * description="The uuid for the user.",
5717 * required=true,
5718 * @OA\Schema(
5719 * type="string"
5721 * ),
5722 * @OA\Response(
5723 * response="200",
5724 * ref="#/components/responses/standard"
5725 * ),
5726 * @OA\Response(
5727 * response="400",
5728 * ref="#/components/responses/badrequest"
5729 * ),
5730 * @OA\Response(
5731 * response="401",
5732 * ref="#/components/responses/unauthorized"
5733 * ),
5734 * security={{"openemr_auth":{}}}
5737 "GET /api/user/:uuid" => function ($uuid) {
5738 RestConfig::authorization_check("admin", "users");
5739 $return = (new UserRestController())->getOne($uuid);
5740 RestConfig::apiLog($return);
5741 return $return;
5745 * @OA\Get(
5746 * path="/api/version",
5747 * description="Retrieves the OpenEMR version information",
5748 * tags={"standard"},
5749 * @OA\Response(
5750 * response="200",
5751 * ref="#/components/responses/standard"
5752 * ),
5753 * @OA\Response(
5754 * response="400",
5755 * ref="#/components/responses/badrequest"
5756 * ),
5757 * @OA\Response(
5758 * response="401",
5759 * ref="#/components/responses/unauthorized"
5760 * ),
5761 * security={{"openemr_auth":{}}}
5764 "GET /api/version" => function () {
5765 $return = (new VersionRestController())->getOne();
5766 RestConfig::apiLog($return);
5767 return $return;
5771 * @OA\Get(
5772 * path="/api/product",
5773 * description="Retrieves the OpenEMR product registration information",
5774 * tags={"standard"},
5775 * @OA\Response(
5776 * response="200",
5777 * ref="#/components/responses/standard"
5778 * ),
5779 * @OA\Response(
5780 * response="400",
5781 * ref="#/components/responses/badrequest"
5782 * ),
5783 * @OA\Response(
5784 * response="401",
5785 * ref="#/components/responses/unauthorized"
5786 * ),
5787 * security={{"openemr_auth":{}}}
5790 "GET /api/product" => function () {
5791 $return = (new ProductRegistrationRestController())->getOne();
5792 RestConfig::apiLog($return);
5793 return $return;
5797 * @OA\Get(
5798 * path="/api/insurance_company",
5799 * description="Retrieves all insurance companies",
5800 * tags={"standard"},
5801 * @OA\Response(
5802 * response="200",
5803 * ref="#/components/responses/standard"
5804 * ),
5805 * @OA\Response(
5806 * response="400",
5807 * ref="#/components/responses/badrequest"
5808 * ),
5809 * @OA\Response(
5810 * response="401",
5811 * ref="#/components/responses/unauthorized"
5812 * ),
5813 * security={{"openemr_auth":{}}}
5816 "GET /api/insurance_company" => function () {
5817 $return = (new InsuranceCompanyRestController())->getAll();
5818 RestConfig::apiLog($return);
5819 return $return;
5823 * @OA\Get(
5824 * path="/api/insurance_company/{iid}",
5825 * description="Retrieves insurance company",
5826 * tags={"standard"},
5827 * @OA\Parameter(
5828 * name="iid",
5829 * in="path",
5830 * description="The id of the insurance company.",
5831 * required=true,
5832 * @OA\Schema(
5833 * type="string"
5835 * ),
5836 * @OA\Response(
5837 * response="200",
5838 * ref="#/components/responses/standard"
5839 * ),
5840 * @OA\Response(
5841 * response="400",
5842 * ref="#/components/responses/badrequest"
5843 * ),
5844 * @OA\Response(
5845 * response="401",
5846 * ref="#/components/responses/unauthorized"
5847 * ),
5848 * security={{"openemr_auth":{}}}
5851 "GET /api/insurance_company/:iid" => function ($iid) {
5852 $return = (new InsuranceCompanyRestController())->getOne($iid);
5853 RestConfig::apiLog($return);
5854 return $return;
5858 * @OA\Get(
5859 * path="/api/insurance_type",
5860 * description="Retrieves all insurance types",
5861 * tags={"standard"},
5862 * @OA\Response(
5863 * response="200",
5864 * ref="#/components/responses/standard"
5865 * ),
5866 * @OA\Response(
5867 * response="400",
5868 * ref="#/components/responses/badrequest"
5869 * ),
5870 * @OA\Response(
5871 * response="401",
5872 * ref="#/components/responses/unauthorized"
5873 * ),
5874 * security={{"openemr_auth":{}}}
5877 "GET /api/insurance_type" => function () {
5878 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5879 RestConfig::apiLog($return);
5880 return $return;
5884 * Schema for the insurance_company request
5886 * @OA\Schema(
5887 * schema="api_insurance_company_request",
5888 * @OA\Property(
5889 * property="name",
5890 * description="The name of insurance company.",
5891 * type="string"
5892 * ),
5893 * @OA\Property(
5894 * property="attn",
5895 * description="The attn of insurance company.",
5896 * type="string"
5897 * ),
5898 * @OA\Property(
5899 * property="cms_id",
5900 * description="The cms id of insurance company.",
5901 * type="string"
5902 * ),
5903 * @OA\Property(
5904 * property="ins_type_code",
5905 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5906 * type="string"
5907 * ),
5908 * @OA\Property(
5909 * property="x12_receiver_id",
5910 * description="The x12 receiver id of insurance company.",
5911 * type="string"
5912 * ),
5913 * @OA\Property(
5914 * property="x12_default_partner_id",
5915 * description="The x12 default partner id of insurance company.",
5916 * type="string"
5917 * ),
5918 * @OA\Property(
5919 * property="alt_cms_id",
5920 * description="The alternate cms id of insurance company.",
5921 * type="string"
5922 * ),
5923 * @OA\Property(
5924 * property="line1",
5925 * description="The line1 address of insurance company.",
5926 * type="string"
5927 * ),
5928 * @OA\Property(
5929 * property="line2",
5930 * description="The line2 address of insurance company.",
5931 * type="string"
5932 * ),
5933 * @OA\Property(
5934 * property="city",
5935 * description="The city of insurance company.",
5936 * type="string"
5937 * ),
5938 * @OA\Property(
5939 * property="state",
5940 * description="The state of insurance company.",
5941 * type="string"
5942 * ),
5943 * @OA\Property(
5944 * property="zip",
5945 * description="The zip of insurance company.",
5946 * type="string"
5947 * ),
5948 * @OA\Property(
5949 * property="country",
5950 * description="The country of insurance company.",
5951 * type="string"
5952 * ),
5953 * required={"name"},
5954 * example={
5955 * "name": "Cool Insurance Company",
5956 * "attn": null,
5957 * "cms_id": null,
5958 * "ins_type_code": "2",
5959 * "x12_receiver_id": null,
5960 * "x12_default_partner_id": null,
5961 * "alt_cms_id": "",
5962 * "line1": "123 Cool Lane",
5963 * "line2": "Suite 123",
5964 * "city": "Cooltown",
5965 * "state": "CA",
5966 * "zip": "12245",
5967 * "country": "USA"
5972 * @OA\Post(
5973 * path="/api/insurance_company",
5974 * description="Submits a new insurance company",
5975 * tags={"standard"},
5976 * @OA\RequestBody(
5977 * required=true,
5978 * @OA\MediaType(
5979 * mediaType="application/json",
5980 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5982 * ),
5983 * @OA\Response(
5984 * response="200",
5985 * ref="#/components/responses/standard"
5986 * ),
5987 * @OA\Response(
5988 * response="400",
5989 * ref="#/components/responses/badrequest"
5990 * ),
5991 * @OA\Response(
5992 * response="401",
5993 * ref="#/components/responses/unauthorized"
5994 * ),
5995 * security={{"openemr_auth":{}}}
5998 "POST /api/insurance_company" => function () {
5999 $data = (array) (json_decode(file_get_contents("php://input")));
6000 $return = (new InsuranceCompanyRestController())->post($data);
6001 RestConfig::apiLog($return, $data);
6002 return $return;
6006 * @OA\Put(
6007 * path="/api/insurance_company/{iid}",
6008 * description="Edit a insurance company",
6009 * tags={"standard"},
6010 * @OA\Parameter(
6011 * name="iid",
6012 * in="path",
6013 * description="The id for the insurance company.",
6014 * required=true,
6015 * @OA\Schema(
6016 * type="string"
6018 * ),
6019 * @OA\RequestBody(
6020 * required=true,
6021 * @OA\MediaType(
6022 * mediaType="application/json",
6023 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
6025 * ),
6026 * @OA\Response(
6027 * response="200",
6028 * ref="#/components/responses/standard"
6029 * ),
6030 * @OA\Response(
6031 * response="400",
6032 * ref="#/components/responses/badrequest"
6033 * ),
6034 * @OA\Response(
6035 * response="401",
6036 * ref="#/components/responses/unauthorized"
6037 * ),
6038 * security={{"openemr_auth":{}}}
6041 "PUT /api/insurance_company/:iid" => function ($iid) {
6042 $data = (array) (json_decode(file_get_contents("php://input")));
6043 $return = (new InsuranceCompanyRestController())->put($iid, $data);
6044 RestConfig::apiLog($return, $data);
6045 return $return;
6049 * @OA\Post(
6050 * path="/api/patient/{pid}/document",
6051 * description="Submits a new patient document",
6052 * tags={"standard"},
6053 * @OA\Parameter(
6054 * name="pid",
6055 * in="path",
6056 * description="The pid for the patient.",
6057 * required=true,
6058 * @OA\Schema(
6059 * type="string"
6061 * ),
6062 * @OA\Parameter(
6063 * name="path",
6064 * in="query",
6065 * description="The category of the document.",
6066 * required=true,
6067 * @OA\Schema(
6068 * type="string"
6070 * ),
6071 * @OA\RequestBody(
6072 * required=true,
6073 * @OA\MediaType(
6074 * mediaType="multipart/form-data",
6075 * @OA\Schema(
6076 * @OA\Property(
6077 * property="document",
6078 * description="document",
6079 * type="string",
6080 * format="binary"
6081 * ),
6082 * ),
6083 * ),
6084 * ),
6085 * @OA\Response(
6086 * response="200",
6087 * ref="#/components/responses/standard"
6088 * ),
6089 * @OA\Response(
6090 * response="400",
6091 * ref="#/components/responses/badrequest"
6092 * ),
6093 * @OA\Response(
6094 * response="401",
6095 * ref="#/components/responses/unauthorized"
6096 * ),
6097 * security={{"openemr_auth":{}}}
6100 "POST /api/patient/:pid/document" => function ($pid) {
6101 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6102 RestConfig::apiLog($return);
6103 return $return;
6107 * @OA\Get(
6108 * path="/api/patient/{pid}/document",
6109 * description="Retrieves all file information of documents from a category for a patient",
6110 * tags={"standard"},
6111 * @OA\Parameter(
6112 * name="pid",
6113 * in="path",
6114 * description="The pid for the patient.",
6115 * required=true,
6116 * @OA\Schema(
6117 * type="string"
6119 * ),
6120 * @OA\Parameter(
6121 * name="path",
6122 * in="query",
6123 * description="The category of the documents.",
6124 * required=true,
6125 * @OA\Schema(
6126 * type="string"
6128 * ),
6129 * @OA\Response(
6130 * response="200",
6131 * ref="#/components/responses/standard"
6132 * ),
6133 * @OA\Response(
6134 * response="400",
6135 * ref="#/components/responses/badrequest"
6136 * ),
6137 * @OA\Response(
6138 * response="401",
6139 * ref="#/components/responses/unauthorized"
6140 * ),
6141 * security={{"openemr_auth":{}}}
6144 "GET /api/patient/:pid/document" => function ($pid) {
6145 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6146 RestConfig::apiLog($return);
6147 return $return;
6151 * @OA\Get(
6152 * path="/api/patient/{pid}/document/{did}",
6153 * description="Retrieves a document for a patient",
6154 * tags={"standard"},
6155 * @OA\Parameter(
6156 * name="pid",
6157 * in="path",
6158 * description="The pid for the patient.",
6159 * required=true,
6160 * @OA\Schema(
6161 * type="string"
6163 * ),
6164 * @OA\Parameter(
6165 * name="did",
6166 * in="path",
6167 * description="The id for the patient document.",
6168 * required=true,
6169 * @OA\Schema(
6170 * type="string"
6172 * ),
6173 * @OA\Response(
6174 * response="200",
6175 * ref="#/components/responses/standard"
6176 * ),
6177 * @OA\Response(
6178 * response="400",
6179 * ref="#/components/responses/badrequest"
6180 * ),
6181 * @OA\Response(
6182 * response="401",
6183 * ref="#/components/responses/unauthorized"
6184 * ),
6185 * security={{"openemr_auth":{}}}
6188 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6189 $return = (new DocumentRestController())->downloadFile($pid, $did);
6190 RestConfig::apiLog($return);
6191 return $return;
6195 * @OA\Get(
6196 * path="/api/patient/{pid}/insurance",
6197 * description="Retrieves all insurances for a patient",
6198 * tags={"standard"},
6199 * @OA\Parameter(
6200 * name="pid",
6201 * in="path",
6202 * description="The pid for the patient.",
6203 * required=true,
6204 * @OA\Schema(
6205 * type="string"
6207 * ),
6208 * @OA\Response(
6209 * response="200",
6210 * ref="#/components/responses/standard"
6211 * ),
6212 * @OA\Response(
6213 * response="400",
6214 * ref="#/components/responses/badrequest"
6215 * ),
6216 * @OA\Response(
6217 * response="401",
6218 * ref="#/components/responses/unauthorized"
6219 * ),
6220 * security={{"openemr_auth":{}}}
6223 "GET /api/patient/:pid/insurance" => function ($pid) {
6224 $return = (new InsuranceRestController())->getAll($pid);
6225 RestConfig::apiLog($return);
6226 return $return;
6230 * @OA\Get(
6231 * path="/api/patient/{pid}/insurance/{type}",
6232 * description="Retrieves a insurance (by type) for a patient",
6233 * tags={"standard"},
6234 * @OA\Parameter(
6235 * name="pid",
6236 * in="path",
6237 * description="The pid for the patient.",
6238 * required=true,
6239 * @OA\Schema(
6240 * type="string"
6242 * ),
6243 * @OA\Parameter(
6244 * name="type",
6245 * in="path",
6246 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6247 * required=true,
6248 * @OA\Schema(
6249 * type="string"
6251 * ),
6252 * @OA\Response(
6253 * response="200",
6254 * ref="#/components/responses/standard"
6255 * ),
6256 * @OA\Response(
6257 * response="400",
6258 * ref="#/components/responses/badrequest"
6259 * ),
6260 * @OA\Response(
6261 * response="401",
6262 * ref="#/components/responses/unauthorized"
6263 * ),
6264 * security={{"openemr_auth":{}}}
6267 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6268 $return = (new InsuranceRestController())->getOne($pid, $type);
6269 RestConfig::apiLog($return);
6270 return $return;
6274 * Schema for the insurance request
6276 * @OA\Schema(
6277 * schema="api_insurance_request",
6278 * @OA\Property(
6279 * property="provider",
6280 * description="The insurance company id.",
6281 * type="string"
6282 * ),
6283 * @OA\Property(
6284 * property="plan_name",
6285 * description="The plan name of insurance.",
6286 * type="string"
6287 * ),
6288 * @OA\Property(
6289 * property="policy_number",
6290 * description="The policy number of insurance.",
6291 * type="string"
6292 * ),
6293 * @OA\Property(
6294 * property="group_number",
6295 * description="The group number of insurance.",
6296 * type="string"
6297 * ),
6298 * @OA\Property(
6299 * property="subscriber_lname",
6300 * description="The subscriber last name of insurance.",
6301 * type="string"
6302 * ),
6303 * @OA\Property(
6304 * property="subscriber_mname",
6305 * description="The subscriber middle name of insurance.",
6306 * type="string"
6307 * ),
6308 * @OA\Property(
6309 * property="subscriber_fname",
6310 * description="The subscriber first name of insurance.",
6311 * type="string"
6312 * ),
6313 * @OA\Property(
6314 * property="subscriber_relationship",
6315 * description="The subscriber relationship of insurance.",
6316 * type="string"
6317 * ),
6318 * @OA\Property(
6319 * property="subscriber_ss",
6320 * description="The subscriber ss number of insurance.",
6321 * type="string"
6322 * ),
6323 * @OA\Property(
6324 * property="subscriber_DOB",
6325 * description="The subscriber DOB of insurance.",
6326 * type="string"
6327 * ),
6328 * @OA\Property(
6329 * property="subscriber_street",
6330 * description="The subscriber street address of insurance.",
6331 * type="string"
6332 * ),
6333 * @OA\Property(
6334 * property="subscriber_postal_code",
6335 * description="The subscriber postal code of insurance.",
6336 * type="string"
6337 * ),
6338 * @OA\Property(
6339 * property="subscriber_city",
6340 * description="The subscriber city of insurance.",
6341 * type="string"
6342 * ),
6343 * @OA\Property(
6344 * property="subscriber_state",
6345 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6346 * type="string"
6347 * ),
6348 * @OA\Property(
6349 * property="subscriber_country",
6350 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6351 * type="string"
6352 * ),
6353 * @OA\Property(
6354 * property="subscriber_phone",
6355 * description="The subscriber phone of insurance.",
6356 * type="string"
6357 * ),
6358 * @OA\Property(
6359 * property="subscriber_employer",
6360 * description="The subscriber employer of insurance.",
6361 * type="string"
6362 * ),
6363 * @OA\Property(
6364 * property="subscriber_employer_street",
6365 * description="The subscriber employer street of insurance.",
6366 * type="string"
6367 * ),
6368 * @OA\Property(
6369 * property="subscriber_employer_postal_code",
6370 * description="The subscriber employer postal code of insurance.",
6371 * type="string"
6372 * ),
6373 * @OA\Property(
6374 * property="subscriber_employer_state",
6375 * description="The subscriber employer state of insurance.",
6376 * type="string"
6377 * ),
6378 * @OA\Property(
6379 * property="subscriber_employer_country",
6380 * description="The subscriber employer country of insurance.",
6381 * type="string"
6382 * ),
6383 * @OA\Property(
6384 * property="subscriber_employer_city",
6385 * description="The subscriber employer city of insurance.",
6386 * type="string"
6387 * ),
6388 * @OA\Property(
6389 * property="copay",
6390 * description="The copay of insurance.",
6391 * type="string"
6392 * ),
6393 * @OA\Property(
6394 * property="date",
6395 * description="The date of insurance.",
6396 * type="string"
6397 * ),
6398 * @OA\Property(
6399 * property="subscriber_sex",
6400 * description="The subscriber sex of insurance.",
6401 * type="string"
6402 * ),
6403 * @OA\Property(
6404 * property="accept_assignment",
6405 * description="The accept_assignment of insurance.",
6406 * type="string"
6407 * ),
6408 * @OA\Property(
6409 * property="policy_type",
6410 * description="The policy_type of insurance.",
6411 * type="string"
6412 * ),
6413 * 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"},
6414 * example={
6415 * "provider": "33",
6416 * "plan_name": "Some Plan",
6417 * "policy_number": "12345",
6418 * "group_number": "252412",
6419 * "subscriber_lname": "Tester",
6420 * "subscriber_mname": "Xi",
6421 * "subscriber_fname": "Foo",
6422 * "subscriber_relationship": "other",
6423 * "subscriber_ss": "234231234",
6424 * "subscriber_DOB": "2018-10-03",
6425 * "subscriber_street": "183 Cool St",
6426 * "subscriber_postal_code": "23418",
6427 * "subscriber_city": "Cooltown",
6428 * "subscriber_state": "AZ",
6429 * "subscriber_country": "USA",
6430 * "subscriber_phone": "234-598-2123",
6431 * "subscriber_employer": "Some Employer",
6432 * "subscriber_employer_street": "123 Heather Lane",
6433 * "subscriber_employer_postal_code": "23415",
6434 * "subscriber_employer_state": "AZ",
6435 * "subscriber_employer_country": "USA",
6436 * "subscriber_employer_city": "Cooltown",
6437 * "copay": "35",
6438 * "date": "2018-10-15",
6439 * "subscriber_sex": "Female",
6440 * "accept_assignment": "TRUE",
6441 * "policy_type": "a"
6446 * @OA\Post(
6447 * path="/api/patient/{pid}/insurance/{type}",
6448 * description="Submits a new patient insurance (with type)",
6449 * tags={"standard"},
6450 * @OA\Parameter(
6451 * name="pid",
6452 * in="path",
6453 * description="The pid for the patient.",
6454 * required=true,
6455 * @OA\Schema(
6456 * type="string"
6458 * ),
6459 * @OA\Parameter(
6460 * name="type",
6461 * in="path",
6462 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6463 * required=true,
6464 * @OA\Schema(
6465 * type="string"
6467 * ),
6468 * @OA\RequestBody(
6469 * required=true,
6470 * @OA\MediaType(
6471 * mediaType="application/json",
6472 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6474 * ),
6475 * @OA\Response(
6476 * response="200",
6477 * ref="#/components/responses/standard"
6478 * ),
6479 * @OA\Response(
6480 * response="400",
6481 * ref="#/components/responses/badrequest"
6482 * ),
6483 * @OA\Response(
6484 * response="401",
6485 * ref="#/components/responses/unauthorized"
6486 * ),
6487 * security={{"openemr_auth":{}}}
6490 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6491 $data = (array) (json_decode(file_get_contents("php://input")));
6492 $return = (new InsuranceRestController())->post($pid, $type, $data);
6493 RestConfig::apiLog($return, $data);
6494 return $return;
6498 * @OA\Put(
6499 * path="/api/patient/{pid}/insurance/{type}",
6500 * description="Edit a patient insurance (by type)",
6501 * tags={"standard"},
6502 * @OA\Parameter(
6503 * name="pid",
6504 * in="path",
6505 * description="The pid for the patient.",
6506 * required=true,
6507 * @OA\Schema(
6508 * type="string"
6510 * ),
6511 * @OA\Parameter(
6512 * name="type",
6513 * in="path",
6514 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6515 * required=true,
6516 * @OA\Schema(
6517 * type="string"
6519 * ),
6520 * @OA\RequestBody(
6521 * required=true,
6522 * @OA\MediaType(
6523 * mediaType="application/json",
6524 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6526 * ),
6527 * @OA\Response(
6528 * response="200",
6529 * ref="#/components/responses/standard"
6530 * ),
6531 * @OA\Response(
6532 * response="400",
6533 * ref="#/components/responses/badrequest"
6534 * ),
6535 * @OA\Response(
6536 * response="401",
6537 * ref="#/components/responses/unauthorized"
6538 * ),
6539 * security={{"openemr_auth":{}}}
6542 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6543 $data = (array) (json_decode(file_get_contents("php://input")));
6544 $return = (new InsuranceRestController())->put($pid, $type, $data);
6545 RestConfig::apiLog($return, $data);
6546 return $return;
6550 * Schema for the message request
6552 * @OA\Schema(
6553 * schema="api_message_request",
6554 * @OA\Property(
6555 * property="body",
6556 * description="The body of message.",
6557 * type="string"
6558 * ),
6559 * @OA\Property(
6560 * property="groupname",
6561 * description="The group name (usually is 'Default').",
6562 * type="string"
6563 * ),
6564 * @OA\Property(
6565 * property="from",
6566 * description="The sender of the message.",
6567 * type="string"
6568 * ),
6569 * @OA\Property(
6570 * property="to",
6571 * description="The recipient of the message.",
6572 * type="string"
6573 * ),
6574 * @OA\Property(
6575 * property="title",
6576 * description="use an option from resource=/api/list/note_type",
6577 * type="string"
6578 * ),
6579 * @OA\Property(
6580 * property="message_status",
6581 * description="use an option from resource=/api/list/message_status",
6582 * type="string"
6583 * ),
6584 * required={"body", "groupname", "from", "to", "title", "message_status"},
6585 * example={
6586 * "body": "Test 456",
6587 * "groupname": "Default",
6588 * "from": "Matthew",
6589 * "to": "admin",
6590 * "title": "Other",
6591 * "message_status": "New"
6596 * @OA\Post(
6597 * path="/api/patient/{pid}/message",
6598 * description="Submits a pnote message",
6599 * tags={"standard"},
6600 * @OA\Parameter(
6601 * name="pid",
6602 * in="path",
6603 * description="The id for the patient.",
6604 * required=true,
6605 * @OA\Schema(
6606 * type="string"
6608 * ),
6609 * @OA\RequestBody(
6610 * required=true,
6611 * @OA\MediaType(
6612 * mediaType="application/json",
6613 * @OA\Schema(ref="#/components/schemas/api_message_request")
6615 * ),
6616 * @OA\Response(
6617 * response="200",
6618 * ref="#/components/responses/standard"
6619 * ),
6620 * @OA\Response(
6621 * response="400",
6622 * ref="#/components/responses/badrequest"
6623 * ),
6624 * @OA\Response(
6625 * response="401",
6626 * ref="#/components/responses/unauthorized"
6627 * ),
6628 * security={{"openemr_auth":{}}}
6631 "POST /api/patient/:pid/message" => function ($pid) {
6632 RestConfig::authorization_check("patients", "notes");
6633 $data = (array) (json_decode(file_get_contents("php://input")));
6634 $return = (new MessageRestController())->post($pid, $data);
6635 RestConfig::apiLog($return, $data);
6636 return $return;
6640 * @OA\Get(
6641 * path="/api/patient/{pid}/transaction",
6642 * description="Get Transactions for a patient",
6643 * tags={"standard"},
6644 * @OA\Parameter(
6645 * name="pid",
6646 * in="path",
6647 * description="The pid for the patient",
6648 * required=true,
6649 * @OA\Schema(
6650 * type="string"
6652 * ),
6653 * @OA\Response(
6654 * response="200",
6655 * ref="#/components/responses/standard"
6656 * ),
6657 * @OA\Response(
6658 * response="400",
6659 * ref="#/components/responses/badrequest"
6660 * ),
6661 * @OA\Response(
6662 * response="401",
6663 * ref="#/components/responses/unauthorized"
6664 * ),
6665 * security={{"openemr_auth":{}}}
6669 "GET /api/patient/:pid/transaction" => function ($pid) {
6670 RestConfig::authorization_check("patients", "trans");
6671 $cont = new TransactionRestController();
6672 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6673 RestConfig::apiLog($return);
6674 return $return;
6678 * Schema for the transaction request
6680 * @OA\Schema(
6681 * schema="api_transaction_request",
6682 * @OA\Property(
6683 * property="message",
6684 * description="The message of the transaction.",
6685 * type="string"
6686 * ),
6687 * @OA\Property(
6688 * property="type",
6689 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6690 * type="string"
6691 * ),
6692 * @OA\Property(
6693 * property="groupname",
6694 * description="The group name (usually is 'Default').",
6695 * type="string"
6696 * ),
6697 * @OA\Property(
6698 * property="referByNpi",
6699 * description="NPI of the person creating the referral.",
6700 * type="string"
6701 * ),
6702 * @OA\Property(
6703 * property="referToNpi",
6704 * description="NPI of the person getting the referral.",
6705 * type="string"
6706 * ),
6707 * @OA\Property(
6708 * property="referDiagnosis",
6709 * description="The referral diagnosis.",
6710 * type="string"
6711 * ),
6712 * @OA\Property(
6713 * property="riskLevel",
6714 * description="The risk level. (Low, Medium, High)",
6715 * type="string"
6716 * ),
6717 * @OA\Property(
6718 * property="includeVitals",
6719 * description="Are vitals included (0,1)",
6720 * type="string"
6721 * ),
6722 * @OA\Property(
6723 * property="referralDate",
6724 * description="The date of the referral",
6725 * type="string"
6726 * ),
6727 * @OA\Property(
6728 * property="authorization",
6729 * description="The authorization for the referral",
6730 * type="string"
6731 * ),
6732 * @OA\Property(
6733 * property="visits",
6734 * description="The number of vists for the referral",
6735 * type="string"
6736 * ),
6737 * @OA\Property(
6738 * property="validFrom",
6739 * description="The date the referral is valid from",
6740 * type="string"
6741 * ),
6742 * @OA\Property(
6743 * property="validThrough",
6744 * description="The date the referral is valid through",
6745 * type="string"
6746 * ),
6747 * required={"message", "groupname", "title"},
6748 * example={
6749 * "message": "Message",
6750 * "type": "LBTref",
6751 * "groupname": "Default",
6752 * "referByNpi":"9999999999",
6753 * "referToNpi":"9999999999",
6754 * "referDiagnosis":"Diag 1",
6755 * "riskLevel":"Low",
6756 * "includeVitals":"1",
6757 * "referralDate":"2022-01-01",
6758 * "authorization":"Auth_123",
6759 * "visits": "1",
6760 * "validFrom": "2022-01-02",
6761 * "validThrough": "2022-01-03",
6762 * "body": "Reason 1"
6767 * @OA\Post(
6768 * path="/api/patient/{pid}/transaction",
6769 * description="Submits a transaction",
6770 * tags={"standard"},
6771 * @OA\Parameter(
6772 * name="pid",
6773 * in="path",
6774 * description="The pid for the patient.",
6775 * required=true,
6776 * @OA\Schema(
6777 * type="string"
6779 * ),
6780 * @OA\RequestBody(
6781 * required=true,
6782 * @OA\MediaType(
6783 * mediaType="application/json",
6784 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6786 * ),
6787 * @OA\Response(
6788 * response="200",
6789 * ref="#/components/responses/standard"
6790 * ),
6791 * @OA\Response(
6792 * response="400",
6793 * ref="#/components/responses/badrequest"
6794 * ),
6795 * @OA\Response(
6796 * response="401",
6797 * ref="#/components/responses/unauthorized"
6798 * ),
6799 * security={{"openemr_auth":{}}}
6802 "POST /api/patient/:pid/transaction" => function ($pid) {
6803 RestConfig::authorization_check("patients", "trans");
6804 $data = (array) (json_decode(file_get_contents("php://input")));
6805 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6806 RestConfig::apiLog($return, $data);
6807 return $return;
6811 * @OA\PUT(
6812 * path="/api/transaction/{tid}",
6813 * description="Updates a transaction",
6814 * tags={"standard"},
6815 * @OA\Parameter(
6816 * name="tid",
6817 * in="path",
6818 * description="The id for the transaction.",
6819 * required=true,
6820 * @OA\Schema(
6821 * type="string"
6823 * ),
6824 * @OA\RequestBody(
6825 * required=true,
6826 * @OA\MediaType(
6827 * mediaType="application/json",
6828 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6830 * ),
6831 * @OA\Response(
6832 * response="200",
6833 * ref="#/components/responses/standard"
6834 * ),
6835 * @OA\Response(
6836 * response="400",
6837 * ref="#/components/responses/badrequest"
6838 * ),
6839 * @OA\Response(
6840 * response="401",
6841 * ref="#/components/responses/unauthorized"
6842 * ),
6843 * security={{"openemr_auth":{}}}
6846 "PUT /api/transaction/:tid" => function ($tid) {
6847 RestConfig::authorization_check("patients", "trans");
6848 $data = (array) (json_decode(file_get_contents("php://input")));
6849 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6850 RestConfig::apiLog($return, $data);
6851 return $return;
6855 * @OA\Put(
6856 * path="/api/patient/{pid}/message/{mid}",
6857 * description="Edit a pnote message",
6858 * tags={"standard"},
6859 * @OA\Parameter(
6860 * name="pid",
6861 * in="path",
6862 * description="The id for the patient.",
6863 * required=true,
6864 * @OA\Schema(
6865 * type="string"
6867 * ),
6868 * @OA\Parameter(
6869 * name="mid",
6870 * in="path",
6871 * description="The id for the pnote message.",
6872 * required=true,
6873 * @OA\Schema(
6874 * type="string"
6876 * ),
6877 * @OA\RequestBody(
6878 * required=true,
6879 * @OA\MediaType(
6880 * mediaType="application/json",
6881 * @OA\Schema(ref="#/components/schemas/api_message_request")
6883 * ),
6884 * @OA\Response(
6885 * response="200",
6886 * ref="#/components/responses/standard"
6887 * ),
6888 * @OA\Response(
6889 * response="400",
6890 * ref="#/components/responses/badrequest"
6891 * ),
6892 * @OA\Response(
6893 * response="401",
6894 * ref="#/components/responses/unauthorized"
6895 * ),
6896 * security={{"openemr_auth":{}}}
6899 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6900 RestConfig::authorization_check("patients", "notes");
6901 $data = (array) (json_decode(file_get_contents("php://input")));
6902 $return = (new MessageRestController())->put($pid, $mid, $data);
6903 RestConfig::apiLog($return, $data);
6904 return $return;
6908 * @OA\Delete(
6909 * path="/api/patient/{pid}/message/{mid}",
6910 * description="Delete a pnote message",
6911 * tags={"standard"},
6912 * @OA\Parameter(
6913 * name="pid",
6914 * in="path",
6915 * description="The id for the patient.",
6916 * required=true,
6917 * @OA\Schema(
6918 * type="string"
6920 * ),
6921 * @OA\Parameter(
6922 * name="mid",
6923 * in="path",
6924 * description="The id for the pnote message.",
6925 * required=true,
6926 * @OA\Schema(
6927 * type="string"
6929 * ),
6930 * @OA\Response(
6931 * response="200",
6932 * ref="#/components/responses/standard"
6933 * ),
6934 * @OA\Response(
6935 * response="400",
6936 * ref="#/components/responses/badrequest"
6937 * ),
6938 * @OA\Response(
6939 * response="401",
6940 * ref="#/components/responses/unauthorized"
6941 * ),
6942 * security={{"openemr_auth":{}}}
6945 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6946 RestConfig::authorization_check("patients", "notes");
6947 $return = (new MessageRestController())->delete($pid, $mid);
6948 RestConfig::apiLog($return);
6949 return $return;
6953 * @OA\Get(
6954 * path="/api/immunization",
6955 * description="Retrieves a list of immunizations",
6956 * tags={"standard"},
6957 * @OA\Parameter(
6958 * name="patient_id",
6959 * in="query",
6960 * description="The pid for the patient.",
6961 * required=false,
6962 * @OA\Schema(
6963 * type="string"
6965 * ),
6966 * @OA\Parameter(
6967 * name="id",
6968 * in="query",
6969 * description="The id for the immunization.",
6970 * required=false,
6971 * @OA\Schema(
6972 * type="string"
6974 * ),
6975 * @OA\Parameter(
6976 * name="uuid",
6977 * in="query",
6978 * description="The uuid for the immunization.",
6979 * required=false,
6980 * @OA\Schema(
6981 * type="string"
6983 * ),
6984 * @OA\Parameter(
6985 * name="administered_date",
6986 * in="query",
6987 * description="The administered date for the immunization.",
6988 * required=false,
6989 * @OA\Schema(
6990 * type="string"
6992 * ),
6993 * @OA\Parameter(
6994 * name="immunization_id",
6995 * in="query",
6996 * description="The immunization list_id for the immunization.",
6997 * required=false,
6998 * @OA\Schema(
6999 * type="string"
7001 * ),
7002 * @OA\Parameter(
7003 * name="cvx_code",
7004 * in="query",
7005 * description="The cvx code for the immunization.",
7006 * required=false,
7007 * @OA\Schema(
7008 * type="string"
7010 * ),
7011 * @OA\Parameter(
7012 * name="manufacturer",
7013 * in="query",
7014 * description="The manufacturer for the immunization.",
7015 * required=false,
7016 * @OA\Schema(
7017 * type="string"
7019 * ),
7020 * @OA\Parameter(
7021 * name="lot_number",
7022 * in="query",
7023 * description="The lot number for the immunization.",
7024 * required=false,
7025 * @OA\Schema(
7026 * type="string"
7028 * ),
7029 * @OA\Parameter(
7030 * name="administered_by_id",
7031 * in="query",
7032 * description="The administered by id for the immunization.",
7033 * required=false,
7034 * @OA\Schema(
7035 * type="string"
7037 * ),
7038 * @OA\Parameter(
7039 * name="administered_by",
7040 * in="query",
7041 * description="The administered by for the immunization.",
7042 * required=false,
7043 * @OA\Schema(
7044 * type="string"
7046 * ),
7047 * @OA\Parameter(
7048 * name="education_date",
7049 * in="query",
7050 * description="The education date for the immunization.",
7051 * required=false,
7052 * @OA\Schema(
7053 * type="string"
7055 * ),
7056 * @OA\Parameter(
7057 * name="vis_date",
7058 * in="query",
7059 * description="The vis date for the immunization.",
7060 * required=false,
7061 * @OA\Schema(
7062 * type="string"
7064 * ),
7065 * @OA\Parameter(
7066 * name="note",
7067 * in="query",
7068 * description="The note for the immunization.",
7069 * required=false,
7070 * @OA\Schema(
7071 * type="string"
7073 * ),
7074 * @OA\Parameter(
7075 * name="create_date",
7076 * in="query",
7077 * description="The create date for the immunization.",
7078 * required=false,
7079 * @OA\Schema(
7080 * type="string"
7082 * ),
7083 * @OA\Parameter(
7084 * name="update_date",
7085 * in="query",
7086 * description="The update date for the immunization.",
7087 * required=false,
7088 * @OA\Schema(
7089 * type="string"
7091 * ),
7092 * @OA\Parameter(
7093 * name="created_by",
7094 * in="query",
7095 * description="The created_by for the immunization.",
7096 * required=false,
7097 * @OA\Schema(
7098 * type="string"
7100 * ),
7101 * @OA\Parameter(
7102 * name="updated_by",
7103 * in="query",
7104 * description="The updated_by for the immunization.",
7105 * required=false,
7106 * @OA\Schema(
7107 * type="string"
7109 * ),
7110 * @OA\Parameter(
7111 * name="amount_administered",
7112 * in="query",
7113 * description="The amount administered for the immunization.",
7114 * required=false,
7115 * @OA\Schema(
7116 * type="string"
7118 * ),
7119 * @OA\Parameter(
7120 * name="amount_administered_unit",
7121 * in="query",
7122 * description="The amount administered unit for the immunization.",
7123 * required=false,
7124 * @OA\Schema(
7125 * type="string"
7127 * ),
7128 * @OA\Parameter(
7129 * name="expiration_date",
7130 * in="query",
7131 * description="The expiration date for the immunization.",
7132 * required=false,
7133 * @OA\Schema(
7134 * type="string"
7136 * ),
7137 * @OA\Parameter(
7138 * name="route",
7139 * in="query",
7140 * description="The route for the immunization.",
7141 * required=false,
7142 * @OA\Schema(
7143 * type="string"
7145 * ),
7146 * @OA\Parameter(
7147 * name="administration_site",
7148 * in="query",
7149 * description="The administration site for the immunization.",
7150 * required=false,
7151 * @OA\Schema(
7152 * type="string"
7154 * ),
7155 * @OA\Parameter(
7156 * name="added_erroneously",
7157 * in="query",
7158 * description="The added_erroneously for the immunization.",
7159 * required=false,
7160 * @OA\Schema(
7161 * type="string"
7163 * ),
7164 * @OA\Parameter(
7165 * name="external_id",
7166 * in="query",
7167 * description="The external_id for the immunization.",
7168 * required=false,
7169 * @OA\Schema(
7170 * type="string"
7172 * ),
7173 * @OA\Parameter(
7174 * name="completion_status",
7175 * in="query",
7176 * description="The completion status for the immunization.",
7177 * required=false,
7178 * @OA\Schema(
7179 * type="string"
7181 * ),
7182 * @OA\Parameter(
7183 * name="information_source",
7184 * in="query",
7185 * description="The information source for the immunization.",
7186 * required=false,
7187 * @OA\Schema(
7188 * type="string"
7190 * ),
7191 * @OA\Parameter(
7192 * name="refusal_reason",
7193 * in="query",
7194 * description="The refusal reason for the immunization.",
7195 * required=false,
7196 * @OA\Schema(
7197 * type="string"
7199 * ),
7200 * @OA\Parameter(
7201 * name="ordering_provider",
7202 * in="query",
7203 * description="The ordering provider for the immunization.",
7204 * required=false,
7205 * @OA\Schema(
7206 * type="string"
7208 * ),
7209 * @OA\Response(
7210 * response="200",
7211 * ref="#/components/responses/standard"
7212 * ),
7213 * @OA\Response(
7214 * response="400",
7215 * ref="#/components/responses/badrequest"
7216 * ),
7217 * @OA\Response(
7218 * response="401",
7219 * ref="#/components/responses/unauthorized"
7220 * ),
7221 * security={{"openemr_auth":{}}}
7224 "GET /api/immunization" => function () {
7225 RestConfig::authorization_check("patients", "med");
7226 $return = (new ImmunizationRestController())->getAll($_GET);
7227 RestConfig::apiLog($return);
7228 return $return;
7232 * @OA\Get(
7233 * path="/api/immunization/{uuid}",
7234 * description="Retrieves a immunization",
7235 * tags={"standard"},
7236 * @OA\Parameter(
7237 * name="uuid",
7238 * in="path",
7239 * description="The uuid for the immunization.",
7240 * required=true,
7241 * @OA\Schema(
7242 * type="string"
7244 * ),
7245 * @OA\Response(
7246 * response="200",
7247 * ref="#/components/responses/standard"
7248 * ),
7249 * @OA\Response(
7250 * response="400",
7251 * ref="#/components/responses/badrequest"
7252 * ),
7253 * @OA\Response(
7254 * response="401",
7255 * ref="#/components/responses/unauthorized"
7256 * ),
7257 * security={{"openemr_auth":{}}}
7260 "GET /api/immunization/:uuid" => function ($uuid) {
7261 RestConfig::authorization_check("patients", "med");
7262 $return = (new ImmunizationRestController())->getOne($uuid);
7263 RestConfig::apiLog($return);
7264 return $return;
7268 * @OA\Get(
7269 * path="/api/procedure",
7270 * description="Retrieves a list of all procedures",
7271 * tags={"standard"},
7272 * @OA\Response(
7273 * response="200",
7274 * ref="#/components/responses/standard"
7275 * ),
7276 * @OA\Response(
7277 * response="400",
7278 * ref="#/components/responses/badrequest"
7279 * ),
7280 * @OA\Response(
7281 * response="401",
7282 * ref="#/components/responses/unauthorized"
7283 * ),
7284 * security={{"openemr_auth":{}}}
7287 "GET /api/procedure" => function () {
7288 RestConfig::authorization_check("patients", "med");
7289 $return = (new ProcedureRestController())->getAll();
7290 RestConfig::apiLog($return);
7291 return $return;
7295 * @OA\Get(
7296 * path="/api/procedure/{uuid}",
7297 * description="Retrieves a procedure",
7298 * tags={"standard"},
7299 * @OA\Parameter(
7300 * name="uuid",
7301 * in="path",
7302 * description="The uuid for the procedure.",
7303 * required=true,
7304 * @OA\Schema(
7305 * type="string"
7307 * ),
7308 * @OA\Response(
7309 * response="200",
7310 * ref="#/components/responses/standard"
7311 * ),
7312 * @OA\Response(
7313 * response="400",
7314 * ref="#/components/responses/badrequest"
7315 * ),
7316 * @OA\Response(
7317 * response="401",
7318 * ref="#/components/responses/unauthorized"
7319 * ),
7320 * security={{"openemr_auth":{}}}
7323 "GET /api/procedure/:uuid" => function ($uuid) {
7324 RestConfig::authorization_check("patients", "med");
7325 $return = (new ProcedureRestController())->getOne($uuid);
7326 RestConfig::apiLog($return);
7327 return $return;
7331 * @OA\Get(
7332 * path="/api/drug",
7333 * description="Retrieves a list of all drugs",
7334 * tags={"standard"},
7335 * @OA\Response(
7336 * response="200",
7337 * ref="#/components/responses/standard"
7338 * ),
7339 * @OA\Response(
7340 * response="400",
7341 * ref="#/components/responses/badrequest"
7342 * ),
7343 * @OA\Response(
7344 * response="401",
7345 * ref="#/components/responses/unauthorized"
7346 * ),
7347 * security={{"openemr_auth":{}}}
7350 "GET /api/drug" => function () {
7351 RestConfig::authorization_check("patients", "med");
7352 $return = (new DrugRestController())->getAll();
7353 RestConfig::apiLog($return);
7354 return $return;
7358 * @OA\Get(
7359 * path="/api/drug/{uuid}",
7360 * description="Retrieves a drug",
7361 * tags={"standard"},
7362 * @OA\Parameter(
7363 * name="uuid",
7364 * in="path",
7365 * description="The uuid for the drug.",
7366 * required=true,
7367 * @OA\Schema(
7368 * type="string"
7370 * ),
7371 * @OA\Response(
7372 * response="200",
7373 * ref="#/components/responses/standard"
7374 * ),
7375 * @OA\Response(
7376 * response="400",
7377 * ref="#/components/responses/badrequest"
7378 * ),
7379 * @OA\Response(
7380 * response="401",
7381 * ref="#/components/responses/unauthorized"
7382 * ),
7383 * security={{"openemr_auth":{}}}
7386 "GET /api/drug/:uuid" => function ($uuid) {
7387 RestConfig::authorization_check("patients", "med");
7388 $return = (new DrugRestController())->getOne($uuid);
7389 RestConfig::apiLog($return);
7390 return $return;
7394 * @OA\Get(
7395 * path="/api/prescription",
7396 * description="Retrieves a list of all prescriptions",
7397 * tags={"standard"},
7398 * @OA\Response(
7399 * response="200",
7400 * ref="#/components/responses/standard"
7401 * ),
7402 * @OA\Response(
7403 * response="400",
7404 * ref="#/components/responses/badrequest"
7405 * ),
7406 * @OA\Response(
7407 * response="401",
7408 * ref="#/components/responses/unauthorized"
7409 * ),
7410 * security={{"openemr_auth":{}}}
7413 "GET /api/prescription" => function () {
7414 RestConfig::authorization_check("patients", "med");
7415 $return = (new PrescriptionRestController())->getAll();
7416 RestConfig::apiLog($return);
7417 return $return;
7421 * @OA\Get(
7422 * path="/api/prescription/{uuid}",
7423 * description="Retrieves a prescription",
7424 * tags={"standard"},
7425 * @OA\Parameter(
7426 * name="uuid",
7427 * in="path",
7428 * description="The uuid for the prescription.",
7429 * required=true,
7430 * @OA\Schema(
7431 * type="string"
7433 * ),
7434 * @OA\Response(
7435 * response="200",
7436 * ref="#/components/responses/standard"
7437 * ),
7438 * @OA\Response(
7439 * response="400",
7440 * ref="#/components/responses/badrequest"
7441 * ),
7442 * @OA\Response(
7443 * response="401",
7444 * ref="#/components/responses/unauthorized"
7445 * ),
7446 * security={{"openemr_auth":{}}}
7449 "GET /api/prescription/:uuid" => function ($uuid) {
7450 RestConfig::authorization_check("patients", "med");
7451 $return = (new PrescriptionRestController())->getOne($uuid);
7452 RestConfig::apiLog($return);
7453 return $return;
7457 use OpenEMR\Common\Http\StatusCode;
7458 use OpenEMR\Common\Http\Psr17Factory;
7459 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7460 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController;
7461 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7462 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7463 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7464 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7465 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7466 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7467 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7468 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7469 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7470 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7471 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7472 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7473 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7474 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7475 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7476 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7477 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7478 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7479 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7480 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7481 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7482 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7483 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7484 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7485 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7486 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController;
7488 // Note that the fhir route includes both user role and patient role
7489 // (there is a mechanism in place to ensure patient role is binded
7490 // to only see the data of the one patient)
7491 RestConfig::$FHIR_ROUTE_MAP = array(
7493 * @OA\Get(
7494 * path="/fhir/AllergyIntolerance",
7495 * description="Returns a list of AllergyIntolerance resources.",
7496 * tags={"fhir"},
7497 * @OA\Parameter(
7498 * name="_id",
7499 * in="query",
7500 * description="The uuid for the AllergyIntolerance resource.",
7501 * required=false,
7502 * @OA\Schema(
7503 * type="string"
7505 * ),
7506 * @OA\Parameter(
7507 * name="patient",
7508 * in="query",
7509 * description="The uuid for the patient.",
7510 * required=false,
7511 * @OA\Schema(
7512 * type="string"
7514 * ),
7515 * @OA\Response(
7516 * response="200",
7517 * description="Standard Response",
7518 * @OA\MediaType(
7519 * mediaType="application/json",
7520 * @OA\Schema(
7521 * @OA\Property(
7522 * property="json object",
7523 * description="FHIR Json object.",
7524 * type="object"
7525 * ),
7526 * example={
7527 * "meta": {
7528 * "lastUpdated": "2021-09-14T09:13:51"
7529 * },
7530 * "resourceType": "Bundle",
7531 * "type": "collection",
7532 * "total": 0,
7533 * "link": {
7535 * "relation": "self",
7536 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7542 * ),
7543 * @OA\Response(
7544 * response="400",
7545 * ref="#/components/responses/badrequest"
7546 * ),
7547 * @OA\Response(
7548 * response="401",
7549 * ref="#/components/responses/unauthorized"
7550 * ),
7551 * security={{"openemr_auth":{}}}
7554 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7555 $getParams = $request->getQueryParams();
7556 if ($request->isPatientRequest()) {
7557 // only allow access to data of binded patient
7558 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7559 } else {
7560 RestConfig::authorization_check("patients", "med");
7561 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7563 RestConfig::apiLog($return);
7564 return $return;
7568 * @OA\Get(
7569 * path="/fhir/AllergyIntolerance/{uuid}",
7570 * description="Returns a single AllergyIntolerance resource.",
7571 * tags={"fhir"},
7572 * @OA\Parameter(
7573 * name="uuid",
7574 * in="path",
7575 * description="The uuid for the AllergyIntolerance resource.",
7576 * required=true,
7577 * @OA\Schema(
7578 * type="string"
7580 * ),
7581 * @OA\Response(
7582 * response="200",
7583 * description="Standard Response",
7584 * @OA\MediaType(
7585 * mediaType="application/json",
7586 * @OA\Schema(
7587 * @OA\Property(
7588 * property="json object",
7589 * description="FHIR Json object.",
7590 * type="object"
7591 * ),
7592 * example={
7593 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7594 * "meta": {
7595 * "versionId": "1",
7596 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7597 * },
7598 * "resourceType": "AllergyIntolerance",
7599 * "text": {
7600 * "status": "additional",
7601 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7602 * },
7603 * "clinicalStatus": {
7604 * "coding": {
7606 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7607 * "code": "active",
7608 * "display": "Active"
7611 * },
7612 * "verificationStatus": {
7613 * "coding": {
7615 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7616 * "code": "confirmed",
7617 * "display": "Confirmed"
7620 * },
7621 * "category": {
7622 * "medication"
7623 * },
7624 * "criticality": "low",
7625 * "code": {
7626 * "coding": {
7628 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7629 * "code": "unknown",
7630 * "display": "Unknown"
7633 * },
7634 * "patient": {
7635 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7636 * },
7637 * "reaction": {
7639 * "manifestation": {
7641 * "coding": {
7643 * "system": "http://snomed.info/sct",
7644 * "code": "422587007",
7645 * "display": "Nausea"
7647 * },
7648 * "text": "Nausea"
7656 * ),
7657 * @OA\Response(
7658 * response="400",
7659 * ref="#/components/responses/badrequest"
7660 * ),
7661 * @OA\Response(
7662 * response="401",
7663 * ref="#/components/responses/unauthorized"
7664 * ),
7665 * @OA\Response(
7666 * response="404",
7667 * ref="#/components/responses/uuidnotfound"
7668 * ),
7669 * security={{"openemr_auth":{}}}
7672 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7673 if ($request->isPatientRequest()) {
7674 // only allow access to data of binded patient
7675 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7676 } else {
7677 RestConfig::authorization_check("patients", "med");
7678 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7680 RestConfig::apiLog($return);
7681 return $return;
7685 * @OA\Get(
7686 * path="/fhir/Appointment",
7687 * description="Returns a list of Appointment resources.",
7688 * tags={"fhir"},
7689 * @OA\Parameter(
7690 * name="_id",
7691 * in="query",
7692 * description="The uuid for the Appointment resource.",
7693 * required=false,
7694 * @OA\Schema(
7695 * type="string"
7697 * ),
7698 * @OA\Parameter(
7699 * name="patient",
7700 * in="query",
7701 * description="The uuid for the patient.",
7702 * required=false,
7703 * @OA\Schema(
7704 * type="string"
7706 * ),
7707 * @OA\Response(
7708 * response="200",
7709 * description="Standard Response",
7710 * @OA\MediaType(
7711 * mediaType="application/json",
7712 * @OA\Schema(
7713 * @OA\Property(
7714 * property="json object",
7715 * description="FHIR Json object.",
7716 * type="object"
7717 * ),
7718 * example={
7719 * "meta": {
7720 * "lastUpdated": "2021-09-14T09:13:51"
7721 * },
7722 * "resourceType": "Bundle",
7723 * "type": "collection",
7724 * "total": 0,
7725 * "link": {
7727 * "relation": "self",
7728 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7734 * ),
7735 * @OA\Response(
7736 * response="400",
7737 * ref="#/components/responses/badrequest"
7738 * ),
7739 * @OA\Response(
7740 * response="401",
7741 * ref="#/components/responses/unauthorized"
7742 * ),
7743 * security={{"openemr_auth":{}}}
7746 "GET /fhir/Appointment" => function (HttpRestRequest $request) {
7747 $getParams = $request->getQueryParams();
7748 if ($request->isPatientRequest()) {
7749 // only allow access to data of binded patient
7750 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7751 } else {
7752 RestConfig::authorization_check("patients", "appt");
7753 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7755 RestConfig::apiLog($return);
7756 return $return;
7760 * @OA\Get(
7761 * path="/fhir/Appointment/{uuid}",
7762 * description="Returns a single Appointment resource.",
7763 * tags={"fhir"},
7764 * @OA\Parameter(
7765 * name="uuid",
7766 * in="path",
7767 * description="The uuid for the Appointment resource.",
7768 * required=true,
7769 * @OA\Schema(
7770 * type="string"
7772 * ),
7773 * @OA\Response(
7774 * response="200",
7775 * description="Standard Response",
7776 * @OA\MediaType(
7777 * mediaType="application/json",
7778 * @OA\Schema(
7779 * @OA\Property(
7780 * property="json object",
7781 * description="FHIR Json object.",
7782 * type="object"
7783 * ),
7784 * example={}
7787 * ),
7788 * @OA\Response(
7789 * response="400",
7790 * ref="#/components/responses/badrequest"
7791 * ),
7792 * @OA\Response(
7793 * response="401",
7794 * ref="#/components/responses/unauthorized"
7795 * ),
7796 * @OA\Response(
7797 * response="404",
7798 * ref="#/components/responses/uuidnotfound"
7799 * ),
7800 * security={{"openemr_auth":{}}}
7803 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest $request) {
7804 if ($request->isPatientRequest()) {
7805 // only allow access to data of binded patient
7806 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7807 } else {
7808 RestConfig::authorization_check("patients", "appt");
7809 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7811 RestConfig::apiLog($return);
7812 return $return;
7816 * @OA\Get(
7817 * path="/fhir/CarePlan",
7818 * description="Returns a list of CarePlan resources.",
7819 * tags={"fhir"},
7820 * @OA\Parameter(
7821 * name="_id",
7822 * in="query",
7823 * description="The uuid for the CarePlan resource.",
7824 * required=false,
7825 * @OA\Schema(
7826 * type="string"
7828 * ),
7829 * @OA\Parameter(
7830 * name="patient",
7831 * in="query",
7832 * description="The uuid for the patient.",
7833 * required=false,
7834 * @OA\Schema(
7835 * type="string"
7837 * ),
7838 * @OA\Parameter(
7839 * name="category",
7840 * in="query",
7841 * description="The category of the CarePlan resource.",
7842 * required=false,
7843 * @OA\Schema(
7844 * type="string"
7846 * ),
7847 * @OA\Response(
7848 * response="200",
7849 * description="Standard Response",
7850 * @OA\MediaType(
7851 * mediaType="application/json",
7852 * @OA\Schema(
7853 * @OA\Property(
7854 * property="json object",
7855 * description="FHIR Json object.",
7856 * type="object"
7857 * ),
7858 * example={
7859 * "meta": {
7860 * "lastUpdated": "2021-09-14T09:13:51"
7861 * },
7862 * "resourceType": "Bundle",
7863 * "type": "collection",
7864 * "total": 0,
7865 * "link": {
7867 * "relation": "self",
7868 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7874 * ),
7875 * @OA\Response(
7876 * response="400",
7877 * ref="#/components/responses/badrequest"
7878 * ),
7879 * @OA\Response(
7880 * response="401",
7881 * ref="#/components/responses/unauthorized"
7882 * ),
7883 * security={{"openemr_auth":{}}}
7886 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7887 $getParams = $request->getQueryParams();
7888 if ($request->isPatientRequest()) {
7889 // only allow access to data of binded patient
7890 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7891 } else {
7892 RestConfig::authorization_check("patients", "med");
7893 $return = (new FhirCarePlanRestController())->getAll($getParams);
7895 RestConfig::apiLog($return);
7896 return $return;
7900 * @OA\Get(
7901 * path="/fhir/CarePlan/{uuid}",
7902 * description="Returns a single CarePlan resource.",
7903 * tags={"fhir"},
7904 * @OA\Parameter(
7905 * name="uuid",
7906 * in="path",
7907 * description="The uuid for the CarePlan resource.",
7908 * required=true,
7909 * @OA\Schema(
7910 * type="string"
7912 * ),
7913 * @OA\Response(
7914 * response="200",
7915 * description="Standard Response",
7916 * @OA\MediaType(
7917 * mediaType="application/json",
7918 * @OA\Schema(
7919 * @OA\Property(
7920 * property="json object",
7921 * description="FHIR Json object.",
7922 * type="object"
7923 * ),
7924 * example={
7925 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7926 * "meta": {
7927 * "versionId": "1",
7928 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7929 * },
7930 * "resourceType": "CarePlan",
7931 * "text": {
7932 * "status": "generated",
7933 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7934 * },
7935 * "status": "active",
7936 * "intent": "plan",
7937 * "category": {
7939 * "coding": {
7941 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7942 * "code": "assess-plan"
7946 * },
7947 * "description": "Treat flu.",
7948 * "subject": {
7949 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7950 * "type": "Patient"
7955 * ),
7956 * @OA\Response(
7957 * response="400",
7958 * ref="#/components/responses/badrequest"
7959 * ),
7960 * @OA\Response(
7961 * response="401",
7962 * ref="#/components/responses/unauthorized"
7963 * ),
7964 * @OA\Response(
7965 * response="404",
7966 * ref="#/components/responses/uuidnotfound"
7967 * ),
7968 * security={{"openemr_auth":{}}}
7971 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7972 if ($request->isPatientRequest()) {
7973 // only allow access to data of binded patient
7974 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7975 } else {
7976 RestConfig::authorization_check("patients", "med");
7977 $return = (new FhirCarePlanRestController())->getOne($uuid);
7979 RestConfig::apiLog($return);
7980 return $return;
7984 * @OA\Get(
7985 * path="/fhir/CareTeam",
7986 * description="Returns a list of CareTeam resources.",
7987 * tags={"fhir"},
7988 * @OA\Parameter(
7989 * name="_id",
7990 * in="query",
7991 * description="The uuid for the CareTeam resource.",
7992 * required=false,
7993 * @OA\Schema(
7994 * type="string"
7996 * ),
7997 * @OA\Parameter(
7998 * name="patient",
7999 * in="query",
8000 * description="The uuid for the patient.",
8001 * required=false,
8002 * @OA\Schema(
8003 * type="string"
8005 * ),
8006 * @OA\Parameter(
8007 * name="status",
8008 * in="query",
8009 * description="The status of the CarePlan resource.",
8010 * required=false,
8011 * @OA\Schema(
8012 * type="string"
8014 * ),
8015 * @OA\Response(
8016 * response="200",
8017 * description="Standard Response",
8018 * @OA\MediaType(
8019 * mediaType="application/json",
8020 * @OA\Schema(
8021 * @OA\Property(
8022 * property="json object",
8023 * description="FHIR Json object.",
8024 * type="object"
8025 * ),
8026 * example={
8027 * "meta": {
8028 * "lastUpdated": "2021-09-14T09:13:51"
8029 * },
8030 * "resourceType": "Bundle",
8031 * "type": "collection",
8032 * "total": 0,
8033 * "link": {
8035 * "relation": "self",
8036 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
8042 * ),
8043 * @OA\Response(
8044 * response="400",
8045 * ref="#/components/responses/badrequest"
8046 * ),
8047 * @OA\Response(
8048 * response="401",
8049 * ref="#/components/responses/unauthorized"
8050 * ),
8051 * security={{"openemr_auth":{}}}
8054 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
8055 $getParams = $request->getQueryParams();
8056 if ($request->isPatientRequest()) {
8057 // only allow access to data of binded patient
8058 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8059 } else {
8060 RestConfig::authorization_check("patients", "med");
8061 $return = (new FhirCareTeamRestController())->getAll($getParams);
8063 RestConfig::apiLog($return);
8064 return $return;
8068 * @OA\Get(
8069 * path="/fhir/CareTeam/{uuid}",
8070 * description="Returns a single CareTeam resource.",
8071 * tags={"fhir"},
8072 * @OA\Parameter(
8073 * name="uuid",
8074 * in="path",
8075 * description="The uuid for the CareTeam resource.",
8076 * required=true,
8077 * @OA\Schema(
8078 * type="string"
8080 * ),
8081 * @OA\Response(
8082 * response="200",
8083 * description="Standard Response",
8084 * @OA\MediaType(
8085 * mediaType="application/json",
8086 * @OA\Schema(
8087 * @OA\Property(
8088 * property="json object",
8089 * description="FHIR Json object.",
8090 * type="object"
8091 * ),
8092 * example={
8093 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8094 * "meta": {
8095 * "versionId": "1",
8096 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8097 * },
8098 * "resourceType": "CareTeam",
8099 * "status": "active",
8100 * "subject": {
8101 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8102 * "type": "Patient"
8103 * },
8104 * "participant": {
8106 * "role": {
8108 * "coding": {
8110 * "system": "http://nucc.org/provider-taxonomy",
8111 * "code": "102L00000X",
8112 * "display": "Psychoanalyst"
8116 * },
8117 * "member": {
8118 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8119 * "type": "Practitioner"
8120 * },
8121 * "onBehalfOf": {
8122 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8123 * "type": "Organization"
8125 * },
8127 * "role": {
8129 * "coding": {
8131 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8132 * "code": "unknown",
8133 * "display": "Unknown"
8137 * },
8138 * "member": {
8139 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8140 * "type": "Organization"
8147 * ),
8148 * @OA\Response(
8149 * response="400",
8150 * ref="#/components/responses/badrequest"
8151 * ),
8152 * @OA\Response(
8153 * response="401",
8154 * ref="#/components/responses/unauthorized"
8155 * ),
8156 * @OA\Response(
8157 * response="404",
8158 * ref="#/components/responses/uuidnotfound"
8159 * ),
8160 * security={{"openemr_auth":{}}}
8163 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
8164 if ($request->isPatientRequest()) {
8165 // only allow access to data of binded patient
8166 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8167 } else {
8168 RestConfig::authorization_check("patients", "med");
8169 $return = (new FhirCareTeamRestController())->getOne($uuid);
8171 RestConfig::apiLog($return);
8172 return $return;
8176 * @OA\Get(
8177 * path="/fhir/Condition",
8178 * description="Returns a list of Condition resources.",
8179 * tags={"fhir"},
8180 * @OA\Parameter(
8181 * name="_id",
8182 * in="query",
8183 * description="The uuid for the Condition resource.",
8184 * required=false,
8185 * @OA\Schema(
8186 * type="string"
8188 * ),
8189 * @OA\Parameter(
8190 * name="patient",
8191 * in="query",
8192 * description="The uuid for the patient.",
8193 * required=false,
8194 * @OA\Schema(
8195 * type="string"
8197 * ),
8198 * @OA\Response(
8199 * response="200",
8200 * description="Standard Response",
8201 * @OA\MediaType(
8202 * mediaType="application/json",
8203 * @OA\Schema(
8204 * @OA\Property(
8205 * property="json object",
8206 * description="FHIR Json object.",
8207 * type="object"
8208 * ),
8209 * example={
8210 * "meta": {
8211 * "lastUpdated": "2021-09-14T09:13:51"
8212 * },
8213 * "resourceType": "Bundle",
8214 * "type": "collection",
8215 * "total": 0,
8216 * "link": {
8218 * "relation": "self",
8219 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8225 * ),
8226 * @OA\Response(
8227 * response="400",
8228 * ref="#/components/responses/badrequest"
8229 * ),
8230 * @OA\Response(
8231 * response="401",
8232 * ref="#/components/responses/unauthorized"
8233 * ),
8234 * security={{"openemr_auth":{}}}
8237 "GET /fhir/Condition" => function (HttpRestRequest $request) {
8238 $getParams = $request->getQueryParams();
8239 if ($request->isPatientRequest()) {
8240 // only allow access to data of binded patient
8241 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8242 } else {
8243 RestConfig::authorization_check("patients", "med");
8244 $return = (new FhirConditionRestController())->getAll($getParams);
8246 RestConfig::apiLog($return);
8247 return $return;
8251 * @OA\Get(
8252 * path="/fhir/Condition/{uuid}",
8253 * description="Returns a single Condition resource.",
8254 * tags={"fhir"},
8255 * @OA\Parameter(
8256 * name="uuid",
8257 * in="path",
8258 * description="The uuid for the Condition resource.",
8259 * required=true,
8260 * @OA\Schema(
8261 * type="string"
8263 * ),
8264 * @OA\Response(
8265 * response="200",
8266 * description="Standard Response",
8267 * @OA\MediaType(
8268 * mediaType="application/json",
8269 * @OA\Schema(
8270 * @OA\Property(
8271 * property="json object",
8272 * description="FHIR Json object.",
8273 * type="object"
8274 * ),
8275 * example={
8276 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8277 * "meta": {
8278 * "versionId": "1",
8279 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8280 * },
8281 * "resourceType": "Condition",
8282 * "clinicalStatus": {
8283 * "coding": {
8285 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8286 * "code": "inactive",
8287 * "display": "Inactive"
8290 * },
8291 * "verificationStatus": {
8292 * "coding": {
8294 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8295 * "code": "unconfirmed",
8296 * "display": "Unconfirmed"
8299 * },
8300 * "category": {
8302 * "coding": {
8304 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8305 * "code": "problem-list-item",
8306 * "display": "Problem List Item"
8310 * },
8311 * "code": {
8312 * "coding": {
8314 * "system": "http://snomed.info/sct",
8315 * "code": "444814009",
8316 * "display": ""
8319 * },
8320 * "subject": {
8321 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8326 * ),
8327 * @OA\Response(
8328 * response="400",
8329 * ref="#/components/responses/badrequest"
8330 * ),
8331 * @OA\Response(
8332 * response="401",
8333 * ref="#/components/responses/unauthorized"
8334 * ),
8335 * @OA\Response(
8336 * response="404",
8337 * ref="#/components/responses/uuidnotfound"
8338 * ),
8339 * security={{"openemr_auth":{}}}
8342 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
8343 if ($request->isPatientRequest()) {
8344 // only allow access to data of binded patient
8345 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8346 } else {
8347 RestConfig::authorization_check("patients", "med");
8348 $return = (new FhirConditionRestController())->getOne($uuid);
8350 RestConfig::apiLog($return);
8351 return $return;
8355 * @OA\Get(
8356 * path="/fhir/Coverage",
8357 * description="Returns a list of Coverage resources.",
8358 * tags={"fhir"},
8359 * @OA\Parameter(
8360 * name="_id",
8361 * in="query",
8362 * description="The uuid for the Coverage resource.",
8363 * required=false,
8364 * @OA\Schema(
8365 * type="string"
8367 * ),
8368 * @OA\Parameter(
8369 * name="patient",
8370 * in="query",
8371 * description="The uuid for the patient.",
8372 * required=false,
8373 * @OA\Schema(
8374 * type="string"
8376 * ),
8377 * @OA\Parameter(
8378 * name="payor",
8379 * in="query",
8380 * description="The payor of the Coverage resource.",
8381 * required=false,
8382 * @OA\Schema(
8383 * type="string"
8385 * ),
8386 * @OA\Response(
8387 * response="200",
8388 * description="Standard Response",
8389 * @OA\MediaType(
8390 * mediaType="application/json",
8391 * @OA\Schema(
8392 * @OA\Property(
8393 * property="json object",
8394 * description="FHIR Json object.",
8395 * type="object"
8396 * ),
8397 * example={
8398 * "meta": {
8399 * "lastUpdated": "2021-09-14T09:13:51"
8400 * },
8401 * "resourceType": "Bundle",
8402 * "type": "collection",
8403 * "total": 0,
8404 * "link": {
8406 * "relation": "self",
8407 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8413 * ),
8414 * @OA\Response(
8415 * response="400",
8416 * ref="#/components/responses/badrequest"
8417 * ),
8418 * @OA\Response(
8419 * response="401",
8420 * ref="#/components/responses/unauthorized"
8421 * ),
8422 * security={{"openemr_auth":{}}}
8425 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
8426 if ($request->isPatientRequest()) {
8427 // only allow access to data of binded patient
8428 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8429 } else {
8430 RestConfig::authorization_check("admin", "super");
8431 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8433 RestConfig::apiLog($return);
8434 return $return;
8438 * @OA\Get(
8439 * path="/fhir/Coverage/{uuid}",
8440 * description="Returns a single Coverage resource.",
8441 * tags={"fhir"},
8442 * @OA\Parameter(
8443 * name="uuid",
8444 * in="path",
8445 * description="The uuid for the Coverage resource.",
8446 * required=true,
8447 * @OA\Schema(
8448 * type="string"
8450 * ),
8451 * @OA\Response(
8452 * response="200",
8453 * description="Standard Response",
8454 * @OA\MediaType(
8455 * mediaType="application/json",
8456 * @OA\Schema(
8457 * @OA\Property(
8458 * property="json object",
8459 * description="FHIR Json object.",
8460 * type="object"
8461 * ),
8462 * example={
8463 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8464 * "meta": {
8465 * "versionId": "1",
8466 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8467 * },
8468 * "resourceType": "Coverage",
8469 * "status": "active",
8470 * "beneficiary": {
8471 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8472 * },
8473 * "relationship": {
8474 * "coding": {
8476 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8477 * "code": ""
8484 * ),
8485 * @OA\Response(
8486 * response="400",
8487 * ref="#/components/responses/badrequest"
8488 * ),
8489 * @OA\Response(
8490 * response="401",
8491 * ref="#/components/responses/unauthorized"
8492 * ),
8493 * @OA\Response(
8494 * response="404",
8495 * ref="#/components/responses/uuidnotfound"
8496 * ),
8497 * security={{"openemr_auth":{}}}
8500 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
8501 if ($request->isPatientRequest()) {
8502 // only allow access to data of binded patient
8503 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8504 } else {
8505 RestConfig::authorization_check("admin", "super");
8506 $return = (new FhirCoverageRestController())->getOne($uuid);
8508 RestConfig::apiLog($return);
8509 return $return;
8513 * @OA\Get(
8514 * path="/fhir/Device",
8515 * description="Returns a list of Device resources.",
8516 * tags={"fhir"},
8517 * @OA\Parameter(
8518 * name="_id",
8519 * in="query",
8520 * description="The uuid for the Device resource.",
8521 * required=false,
8522 * @OA\Schema(
8523 * type="string"
8525 * ),
8526 * @OA\Parameter(
8527 * name="patient",
8528 * in="query",
8529 * description="The uuid for the patient.",
8530 * required=false,
8531 * @OA\Schema(
8532 * type="string"
8534 * ),
8535 * @OA\Response(
8536 * response="200",
8537 * description="Standard Response",
8538 * @OA\MediaType(
8539 * mediaType="application/json",
8540 * @OA\Schema(
8541 * @OA\Property(
8542 * property="json object",
8543 * description="FHIR Json object.",
8544 * type="object"
8545 * ),
8546 * example={
8547 * "meta": {
8548 * "lastUpdated": "2021-09-14T09:13:51"
8549 * },
8550 * "resourceType": "Bundle",
8551 * "type": "collection",
8552 * "total": 0,
8553 * "link": {
8555 * "relation": "self",
8556 * "url": "https://localhost:9300/apis/default/fhir/Device"
8562 * ),
8563 * @OA\Response(
8564 * response="400",
8565 * ref="#/components/responses/badrequest"
8566 * ),
8567 * @OA\Response(
8568 * response="401",
8569 * ref="#/components/responses/unauthorized"
8570 * ),
8571 * security={{"openemr_auth":{}}}
8574 "GET /fhir/Device" => function (HttpRestRequest $request) {
8575 if ($request->isPatientRequest()) {
8576 // only allow access to data of binded patient
8577 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8578 } else {
8579 RestConfig::authorization_check("admin", "super");
8580 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8582 RestConfig::apiLog($return);
8583 return $return;
8587 * @OA\Get(
8588 * path="/fhir/Device/{uuid}",
8589 * description="Returns a single Device resource.",
8590 * tags={"fhir"},
8591 * @OA\Parameter(
8592 * name="uuid",
8593 * in="path",
8594 * description="The uuid for the Device resource.",
8595 * required=true,
8596 * @OA\Schema(
8597 * type="string"
8599 * ),
8600 * @OA\Response(
8601 * response="200",
8602 * description="Standard Response",
8603 * @OA\MediaType(
8604 * mediaType="application/json",
8605 * @OA\Schema(
8606 * @OA\Property(
8607 * property="json object",
8608 * description="FHIR Json object.",
8609 * type="object"
8610 * ),
8611 * example={
8612 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8613 * "meta": {
8614 * "versionId": "1",
8615 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8616 * },
8617 * "resourceType": "Device",
8618 * "udiCarrier": {
8620 * "deviceIdentifier": "08717648200274",
8621 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8623 * },
8624 * "distinctIdentifier": "A99971312345600",
8625 * "manufactureDate": "2013-02-01",
8626 * "expirationDate": "2014-02-01",
8627 * "lotNumber": "000000000000XYZ123",
8628 * "serialNumber": "000025",
8629 * "type": {
8630 * "extension": {
8632 * "valueCode": "unknown",
8633 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8636 * },
8637 * "patient": {
8638 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8639 * "type": "Patient"
8644 * ),
8645 * @OA\Response(
8646 * response="400",
8647 * ref="#/components/responses/badrequest"
8648 * ),
8649 * @OA\Response(
8650 * response="401",
8651 * ref="#/components/responses/unauthorized"
8652 * ),
8653 * @OA\Response(
8654 * response="404",
8655 * ref="#/components/responses/uuidnotfound"
8656 * ),
8657 * security={{"openemr_auth":{}}}
8660 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8661 if ($request->isPatientRequest()) {
8662 // only allow access to data of binded patient
8663 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8664 } else {
8665 RestConfig::authorization_check("admin", "super");
8666 $return = (new FhirDeviceRestController())->getOne($uuid);
8668 RestConfig::apiLog($return);
8669 return $return;
8673 * @OA\Get(
8674 * path="/fhir/DiagnosticReport",
8675 * description="Returns a list of DiagnosticReport resources.",
8676 * tags={"fhir"},
8677 * @OA\Parameter(
8678 * name="_id",
8679 * in="query",
8680 * description="The uuid for the DiagnosticReport resource.",
8681 * required=false,
8682 * @OA\Schema(
8683 * type="string"
8685 * ),
8686 * @OA\Parameter(
8687 * name="patient",
8688 * in="query",
8689 * description="The uuid for the patient.",
8690 * required=false,
8691 * @OA\Schema(
8692 * type="string"
8694 * ),
8695 * @OA\Parameter(
8696 * name="code",
8697 * in="query",
8698 * description="The code of the DiagnosticReport resource.",
8699 * required=false,
8700 * @OA\Schema(
8701 * type="string"
8703 * ),
8704 * @OA\Parameter(
8705 * name="category",
8706 * in="query",
8707 * description="The category of the DiagnosticReport resource.",
8708 * required=false,
8709 * @OA\Schema(
8710 * type="string"
8712 * ),
8713 * @OA\Parameter(
8714 * name="date",
8715 * in="query",
8716 * description="The datetime of the DiagnosticReport resource.",
8717 * required=false,
8718 * @OA\Schema(
8719 * type="string"
8721 * ),
8722 * @OA\Response(
8723 * response="200",
8724 * description="Standard Response",
8725 * @OA\MediaType(
8726 * mediaType="application/json",
8727 * @OA\Schema(
8728 * @OA\Property(
8729 * property="json object",
8730 * description="FHIR Json object.",
8731 * type="object"
8732 * ),
8733 * example={
8734 * "meta": {
8735 * "lastUpdated": "2021-09-14T09:13:51"
8736 * },
8737 * "resourceType": "Bundle",
8738 * "type": "collection",
8739 * "total": 0,
8740 * "link": {
8742 * "relation": "self",
8743 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8749 * ),
8750 * @OA\Response(
8751 * response="400",
8752 * ref="#/components/responses/badrequest"
8753 * ),
8754 * @OA\Response(
8755 * response="401",
8756 * ref="#/components/responses/unauthorized"
8757 * ),
8758 * security={{"openemr_auth":{}}}
8761 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8762 $getParams = $request->getQueryParams();
8763 if ($request->isPatientRequest()) {
8764 // only allow access to data of binded patient
8765 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8766 } else {
8767 RestConfig::authorization_check("admin", "super");
8768 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8770 RestConfig::apiLog($return);
8771 return $return;
8775 * @OA\Get(
8776 * path="/fhir/DiagnosticReport/{uuid}",
8777 * description="Returns a single DiagnosticReport resource.",
8778 * tags={"fhir"},
8779 * @OA\Parameter(
8780 * name="uuid",
8781 * in="path",
8782 * description="The uuid for the DiagnosticReport resource.",
8783 * required=true,
8784 * @OA\Schema(
8785 * type="string"
8787 * ),
8788 * @OA\Response(
8789 * response="200",
8790 * description="Standard Response",
8791 * @OA\MediaType(
8792 * mediaType="application/json",
8793 * @OA\Schema(
8794 * @OA\Property(
8795 * property="json object",
8796 * description="FHIR Json object.",
8797 * type="object"
8798 * ),
8799 * example={
8800 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8801 * "meta": {
8802 * "versionId": "1",
8803 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8804 * },
8805 * "resourceType": "DiagnosticReport",
8806 * "status": "final",
8807 * "category": {
8809 * "coding": {
8811 * "system": "http://loinc.org",
8812 * "code": "LP7839-6",
8813 * "display": "Pathology"
8817 * },
8818 * "code": {
8819 * "coding": {
8821 * "system": "http://loinc.org",
8822 * "code": "11502-2",
8823 * "display": "Laboratory report"
8826 * },
8827 * "subject": {
8828 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8829 * "type": "Patient"
8830 * },
8831 * "encounter": {
8832 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8833 * "type": "Encounter"
8834 * },
8835 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8836 * "issued": "2015-06-22T00:00:00+00:00",
8837 * "performer": {
8839 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8840 * "type": "Organization"
8842 * },
8843 * "presentedForm": {
8845 * "contentType": "text/plain",
8846 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8852 * ),
8853 * @OA\Response(
8854 * response="400",
8855 * ref="#/components/responses/badrequest"
8856 * ),
8857 * @OA\Response(
8858 * response="401",
8859 * ref="#/components/responses/unauthorized"
8860 * ),
8861 * @OA\Response(
8862 * response="404",
8863 * ref="#/components/responses/uuidnotfound"
8864 * ),
8865 * security={{"openemr_auth":{}}}
8868 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8869 $getParams = $request->getQueryParams();
8870 if ($request->isPatientRequest()) {
8871 // only allow access to data of binded patient
8872 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8873 } else {
8874 RestConfig::authorization_check("admin", "super");
8875 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8877 RestConfig::apiLog($return);
8878 return $return;
8882 * @OA\Get(
8883 * path="/fhir/DocumentReference",
8884 * description="Returns a list of DocumentReference resources.",
8885 * tags={"fhir"},
8886 * @OA\Parameter(
8887 * name="_id",
8888 * in="query",
8889 * description="The uuid for the DocumentReference resource.",
8890 * required=false,
8891 * @OA\Schema(
8892 * type="string"
8894 * ),
8895 * @OA\Parameter(
8896 * name="patient",
8897 * in="query",
8898 * description="The uuid for the patient.",
8899 * required=false,
8900 * @OA\Schema(
8901 * type="string"
8903 * ),
8904 * @OA\Parameter(
8905 * name="type",
8906 * in="query",
8907 * description="The type of the DocumentReference resource.",
8908 * required=false,
8909 * @OA\Schema(
8910 * type="string"
8912 * ),
8913 * @OA\Parameter(
8914 * name="category",
8915 * in="query",
8916 * description="The category of the DocumentReference resource.",
8917 * required=false,
8918 * @OA\Schema(
8919 * type="string"
8921 * ),
8922 * @OA\Parameter(
8923 * name="date",
8924 * in="query",
8925 * description="The datetime of the DocumentReference resource.",
8926 * required=false,
8927 * @OA\Schema(
8928 * type="string"
8930 * ),
8931 * @OA\Response(
8932 * response="200",
8933 * description="Standard Response",
8934 * @OA\MediaType(
8935 * mediaType="application/json",
8936 * @OA\Schema(
8937 * @OA\Property(
8938 * property="json object",
8939 * description="FHIR Json object.",
8940 * type="object"
8941 * ),
8942 * example={
8943 * "meta": {
8944 * "lastUpdated": "2021-09-14T09:13:51"
8945 * },
8946 * "resourceType": "Bundle",
8947 * "type": "collection",
8948 * "total": 0,
8949 * "link": {
8951 * "relation": "self",
8952 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8958 * ),
8959 * @OA\Response(
8960 * response="400",
8961 * ref="#/components/responses/badrequest"
8962 * ),
8963 * @OA\Response(
8964 * response="401",
8965 * ref="#/components/responses/unauthorized"
8966 * ),
8967 * security={{"openemr_auth":{}}}
8970 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8971 $getParams = $request->getQueryParams();
8972 if ($request->isPatientRequest()) {
8973 // only allow access to data of binded patient
8974 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8975 } else {
8976 RestConfig::authorization_check("admin", "super");
8977 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8979 RestConfig::apiLog($return);
8980 return $return;
8984 * @OA\POST(
8985 * path="/fhir/DocumentReference/$docref",
8986 * 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.",
8987 * tags={"fhir"},
8988 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8989 * @OA\Parameter(
8990 * name="patient",
8991 * in="query",
8992 * description="The uuid for the patient.",
8993 * required=true,
8994 * @OA\Schema(
8995 * type="string"
8997 * ),
8998 * @OA\Parameter(
8999 * name="start",
9000 * in="query",
9001 * 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.",
9002 * required=false,
9003 * @OA\Schema(
9004 * type="string"
9006 * ),
9007 * @OA\Parameter(
9008 * name="end",
9009 * in="query",
9010 * 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.",
9011 * required=false,
9012 * @OA\Schema(
9013 * type="string"
9015 * ),
9016 * @OA\Parameter(
9017 * name="type",
9018 * in="query",
9019 * 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).",
9020 * required=false,
9021 * @OA\Schema(
9022 * type="string"
9024 * ),
9025 * @OA\Response(
9026 * response="200",
9027 * description="A search bundle of DocumentReferences is returned"
9028 * ),
9029 * @OA\Response(
9030 * response="400",
9031 * ref="#/components/responses/badrequest"
9032 * ),
9033 * @OA\Response(
9034 * response="401",
9035 * ref="#/components/responses/unauthorized"
9036 * ),
9037 * security={{"openemr_auth":{}}}
9040 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
9042 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
9043 if ($request->isPatientRequest()) {
9044 // only allow access to data of binded patient
9045 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9046 } else {
9047 // TODO: it seems like regular users should be able to grab authorship / provenance information
9048 RestConfig::authorization_check("patients", "demo");
9049 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
9051 RestConfig::apiLog($return);
9052 return $return;
9056 * @OA\Get(
9057 * path="/fhir/DocumentReference/{uuid}",
9058 * description="Returns a single DocumentReference resource.",
9059 * tags={"fhir"},
9060 * @OA\Parameter(
9061 * name="uuid",
9062 * in="path",
9063 * description="The uuid for the DocumentReference resource.",
9064 * required=true,
9065 * @OA\Schema(
9066 * type="string"
9068 * ),
9069 * @OA\Response(
9070 * response="200",
9071 * description="Standard Response",
9072 * @OA\MediaType(
9073 * mediaType="application/json",
9074 * @OA\Schema(
9075 * @OA\Property(
9076 * property="json object",
9077 * description="FHIR Json object.",
9078 * type="object"
9079 * ),
9080 * example={
9081 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9082 * "meta": {
9083 * "versionId": "1",
9084 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9085 * },
9086 * "resourceType": "DocumentReference",
9087 * "identifier": {
9089 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9091 * },
9092 * "status": "current",
9093 * "type": {
9094 * "coding": {
9096 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9097 * "code": "UNK",
9098 * "display": "unknown"
9101 * },
9102 * "category": {
9104 * "coding": {
9106 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9107 * "code": "openemr-document",
9108 * "display": "OpenEMR Document"
9112 * },
9113 * "subject": {
9114 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9115 * "type": "Patient"
9116 * },
9117 * "date": "2021-09-19T03:15:56+00:00",
9118 * "author": {
9119 * null
9120 * },
9121 * "content": {
9123 * "attachment": {
9124 * "contentType": "image/gif",
9125 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9126 * },
9127 * "format": {
9128 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9129 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9130 * "display": "mimeType Sufficient"
9137 * ),
9138 * @OA\Response(
9139 * response="400",
9140 * ref="#/components/responses/badrequest"
9141 * ),
9142 * @OA\Response(
9143 * response="401",
9144 * ref="#/components/responses/unauthorized"
9145 * ),
9146 * @OA\Response(
9147 * response="404",
9148 * ref="#/components/responses/uuidnotfound"
9149 * ),
9150 * security={{"openemr_auth":{}}}
9153 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
9154 $getParams = $request->getQueryParams();
9155 if ($request->isPatientRequest()) {
9156 // only allow access to data of binded patient
9157 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9158 } else {
9159 RestConfig::authorization_check("admin", "super");
9160 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9162 RestConfig::apiLog($return);
9163 return $return;
9167 * @OA\Get(
9168 * path="/fhir/Binary/{id}",
9169 * 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>",
9170 * tags={"fhir"},
9171 * @OA\Parameter(
9172 * name="id",
9173 * in="path",
9174 * description="The id for the Document.",
9175 * required=true,
9176 * @OA\Schema(
9177 * type="string"
9179 * ),
9180 * @OA\Response(
9181 * response="200",
9182 * 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>"
9183 * ),
9184 * @OA\Response(
9185 * response="400",
9186 * ref="#/components/responses/badrequest"
9187 * ),
9188 * @OA\Response(
9189 * response="401",
9190 * ref="#/components/responses/unauthorized"
9191 * ),
9192 * security={{"openemr_auth":{}}}
9195 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest $request) {
9196 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
9198 if ($request->isPatientRequest()) {
9199 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9200 } else {
9201 RestConfig::authorization_check("admin", "users");
9202 $response = $docController->downloadDocument($documentId);
9205 return $response;
9209 * @OA\Get(
9210 * path="/fhir/Encounter",
9211 * description="Returns a list of Encounter resources.",
9212 * tags={"fhir"},
9213 * @OA\Parameter(
9214 * name="_id",
9215 * in="query",
9216 * description="The uuid for the Encounter resource.",
9217 * required=false,
9218 * @OA\Schema(
9219 * type="string"
9221 * ),
9222 * @OA\Parameter(
9223 * name="patient",
9224 * in="query",
9225 * description="The uuid for the patient.",
9226 * required=false,
9227 * @OA\Schema(
9228 * type="string"
9230 * ),
9231 * @OA\Parameter(
9232 * name="date",
9233 * in="query",
9234 * description="The datetime of the Encounter resource.",
9235 * required=false,
9236 * @OA\Schema(
9237 * type="string"
9239 * ),
9240 * @OA\Response(
9241 * response="200",
9242 * description="Standard Response",
9243 * @OA\MediaType(
9244 * mediaType="application/json",
9245 * @OA\Schema(
9246 * @OA\Property(
9247 * property="json object",
9248 * description="FHIR Json object.",
9249 * type="object"
9250 * ),
9251 * example={
9252 * "meta": {
9253 * "lastUpdated": "2021-09-14T09:13:51"
9254 * },
9255 * "resourceType": "Bundle",
9256 * "type": "collection",
9257 * "total": 0,
9258 * "link": {
9260 * "relation": "self",
9261 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9267 * ),
9268 * @OA\Response(
9269 * response="400",
9270 * ref="#/components/responses/badrequest"
9271 * ),
9272 * @OA\Response(
9273 * response="401",
9274 * ref="#/components/responses/unauthorized"
9275 * ),
9276 * security={{"openemr_auth":{}}}
9279 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
9280 $getParams = $request->getQueryParams();
9281 if ($request->isPatientRequest()) {
9282 // only allow access to data of binded patient
9283 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9284 } else {
9285 RestConfig::authorization_check("encounters", "auth_a");
9286 $return = (new FhirEncounterRestController())->getAll($getParams);
9288 RestConfig::apiLog($return);
9289 return $return;
9293 * @OA\Get(
9294 * path="/fhir/Encounter/{uuid}",
9295 * description="Returns a single Encounter resource.",
9296 * tags={"fhir"},
9297 * @OA\Parameter(
9298 * name="uuid",
9299 * in="path",
9300 * description="The uuid for the Encounter resource.",
9301 * required=true,
9302 * @OA\Schema(
9303 * type="string"
9305 * ),
9306 * @OA\Response(
9307 * response="200",
9308 * description="Standard Response",
9309 * @OA\MediaType(
9310 * mediaType="application/json",
9311 * @OA\Schema(
9312 * @OA\Property(
9313 * property="json object",
9314 * description="FHIR Json object.",
9315 * type="object"
9316 * ),
9317 * example={
9318 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9319 * "meta": {
9320 * "versionId": "1",
9321 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9322 * },
9323 * "resourceType": "Encounter",
9324 * "identifier": {
9326 * "system": "urn:ietf:rfc:3986",
9327 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9329 * },
9330 * "status": "finished",
9331 * "class": {
9332 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9333 * "code": "AMB",
9334 * "display": "ambulatory"
9335 * },
9336 * "type": {
9338 * "coding": {
9340 * "system": "http://snomed.info/sct",
9341 * "code": "185349003",
9342 * "display": "Encounter for check up (procedure)"
9346 * },
9347 * "subject": {
9348 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9349 * "type": "Patient"
9350 * },
9351 * "participant": {
9353 * "type": {
9355 * "coding": {
9357 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9358 * "code": "PPRF",
9359 * "display": "Primary Performer"
9363 * },
9364 * "period": {
9365 * "start": "2012-08-13T00:00:00+00:00"
9366 * },
9367 * "individual": {
9368 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9369 * "type": "Practitioner"
9372 * },
9373 * "period": {
9374 * "start": "2012-08-13T00:00:00+00:00"
9379 * ),
9380 * @OA\Response(
9381 * response="400",
9382 * ref="#/components/responses/badrequest"
9383 * ),
9384 * @OA\Response(
9385 * response="401",
9386 * ref="#/components/responses/unauthorized"
9387 * ),
9388 * @OA\Response(
9389 * response="404",
9390 * ref="#/components/responses/uuidnotfound"
9391 * ),
9392 * security={{"openemr_auth":{}}}
9395 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
9396 if ($request->isPatientRequest()) {
9397 // only allow access to data of binded patient
9398 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9399 } else {
9400 RestConfig::authorization_check("admin", "super");
9401 $return = (new FhirEncounterRestController())->getOne($uuid);
9403 RestConfig::apiLog($return);
9404 return $return;
9408 * @OA\Get(
9409 * path="/fhir/Goal",
9410 * description="Returns a list of Condition resources.",
9411 * tags={"fhir"},
9412 * @OA\Parameter(
9413 * name="_id",
9414 * in="query",
9415 * description="The uuid for the Goal resource.",
9416 * required=false,
9417 * @OA\Schema(
9418 * type="string"
9420 * ),
9421 * @OA\Parameter(
9422 * name="patient",
9423 * in="query",
9424 * description="The uuid for the patient.",
9425 * required=false,
9426 * @OA\Schema(
9427 * type="string"
9429 * ),
9430 * @OA\Response(
9431 * response="200",
9432 * description="Standard Response",
9433 * @OA\MediaType(
9434 * mediaType="application/json",
9435 * @OA\Schema(
9436 * @OA\Property(
9437 * property="json object",
9438 * description="FHIR Json object.",
9439 * type="object"
9440 * ),
9441 * example={
9442 * "meta": {
9443 * "lastUpdated": "2021-09-14T09:13:51"
9444 * },
9445 * "resourceType": "Bundle",
9446 * "type": "collection",
9447 * "total": 0,
9448 * "link": {
9450 * "relation": "self",
9451 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9457 * ),
9458 * @OA\Response(
9459 * response="400",
9460 * ref="#/components/responses/badrequest"
9461 * ),
9462 * @OA\Response(
9463 * response="401",
9464 * ref="#/components/responses/unauthorized"
9465 * ),
9466 * security={{"openemr_auth":{}}}
9469 "GET /fhir/Goal" => function (HttpRestRequest $request) {
9470 $getParams = $request->getQueryParams();
9471 if ($request->isPatientRequest()) {
9472 // only allow access to data of binded patient
9473 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9474 } else {
9475 RestConfig::authorization_check("admin", "super");
9476 $return = (new FhirGoalRestController())->getAll($getParams);
9478 RestConfig::apiLog($return);
9479 return $return;
9483 * @OA\Get(
9484 * path="/fhir/Goal/{uuid}",
9485 * description="Returns a single Goal resource.",
9486 * tags={"fhir"},
9487 * @OA\Parameter(
9488 * name="uuid",
9489 * in="path",
9490 * description="The uuid for the Goal resource.",
9491 * required=true,
9492 * @OA\Schema(
9493 * type="string"
9495 * ),
9496 * @OA\Response(
9497 * response="200",
9498 * description="Standard Response",
9499 * @OA\MediaType(
9500 * mediaType="application/json",
9501 * @OA\Schema(
9502 * @OA\Property(
9503 * property="json object",
9504 * description="FHIR Json object.",
9505 * type="object"
9506 * ),
9507 * example={
9508 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9509 * "meta": {
9510 * "versionId": "1",
9511 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9512 * },
9513 * "resourceType": "Goal",
9514 * "lifecycleStatus": "active",
9515 * "description": {
9516 * "text": "Eating more vegetables."
9517 * },
9518 * "subject": {
9519 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9520 * "type": "Patient"
9521 * },
9522 * "target": {
9524 * "measure": {
9525 * "extension": {
9527 * "valueCode": "unknown",
9528 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9531 * },
9532 * "detailString": "Eating more vegetables.",
9533 * "dueDate": "2021-09-09"
9539 * ),
9540 * @OA\Response(
9541 * response="400",
9542 * ref="#/components/responses/badrequest"
9543 * ),
9544 * @OA\Response(
9545 * response="401",
9546 * ref="#/components/responses/unauthorized"
9547 * ),
9548 * @OA\Response(
9549 * response="404",
9550 * ref="#/components/responses/uuidnotfound"
9551 * ),
9552 * security={{"openemr_auth":{}}}
9555 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9556 if ($request->isPatientRequest()) {
9557 // only allow access to data of binded patient
9558 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9559 } else {
9560 RestConfig::authorization_check("admin", "super");
9561 $return = (new FhirGoalRestController())->getOne($uuid);
9563 RestConfig::apiLog($return);
9564 return $return;
9568 * @OA\Get(
9569 * path="/fhir/Group",
9570 * 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>",
9571 * tags={"fhir"},
9572 * @OA\Parameter(
9573 * name="_id",
9574 * in="query",
9575 * description="The uuid for the Group resource.",
9576 * required=false,
9577 * @OA\Schema(
9578 * type="string"
9580 * ),
9581 * @OA\Parameter(
9582 * name="patient",
9583 * in="query",
9584 * description="The uuid for the patient.",
9585 * required=false,
9586 * @OA\Schema(
9587 * type="string"
9589 * ),
9590 * @OA\Response(
9591 * response="200",
9592 * description="Standard Response",
9593 * @OA\MediaType(
9594 * mediaType="application/json",
9595 * @OA\Schema(
9596 * @OA\Property(
9597 * property="json object",
9598 * description="FHIR Json object.",
9599 * type="object"
9600 * ),
9601 * example={
9602 * "meta": {
9603 * "lastUpdated": "2021-09-14T09:13:51"
9604 * },
9605 * "resourceType": "Bundle",
9606 * "type": "collection",
9607 * "total": 0,
9608 * "link": {
9610 * "relation": "self",
9611 * "url": "https://localhost:9300/apis/default/fhir/Group"
9617 * ),
9618 * @OA\Response(
9619 * response="400",
9620 * ref="#/components/responses/badrequest"
9621 * ),
9622 * @OA\Response(
9623 * response="401",
9624 * ref="#/components/responses/unauthorized"
9625 * ),
9626 * security={{"openemr_auth":{}}}
9629 'GET /fhir/Group' => function (HttpRestRequest $request) {
9630 RestConfig::authorization_check("admin", "users");
9631 $getParams = $request->getQueryParams();
9632 if ($request->isPatientRequest()) {
9633 // only allow access to data of binded patient
9634 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9635 } else {
9636 $return = (new FhirGroupRestController())->getAll($getParams);
9638 RestConfig::apiLog($return);
9639 return $return;
9643 * @OA\Get(
9644 * path="/fhir/Group/{uuid}",
9645 * 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>",
9646 * tags={"fhir"},
9647 * @OA\Parameter(
9648 * name="uuid",
9649 * in="path",
9650 * description="The uuid for the Group resource.",
9651 * required=true,
9652 * @OA\Schema(
9653 * type="string"
9655 * ),
9656 * @OA\Response(
9657 * response="200",
9658 * 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>"
9659 * ),
9660 * @OA\Response(
9661 * response="400",
9662 * ref="#/components/responses/badrequest"
9663 * ),
9664 * @OA\Response(
9665 * response="401",
9666 * ref="#/components/responses/unauthorized"
9667 * ),
9668 * @OA\Response(
9669 * response="404",
9670 * ref="#/components/responses/uuidnotfound"
9671 * ),
9672 * security={{"openemr_auth":{}}}
9675 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9676 RestConfig::authorization_check("admin", "users");
9677 if ($request->isPatientRequest()) {
9678 // only allow access to data of binded patient
9679 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9680 } else {
9681 $return = (new FhirGroupRestController())->getOne($uuid);
9683 RestConfig::apiLog($return);
9684 return $return;
9688 * @OA\Get(
9689 * path="/fhir/Group/{id}/$export",
9690 * 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>",
9691 * tags={"fhir"},
9692 * @OA\Parameter(
9693 * name="id",
9694 * in="path",
9695 * description="The id for the Group resource.",
9696 * required=true,
9697 * @OA\Schema(
9698 * type="string"
9700 * ),
9701 * @OA\Response(
9702 * response="200",
9703 * 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>"
9704 * ),
9705 * @OA\Response(
9706 * response="400",
9707 * ref="#/components/responses/badrequest"
9708 * ),
9709 * @OA\Response(
9710 * response="401",
9711 * ref="#/components/responses/unauthorized"
9712 * ),
9713 * security={{"openemr_auth":{}}}
9716 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9717 RestConfig::authorization_check("admin", "users");
9718 $fhirExportService = new FhirOperationExportRestController($request);
9719 $exportParams = $request->getQueryParams();
9720 $exportParams['groupId'] = $groupId;
9721 $return = $fhirExportService->processExport(
9722 $exportParams,
9723 'Group',
9724 $request->getHeader('Accept')[0] ?? '',
9725 $request->getHeader('Prefer')[0] ?? ''
9727 RestConfig::apiLog($return);
9728 return $return;
9732 * @OA\Get(
9733 * path="/fhir/Immunization",
9734 * description="Returns a list of Immunization resources.",
9735 * tags={"fhir"},
9736 * @OA\Parameter(
9737 * name="_id",
9738 * in="query",
9739 * description="The uuid for the Immunization resource.",
9740 * required=false,
9741 * @OA\Schema(
9742 * type="string"
9744 * ),
9745 * @OA\Parameter(
9746 * name="patient",
9747 * in="query",
9748 * description="The uuid for the patient.",
9749 * required=false,
9750 * @OA\Schema(
9751 * type="string"
9753 * ),
9754 * @OA\Response(
9755 * response="200",
9756 * description="Standard Response",
9757 * @OA\MediaType(
9758 * mediaType="application/json",
9759 * @OA\Schema(
9760 * @OA\Property(
9761 * property="json object",
9762 * description="FHIR Json object.",
9763 * type="object"
9764 * ),
9765 * example={
9766 * "meta": {
9767 * "lastUpdated": "2021-09-14T09:13:51"
9768 * },
9769 * "resourceType": "Bundle",
9770 * "type": "collection",
9771 * "total": 0,
9772 * "link": {
9774 * "relation": "self",
9775 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9781 * ),
9782 * @OA\Response(
9783 * response="400",
9784 * ref="#/components/responses/badrequest"
9785 * ),
9786 * @OA\Response(
9787 * response="401",
9788 * ref="#/components/responses/unauthorized"
9789 * ),
9790 * security={{"openemr_auth":{}}}
9793 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9794 $getParams = $request->getQueryParams();
9795 if ($request->isPatientRequest()) {
9796 // only allow access to data of binded patient
9797 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9798 } else {
9799 RestConfig::authorization_check("patients", "med");
9800 $return = (new FhirImmunizationRestController())->getAll($getParams);
9802 RestConfig::apiLog($return);
9803 return $return;
9807 * @OA\Get(
9808 * path="/fhir/Immunization/{uuid}",
9809 * description="Returns a single Immunization resource.",
9810 * tags={"fhir"},
9811 * @OA\Parameter(
9812 * name="uuid",
9813 * in="path",
9814 * description="The uuid for the Immunization resource.",
9815 * required=true,
9816 * @OA\Schema(
9817 * type="string"
9819 * ),
9820 * @OA\Response(
9821 * response="200",
9822 * description="Standard Response",
9823 * @OA\MediaType(
9824 * mediaType="application/json",
9825 * @OA\Schema(
9826 * @OA\Property(
9827 * property="json object",
9828 * description="FHIR Json object.",
9829 * type="object"
9830 * ),
9831 * example={
9832 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9833 * "meta": {
9834 * "versionId": "1",
9835 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9836 * },
9837 * "resourceType": "Immunization",
9838 * "status": "completed",
9839 * "vaccineCode": {
9840 * "coding": {
9842 * "system": "http://hl7.org/fhir/sid/cvx",
9843 * "code": "207",
9844 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9847 * },
9848 * "patient": {
9849 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9850 * },
9851 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9852 * "recorded": "2022-03-26T05:42:26+00:00",
9853 * "primarySource": false
9857 * ),
9858 * @OA\Response(
9859 * response="400",
9860 * ref="#/components/responses/badrequest"
9861 * ),
9862 * @OA\Response(
9863 * response="401",
9864 * ref="#/components/responses/unauthorized"
9865 * ),
9866 * @OA\Response(
9867 * response="404",
9868 * ref="#/components/responses/uuidnotfound"
9869 * ),
9870 * security={{"openemr_auth":{}}}
9873 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9874 if ($request->isPatientRequest()) {
9875 // only allow access to data of binded patient
9876 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9877 } else {
9878 RestConfig::authorization_check("patients", "med");
9879 $return = (new FhirImmunizationRestController())->getOne($uuid);
9881 RestConfig::apiLog($return);
9882 return $return;
9886 * @OA\Get(
9887 * path="/fhir/Location",
9888 * description="Returns a list of Location resources.",
9889 * tags={"fhir"},
9890 * @OA\Parameter(
9891 * name="_id",
9892 * in="query",
9893 * description="The uuid for the Location resource.",
9894 * required=false,
9895 * @OA\Schema(
9896 * type="string"
9898 * ),
9899 * @OA\Response(
9900 * response="200",
9901 * description="Standard Response",
9902 * @OA\MediaType(
9903 * mediaType="application/json",
9904 * @OA\Schema(
9905 * @OA\Property(
9906 * property="json object",
9907 * description="FHIR Json object.",
9908 * type="object"
9909 * ),
9910 * example={
9911 * "meta": {
9912 * "lastUpdated": "2021-09-14T09:13:51"
9913 * },
9914 * "resourceType": "Bundle",
9915 * "type": "collection",
9916 * "total": 0,
9917 * "link": {
9919 * "relation": "self",
9920 * "url": "https://localhost:9300/apis/default/fhir/Location"
9926 * ),
9927 * @OA\Response(
9928 * response="400",
9929 * ref="#/components/responses/badrequest"
9930 * ),
9931 * @OA\Response(
9932 * response="401",
9933 * ref="#/components/responses/unauthorized"
9934 * ),
9935 * security={{"openemr_auth":{}}}
9938 "GET /fhir/Location" => function (HttpRestRequest $request) {
9939 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9940 RestConfig::apiLog($return);
9941 return $return;
9945 * @OA\Get(
9946 * path="/fhir/Location/{uuid}",
9947 * description="Returns a single Location resource.",
9948 * tags={"fhir"},
9949 * @OA\Parameter(
9950 * name="uuid",
9951 * in="path",
9952 * description="The uuid for the Location resource.",
9953 * required=true,
9954 * @OA\Schema(
9955 * type="string"
9957 * ),
9958 * @OA\Response(
9959 * response="200",
9960 * description="Standard Response",
9961 * @OA\MediaType(
9962 * mediaType="application/json",
9963 * @OA\Schema(
9964 * @OA\Property(
9965 * property="json object",
9966 * description="FHIR Json object.",
9967 * type="object"
9968 * ),
9969 * example={
9970 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9971 * "meta": {
9972 * "versionId": "1",
9973 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9974 * },
9975 * "resourceType": "Location",
9976 * "status": "active",
9977 * "name": "Your Clinic Name Here",
9978 * "telecom": {
9980 * "system": "phone",
9981 * "value": "000-000-0000"
9982 * },
9984 * "system": "fax",
9985 * "value": "000-000-0000"
9991 * ),
9992 * @OA\Response(
9993 * response="400",
9994 * ref="#/components/responses/badrequest"
9995 * ),
9996 * @OA\Response(
9997 * response="401",
9998 * ref="#/components/responses/unauthorized"
9999 * ),
10000 * @OA\Response(
10001 * response="404",
10002 * ref="#/components/responses/uuidnotfound"
10003 * ),
10004 * security={{"openemr_auth":{}}}
10007 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
10008 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10009 RestConfig::apiLog($return);
10010 return $return;
10014 * @OA\Get(
10015 * path="/fhir/Medication",
10016 * description="Returns a list of Medication resources.",
10017 * tags={"fhir"},
10018 * @OA\Response(
10019 * response="200",
10020 * description="Standard Response",
10021 * @OA\MediaType(
10022 * mediaType="application/json",
10023 * @OA\Schema(
10024 * @OA\Property(
10025 * property="json object",
10026 * description="FHIR Json object.",
10027 * type="object"
10028 * ),
10029 * example={
10030 * "meta": {
10031 * "lastUpdated": "2021-09-14T09:13:51"
10032 * },
10033 * "resourceType": "Bundle",
10034 * "type": "collection",
10035 * "total": 0,
10036 * "link": {
10038 * "relation": "self",
10039 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10045 * ),
10046 * @OA\Response(
10047 * response="400",
10048 * ref="#/components/responses/badrequest"
10049 * ),
10050 * @OA\Response(
10051 * response="401",
10052 * ref="#/components/responses/unauthorized"
10053 * ),
10054 * security={{"openemr_auth":{}}}
10057 "GET /fhir/Medication" => function (HttpRestRequest $request) {
10058 RestConfig::authorization_check("patients", "med");
10059 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10060 RestConfig::apiLog($return);
10061 return $return;
10065 * @OA\Get(
10066 * path="/fhir/Medication/{uuid}",
10067 * description="Returns a single Medication resource.",
10068 * tags={"fhir"},
10069 * @OA\Parameter(
10070 * name="uuid",
10071 * in="path",
10072 * description="The uuid for the Medication resource.",
10073 * required=true,
10074 * @OA\Schema(
10075 * type="string"
10077 * ),
10078 * @OA\Response(
10079 * response="200",
10080 * description="Standard Response",
10081 * @OA\MediaType(
10082 * mediaType="application/json",
10083 * @OA\Schema(
10084 * @OA\Property(
10085 * property="json object",
10086 * description="FHIR Json object.",
10087 * type="object"
10088 * ),
10089 * example={
10090 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10091 * "meta": {
10092 * "versionId": "1",
10093 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10094 * },
10095 * "resourceType": "Medication",
10096 * "code": {
10097 * "coding": {
10099 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10100 * "code": 153165
10103 * },
10104 * "status": "active",
10105 * "batch": {
10106 * "lotNumber": "132",
10107 * "expirationDate": "0000-00-00"
10112 * ),
10113 * @OA\Response(
10114 * response="400",
10115 * ref="#/components/responses/badrequest"
10116 * ),
10117 * @OA\Response(
10118 * response="401",
10119 * ref="#/components/responses/unauthorized"
10120 * ),
10121 * @OA\Response(
10122 * response="404",
10123 * ref="#/components/responses/uuidnotfound"
10124 * ),
10125 * security={{"openemr_auth":{}}}
10128 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
10129 if ($request->isPatientRequest()) {
10130 // only allow access to data of binded patient
10131 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10132 } else {
10133 RestConfig::authorization_check("patients", "med");
10134 $return = (new FhirMedicationRestController())->getOne($uuid);
10136 RestConfig::apiLog($return);
10137 return $return;
10141 * @OA\Get(
10142 * path="/fhir/MedicationRequest",
10143 * description="Returns a list of MedicationRequest resources.",
10144 * tags={"fhir"},
10145 * @OA\Parameter(
10146 * name="_id",
10147 * in="query",
10148 * description="The uuid for the MedicationRequest resource.",
10149 * required=false,
10150 * @OA\Schema(
10151 * type="string"
10153 * ),
10154 * @OA\Parameter(
10155 * name="patient",
10156 * in="query",
10157 * description="The uuid for the patient.",
10158 * required=false,
10159 * @OA\Schema(
10160 * type="string"
10162 * ),
10163 * @OA\Parameter(
10164 * name="intent",
10165 * in="query",
10166 * description="The intent of the MedicationRequest resource.",
10167 * required=false,
10168 * @OA\Schema(
10169 * type="string"
10171 * ),
10172 * @OA\Parameter(
10173 * name="status",
10174 * in="query",
10175 * description="The status of the MedicationRequest resource.",
10176 * required=false,
10177 * @OA\Schema(
10178 * type="string"
10180 * ),
10181 * @OA\Response(
10182 * response="200",
10183 * description="Standard Response",
10184 * @OA\MediaType(
10185 * mediaType="application/json",
10186 * @OA\Schema(
10187 * @OA\Property(
10188 * property="json object",
10189 * description="FHIR Json object.",
10190 * type="object"
10191 * ),
10192 * example={
10193 * "meta": {
10194 * "lastUpdated": "2021-09-14T09:13:51"
10195 * },
10196 * "resourceType": "Bundle",
10197 * "type": "collection",
10198 * "total": 0,
10199 * "link": {
10201 * "relation": "self",
10202 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10208 * ),
10209 * @OA\Response(
10210 * response="400",
10211 * ref="#/components/responses/badrequest"
10212 * ),
10213 * @OA\Response(
10214 * response="401",
10215 * ref="#/components/responses/unauthorized"
10216 * ),
10217 * security={{"openemr_auth":{}}}
10220 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
10221 $getParams = $request->getQueryParams();
10222 if ($request->isPatientRequest()) {
10223 // only allow access to data of binded patient
10224 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10225 } else {
10226 RestConfig::authorization_check("patients", "med");
10227 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10229 RestConfig::apiLog($return);
10230 return $return;
10234 * @OA\Get(
10235 * path="/fhir/MedicationRequest/{uuid}",
10236 * description="Returns a single MedicationRequest resource.",
10237 * tags={"fhir"},
10238 * @OA\Parameter(
10239 * name="uuid",
10240 * in="path",
10241 * description="The uuid for the MedicationRequest resource.",
10242 * required=true,
10243 * @OA\Schema(
10244 * type="string"
10246 * ),
10247 * @OA\Response(
10248 * response="200",
10249 * description="Standard Response",
10250 * @OA\MediaType(
10251 * mediaType="application/json",
10252 * @OA\Schema(
10253 * @OA\Property(
10254 * property="json object",
10255 * description="FHIR Json object.",
10256 * type="object"
10257 * ),
10258 * example={
10259 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10260 * "meta": {
10261 * "versionId": "1",
10262 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10263 * },
10264 * "resourceType": "MedicationRequest",
10265 * "status": "active",
10266 * "intent": "order",
10267 * "category": {
10269 * "coding": {
10271 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10272 * "code": "community",
10273 * "display": "Home/Community"
10277 * },
10278 * "reportedBoolean": false,
10279 * "medicationCodeableConcept": {
10280 * "coding": {
10282 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10283 * "code": "1738139",
10284 * "display": "Acetaminophen 325 MG Oral Tablet"
10287 * },
10288 * "subject": {
10289 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10290 * "type": "Patient"
10291 * },
10292 * "authoredOn": "2021-09-18T00:00:00+00:00",
10293 * "requester": {
10294 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10295 * "type": "Practitioner"
10300 * ),
10301 * @OA\Response(
10302 * response="400",
10303 * ref="#/components/responses/badrequest"
10304 * ),
10305 * @OA\Response(
10306 * response="401",
10307 * ref="#/components/responses/unauthorized"
10308 * ),
10309 * @OA\Response(
10310 * response="404",
10311 * ref="#/components/responses/uuidnotfound"
10312 * ),
10313 * security={{"openemr_auth":{}}}
10316 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
10317 if ($request->isPatientRequest()) {
10318 // only allow access to data of binded patient
10319 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10320 } else {
10321 RestConfig::authorization_check("patients", "med");
10322 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10324 RestConfig::apiLog($return);
10325 return $return;
10329 * @OA\Get(
10330 * path="/fhir/Observation",
10331 * description="Returns a list of Observation resources.",
10332 * tags={"fhir"},
10333 * @OA\Parameter(
10334 * name="_id",
10335 * in="query",
10336 * description="The uuid for the Observation resource.",
10337 * required=false,
10338 * @OA\Schema(
10339 * type="string"
10341 * ),
10342 * @OA\Parameter(
10343 * name="patient",
10344 * in="query",
10345 * description="The uuid for the patient.",
10346 * required=false,
10347 * @OA\Schema(
10348 * type="string"
10350 * ),
10351 * @OA\Parameter(
10352 * name="code",
10353 * in="query",
10354 * description="The code of the Observation resource.",
10355 * required=false,
10356 * @OA\Schema(
10357 * type="string"
10359 * ),
10360 * @OA\Parameter(
10361 * name="category",
10362 * in="query",
10363 * description="The category of the Observation resource.",
10364 * required=false,
10365 * @OA\Schema(
10366 * type="string"
10368 * ),
10369 * @OA\Parameter(
10370 * name="date",
10371 * in="query",
10372 * description="The datetime of the Observation resource.",
10373 * required=false,
10374 * @OA\Schema(
10375 * type="string"
10377 * ),
10378 * @OA\Response(
10379 * response="200",
10380 * description="Standard Response",
10381 * @OA\MediaType(
10382 * mediaType="application/json",
10383 * @OA\Schema(
10384 * @OA\Property(
10385 * property="json object",
10386 * description="FHIR Json object.",
10387 * type="object"
10388 * ),
10389 * example={
10390 * "meta": {
10391 * "lastUpdated": "2021-09-14T09:13:51"
10392 * },
10393 * "resourceType": "Bundle",
10394 * "type": "collection",
10395 * "total": 0,
10396 * "link": {
10398 * "relation": "self",
10399 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10405 * ),
10406 * @OA\Response(
10407 * response="400",
10408 * ref="#/components/responses/badrequest"
10409 * ),
10410 * @OA\Response(
10411 * response="401",
10412 * ref="#/components/responses/unauthorized"
10413 * ),
10414 * security={{"openemr_auth":{}}}
10417 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10418 $getParams = $request->getQueryParams();
10419 if ($request->isPatientRequest()) {
10420 // only allow access to data of binded patient
10421 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10422 } else {
10423 RestConfig::authorization_check("patients", "med");
10424 $return = (new FhirObservationRestController())->getAll($getParams);
10426 RestConfig::apiLog($return);
10427 return $return;
10431 * @OA\Get(
10432 * path="/fhir/Observation/{uuid}",
10433 * description="Returns a single Observation resource.",
10434 * tags={"fhir"},
10435 * @OA\Parameter(
10436 * name="uuid",
10437 * in="path",
10438 * description="The uuid for the Observation resource.",
10439 * required=true,
10440 * @OA\Schema(
10441 * type="string"
10443 * ),
10444 * @OA\Response(
10445 * response="200",
10446 * description="Standard Response",
10447 * @OA\MediaType(
10448 * mediaType="application/json",
10449 * @OA\Schema(
10450 * @OA\Property(
10451 * property="json object",
10452 * description="FHIR Json object.",
10453 * type="object"
10454 * ),
10455 * example={
10456 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10457 * "meta": {
10458 * "versionId": "1",
10459 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10460 * },
10461 * "resourceType": "Observation",
10462 * "status": "final",
10463 * "category": {
10465 * "coding": {
10467 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10468 * "code": "vital-signs"
10472 * },
10473 * "code": {
10474 * "coding": {
10476 * "system": "http://loinc.org",
10477 * "code": "85354-9",
10478 * "display": "Blood pressure systolic and diastolic"
10481 * },
10482 * "subject": {
10483 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10484 * "type": "Patient"
10485 * },
10486 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10487 * "component": {
10489 * "code": {
10490 * "coding": {
10492 * "system": "http://loinc.org",
10493 * "code": "8480-6",
10494 * "display": "Systolic blood pressure"
10497 * },
10498 * "valueQuantity": {
10499 * "value": 122,
10500 * "unit": "mm[Hg]",
10501 * "system": "http://unitsofmeasure.org",
10502 * "code": "mm[Hg]"
10504 * },
10506 * "code": {
10507 * "coding": {
10509 * "system": "http://loinc.org",
10510 * "code": "8462-4",
10511 * "display": "Diastolic blood pressure"
10514 * },
10515 * "valueQuantity": {
10516 * "value": 77,
10517 * "unit": "mm[Hg]",
10518 * "system": "http://unitsofmeasure.org",
10519 * "code": "mm[Hg]"
10526 * ),
10527 * @OA\Response(
10528 * response="400",
10529 * ref="#/components/responses/badrequest"
10530 * ),
10531 * @OA\Response(
10532 * response="401",
10533 * ref="#/components/responses/unauthorized"
10534 * ),
10535 * @OA\Response(
10536 * response="404",
10537 * ref="#/components/responses/uuidnotfound"
10538 * ),
10539 * security={{"openemr_auth":{}}}
10542 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10543 if ($request->isPatientRequest()) {
10544 // only allow access to data of binded patient
10545 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10546 } else {
10547 RestConfig::authorization_check("patients", "med");
10548 $return = (new FhirObservationRestController())->getOne($uuid);
10550 RestConfig::apiLog($return);
10551 return $return;
10555 * @OA\Get(
10556 * path="/fhir/Organization",
10557 * description="Returns a list of Organization resources.",
10558 * tags={"fhir"},
10559 * @OA\Parameter(
10560 * name="_id",
10561 * in="query",
10562 * description="The uuid for the Organization resource.",
10563 * required=false,
10564 * @OA\Schema(
10565 * type="string"
10567 * ),
10568 * @OA\Parameter(
10569 * name="name",
10570 * in="query",
10571 * description="The name of the Organization resource.",
10572 * required=false,
10573 * @OA\Schema(
10574 * type="string"
10576 * ),
10577 * @OA\Parameter(
10578 * name="email",
10579 * in="query",
10580 * description="The email of the Organization resource.",
10581 * required=false,
10582 * @OA\Schema(
10583 * type="string"
10585 * ),
10586 * @OA\Parameter(
10587 * name="phone",
10588 * in="query",
10589 * description="The phone of the Organization resource.",
10590 * required=false,
10591 * @OA\Schema(
10592 * type="string"
10594 * ),
10595 * @OA\Parameter(
10596 * name="telecom",
10597 * in="query",
10598 * description="The telecom of the Organization resource.",
10599 * required=false,
10600 * @OA\Schema(
10601 * type="string"
10603 * ),
10604 * @OA\Parameter(
10605 * name="address",
10606 * in="query",
10607 * description="The address of the Organization resource.",
10608 * required=false,
10609 * @OA\Schema(
10610 * type="string"
10612 * ),
10613 * @OA\Parameter(
10614 * name="address-city",
10615 * in="query",
10616 * description="The address-city of the Organization resource.",
10617 * required=false,
10618 * @OA\Schema(
10619 * type="string"
10621 * ),
10622 * @OA\Parameter(
10623 * name="address-postalcode",
10624 * in="query",
10625 * description="The address-postalcode of the Organization resource.",
10626 * required=false,
10627 * @OA\Schema(
10628 * type="string"
10630 * ),
10631 * @OA\Parameter(
10632 * name="address-state",
10633 * in="query",
10634 * description="The address-state of the Organization resource.",
10635 * required=false,
10636 * @OA\Schema(
10637 * type="string"
10639 * ),
10640 * @OA\Response(
10641 * response="200",
10642 * description="Standard Response",
10643 * @OA\MediaType(
10644 * mediaType="application/json",
10645 * @OA\Schema(
10646 * @OA\Property(
10647 * property="json object",
10648 * description="FHIR Json object.",
10649 * type="object"
10650 * ),
10651 * example={
10652 * "meta": {
10653 * "lastUpdated": "2021-09-14T09:13:51"
10654 * },
10655 * "resourceType": "Bundle",
10656 * "type": "collection",
10657 * "total": 0,
10658 * "link": {
10660 * "relation": "self",
10661 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10667 * ),
10668 * @OA\Response(
10669 * response="400",
10670 * ref="#/components/responses/badrequest"
10671 * ),
10672 * @OA\Response(
10673 * response="401",
10674 * ref="#/components/responses/unauthorized"
10675 * ),
10676 * security={{"openemr_auth":{}}}
10679 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10680 if (!$request->isPatientRequest()) {
10681 RestConfig::authorization_check("admin", "users");
10683 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10684 RestConfig::apiLog($return);
10685 return $return;
10689 * @OA\Get(
10690 * path="/fhir/Organization/{uuid}",
10691 * description="Returns a single Organization resource.",
10692 * tags={"fhir"},
10693 * @OA\Parameter(
10694 * name="uuid",
10695 * in="path",
10696 * description="The uuid for the Organization resource.",
10697 * required=true,
10698 * @OA\Schema(
10699 * type="string"
10701 * ),
10702 * @OA\Response(
10703 * response="200",
10704 * description="Standard Response",
10705 * @OA\MediaType(
10706 * mediaType="application/json",
10707 * @OA\Schema(
10708 * @OA\Property(
10709 * property="json object",
10710 * description="FHIR Json object.",
10711 * type="object"
10712 * ),
10713 * example={
10714 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10715 * "meta": {
10716 * "versionId": "1",
10717 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10718 * },
10719 * "resourceType": "Organization",
10720 * "text": {
10721 * "status": "generated",
10722 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10723 * },
10724 * "identifier": {
10726 * "system": "http://hl7.org/fhir/sid/us-npi",
10727 * "value": "1234567890"
10729 * },
10730 * "active": true,
10731 * "type": {
10733 * "coding": {
10735 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10736 * "code": "prov",
10737 * "display": "Healthcare Provider"
10741 * },
10742 * "name": "Your Clinic Name Here",
10743 * "telecom": {
10745 * "system": "phone",
10746 * "value": "000-000-0000",
10747 * "use": "work"
10748 * },
10750 * "system": "fax",
10751 * "value": "000-000-0000",
10752 * "use": "work"
10754 * },
10755 * "address": {
10756 * null
10761 * ),
10762 * @OA\Response(
10763 * response="400",
10764 * ref="#/components/responses/badrequest"
10765 * ),
10766 * @OA\Response(
10767 * response="401",
10768 * ref="#/components/responses/unauthorized"
10769 * ),
10770 * @OA\Response(
10771 * response="404",
10772 * ref="#/components/responses/uuidnotfound"
10773 * ),
10774 * security={{"openemr_auth":{}}}
10777 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10778 $patientUUID = null;
10779 if (!$request->isPatientRequest()) {
10780 RestConfig::authorization_check("admin", "users");
10781 } else {
10782 $patientUUID = $request->getPatientUUIDString();
10784 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10786 RestConfig::apiLog($return);
10787 return $return;
10791 * @OA\Post(
10792 * path="/fhir/Organization",
10793 * description="Adds a Organization resource.",
10794 * tags={"fhir"},
10795 * @OA\RequestBody(
10796 * required=true,
10797 * @OA\MediaType(
10798 * mediaType="application/json",
10799 * @OA\Schema(
10800 * description="The json object for the Organization resource.",
10801 * type="object"
10802 * ),
10803 * example={
10804 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10805 * "meta": {
10806 * "versionId": "1",
10807 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10808 * },
10809 * "resourceType": "Organization",
10810 * "text": {
10811 * "status": "generated",
10812 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10813 * },
10814 * "identifier": {
10816 * "system": "http://hl7.org/fhir/sid/us-npi",
10817 * "value": "1234567890"
10819 * },
10820 * "active": true,
10821 * "type": {
10823 * "coding": {
10825 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10826 * "code": "prov",
10827 * "display": "Healthcare Provider"
10831 * },
10832 * "name": "Your Clinic Name Here Hey",
10833 * "telecom": {
10835 * "system": "phone",
10836 * "value": "000-000-0000",
10837 * "use": "work"
10838 * },
10840 * "system": "fax",
10841 * "value": "000-000-0000",
10842 * "use": "work"
10844 * },
10845 * "address": {
10846 * null
10850 * ),
10851 * @OA\Response(
10852 * response="200",
10853 * description="Standard Response",
10854 * @OA\MediaType(
10855 * mediaType="application/json",
10856 * @OA\Schema(
10857 * @OA\Property(
10858 * property="json object",
10859 * description="FHIR Json object.",
10860 * type="object"
10861 * ),
10862 * example={
10863 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10864 * "meta": {
10865 * "versionId": "1",
10866 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10867 * },
10868 * "resourceType": "Organization",
10869 * "text": {
10870 * "status": "generated",
10871 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10872 * },
10873 * "identifier": {
10875 * "system": "http://hl7.org/fhir/sid/us-npi",
10876 * "value": "1234567890"
10878 * },
10879 * "active": true,
10880 * "type": {
10882 * "coding": {
10884 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10885 * "code": "prov",
10886 * "display": "Healthcare Provider"
10890 * },
10891 * "name": "Your Clinic Name Here Now",
10892 * "telecom": {
10894 * "system": "phone",
10895 * "value": "000-000-0000",
10896 * "use": "work"
10897 * },
10899 * "system": "fax",
10900 * "value": "000-000-0000",
10901 * "use": "work"
10903 * },
10904 * "address": {
10905 * null
10910 * ),
10911 * @OA\Response(
10912 * response="400",
10913 * ref="#/components/responses/badrequest"
10914 * ),
10915 * @OA\Response(
10916 * response="401",
10917 * ref="#/components/responses/unauthorized"
10918 * ),
10919 * security={{"openemr_auth":{}}}
10922 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10923 RestConfig::authorization_check("admin", "super");
10924 $data = (array) (json_decode(file_get_contents("php://input"), true));
10925 $return = (new FhirOrganizationRestController())->post($data);
10926 RestConfig::apiLog($return, $data);
10927 return $return;
10931 * @OA\Put(
10932 * path="/fhir/Organization/{uuid}",
10933 * description="Modifies a Organization resource.",
10934 * tags={"fhir"},
10935 * @OA\Parameter(
10936 * name="uuid",
10937 * in="path",
10938 * description="The uuid for the organization.",
10939 * required=true,
10940 * @OA\Schema(
10941 * type="string"
10943 * ),
10944 * @OA\RequestBody(
10945 * required=true,
10946 * @OA\MediaType(
10947 * mediaType="application/json",
10948 * @OA\Schema(
10949 * description="The json object for the Organization resource.",
10950 * type="object"
10951 * ),
10952 * example={
10953 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10954 * "meta": {
10955 * "versionId": "1",
10956 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10957 * },
10958 * "resourceType": "Organization",
10959 * "text": {
10960 * "status": "generated",
10961 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10962 * },
10963 * "identifier": {
10965 * "system": "http://hl7.org/fhir/sid/us-npi",
10966 * "value": "1234567890"
10968 * },
10969 * "active": true,
10970 * "type": {
10972 * "coding": {
10974 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10975 * "code": "prov",
10976 * "display": "Healthcare Provider"
10980 * },
10981 * "name": "Your Clinic Name Here",
10982 * "telecom": {
10984 * "system": "phone",
10985 * "value": "000-000-0000",
10986 * "use": "work"
10987 * },
10989 * "system": "fax",
10990 * "value": "000-000-0000",
10991 * "use": "work"
10993 * },
10994 * "address": {
10995 * null
10999 * ),
11000 * @OA\Response(
11001 * response="201",
11002 * description="Standard Response",
11003 * @OA\MediaType(
11004 * mediaType="application/json",
11005 * @OA\Schema(
11006 * example={
11007 * "id": 14,
11008 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11012 * ),
11013 * @OA\Response(
11014 * response="400",
11015 * ref="#/components/responses/badrequest"
11016 * ),
11017 * @OA\Response(
11018 * response="401",
11019 * ref="#/components/responses/unauthorized"
11020 * ),
11021 * security={{"openemr_auth":{}}}
11024 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
11025 RestConfig::authorization_check("admin", "super");
11026 $data = (array) (json_decode(file_get_contents("php://input"), true));
11027 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11028 RestConfig::apiLog($return, $data);
11029 return $return;
11033 * @OA\Post(
11034 * path="/fhir/Patient",
11035 * description="Adds a Patient resource.",
11036 * tags={"fhir"},
11037 * @OA\RequestBody(
11038 * required=true,
11039 * @OA\MediaType(
11040 * mediaType="application/json",
11041 * @OA\Schema(
11042 * description="The json object for the Patient resource.",
11043 * type="object"
11044 * ),
11045 * example={
11046 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11047 * "meta": {
11048 * "versionId": "1",
11049 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11050 * },
11051 * "resourceType": "Patient",
11052 * "text": {
11053 * "status": "generated",
11054 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11055 * },
11056 * "extension": {
11058 * "valueCode": "F",
11059 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11060 * },
11062 * "extension": {
11064 * "valueCoding": {
11065 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11066 * "code": "UNK",
11067 * "display": "Unknown"
11068 * },
11069 * "url": "ombCategory"
11070 * },
11072 * "valueString": "Unknown",
11073 * "url": "text"
11075 * },
11076 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11078 * },
11079 * "identifier": {
11081 * "use": "official",
11082 * "type": {
11083 * "coding": {
11085 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11086 * "code": "PT"
11089 * },
11090 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11091 * "value": "1"
11093 * },
11094 * "active": true,
11095 * "name": {
11097 * "use": "official",
11098 * "family": "Smith",
11099 * "given": {
11100 * "Brenda"
11103 * },
11104 * "gender": "female",
11105 * "birthDate": "2017-03-10",
11106 * "communication": {
11108 * "language": {
11109 * "coding": {
11111 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11112 * "code": "unknown",
11113 * "display": "Unknown"
11121 * ),
11122 * @OA\Response(
11123 * response="200",
11124 * description="Standard Response",
11125 * @OA\MediaType(
11126 * mediaType="application/json",
11127 * @OA\Schema(
11128 * @OA\Property(
11129 * property="json object",
11130 * description="FHIR Json object.",
11131 * type="object"
11132 * ),
11133 * example={
11134 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11135 * "meta": {
11136 * "versionId": "1",
11137 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11138 * },
11139 * "resourceType": "Patient",
11140 * "text": {
11141 * "status": "generated",
11142 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11143 * },
11144 * "extension": {
11146 * "valueCode": "F",
11147 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11148 * },
11150 * "extension": {
11152 * "valueCoding": {
11153 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11154 * "code": "UNK",
11155 * "display": "Unknown"
11156 * },
11157 * "url": "ombCategory"
11158 * },
11160 * "valueString": "Unknown",
11161 * "url": "text"
11163 * },
11164 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11166 * },
11167 * "identifier": {
11169 * "use": "official",
11170 * "type": {
11171 * "coding": {
11173 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11174 * "code": "PT"
11177 * },
11178 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11179 * "value": "1"
11181 * },
11182 * "active": true,
11183 * "name": {
11185 * "use": "official",
11186 * "family": "Smith",
11187 * "given": {
11188 * "Brenda"
11191 * },
11192 * "gender": "female",
11193 * "birthDate": "2017-03-10",
11194 * "communication": {
11196 * "language": {
11197 * "coding": {
11199 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11200 * "code": "unknown",
11201 * "display": "Unknown"
11210 * ),
11211 * @OA\Response(
11212 * response="400",
11213 * ref="#/components/responses/badrequest"
11214 * ),
11215 * @OA\Response(
11216 * response="401",
11217 * ref="#/components/responses/unauthorized"
11218 * ),
11219 * security={{"openemr_auth":{}}}
11222 "POST /fhir/Patient" => function (HttpRestRequest $request) {
11223 RestConfig::authorization_check("patients", "demo");
11224 $data = (array) (json_decode(file_get_contents("php://input"), true));
11225 $return = (new FhirPatientRestController())->post($data);
11226 RestConfig::apiLog($return, $data);
11227 return $return;
11231 * @OA\Put(
11232 * path="/fhir/Patient/{uuid}",
11233 * description="Modifies a Patient resource.",
11234 * tags={"fhir"},
11235 * @OA\Parameter(
11236 * name="uuid",
11237 * in="path",
11238 * description="The uuid for the Patient resource.",
11239 * required=true,
11240 * @OA\Schema(
11241 * type="string"
11243 * ),
11244 * @OA\RequestBody(
11245 * required=true,
11246 * @OA\MediaType(
11247 * mediaType="application/json",
11248 * @OA\Schema(
11249 * description="The json object for the Patient resource.",
11250 * type="object"
11251 * ),
11252 * example={
11253 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11254 * "meta": {
11255 * "versionId": "1",
11256 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11257 * },
11258 * "resourceType": "Patient",
11259 * "text": {
11260 * "status": "generated",
11261 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11262 * },
11263 * "extension": {
11265 * "valueCode": "F",
11266 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11267 * },
11269 * "extension": {
11271 * "valueCoding": {
11272 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11273 * "code": "UNK",
11274 * "display": "Unknown"
11275 * },
11276 * "url": "ombCategory"
11277 * },
11279 * "valueString": "Unknown",
11280 * "url": "text"
11282 * },
11283 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11285 * },
11286 * "identifier": {
11288 * "use": "official",
11289 * "type": {
11290 * "coding": {
11292 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11293 * "code": "PT"
11296 * },
11297 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11298 * "value": "1"
11300 * },
11301 * "active": true,
11302 * "name": {
11304 * "use": "official",
11305 * "family": "Smith",
11306 * "given": {
11307 * "Brenda"
11310 * },
11311 * "gender": "female",
11312 * "birthDate": "2017-03-10",
11313 * "communication": {
11315 * "language": {
11316 * "coding": {
11318 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11319 * "code": "unknown",
11320 * "display": "Unknown"
11328 * ),
11329 * @OA\Response(
11330 * response="201",
11331 * description="Standard Response",
11332 * @OA\MediaType(
11333 * mediaType="application/json",
11334 * @OA\Schema(
11335 * example={
11336 * "id": 2,
11337 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11341 * ),
11342 * @OA\Response(
11343 * response="400",
11344 * ref="#/components/responses/badrequest"
11345 * ),
11346 * @OA\Response(
11347 * response="401",
11348 * ref="#/components/responses/unauthorized"
11349 * ),
11350 * security={{"openemr_auth":{}}}
11353 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11354 RestConfig::authorization_check("patients", "demo");
11355 $data = (array) (json_decode(file_get_contents("php://input"), true));
11356 $return = (new FhirPatientRestController())->put($uuid, $data);
11357 RestConfig::apiLog($return, $data);
11358 return $return;
11362 * @OA\Get(
11363 * path="/fhir/Patient",
11364 * description="Returns a list of Patient resources.",
11365 * tags={"fhir"},
11366 * @OA\Parameter(
11367 * name="_id",
11368 * in="query",
11369 * description="The uuid for the Patient resource.",
11370 * required=false,
11371 * @OA\Schema(
11372 * type="string"
11374 * ),
11375 * @OA\Parameter(
11376 * name="identifier",
11377 * in="query",
11378 * description="The identifier of the Patient resource.",
11379 * required=false,
11380 * @OA\Schema(
11381 * type="string"
11383 * ),
11384 * @OA\Parameter(
11385 * name="name",
11386 * in="query",
11387 * description="The name of the Patient resource.",
11388 * required=false,
11389 * @OA\Schema(
11390 * type="string"
11392 * ),
11393 * @OA\Parameter(
11394 * name="birthdate",
11395 * in="query",
11396 * description="The birthdate of the Patient resource.",
11397 * required=false,
11398 * @OA\Schema(
11399 * type="string"
11401 * ),
11402 * @OA\Parameter(
11403 * name="gender",
11404 * in="query",
11405 * description="The gender of the Patient resource.",
11406 * required=false,
11407 * @OA\Schema(
11408 * type="string"
11410 * ),
11411 * @OA\Parameter(
11412 * name="address",
11413 * in="query",
11414 * description="The address of the Patient resource.",
11415 * required=false,
11416 * @OA\Schema(
11417 * type="string"
11419 * ),
11420 * @OA\Parameter(
11421 * name="address-city",
11422 * in="query",
11423 * description="The address-city of the Patient resource.",
11424 * required=false,
11425 * @OA\Schema(
11426 * type="string"
11428 * ),
11429 * @OA\Parameter(
11430 * name="address-postalcode",
11431 * in="query",
11432 * description="The address-postalcode of the Patient resource.",
11433 * required=false,
11434 * @OA\Schema(
11435 * type="string"
11437 * ),
11438 * @OA\Parameter(
11439 * name="address-state",
11440 * in="query",
11441 * description="The address-state of the Patient resource.",
11442 * required=false,
11443 * @OA\Schema(
11444 * type="string"
11446 * ),
11447 * @OA\Parameter(
11448 * name="email",
11449 * in="query",
11450 * description="The email of the Patient resource.",
11451 * required=false,
11452 * @OA\Schema(
11453 * type="string"
11455 * ),
11456 * @OA\Parameter(
11457 * name="family",
11458 * in="query",
11459 * description="The family name of the Patient resource.",
11460 * required=false,
11461 * @OA\Schema(
11462 * type="string"
11464 * ),
11465 * @OA\Parameter(
11466 * name="given",
11467 * in="query",
11468 * description="The given name of the Patient resource.",
11469 * required=false,
11470 * @OA\Schema(
11471 * type="string"
11473 * ),
11474 * @OA\Parameter(
11475 * name="phone",
11476 * in="query",
11477 * description="The phone number of the Patient resource.",
11478 * required=false,
11479 * @OA\Schema(
11480 * type="string"
11482 * ),
11483 * @OA\Parameter(
11484 * name="telecom",
11485 * in="query",
11486 * description="The fax number of the Patient resource.",
11487 * required=false,
11488 * @OA\Schema(
11489 * type="string"
11491 * ),
11492 * @OA\Parameter(
11493 * ref="#/components/parameters/_lastUpdated"
11494 * ),
11495 * @OA\Response(
11496 * response="200",
11497 * description="Standard Response",
11498 * @OA\MediaType(
11499 * mediaType="application/json",
11500 * @OA\Schema(
11501 * @OA\Property(
11502 * property="json object",
11503 * description="FHIR Json object.",
11504 * type="object"
11505 * ),
11506 * example={
11507 * "meta": {
11508 * "lastUpdated": "2021-09-14T09:13:51"
11509 * },
11510 * "resourceType": "Bundle",
11511 * "type": "collection",
11512 * "total": 0,
11513 * "link": {
11515 * "relation": "self",
11516 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11522 * ),
11523 * @OA\Response(
11524 * response="400",
11525 * ref="#/components/responses/badrequest"
11526 * ),
11527 * @OA\Response(
11528 * response="401",
11529 * ref="#/components/responses/unauthorized"
11530 * ),
11531 * security={{"openemr_auth":{}}}
11534 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11535 $params = $request->getQueryParams();
11536 if ($request->isPatientRequest()) {
11537 // only allow access to data of binded patient
11538 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11539 // need to use getAll rather than getOne)
11540 $params['_id'] = $request->getPatientUUIDString();
11541 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11542 } else {
11543 RestConfig::authorization_check("patients", "demo");
11544 $return = (new FhirPatientRestController())->getAll($params);
11546 RestConfig::apiLog($return);
11547 return $return;
11551 * @OA\Get(
11552 * path="/fhir/Patient/$export",
11553 * 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>",
11554 * tags={"fhir"},
11555 * @OA\Response(
11556 * response="200",
11557 * 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>"
11558 * ),
11559 * @OA\Response(
11560 * response="400",
11561 * ref="#/components/responses/badrequest"
11562 * ),
11563 * @OA\Response(
11564 * response="401",
11565 * ref="#/components/responses/unauthorized"
11566 * ),
11567 * security={{"openemr_auth":{}}}
11570 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11571 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11572 RestConfig::authorization_check("admin", "users");
11573 $fhirExportService = new FhirOperationExportRestController($request);
11574 $return = $fhirExportService->processExport(
11575 $request->getQueryParams(),
11576 'Patient',
11577 $request->getHeader('Accept')[0] ?? '',
11578 $request->getHeader('Prefer')[0] ?? ''
11580 RestConfig::apiLog($return);
11581 return $return;
11585 * @OA\Get(
11586 * path="/fhir/Patient/{uuid}",
11587 * description="Returns a single Patient resource.",
11588 * tags={"fhir"},
11589 * @OA\Parameter(
11590 * name="uuid",
11591 * in="path",
11592 * description="The uuid for the Patient resource.",
11593 * required=true,
11594 * @OA\Schema(
11595 * type="string"
11597 * ),
11598 * @OA\Response(
11599 * response="200",
11600 * description="Standard Response",
11601 * @OA\MediaType(
11602 * mediaType="application/json",
11603 * @OA\Schema(
11604 * @OA\Property(
11605 * property="json object",
11606 * description="FHIR Json object.",
11607 * type="object"
11608 * ),
11609 * example={
11610 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11611 * "meta": {
11612 * "versionId": "1",
11613 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11614 * },
11615 * "resourceType": "Patient",
11616 * "text": {
11617 * "status": "generated",
11618 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11619 * },
11620 * "extension": {
11622 * "valueCode": "F",
11623 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11624 * },
11626 * "extension": {
11628 * "valueCoding": {
11629 * "system": "urn:oid:2.16.840.1.113883.6.238",
11630 * "code": "1006-6",
11631 * "display": "Abenaki"
11632 * },
11633 * "url": "ombCategory"
11634 * },
11636 * "valueString": "Abenaki",
11637 * "url": "text"
11639 * },
11640 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11641 * },
11643 * "extension": {
11645 * "valueString": "Declined To Specify",
11646 * "url": "text"
11648 * },
11649 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11651 * },
11652 * "identifier": {
11654 * "use": "official",
11655 * "type": {
11656 * "coding": {
11658 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11659 * "code": "PT"
11662 * },
11663 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11664 * "value": "1"
11666 * },
11667 * "active": true,
11668 * "name": {
11670 * "use": "official",
11671 * "family": "Von197",
11672 * "given": {
11673 * "Aurore252"
11676 * },
11677 * "gender": "female",
11678 * "birthDate": "1970-07-03",
11679 * "address": {
11681 * "line": {
11682 * "245 Crona Wall"
11683 * },
11684 * "city": "Boston",
11685 * "state": "Massachusetts",
11686 * "postalCode": "02215",
11687 * "period": {
11688 * "start": "2020-09-21T17:08:03.532+00:00"
11691 * },
11692 * "communication": {
11694 * "language": {
11695 * "coding": {
11697 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11698 * "code": "unknown",
11699 * "display": "Unknown"
11708 * ),
11709 * @OA\Response(
11710 * response="400",
11711 * ref="#/components/responses/badrequest"
11712 * ),
11713 * @OA\Response(
11714 * response="401",
11715 * ref="#/components/responses/unauthorized"
11716 * ),
11717 * @OA\Response(
11718 * response="404",
11719 * ref="#/components/responses/uuidnotfound"
11720 * ),
11721 * security={{"openemr_auth":{}}}
11724 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11725 if ($request->isPatientRequest()) {
11726 // only allow access to data of binded patient
11727 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11728 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11730 $uuid = $request->getPatientUUIDString();
11731 } else {
11732 RestConfig::authorization_check("patients", "demo");
11734 $return = (new FhirPatientRestController())->getOne($uuid);
11735 RestConfig::apiLog($return);
11736 return $return;
11740 * @OA\Get(
11741 * path="/fhir/Person",
11742 * description="Returns a list of Person resources.",
11743 * tags={"fhir"},
11744 * @OA\Parameter(
11745 * name="name",
11746 * in="query",
11747 * description="The name of the Person resource.",
11748 * required=false,
11749 * @OA\Schema(
11750 * type="string"
11752 * ),
11753 * @OA\Parameter(
11754 * name="active",
11755 * in="query",
11756 * description="The active status of the Person resource.",
11757 * required=false,
11758 * @OA\Schema(
11759 * type="string"
11761 * ),
11762 * @OA\Parameter(
11763 * name="address",
11764 * in="query",
11765 * description="The address of the Person resource.",
11766 * required=false,
11767 * @OA\Schema(
11768 * type="string"
11770 * ),
11771 * @OA\Parameter(
11772 * name="address-city",
11773 * in="query",
11774 * description="The address-city of the Person resource.",
11775 * required=false,
11776 * @OA\Schema(
11777 * type="string"
11779 * ),
11780 * @OA\Parameter(
11781 * name="address-postalcode",
11782 * in="query",
11783 * description="The address-postalcode of the Person resource.",
11784 * required=false,
11785 * @OA\Schema(
11786 * type="string"
11788 * ),
11789 * @OA\Parameter(
11790 * name="address-state",
11791 * in="query",
11792 * description="The address-state of the Person resource.",
11793 * required=false,
11794 * @OA\Schema(
11795 * type="string"
11797 * ),
11798 * @OA\Parameter(
11799 * name="email",
11800 * in="query",
11801 * description="The email of the Person resource.",
11802 * required=false,
11803 * @OA\Schema(
11804 * type="string"
11806 * ),
11807 * @OA\Parameter(
11808 * name="family",
11809 * in="query",
11810 * description="The family name of the Person resource.",
11811 * required=false,
11812 * @OA\Schema(
11813 * type="string"
11815 * ),
11816 * @OA\Parameter(
11817 * name="given",
11818 * in="query",
11819 * description="The given name of the Person resource.",
11820 * required=false,
11821 * @OA\Schema(
11822 * type="string"
11824 * ),
11825 * @OA\Parameter(
11826 * name="phone",
11827 * in="query",
11828 * description="The phone number of the Person resource.",
11829 * required=false,
11830 * @OA\Schema(
11831 * type="string"
11833 * ),
11834 * @OA\Parameter(
11835 * name="telecom",
11836 * in="query",
11837 * description="The fax number of the Person resource.",
11838 * required=false,
11839 * @OA\Schema(
11840 * type="string"
11842 * ),
11843 * @OA\Response(
11844 * response="200",
11845 * description="Standard Response",
11846 * @OA\MediaType(
11847 * mediaType="application/json",
11848 * @OA\Schema(
11849 * @OA\Property(
11850 * property="json object",
11851 * description="FHIR Json object.",
11852 * type="object"
11853 * ),
11854 * example={
11855 * "meta": {
11856 * "lastUpdated": "2021-09-14T09:13:51"
11857 * },
11858 * "resourceType": "Bundle",
11859 * "type": "collection",
11860 * "total": 0,
11861 * "link": {
11863 * "relation": "self",
11864 * "url": "https://localhost:9300/apis/default/fhir/Person"
11870 * ),
11871 * @OA\Response(
11872 * response="400",
11873 * ref="#/components/responses/badrequest"
11874 * ),
11875 * @OA\Response(
11876 * response="401",
11877 * ref="#/components/responses/unauthorized"
11878 * ),
11879 * security={{"openemr_auth":{}}}
11882 "GET /fhir/Person" => function (HttpRestRequest $request) {
11883 RestConfig::authorization_check("admin", "users");
11884 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11885 RestConfig::apiLog($return);
11886 return $return;
11890 * @OA\Get(
11891 * path="/fhir/Person/{uuid}",
11892 * description="Returns a single Person resource.",
11893 * tags={"fhir"},
11894 * @OA\Parameter(
11895 * name="uuid",
11896 * in="path",
11897 * description="The uuid for the Person resource.",
11898 * required=true,
11899 * @OA\Schema(
11900 * type="string"
11902 * ),
11903 * @OA\Response(
11904 * response="200",
11905 * description="Standard Response",
11906 * @OA\MediaType(
11907 * mediaType="application/json",
11908 * @OA\Schema(
11909 * @OA\Property(
11910 * property="json object",
11911 * description="FHIR Json object.",
11912 * type="object"
11913 * ),
11914 * example={
11915 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11916 * "meta": {
11917 * "versionId": "1",
11918 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11919 * },
11920 * "resourceType": "Person",
11921 * "text": {
11922 * "status": "generated",
11923 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11924 * },
11925 * "name": {
11927 * "use": "official",
11928 * "family": "Administrator",
11929 * "given": {
11930 * "Administrator",
11931 * "Larry"
11934 * },
11935 * "telecom": {
11937 * "system": "phone",
11938 * "value": "1234567890",
11939 * "use": "home"
11940 * },
11942 * "system": "phone",
11943 * "value": "1234567890",
11944 * "use": "work"
11945 * },
11947 * "system": "phone",
11948 * "value": "1234567890",
11949 * "use": "mobile"
11950 * },
11952 * "system": "email",
11953 * "value": "hey@hey.com",
11954 * "use": "home"
11956 * },
11957 * "address": {
11959 * "line": {
11960 * "123 Lane Street"
11961 * },
11962 * "city": "Bellevue",
11963 * "state": "WA",
11964 * "period": {
11965 * "start": "2021-04-13T08:57:32.146+00:00"
11968 * },
11969 * "active": true
11973 * ),
11974 * @OA\Response(
11975 * response="400",
11976 * ref="#/components/responses/badrequest"
11977 * ),
11978 * @OA\Response(
11979 * response="401",
11980 * ref="#/components/responses/unauthorized"
11981 * ),
11982 * @OA\Response(
11983 * response="404",
11984 * ref="#/components/responses/uuidnotfound"
11985 * ),
11986 * security={{"openemr_auth":{}}}
11989 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11990 // if the api user is requesting their own user we need to let it through
11991 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11992 // for the currently logged in user
11993 if ($request->getRequestUserUUIDString() == $uuid) {
11994 $return = (new FhirPersonRestController())->getOne($uuid);
11995 } else if (!$request->isPatientRequest()) {
11996 // not a patient ,make sure we have access to the users ACL
11997 RestConfig::authorization_check("admin", "users");
11998 $return = (new FhirPersonRestController())->getOne($uuid);
11999 } else {
12000 // if we are a patient bound request we need to make sure we are only bound to the patient
12001 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
12004 RestConfig::apiLog($return);
12005 return $return;
12009 * @OA\Get(
12010 * path="/fhir/Practitioner",
12011 * description="Returns a list of Practitioner resources.",
12012 * tags={"fhir"},
12013 * @OA\Parameter(
12014 * name="_id",
12015 * in="query",
12016 * description="The uuid for the Practitioner resource.",
12017 * required=false,
12018 * @OA\Schema(
12019 * type="string"
12021 * ),
12022 * @OA\Parameter(
12023 * name="name",
12024 * in="query",
12025 * description="The name of the Practitioner resource.",
12026 * required=false,
12027 * @OA\Schema(
12028 * type="string"
12030 * ),
12031 * @OA\Parameter(
12032 * name="active",
12033 * in="query",
12034 * description="The active status of the Practitioner resource.",
12035 * required=false,
12036 * @OA\Schema(
12037 * type="string"
12039 * ),
12040 * @OA\Parameter(
12041 * name="address",
12042 * in="query",
12043 * description="The address of the Practitioner resource.",
12044 * required=false,
12045 * @OA\Schema(
12046 * type="string"
12048 * ),
12049 * @OA\Parameter(
12050 * name="address-city",
12051 * in="query",
12052 * description="The address-city of the Practitioner resource.",
12053 * required=false,
12054 * @OA\Schema(
12055 * type="string"
12057 * ),
12058 * @OA\Parameter(
12059 * name="address-postalcode",
12060 * in="query",
12061 * description="The address-postalcode of the Practitioner resource.",
12062 * required=false,
12063 * @OA\Schema(
12064 * type="string"
12066 * ),
12067 * @OA\Parameter(
12068 * name="address-state",
12069 * in="query",
12070 * description="The address-state of the Practitioner resource.",
12071 * required=false,
12072 * @OA\Schema(
12073 * type="string"
12075 * ),
12076 * @OA\Parameter(
12077 * name="email",
12078 * in="query",
12079 * description="The email of the Practitioner resource.",
12080 * required=false,
12081 * @OA\Schema(
12082 * type="string"
12084 * ),
12085 * @OA\Parameter(
12086 * name="family",
12087 * in="query",
12088 * description="The family name of the Practitioner resource.",
12089 * required=false,
12090 * @OA\Schema(
12091 * type="string"
12093 * ),
12094 * @OA\Parameter(
12095 * name="given",
12096 * in="query",
12097 * description="The given name of the Practitioner resource.",
12098 * required=false,
12099 * @OA\Schema(
12100 * type="string"
12102 * ),
12103 * @OA\Parameter(
12104 * name="phone",
12105 * in="query",
12106 * description="The phone number of the Practitioner resource.",
12107 * required=false,
12108 * @OA\Schema(
12109 * type="string"
12111 * ),
12112 * @OA\Parameter(
12113 * name="telecom",
12114 * in="query",
12115 * description="The fax number of the Practitioner resource.",
12116 * required=false,
12117 * @OA\Schema(
12118 * type="string"
12120 * ),
12121 * @OA\Response(
12122 * response="200",
12123 * description="Standard Response",
12124 * @OA\MediaType(
12125 * mediaType="application/json",
12126 * @OA\Schema(
12127 * @OA\Property(
12128 * property="json object",
12129 * description="FHIR Json object.",
12130 * type="object"
12131 * ),
12132 * example={
12133 * "meta": {
12134 * "lastUpdated": "2021-09-14T09:13:51"
12135 * },
12136 * "resourceType": "Bundle",
12137 * "type": "collection",
12138 * "total": 0,
12139 * "link": {
12141 * "relation": "self",
12142 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12148 * ),
12149 * @OA\Response(
12150 * response="400",
12151 * ref="#/components/responses/badrequest"
12152 * ),
12153 * @OA\Response(
12154 * response="401",
12155 * ref="#/components/responses/unauthorized"
12156 * ),
12157 * security={{"openemr_auth":{}}}
12160 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
12162 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12163 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12164 // I don't believe patients are assigned to a particular practitioner
12165 // should we allow just open api access to admin information? Should we restrict particular pieces
12166 // of data in the practitioner side (phone number, address information) based on a permission set?
12167 if (!$request->isPatientRequest()) {
12168 RestConfig::authorization_check("admin", "users");
12170 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12171 RestConfig::apiLog($return);
12172 return $return;
12176 * @OA\Get(
12177 * path="/fhir/Practitioner/{uuid}",
12178 * description="Returns a single Practitioner resource.",
12179 * tags={"fhir"},
12180 * @OA\Parameter(
12181 * name="uuid",
12182 * in="path",
12183 * description="The uuid for the Practitioner resource.",
12184 * required=true,
12185 * @OA\Schema(
12186 * type="string"
12188 * ),
12189 * @OA\Response(
12190 * response="200",
12191 * description="Standard Response",
12192 * @OA\MediaType(
12193 * mediaType="application/json",
12194 * @OA\Schema(
12195 * @OA\Property(
12196 * property="json object",
12197 * description="FHIR Json object.",
12198 * type="object"
12199 * ),
12200 * example={
12201 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12202 * "meta": {
12203 * "versionId": "1",
12204 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12205 * },
12206 * "resourceType": "Practitioner",
12207 * "text": {
12208 * "status": "generated",
12209 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12210 * },
12211 * "identifier": {
12213 * "system": "http://hl7.org/fhir/sid/us-npi",
12214 * "value": "11223344554543"
12216 * },
12217 * "active": true,
12218 * "name": {
12220 * "use": "official",
12221 * "family": "Smith",
12222 * "given": {
12223 * "Billy"
12230 * ),
12231 * @OA\Response(
12232 * response="400",
12233 * ref="#/components/responses/badrequest"
12234 * ),
12235 * @OA\Response(
12236 * response="401",
12237 * ref="#/components/responses/unauthorized"
12238 * ),
12239 * @OA\Response(
12240 * response="404",
12241 * ref="#/components/responses/uuidnotfound"
12242 * ),
12243 * security={{"openemr_auth":{}}}
12246 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12247 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12248 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12249 // I don't believe patients are assigned to a particular practitioner
12250 // should we allow just open api access to admin information? Should we restrict particular pieces
12251 // of data in the practitioner side (phone number, address information) based on a permission set?
12252 if (!$request->isPatientRequest()) {
12253 RestConfig::authorization_check("admin", "users");
12255 $return = (new FhirPractitionerRestController())->getOne($uuid);
12256 RestConfig::apiLog($return);
12257 return $return;
12261 * @OA\Post(
12262 * path="/fhir/Practitioner",
12263 * description="Adds a Practitioner resources.",
12264 * tags={"fhir"},
12265 * @OA\RequestBody(
12266 * required=true,
12267 * @OA\MediaType(
12268 * mediaType="application/json",
12269 * @OA\Schema(
12270 * description="The json object for the Practitioner resource.",
12271 * type="object"
12272 * ),
12273 * example={
12274 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12275 * "meta": {
12276 * "versionId": "1",
12277 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12278 * },
12279 * "resourceType": "Practitioner",
12280 * "text": {
12281 * "status": "generated",
12282 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12283 * },
12284 * "identifier": {
12286 * "system": "http://hl7.org/fhir/sid/us-npi",
12287 * "value": "11223344554543"
12289 * },
12290 * "active": true,
12291 * "name": {
12293 * "use": "official",
12294 * "family": "Smith",
12295 * "given": {
12296 * "Danny"
12302 * ),
12303 * @OA\Response(
12304 * response="200",
12305 * description="Standard Response",
12306 * @OA\MediaType(
12307 * mediaType="application/json",
12308 * @OA\Schema(
12309 * @OA\Property(
12310 * property="json object",
12311 * description="FHIR Json object.",
12312 * type="object"
12313 * ),
12314 * example={
12315 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12316 * "meta": {
12317 * "versionId": "1",
12318 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12319 * },
12320 * "resourceType": "Practitioner",
12321 * "text": {
12322 * "status": "generated",
12323 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12324 * },
12325 * "identifier": {
12327 * "system": "http://hl7.org/fhir/sid/us-npi",
12328 * "value": "11223344554543"
12330 * },
12331 * "active": true,
12332 * "name": {
12334 * "use": "official",
12335 * "family": "Smith",
12336 * "given": {
12337 * "Danny"
12344 * ),
12345 * @OA\Response(
12346 * response="400",
12347 * ref="#/components/responses/badrequest"
12348 * ),
12349 * @OA\Response(
12350 * response="401",
12351 * ref="#/components/responses/unauthorized"
12352 * ),
12353 * security={{"openemr_auth":{}}}
12356 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
12357 RestConfig::authorization_check("admin", "users");
12358 $data = (array) (json_decode(file_get_contents("php://input"), true));
12359 $return = (new FhirPractitionerRestController())->post($data);
12360 RestConfig::apiLog($return, $data);
12361 return $return;
12365 * @OA\Put(
12366 * path="/fhir/Practitioner/{uuid}",
12367 * description="Modify a Practitioner resource.",
12368 * tags={"fhir"},
12369 * @OA\Parameter(
12370 * name="uuid",
12371 * in="path",
12372 * description="The uuid for the Practitioner resource.",
12373 * required=true,
12374 * @OA\Schema(
12375 * type="string"
12377 * ),
12378 * @OA\RequestBody(
12379 * required=true,
12380 * @OA\MediaType(
12381 * mediaType="application/json",
12382 * @OA\Schema(
12383 * description="The json object for the Practitioner resource.",
12384 * type="object"
12385 * ),
12386 * example={
12387 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12388 * "meta": {
12389 * "versionId": "1",
12390 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12391 * },
12392 * "resourceType": "Practitioner",
12393 * "text": {
12394 * "status": "generated",
12395 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12396 * },
12397 * "identifier": {
12399 * "system": "http://hl7.org/fhir/sid/us-npi",
12400 * "value": "11223344554543"
12402 * },
12403 * "active": true,
12404 * "name": {
12406 * "use": "official",
12407 * "family": "Smith",
12408 * "given": {
12409 * "Billy"
12415 * ),
12416 * @OA\Response(
12417 * response="201",
12418 * description="Standard Response",
12419 * @OA\MediaType(
12420 * mediaType="application/json",
12421 * @OA\Schema(
12422 * example={
12423 * "id": 5,
12424 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12428 * ),
12429 * @OA\Response(
12430 * response="400",
12431 * ref="#/components/responses/badrequest"
12432 * ),
12433 * @OA\Response(
12434 * response="401",
12435 * ref="#/components/responses/unauthorized"
12436 * ),
12437 * security={{"openemr_auth":{}}}
12440 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12441 RestConfig::authorization_check("admin", "users");
12442 $data = (array) (json_decode(file_get_contents("php://input"), true));
12443 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12444 RestConfig::apiLog($return, $data);
12445 return $return;
12449 * @OA\Get(
12450 * path="/fhir/PractitionerRole",
12451 * description="Returns a list of PractitionerRole resources.",
12452 * tags={"fhir"},
12453 * @OA\Parameter(
12454 * name="specialty",
12455 * in="query",
12456 * description="The specialty of the PractitionerRole resource.",
12457 * required=false,
12458 * @OA\Schema(
12459 * type="string"
12461 * ),
12462 * @OA\Parameter(
12463 * name="practitioner",
12464 * in="query",
12465 * description="The practitioner of the PractitionerRole resource.",
12466 * required=false,
12467 * @OA\Schema(
12468 * type="string"
12470 * ),
12471 * @OA\Response(
12472 * response="200",
12473 * description="Standard Response",
12474 * @OA\MediaType(
12475 * mediaType="application/json",
12476 * @OA\Schema(
12477 * @OA\Property(
12478 * property="json object",
12479 * description="FHIR Json object.",
12480 * type="object"
12481 * ),
12482 * example={
12483 * "meta": {
12484 * "lastUpdated": "2021-09-14T09:13:51"
12485 * },
12486 * "resourceType": "Bundle",
12487 * "type": "collection",
12488 * "total": 0,
12489 * "link": {
12491 * "relation": "self",
12492 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12498 * ),
12499 * @OA\Response(
12500 * response="400",
12501 * ref="#/components/responses/badrequest"
12502 * ),
12503 * @OA\Response(
12504 * response="401",
12505 * ref="#/components/responses/unauthorized"
12506 * ),
12507 * security={{"openemr_auth":{}}}
12510 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12511 RestConfig::authorization_check("admin", "users");
12512 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12513 RestConfig::apiLog($return);
12514 return $return;
12518 * @OA\Get(
12519 * path="/fhir/PractitionerRole/{uuid}",
12520 * description="Returns a single PractitionerRole resource.",
12521 * tags={"fhir"},
12522 * @OA\Parameter(
12523 * name="uuid",
12524 * in="path",
12525 * description="The uuid for the PractitionerRole resource.",
12526 * required=true,
12527 * @OA\Schema(
12528 * type="string"
12530 * ),
12531 * @OA\Response(
12532 * response="200",
12533 * description="Standard Response",
12534 * @OA\MediaType(
12535 * mediaType="application/json",
12536 * @OA\Schema(
12537 * @OA\Property(
12538 * property="json object",
12539 * description="FHIR Json object.",
12540 * type="object"
12541 * ),
12542 * example={
12543 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12544 * "meta": {
12545 * "versionId": "1",
12546 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12547 * },
12548 * "resourceType": "PractitionerRole",
12549 * "practitioner": {
12550 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12551 * "display": "Administrator Administrator"
12552 * },
12553 * "organization": {
12554 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12555 * "display": "Your Clinic Name Here"
12556 * },
12557 * "code": {
12559 * "coding": {
12560 * "102L00000X"
12561 * },
12562 * "text": "Psychoanalyst"
12563 * },
12565 * "coding": {
12566 * "101Y00000X"
12567 * },
12568 * "text": "Counselor"
12574 * ),
12575 * @OA\Response(
12576 * response="400",
12577 * ref="#/components/responses/badrequest"
12578 * ),
12579 * @OA\Response(
12580 * response="401",
12581 * ref="#/components/responses/unauthorized"
12582 * ),
12583 * @OA\Response(
12584 * response="404",
12585 * ref="#/components/responses/uuidnotfound"
12586 * ),
12587 * security={{"openemr_auth":{}}}
12590 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12591 RestConfig::authorization_check("admin", "users");
12592 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12593 RestConfig::apiLog($return);
12594 return $return;
12598 * @OA\Get(
12599 * path="/fhir/Procedure",
12600 * description="Returns a list of Procedure resources.",
12601 * tags={"fhir"},
12602 * @OA\Parameter(
12603 * name="_id",
12604 * in="query",
12605 * description="The uuid for the Procedure resource.",
12606 * required=false,
12607 * @OA\Schema(
12608 * type="string"
12610 * ),
12611 * @OA\Parameter(
12612 * name="patient",
12613 * in="query",
12614 * description="The uuid for the patient.",
12615 * required=false,
12616 * @OA\Schema(
12617 * type="string"
12619 * ),
12620 * @OA\Parameter(
12621 * name="date",
12622 * in="query",
12623 * description="The datetime of the Procedure resource.",
12624 * required=false,
12625 * @OA\Schema(
12626 * type="string"
12628 * ),
12629 * @OA\Response(
12630 * response="200",
12631 * description="Standard Response",
12632 * @OA\MediaType(
12633 * mediaType="application/json",
12634 * @OA\Schema(
12635 * @OA\Property(
12636 * property="json object",
12637 * description="FHIR Json object.",
12638 * type="object"
12639 * ),
12640 * example={
12641 * "meta": {
12642 * "lastUpdated": "2021-09-14T09:13:51"
12643 * },
12644 * "resourceType": "Bundle",
12645 * "type": "collection",
12646 * "total": 0,
12647 * "link": {
12649 * "relation": "self",
12650 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12656 * ),
12657 * @OA\Response(
12658 * response="400",
12659 * ref="#/components/responses/badrequest"
12660 * ),
12661 * @OA\Response(
12662 * response="401",
12663 * ref="#/components/responses/unauthorized"
12664 * ),
12665 * security={{"openemr_auth":{}}}
12668 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12669 if ($request->isPatientRequest()) {
12670 // only allow access to data of binded patient
12671 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12672 } else {
12673 RestConfig::authorization_check("patients", "med");
12674 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12676 RestConfig::apiLog($return);
12677 return $return;
12681 * @OA\Get(
12682 * path="/fhir/Procedure/{uuid}",
12683 * description="Returns a single Procedure resource.",
12684 * tags={"fhir"},
12685 * @OA\Parameter(
12686 * name="uuid",
12687 * in="path",
12688 * description="The uuid for the Procedure resource.",
12689 * required=true,
12690 * @OA\Schema(
12691 * type="string"
12693 * ),
12694 * @OA\Response(
12695 * response="200",
12696 * description="Standard Response",
12697 * @OA\MediaType(
12698 * mediaType="application/json",
12699 * @OA\Schema(
12700 * @OA\Property(
12701 * property="json object",
12702 * description="FHIR Json object.",
12703 * type="object"
12704 * ),
12705 * example={
12706 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12707 * "meta": {
12708 * "versionId": "1",
12709 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12710 * },
12711 * "resourceType": "Procedure",
12712 * "status": "in-progress",
12713 * "subject": {
12714 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12715 * "type": "Patient"
12720 * ),
12721 * @OA\Response(
12722 * response="400",
12723 * ref="#/components/responses/badrequest"
12724 * ),
12725 * @OA\Response(
12726 * response="401",
12727 * ref="#/components/responses/unauthorized"
12728 * ),
12729 * @OA\Response(
12730 * response="404",
12731 * ref="#/components/responses/uuidnotfound"
12732 * ),
12733 * security={{"openemr_auth":{}}}
12736 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12737 if ($request->isPatientRequest()) {
12738 // only allow access to data of binded patient
12739 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12740 } else {
12741 RestConfig::authorization_check("patients", "med");
12742 $return = (new FhirProcedureRestController())->getOne($uuid);
12744 RestConfig::apiLog($return);
12745 return $return;
12749 * @OA\Get(
12750 * path="/fhir/Provenance/{uuid}",
12751 * description="Returns a single Provenance resource.",
12752 * tags={"fhir"},
12753 * @OA\Parameter(
12754 * name="uuid",
12755 * in="path",
12756 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12757 * required=true,
12758 * @OA\Schema(
12759 * type="string"
12761 * ),
12762 * @OA\Response(
12763 * response="200",
12764 * description="Standard Response",
12765 * @OA\MediaType(
12766 * mediaType="application/json",
12767 * @OA\Schema(
12768 * @OA\Property(
12769 * property="json object",
12770 * description="FHIR Json object.",
12771 * type="object"
12772 * ),
12773 * example={
12774 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12775 * "resourceType": "Provenance",
12776 * "target": {
12778 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12779 * "type": "AllergyIntolerance"
12781 * },
12782 * "recorded": "2022-03-26T22:43:30+00:00",
12783 * "agent": {
12785 * "type": {
12786 * "coding": {
12788 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12789 * "code": "author",
12790 * "display": "Author"
12793 * },
12794 * "who": {
12795 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12796 * "type": "Organization"
12797 * },
12798 * "onBehalfOf": {
12799 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12800 * "type": "Organization"
12802 * },
12804 * "type": {
12805 * "coding": {
12807 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12808 * "code": "transmitter",
12809 * "display": "Transmitter"
12813 * },
12814 * "who": {
12815 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12816 * "type": "Organization"
12817 * },
12818 * "onBehalfOf": {
12819 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12820 * "type": "Organization"
12826 * ),
12827 * @OA\Response(
12828 * response="400",
12829 * ref="#/components/responses/badrequest"
12830 * ),
12831 * @OA\Response(
12832 * response="401",
12833 * ref="#/components/responses/unauthorized"
12834 * ),
12835 * @OA\Response(
12836 * response="404",
12837 * ref="#/components/responses/uuidnotfound"
12838 * ),
12839 * security={{"openemr_auth":{}}}
12842 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12843 if ($request->isPatientRequest()) {
12844 // only allow access to data of binded patient
12845 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12846 } else {
12847 RestConfig::authorization_check("admin", "super");
12848 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12850 RestConfig::apiLog($return);
12851 return $return;
12855 * @OA\Get(
12856 * path="/fhir/Provenance",
12857 * description="Returns a list of Provenance resources.",
12858 * tags={"fhir"},
12859 * @OA\Parameter(
12860 * name="_id",
12861 * in="query",
12862 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12863 * required=false,
12864 * @OA\Schema(
12865 * type="string"
12867 * ),
12868 * @OA\Response(
12869 * response="200",
12870 * description="Standard Response",
12871 * @OA\MediaType(
12872 * mediaType="application/json",
12873 * @OA\Schema(
12874 * @OA\Property(
12875 * property="json object",
12876 * description="FHIR Json object.",
12877 * type="object"
12878 * ),
12879 * example={
12880 * "meta": {
12881 * "lastUpdated": "2021-09-14T09:13:51"
12882 * },
12883 * "resourceType": "Bundle",
12884 * "type": "collection",
12885 * "total": 0,
12886 * "link": {
12888 * "relation": "self",
12889 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12895 * ),
12896 * @OA\Response(
12897 * response="400",
12898 * ref="#/components/responses/badrequest"
12899 * ),
12900 * @OA\Response(
12901 * response="401",
12902 * ref="#/components/responses/unauthorized"
12903 * ),
12904 * security={{"openemr_auth":{}}}
12907 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12908 // property to support which is why this endpoint exists.
12909 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12910 if ($request->isPatientRequest()) {
12911 // only allow access to data of binded patient
12912 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12913 } else {
12914 // TODO: it seems like regular users should be able to grab authorship / provenance information
12915 RestConfig::authorization_check("admin", "super");
12916 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12918 RestConfig::apiLog($return);
12919 return $return;
12922 // other endpoints
12925 * @OA\Get(
12926 * path="/fhir/metadata",
12927 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12928 * tags={"fhir"},
12929 * @OA\Response(
12930 * response="200",
12931 * description="Return CapabilityStatement resource of the fhir server"
12935 "GET /fhir/metadata" => function () {
12936 $return = (new FhirMetaDataRestController())->getMetaData();
12937 RestConfig::apiLog($return);
12938 return $return;
12942 * @OA\Get(
12943 * path="/fhir/.well-known/smart-configuration",
12944 * description="Returns smart configuration of the fhir server.",
12945 * tags={"fhir"},
12946 * @OA\Response(
12947 * response="200",
12948 * description="Return smart configuration of the fhir server"
12952 "GET /fhir/.well-known/smart-configuration" => function () {
12953 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12954 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12955 RestConfig::apiLog($return);
12956 return $return;
12960 * @OA\Get(
12961 * path="/fhir/OperationDefinition",
12962 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
12963 * tags={"fhir"},
12964 * @OA\Response(
12965 * response="200",
12966 * description="Return list of OperationDefinition resources"
12970 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
12971 // for now we will just hard code the custom resources
12972 $operationDefinitionController = new FhirOperationDefinitionRestController();
12973 $return = $operationDefinitionController->getAll($request->getQueryParams());
12974 RestConfig::apiLog($return);
12975 return $return;
12979 * @OA\Get(
12980 * path="/fhir/OperationDefinition/{operation}",
12981 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
12982 * tags={"fhir"},
12983 * @OA\Parameter(
12984 * name="operation",
12985 * in="path",
12986 * description="The name of the operation to query. For example $bulkdata-status",
12987 * required=true,
12988 * @OA\Schema(
12989 * type="string"
12991 * ),
12992 * @OA\Response(
12993 * response="200",
12994 * description="Standard Response",
12995 * @OA\MediaType(
12996 * mediaType="application/json",
12997 * @OA\Schema(
12998 * @OA\Property(
12999 * property="json object",
13000 * description="FHIR Json object.",
13001 * type="object"
13002 * ),
13003 * example={
13004 * "resourceType": "OperationDefinition",
13005 * "name": "$bulkdata-status",
13006 * "status": "active",
13007 * "kind": "operation",
13008 * "parameter": {
13010 * "name": "job",
13011 * "use": "in",
13012 * "min": 1,
13013 * "max": 1,
13014 * "type": {
13015 * "system": "http://hl7.org/fhir/data-types",
13016 * "code": "string",
13017 * "display": "string"
13018 * },
13019 * "searchType": {
13020 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13021 * "code": "string",
13022 * "display": "string"
13029 * ),
13032 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
13033 // for now we will just hard code the custom resources
13034 $operationDefinitionController = new FhirOperationDefinitionRestController();
13035 $return = $operationDefinitionController->getOne($operation);
13036 RestConfig::apiLog($return);
13037 return $return;
13040 // FHIR root level operations
13043 * @OA\Get(
13044 * path="/fhir/$export",
13045 * 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>",
13046 * tags={"fhir"},
13047 * @OA\Response(
13048 * response="200",
13049 * 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>"
13050 * ),
13051 * @OA\Response(
13052 * response="400",
13053 * ref="#/components/responses/badrequest"
13054 * ),
13055 * @OA\Response(
13056 * response="401",
13057 * ref="#/components/responses/unauthorized"
13058 * ),
13059 * security={{"openemr_auth":{}}}
13062 'GET /fhir/$export' => function (HttpRestRequest $request) {
13063 RestConfig::authorization_check("admin", "users");
13064 $fhirExportService = new FhirOperationExportRestController($request);
13065 $return = $fhirExportService->processExport(
13066 $request->getQueryParams(),
13067 'System',
13068 $request->getHeader('Accept')[0] ?? '',
13069 $request->getHeader('Prefer')[0] ?? ''
13071 RestConfig::apiLog($return);
13072 return $return;
13075 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13076 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13077 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13080 * @OA\Get(
13081 * path="/fhir/$bulkdata-status",
13082 * 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>",
13083 * tags={"fhir"},
13084 * @OA\Response(
13085 * response="200",
13086 * 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>"
13087 * ),
13088 * @OA\Response(
13089 * response="400",
13090 * ref="#/components/responses/badrequest"
13091 * ),
13092 * @OA\Response(
13093 * response="401",
13094 * ref="#/components/responses/unauthorized"
13095 * ),
13096 * security={{"openemr_auth":{}}}
13099 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13100 RestConfig::authorization_check("admin", "users");
13101 $jobUuidString = $request->getQueryParam('job');
13102 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13103 // since OpenEMR data is so small we just return the JSON from the database
13104 $fhirExportService = new FhirOperationExportRestController($request);
13105 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13106 RestConfig::apiLog($return);
13107 return $return;
13111 * @OA\Delete(
13112 * path="/fhir/$bulkdata-status",
13113 * 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>",
13114 * tags={"fhir"},
13115 * @OA\Response(
13116 * response="200",
13117 * 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>"
13118 * ),
13119 * @OA\Response(
13120 * response="400",
13121 * ref="#/components/responses/badrequest"
13122 * ),
13123 * @OA\Response(
13124 * response="401",
13125 * ref="#/components/responses/unauthorized"
13126 * ),
13127 * security={{"openemr_auth":{}}}
13130 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13131 RestConfig::authorization_check("admin", "users");
13132 $job = $request->getQueryParam('job');
13133 $fhirExportService = new FhirOperationExportRestController($request);
13134 $return = $fhirExportService->processDeleteExportForJob($job);
13135 RestConfig::apiLog($return);
13136 return $return;
13140 // Note that the portal (api) route is only for patient role
13141 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13142 RestConfig::$PORTAL_ROUTE_MAP = array(
13144 * @OA\Get(
13145 * path="/portal/patient",
13146 * description="Returns the patient.",
13147 * tags={"standard-patient"},
13148 * @OA\Response(
13149 * response="200",
13150 * description="Standard response",
13151 * @OA\MediaType(
13152 * mediaType="application/json",
13153 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13155 * ),
13156 * @OA\Response(
13157 * response="401",
13158 * ref="#/components/responses/unauthorized"
13159 * ),
13160 * security={{"openemr_auth":{}}}
13163 "GET /portal/patient" => function (HttpRestRequest $request) {
13164 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13165 RestConfig::apiLog($return);
13166 return $return;
13170 * @OA\Get(
13171 * path="/portal/patient/encounter",
13172 * description="Returns encounters for the patient.",
13173 * tags={"standard-patient"},
13174 * @OA\Response(
13175 * response="200",
13176 * ref="#/components/responses/standard"
13177 * ),
13178 * @OA\Response(
13179 * response="400",
13180 * ref="#/components/responses/badrequest"
13181 * ),
13182 * @OA\Response(
13183 * response="401",
13184 * ref="#/components/responses/unauthorized"
13185 * ),
13186 * security={{"openemr_auth":{}}}
13189 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
13190 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13191 RestConfig::apiLog($return);
13192 return $return;
13196 * @OA\Get(
13197 * path="/portal/patient/encounter/{euuid}",
13198 * description="Returns a selected encounter by its uuid.",
13199 * tags={"standard-patient"},
13200 * @OA\Parameter(
13201 * name="euuid",
13202 * in="path",
13203 * description="The uuid for the encounter.",
13204 * required=true,
13205 * @OA\Schema(
13206 * type="string"
13208 * ),
13209 * @OA\Response(
13210 * response="200",
13211 * ref="#/components/responses/standard"
13212 * ),
13213 * @OA\Response(
13214 * response="400",
13215 * ref="#/components/responses/badrequest"
13216 * ),
13217 * @OA\Response(
13218 * response="401",
13219 * ref="#/components/responses/unauthorized"
13220 * ),
13221 * security={{"openemr_auth":{}}}
13224 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
13225 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13226 RestConfig::apiLog($return);
13227 return $return;
13231 * @OA\Get(
13232 * path="/portal/patient/appointment",
13233 * description="Retrieves all appointments for a patient",
13234 * tags={"standard-patient"},
13235 * @OA\Response(
13236 * response="200",
13237 * ref="#/components/responses/standard"
13238 * ),
13239 * @OA\Response(
13240 * response="400",
13241 * ref="#/components/responses/badrequest"
13242 * ),
13243 * @OA\Response(
13244 * response="401",
13245 * ref="#/components/responses/unauthorized"
13246 * ),
13247 * security={{"openemr_auth":{}}}
13250 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
13251 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13252 RestConfig::apiLog($return);
13253 return $return;
13258 * @OA\Get(
13259 * path="/portal/patient/appointment/{auuid}",
13260 * description="Returns a selected appointment by its uuid.",
13261 * tags={"standard-patient"},
13262 * @OA\Parameter(
13263 * name="auuid",
13264 * in="path",
13265 * description="The uuid for the appointment.",
13266 * required=true,
13267 * @OA\Schema(
13268 * type="string"
13270 * ),
13271 * @OA\Response(
13272 * response="200",
13273 * ref="#/components/responses/standard"
13274 * ),
13275 * @OA\Response(
13276 * response="400",
13277 * ref="#/components/responses/badrequest"
13278 * ),
13279 * @OA\Response(
13280 * response="401",
13281 * ref="#/components/responses/unauthorized"
13282 * ),
13283 * security={{"openemr_auth":{}}}
13286 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
13287 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13288 RestConfig::apiLog($return);
13289 return $return;