chore: ci mariadb stuff - added 11.1 and removed 10.9 (#6834)
[openemr.git] / _rest_routes.inc.php
blob3d7853c1f5d376582deefa62176b068c566ffa20
1 <?php
3 /**
4 * Routes
5 * (All REST routes)
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Matthew Vita <matthewvita48@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @author Yash Raj Bothra <yashrajbothra786@gmail.com>
13 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
14 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
15 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 /**
21 * @OA\Info(title="OpenEMR API", version="7.0.0")
22 * @OA\Server(url="/apis/default/")
23 * @OA\SecurityScheme(
24 * securityScheme="openemr_auth",
25 * type="oauth2",
26 * @OA\Flow(
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
31 * scopes={
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
35 * "api:fhir": "FHIR R4 API",
36 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
37 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
38 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
39 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
40 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
41 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
42 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
43 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
44 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
46 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
47 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
48 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
49 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
50 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
51 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
52 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
53 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
54 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
55 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
56 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
57 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
58 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
59 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
60 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
61 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
62 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
63 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
64 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
65 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
66 * "system/Device.read": "Read all device resources in the system (api:fhir)",
67 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
68 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
69 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
70 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
71 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
72 * "system/Group.read": "Read all group resources in the system (api:fhir)",
73 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
74 * "system/Location.read": "Read all location resources in the system (api:fhir)",
75 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
76 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
77 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
78 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
79 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
80 * "system/Person.read": "Read all person resources in the system (api:fhir)",
81 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
82 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
83 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
84 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
85 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
86 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
87 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
88 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
89 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
90 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
91 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
92 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
93 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
94 * "user/DocumentReference.$docref" : "Generate a document for any patient the user has access to or returns the most current Clinical Summary of Care Document (CCD) (api:fhir)",
95 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
96 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
97 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
98 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
99 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
100 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
101 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
102 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
103 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
104 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
105 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
106 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
107 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
108 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
109 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
110 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
111 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
112 * "api:oemr": "Standard OpenEMR API",
113 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
114 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
115 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
116 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
117 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
118 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
119 * "user/document.read": "Read documents the user has access to (api:oemr)",
120 * "user/document.write": "Write documents the user has access to (api:oemr)",
121 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
122 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
123 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
124 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
125 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
126 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
127 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
128 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
129 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
130 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
131 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
132 * "user/list.read": "Read lists the user has access to (api:oemr)",
133 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
134 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
135 * "user/medication.read": "Read medications the user has access to (api:oemr)",
136 * "user/medication.write": "Write medications the user has access to (api:oemr)",
137 * "user/message.write": "Read messages the user has access to (api:oemr)",
138 * "user/patient.read": "Read patients the user has access to (api:oemr)",
139 * "user/patient.write": "Write patients the user has access to (api:oemr)",
140 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
141 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
142 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
143 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
144 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
145 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
146 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
147 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
148 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
149 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
150 * "user/user.read": "Read users the current user has access to (api:oemr)",
151 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
152 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
153 * "api:port": "Standard Patient Portal OpenEMR API",
154 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
155 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
156 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
160 * @OA\Tag(
161 * name="fhir",
162 * description="FHIR R4 API"
164 * @OA\Tag(
165 * name="standard",
166 * description="Standard OpenEMR API"
168 * @OA\Tag(
169 * name="standard-patient",
170 * description="Standard Patient Portal OpenEMR API"
172 * @OA\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="eid",
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\Response(
9693 * response="200",
9694 * 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>"
9695 * ),
9696 * @OA\Response(
9697 * response="400",
9698 * ref="#/components/responses/badrequest"
9699 * ),
9700 * @OA\Response(
9701 * response="401",
9702 * ref="#/components/responses/unauthorized"
9703 * ),
9704 * security={{"openemr_auth":{}}}
9707 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9708 RestConfig::authorization_check("admin", "users");
9709 $fhirExportService = new FhirOperationExportRestController($request);
9710 $exportParams = $request->getQueryParams();
9711 $exportParams['groupId'] = $groupId;
9712 $return = $fhirExportService->processExport(
9713 $exportParams,
9714 'Group',
9715 $request->getHeader('Accept')[0] ?? '',
9716 $request->getHeader('Prefer')[0] ?? ''
9718 RestConfig::apiLog($return);
9719 return $return;
9723 * @OA\Get(
9724 * path="/fhir/Immunization",
9725 * description="Returns a list of Immunization resources.",
9726 * tags={"fhir"},
9727 * @OA\Parameter(
9728 * name="_id",
9729 * in="query",
9730 * description="The uuid for the Immunization resource.",
9731 * required=false,
9732 * @OA\Schema(
9733 * type="string"
9735 * ),
9736 * @OA\Parameter(
9737 * name="patient",
9738 * in="query",
9739 * description="The uuid for the patient.",
9740 * required=false,
9741 * @OA\Schema(
9742 * type="string"
9744 * ),
9745 * @OA\Response(
9746 * response="200",
9747 * description="Standard Response",
9748 * @OA\MediaType(
9749 * mediaType="application/json",
9750 * @OA\Schema(
9751 * @OA\Property(
9752 * property="json object",
9753 * description="FHIR Json object.",
9754 * type="object"
9755 * ),
9756 * example={
9757 * "meta": {
9758 * "lastUpdated": "2021-09-14T09:13:51"
9759 * },
9760 * "resourceType": "Bundle",
9761 * "type": "collection",
9762 * "total": 0,
9763 * "link": {
9765 * "relation": "self",
9766 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9772 * ),
9773 * @OA\Response(
9774 * response="400",
9775 * ref="#/components/responses/badrequest"
9776 * ),
9777 * @OA\Response(
9778 * response="401",
9779 * ref="#/components/responses/unauthorized"
9780 * ),
9781 * security={{"openemr_auth":{}}}
9784 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9785 $getParams = $request->getQueryParams();
9786 if ($request->isPatientRequest()) {
9787 // only allow access to data of binded patient
9788 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9789 } else {
9790 RestConfig::authorization_check("patients", "med");
9791 $return = (new FhirImmunizationRestController())->getAll($getParams);
9793 RestConfig::apiLog($return);
9794 return $return;
9798 * @OA\Get(
9799 * path="/fhir/Immunization/{uuid}",
9800 * description="Returns a single Immunization resource.",
9801 * tags={"fhir"},
9802 * @OA\Parameter(
9803 * name="uuid",
9804 * in="path",
9805 * description="The uuid for the Immunization resource.",
9806 * required=true,
9807 * @OA\Schema(
9808 * type="string"
9810 * ),
9811 * @OA\Response(
9812 * response="200",
9813 * description="Standard Response",
9814 * @OA\MediaType(
9815 * mediaType="application/json",
9816 * @OA\Schema(
9817 * @OA\Property(
9818 * property="json object",
9819 * description="FHIR Json object.",
9820 * type="object"
9821 * ),
9822 * example={
9823 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9824 * "meta": {
9825 * "versionId": "1",
9826 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9827 * },
9828 * "resourceType": "Immunization",
9829 * "status": "completed",
9830 * "vaccineCode": {
9831 * "coding": {
9833 * "system": "http://hl7.org/fhir/sid/cvx",
9834 * "code": "207",
9835 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9838 * },
9839 * "patient": {
9840 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9841 * },
9842 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9843 * "recorded": "2022-03-26T05:42:26+00:00",
9844 * "primarySource": false
9848 * ),
9849 * @OA\Response(
9850 * response="400",
9851 * ref="#/components/responses/badrequest"
9852 * ),
9853 * @OA\Response(
9854 * response="401",
9855 * ref="#/components/responses/unauthorized"
9856 * ),
9857 * @OA\Response(
9858 * response="404",
9859 * ref="#/components/responses/uuidnotfound"
9860 * ),
9861 * security={{"openemr_auth":{}}}
9864 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9865 if ($request->isPatientRequest()) {
9866 // only allow access to data of binded patient
9867 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9868 } else {
9869 RestConfig::authorization_check("patients", "med");
9870 $return = (new FhirImmunizationRestController())->getOne($uuid);
9872 RestConfig::apiLog($return);
9873 return $return;
9877 * @OA\Get(
9878 * path="/fhir/Location",
9879 * description="Returns a list of Location resources.",
9880 * tags={"fhir"},
9881 * @OA\Parameter(
9882 * name="_id",
9883 * in="query",
9884 * description="The uuid for the Location resource.",
9885 * required=false,
9886 * @OA\Schema(
9887 * type="string"
9889 * ),
9890 * @OA\Response(
9891 * response="200",
9892 * description="Standard Response",
9893 * @OA\MediaType(
9894 * mediaType="application/json",
9895 * @OA\Schema(
9896 * @OA\Property(
9897 * property="json object",
9898 * description="FHIR Json object.",
9899 * type="object"
9900 * ),
9901 * example={
9902 * "meta": {
9903 * "lastUpdated": "2021-09-14T09:13:51"
9904 * },
9905 * "resourceType": "Bundle",
9906 * "type": "collection",
9907 * "total": 0,
9908 * "link": {
9910 * "relation": "self",
9911 * "url": "https://localhost:9300/apis/default/fhir/Location"
9917 * ),
9918 * @OA\Response(
9919 * response="400",
9920 * ref="#/components/responses/badrequest"
9921 * ),
9922 * @OA\Response(
9923 * response="401",
9924 * ref="#/components/responses/unauthorized"
9925 * ),
9926 * security={{"openemr_auth":{}}}
9929 "GET /fhir/Location" => function (HttpRestRequest $request) {
9930 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9931 RestConfig::apiLog($return);
9932 return $return;
9936 * @OA\Get(
9937 * path="/fhir/Location/{uuid}",
9938 * description="Returns a single Location resource.",
9939 * tags={"fhir"},
9940 * @OA\Parameter(
9941 * name="uuid",
9942 * in="path",
9943 * description="The uuid for the Location resource.",
9944 * required=true,
9945 * @OA\Schema(
9946 * type="string"
9948 * ),
9949 * @OA\Response(
9950 * response="200",
9951 * description="Standard Response",
9952 * @OA\MediaType(
9953 * mediaType="application/json",
9954 * @OA\Schema(
9955 * @OA\Property(
9956 * property="json object",
9957 * description="FHIR Json object.",
9958 * type="object"
9959 * ),
9960 * example={
9961 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9962 * "meta": {
9963 * "versionId": "1",
9964 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9965 * },
9966 * "resourceType": "Location",
9967 * "status": "active",
9968 * "name": "Your Clinic Name Here",
9969 * "telecom": {
9971 * "system": "phone",
9972 * "value": "000-000-0000"
9973 * },
9975 * "system": "fax",
9976 * "value": "000-000-0000"
9982 * ),
9983 * @OA\Response(
9984 * response="400",
9985 * ref="#/components/responses/badrequest"
9986 * ),
9987 * @OA\Response(
9988 * response="401",
9989 * ref="#/components/responses/unauthorized"
9990 * ),
9991 * @OA\Response(
9992 * response="404",
9993 * ref="#/components/responses/uuidnotfound"
9994 * ),
9995 * security={{"openemr_auth":{}}}
9998 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9999 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10000 RestConfig::apiLog($return);
10001 return $return;
10005 * @OA\Get(
10006 * path="/fhir/Medication",
10007 * description="Returns a list of Medication resources.",
10008 * tags={"fhir"},
10009 * @OA\Response(
10010 * response="200",
10011 * description="Standard Response",
10012 * @OA\MediaType(
10013 * mediaType="application/json",
10014 * @OA\Schema(
10015 * @OA\Property(
10016 * property="json object",
10017 * description="FHIR Json object.",
10018 * type="object"
10019 * ),
10020 * example={
10021 * "meta": {
10022 * "lastUpdated": "2021-09-14T09:13:51"
10023 * },
10024 * "resourceType": "Bundle",
10025 * "type": "collection",
10026 * "total": 0,
10027 * "link": {
10029 * "relation": "self",
10030 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10036 * ),
10037 * @OA\Response(
10038 * response="400",
10039 * ref="#/components/responses/badrequest"
10040 * ),
10041 * @OA\Response(
10042 * response="401",
10043 * ref="#/components/responses/unauthorized"
10044 * ),
10045 * security={{"openemr_auth":{}}}
10048 "GET /fhir/Medication" => function (HttpRestRequest $request) {
10049 RestConfig::authorization_check("patients", "med");
10050 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10051 RestConfig::apiLog($return);
10052 return $return;
10056 * @OA\Get(
10057 * path="/fhir/Medication/{uuid}",
10058 * description="Returns a single Medication resource.",
10059 * tags={"fhir"},
10060 * @OA\Parameter(
10061 * name="uuid",
10062 * in="path",
10063 * description="The uuid for the Medication resource.",
10064 * required=true,
10065 * @OA\Schema(
10066 * type="string"
10068 * ),
10069 * @OA\Response(
10070 * response="200",
10071 * description="Standard Response",
10072 * @OA\MediaType(
10073 * mediaType="application/json",
10074 * @OA\Schema(
10075 * @OA\Property(
10076 * property="json object",
10077 * description="FHIR Json object.",
10078 * type="object"
10079 * ),
10080 * example={
10081 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10082 * "meta": {
10083 * "versionId": "1",
10084 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10085 * },
10086 * "resourceType": "Medication",
10087 * "code": {
10088 * "coding": {
10090 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10091 * "code": 153165
10094 * },
10095 * "status": "active",
10096 * "batch": {
10097 * "lotNumber": "132",
10098 * "expirationDate": "0000-00-00"
10103 * ),
10104 * @OA\Response(
10105 * response="400",
10106 * ref="#/components/responses/badrequest"
10107 * ),
10108 * @OA\Response(
10109 * response="401",
10110 * ref="#/components/responses/unauthorized"
10111 * ),
10112 * @OA\Response(
10113 * response="404",
10114 * ref="#/components/responses/uuidnotfound"
10115 * ),
10116 * security={{"openemr_auth":{}}}
10119 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
10120 if ($request->isPatientRequest()) {
10121 // only allow access to data of binded patient
10122 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10123 } else {
10124 RestConfig::authorization_check("patients", "med");
10125 $return = (new FhirMedicationRestController())->getOne($uuid);
10127 RestConfig::apiLog($return);
10128 return $return;
10132 * @OA\Get(
10133 * path="/fhir/MedicationRequest",
10134 * description="Returns a list of MedicationRequest resources.",
10135 * tags={"fhir"},
10136 * @OA\Parameter(
10137 * name="_id",
10138 * in="query",
10139 * description="The uuid for the MedicationRequest resource.",
10140 * required=false,
10141 * @OA\Schema(
10142 * type="string"
10144 * ),
10145 * @OA\Parameter(
10146 * name="patient",
10147 * in="query",
10148 * description="The uuid for the patient.",
10149 * required=false,
10150 * @OA\Schema(
10151 * type="string"
10153 * ),
10154 * @OA\Parameter(
10155 * name="intent",
10156 * in="query",
10157 * description="The intent of the MedicationRequest resource.",
10158 * required=false,
10159 * @OA\Schema(
10160 * type="string"
10162 * ),
10163 * @OA\Parameter(
10164 * name="status",
10165 * in="query",
10166 * description="The status of the MedicationRequest resource.",
10167 * required=false,
10168 * @OA\Schema(
10169 * type="string"
10171 * ),
10172 * @OA\Response(
10173 * response="200",
10174 * description="Standard Response",
10175 * @OA\MediaType(
10176 * mediaType="application/json",
10177 * @OA\Schema(
10178 * @OA\Property(
10179 * property="json object",
10180 * description="FHIR Json object.",
10181 * type="object"
10182 * ),
10183 * example={
10184 * "meta": {
10185 * "lastUpdated": "2021-09-14T09:13:51"
10186 * },
10187 * "resourceType": "Bundle",
10188 * "type": "collection",
10189 * "total": 0,
10190 * "link": {
10192 * "relation": "self",
10193 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10199 * ),
10200 * @OA\Response(
10201 * response="400",
10202 * ref="#/components/responses/badrequest"
10203 * ),
10204 * @OA\Response(
10205 * response="401",
10206 * ref="#/components/responses/unauthorized"
10207 * ),
10208 * security={{"openemr_auth":{}}}
10211 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
10212 $getParams = $request->getQueryParams();
10213 if ($request->isPatientRequest()) {
10214 // only allow access to data of binded patient
10215 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10216 } else {
10217 RestConfig::authorization_check("patients", "med");
10218 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10220 RestConfig::apiLog($return);
10221 return $return;
10225 * @OA\Get(
10226 * path="/fhir/MedicationRequest/{uuid}",
10227 * description="Returns a single MedicationRequest resource.",
10228 * tags={"fhir"},
10229 * @OA\Parameter(
10230 * name="uuid",
10231 * in="path",
10232 * description="The uuid for the MedicationRequest resource.",
10233 * required=true,
10234 * @OA\Schema(
10235 * type="string"
10237 * ),
10238 * @OA\Response(
10239 * response="200",
10240 * description="Standard Response",
10241 * @OA\MediaType(
10242 * mediaType="application/json",
10243 * @OA\Schema(
10244 * @OA\Property(
10245 * property="json object",
10246 * description="FHIR Json object.",
10247 * type="object"
10248 * ),
10249 * example={
10250 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10251 * "meta": {
10252 * "versionId": "1",
10253 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10254 * },
10255 * "resourceType": "MedicationRequest",
10256 * "status": "active",
10257 * "intent": "order",
10258 * "category": {
10260 * "coding": {
10262 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10263 * "code": "community",
10264 * "display": "Home/Community"
10268 * },
10269 * "reportedBoolean": false,
10270 * "medicationCodeableConcept": {
10271 * "coding": {
10273 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10274 * "code": "1738139",
10275 * "display": "Acetaminophen 325 MG Oral Tablet"
10278 * },
10279 * "subject": {
10280 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10281 * "type": "Patient"
10282 * },
10283 * "authoredOn": "2021-09-18T00:00:00+00:00",
10284 * "requester": {
10285 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10286 * "type": "Practitioner"
10291 * ),
10292 * @OA\Response(
10293 * response="400",
10294 * ref="#/components/responses/badrequest"
10295 * ),
10296 * @OA\Response(
10297 * response="401",
10298 * ref="#/components/responses/unauthorized"
10299 * ),
10300 * @OA\Response(
10301 * response="404",
10302 * ref="#/components/responses/uuidnotfound"
10303 * ),
10304 * security={{"openemr_auth":{}}}
10307 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
10308 if ($request->isPatientRequest()) {
10309 // only allow access to data of binded patient
10310 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10311 } else {
10312 RestConfig::authorization_check("patients", "med");
10313 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10315 RestConfig::apiLog($return);
10316 return $return;
10320 * @OA\Get(
10321 * path="/fhir/Observation",
10322 * description="Returns a list of Observation resources.",
10323 * tags={"fhir"},
10324 * @OA\Parameter(
10325 * name="_id",
10326 * in="query",
10327 * description="The uuid for the Observation resource.",
10328 * required=false,
10329 * @OA\Schema(
10330 * type="string"
10332 * ),
10333 * @OA\Parameter(
10334 * name="patient",
10335 * in="query",
10336 * description="The uuid for the patient.",
10337 * required=false,
10338 * @OA\Schema(
10339 * type="string"
10341 * ),
10342 * @OA\Parameter(
10343 * name="code",
10344 * in="query",
10345 * description="The code of the Observation resource.",
10346 * required=false,
10347 * @OA\Schema(
10348 * type="string"
10350 * ),
10351 * @OA\Parameter(
10352 * name="category",
10353 * in="query",
10354 * description="The category of the Observation resource.",
10355 * required=false,
10356 * @OA\Schema(
10357 * type="string"
10359 * ),
10360 * @OA\Parameter(
10361 * name="date",
10362 * in="query",
10363 * description="The datetime of the Observation resource.",
10364 * required=false,
10365 * @OA\Schema(
10366 * type="string"
10368 * ),
10369 * @OA\Response(
10370 * response="200",
10371 * description="Standard Response",
10372 * @OA\MediaType(
10373 * mediaType="application/json",
10374 * @OA\Schema(
10375 * @OA\Property(
10376 * property="json object",
10377 * description="FHIR Json object.",
10378 * type="object"
10379 * ),
10380 * example={
10381 * "meta": {
10382 * "lastUpdated": "2021-09-14T09:13:51"
10383 * },
10384 * "resourceType": "Bundle",
10385 * "type": "collection",
10386 * "total": 0,
10387 * "link": {
10389 * "relation": "self",
10390 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10396 * ),
10397 * @OA\Response(
10398 * response="400",
10399 * ref="#/components/responses/badrequest"
10400 * ),
10401 * @OA\Response(
10402 * response="401",
10403 * ref="#/components/responses/unauthorized"
10404 * ),
10405 * security={{"openemr_auth":{}}}
10408 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10409 $getParams = $request->getQueryParams();
10410 if ($request->isPatientRequest()) {
10411 // only allow access to data of binded patient
10412 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10413 } else {
10414 RestConfig::authorization_check("patients", "med");
10415 $return = (new FhirObservationRestController())->getAll($getParams);
10417 RestConfig::apiLog($return);
10418 return $return;
10422 * @OA\Get(
10423 * path="/fhir/Observation/{uuid}",
10424 * description="Returns a single Observation resource.",
10425 * tags={"fhir"},
10426 * @OA\Parameter(
10427 * name="uuid",
10428 * in="path",
10429 * description="The uuid for the Observation resource.",
10430 * required=true,
10431 * @OA\Schema(
10432 * type="string"
10434 * ),
10435 * @OA\Response(
10436 * response="200",
10437 * description="Standard Response",
10438 * @OA\MediaType(
10439 * mediaType="application/json",
10440 * @OA\Schema(
10441 * @OA\Property(
10442 * property="json object",
10443 * description="FHIR Json object.",
10444 * type="object"
10445 * ),
10446 * example={
10447 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10448 * "meta": {
10449 * "versionId": "1",
10450 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10451 * },
10452 * "resourceType": "Observation",
10453 * "status": "final",
10454 * "category": {
10456 * "coding": {
10458 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10459 * "code": "vital-signs"
10463 * },
10464 * "code": {
10465 * "coding": {
10467 * "system": "http://loinc.org",
10468 * "code": "85354-9",
10469 * "display": "Blood pressure systolic and diastolic"
10472 * },
10473 * "subject": {
10474 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10475 * "type": "Patient"
10476 * },
10477 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10478 * "component": {
10480 * "code": {
10481 * "coding": {
10483 * "system": "http://loinc.org",
10484 * "code": "8480-6",
10485 * "display": "Systolic blood pressure"
10488 * },
10489 * "valueQuantity": {
10490 * "value": 122,
10491 * "unit": "mm[Hg]",
10492 * "system": "http://unitsofmeasure.org",
10493 * "code": "mm[Hg]"
10495 * },
10497 * "code": {
10498 * "coding": {
10500 * "system": "http://loinc.org",
10501 * "code": "8462-4",
10502 * "display": "Diastolic blood pressure"
10505 * },
10506 * "valueQuantity": {
10507 * "value": 77,
10508 * "unit": "mm[Hg]",
10509 * "system": "http://unitsofmeasure.org",
10510 * "code": "mm[Hg]"
10517 * ),
10518 * @OA\Response(
10519 * response="400",
10520 * ref="#/components/responses/badrequest"
10521 * ),
10522 * @OA\Response(
10523 * response="401",
10524 * ref="#/components/responses/unauthorized"
10525 * ),
10526 * @OA\Response(
10527 * response="404",
10528 * ref="#/components/responses/uuidnotfound"
10529 * ),
10530 * security={{"openemr_auth":{}}}
10533 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10534 if ($request->isPatientRequest()) {
10535 // only allow access to data of binded patient
10536 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10537 } else {
10538 RestConfig::authorization_check("patients", "med");
10539 $return = (new FhirObservationRestController())->getOne($uuid);
10541 RestConfig::apiLog($return);
10542 return $return;
10546 * @OA\Get(
10547 * path="/fhir/Organization",
10548 * description="Returns a list of Organization resources.",
10549 * tags={"fhir"},
10550 * @OA\Parameter(
10551 * name="_id",
10552 * in="query",
10553 * description="The uuid for the Organization resource.",
10554 * required=false,
10555 * @OA\Schema(
10556 * type="string"
10558 * ),
10559 * @OA\Parameter(
10560 * name="name",
10561 * in="query",
10562 * description="The name of the Organization resource.",
10563 * required=false,
10564 * @OA\Schema(
10565 * type="string"
10567 * ),
10568 * @OA\Parameter(
10569 * name="email",
10570 * in="query",
10571 * description="The email of the Organization resource.",
10572 * required=false,
10573 * @OA\Schema(
10574 * type="string"
10576 * ),
10577 * @OA\Parameter(
10578 * name="phone",
10579 * in="query",
10580 * description="The phone of the Organization resource.",
10581 * required=false,
10582 * @OA\Schema(
10583 * type="string"
10585 * ),
10586 * @OA\Parameter(
10587 * name="telecom",
10588 * in="query",
10589 * description="The telecom of the Organization resource.",
10590 * required=false,
10591 * @OA\Schema(
10592 * type="string"
10594 * ),
10595 * @OA\Parameter(
10596 * name="address",
10597 * in="query",
10598 * description="The address of the Organization resource.",
10599 * required=false,
10600 * @OA\Schema(
10601 * type="string"
10603 * ),
10604 * @OA\Parameter(
10605 * name="address-city",
10606 * in="query",
10607 * description="The address-city of the Organization resource.",
10608 * required=false,
10609 * @OA\Schema(
10610 * type="string"
10612 * ),
10613 * @OA\Parameter(
10614 * name="address-postalcode",
10615 * in="query",
10616 * description="The address-postalcode of the Organization resource.",
10617 * required=false,
10618 * @OA\Schema(
10619 * type="string"
10621 * ),
10622 * @OA\Parameter(
10623 * name="address-state",
10624 * in="query",
10625 * description="The address-state of the Organization resource.",
10626 * required=false,
10627 * @OA\Schema(
10628 * type="string"
10630 * ),
10631 * @OA\Response(
10632 * response="200",
10633 * description="Standard Response",
10634 * @OA\MediaType(
10635 * mediaType="application/json",
10636 * @OA\Schema(
10637 * @OA\Property(
10638 * property="json object",
10639 * description="FHIR Json object.",
10640 * type="object"
10641 * ),
10642 * example={
10643 * "meta": {
10644 * "lastUpdated": "2021-09-14T09:13:51"
10645 * },
10646 * "resourceType": "Bundle",
10647 * "type": "collection",
10648 * "total": 0,
10649 * "link": {
10651 * "relation": "self",
10652 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10658 * ),
10659 * @OA\Response(
10660 * response="400",
10661 * ref="#/components/responses/badrequest"
10662 * ),
10663 * @OA\Response(
10664 * response="401",
10665 * ref="#/components/responses/unauthorized"
10666 * ),
10667 * security={{"openemr_auth":{}}}
10670 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10671 if (!$request->isPatientRequest()) {
10672 RestConfig::authorization_check("admin", "users");
10674 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10675 RestConfig::apiLog($return);
10676 return $return;
10680 * @OA\Get(
10681 * path="/fhir/Organization/{uuid}",
10682 * description="Returns a single Organization resource.",
10683 * tags={"fhir"},
10684 * @OA\Parameter(
10685 * name="uuid",
10686 * in="path",
10687 * description="The uuid for the Organization resource.",
10688 * required=true,
10689 * @OA\Schema(
10690 * type="string"
10692 * ),
10693 * @OA\Response(
10694 * response="200",
10695 * description="Standard Response",
10696 * @OA\MediaType(
10697 * mediaType="application/json",
10698 * @OA\Schema(
10699 * @OA\Property(
10700 * property="json object",
10701 * description="FHIR Json object.",
10702 * type="object"
10703 * ),
10704 * example={
10705 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10706 * "meta": {
10707 * "versionId": "1",
10708 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10709 * },
10710 * "resourceType": "Organization",
10711 * "text": {
10712 * "status": "generated",
10713 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10714 * },
10715 * "identifier": {
10717 * "system": "http://hl7.org/fhir/sid/us-npi",
10718 * "value": "1234567890"
10720 * },
10721 * "active": true,
10722 * "type": {
10724 * "coding": {
10726 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10727 * "code": "prov",
10728 * "display": "Healthcare Provider"
10732 * },
10733 * "name": "Your Clinic Name Here",
10734 * "telecom": {
10736 * "system": "phone",
10737 * "value": "000-000-0000",
10738 * "use": "work"
10739 * },
10741 * "system": "fax",
10742 * "value": "000-000-0000",
10743 * "use": "work"
10745 * },
10746 * "address": {
10747 * null
10752 * ),
10753 * @OA\Response(
10754 * response="400",
10755 * ref="#/components/responses/badrequest"
10756 * ),
10757 * @OA\Response(
10758 * response="401",
10759 * ref="#/components/responses/unauthorized"
10760 * ),
10761 * @OA\Response(
10762 * response="404",
10763 * ref="#/components/responses/uuidnotfound"
10764 * ),
10765 * security={{"openemr_auth":{}}}
10768 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10769 $patientUUID = null;
10770 if (!$request->isPatientRequest()) {
10771 RestConfig::authorization_check("admin", "users");
10772 } else {
10773 $patientUUID = $request->getPatientUUIDString();
10775 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10777 RestConfig::apiLog($return);
10778 return $return;
10782 * @OA\Post(
10783 * path="/fhir/Organization",
10784 * description="Adds a Organization resource.",
10785 * tags={"fhir"},
10786 * @OA\RequestBody(
10787 * required=true,
10788 * @OA\MediaType(
10789 * mediaType="application/json",
10790 * @OA\Schema(
10791 * description="The json object for the Organization resource.",
10792 * type="object"
10793 * ),
10794 * example={
10795 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10796 * "meta": {
10797 * "versionId": "1",
10798 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10799 * },
10800 * "resourceType": "Organization",
10801 * "text": {
10802 * "status": "generated",
10803 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10804 * },
10805 * "identifier": {
10807 * "system": "http://hl7.org/fhir/sid/us-npi",
10808 * "value": "1234567890"
10810 * },
10811 * "active": true,
10812 * "type": {
10814 * "coding": {
10816 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10817 * "code": "prov",
10818 * "display": "Healthcare Provider"
10822 * },
10823 * "name": "Your Clinic Name Here Hey",
10824 * "telecom": {
10826 * "system": "phone",
10827 * "value": "000-000-0000",
10828 * "use": "work"
10829 * },
10831 * "system": "fax",
10832 * "value": "000-000-0000",
10833 * "use": "work"
10835 * },
10836 * "address": {
10837 * null
10841 * ),
10842 * @OA\Response(
10843 * response="200",
10844 * description="Standard Response",
10845 * @OA\MediaType(
10846 * mediaType="application/json",
10847 * @OA\Schema(
10848 * @OA\Property(
10849 * property="json object",
10850 * description="FHIR Json object.",
10851 * type="object"
10852 * ),
10853 * example={
10854 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10855 * "meta": {
10856 * "versionId": "1",
10857 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10858 * },
10859 * "resourceType": "Organization",
10860 * "text": {
10861 * "status": "generated",
10862 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10863 * },
10864 * "identifier": {
10866 * "system": "http://hl7.org/fhir/sid/us-npi",
10867 * "value": "1234567890"
10869 * },
10870 * "active": true,
10871 * "type": {
10873 * "coding": {
10875 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10876 * "code": "prov",
10877 * "display": "Healthcare Provider"
10881 * },
10882 * "name": "Your Clinic Name Here Now",
10883 * "telecom": {
10885 * "system": "phone",
10886 * "value": "000-000-0000",
10887 * "use": "work"
10888 * },
10890 * "system": "fax",
10891 * "value": "000-000-0000",
10892 * "use": "work"
10894 * },
10895 * "address": {
10896 * null
10901 * ),
10902 * @OA\Response(
10903 * response="400",
10904 * ref="#/components/responses/badrequest"
10905 * ),
10906 * @OA\Response(
10907 * response="401",
10908 * ref="#/components/responses/unauthorized"
10909 * ),
10910 * security={{"openemr_auth":{}}}
10913 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10914 RestConfig::authorization_check("admin", "super");
10915 $data = (array) (json_decode(file_get_contents("php://input"), true));
10916 $return = (new FhirOrganizationRestController())->post($data);
10917 RestConfig::apiLog($return, $data);
10918 return $return;
10922 * @OA\Put(
10923 * path="/fhir/Organization/{uuid}",
10924 * description="Modifies a Organization resource.",
10925 * tags={"fhir"},
10926 * @OA\Parameter(
10927 * name="uuid",
10928 * in="path",
10929 * description="The uuid for the organization.",
10930 * required=true,
10931 * @OA\Schema(
10932 * type="string"
10934 * ),
10935 * @OA\RequestBody(
10936 * required=true,
10937 * @OA\MediaType(
10938 * mediaType="application/json",
10939 * @OA\Schema(
10940 * description="The json object for the Organization resource.",
10941 * type="object"
10942 * ),
10943 * example={
10944 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10945 * "meta": {
10946 * "versionId": "1",
10947 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10948 * },
10949 * "resourceType": "Organization",
10950 * "text": {
10951 * "status": "generated",
10952 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10953 * },
10954 * "identifier": {
10956 * "system": "http://hl7.org/fhir/sid/us-npi",
10957 * "value": "1234567890"
10959 * },
10960 * "active": true,
10961 * "type": {
10963 * "coding": {
10965 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10966 * "code": "prov",
10967 * "display": "Healthcare Provider"
10971 * },
10972 * "name": "Your Clinic Name Here",
10973 * "telecom": {
10975 * "system": "phone",
10976 * "value": "000-000-0000",
10977 * "use": "work"
10978 * },
10980 * "system": "fax",
10981 * "value": "000-000-0000",
10982 * "use": "work"
10984 * },
10985 * "address": {
10986 * null
10990 * ),
10991 * @OA\Response(
10992 * response="201",
10993 * description="Standard Response",
10994 * @OA\MediaType(
10995 * mediaType="application/json",
10996 * @OA\Schema(
10997 * example={
10998 * "id": 14,
10999 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11003 * ),
11004 * @OA\Response(
11005 * response="400",
11006 * ref="#/components/responses/badrequest"
11007 * ),
11008 * @OA\Response(
11009 * response="401",
11010 * ref="#/components/responses/unauthorized"
11011 * ),
11012 * security={{"openemr_auth":{}}}
11015 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
11016 RestConfig::authorization_check("admin", "super");
11017 $data = (array) (json_decode(file_get_contents("php://input"), true));
11018 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11019 RestConfig::apiLog($return, $data);
11020 return $return;
11024 * @OA\Post(
11025 * path="/fhir/Patient",
11026 * description="Adds a Patient resource.",
11027 * tags={"fhir"},
11028 * @OA\RequestBody(
11029 * required=true,
11030 * @OA\MediaType(
11031 * mediaType="application/json",
11032 * @OA\Schema(
11033 * description="The json object for the Patient resource.",
11034 * type="object"
11035 * ),
11036 * example={
11037 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11038 * "meta": {
11039 * "versionId": "1",
11040 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11041 * },
11042 * "resourceType": "Patient",
11043 * "text": {
11044 * "status": "generated",
11045 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11046 * },
11047 * "extension": {
11049 * "valueCode": "F",
11050 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11051 * },
11053 * "extension": {
11055 * "valueCoding": {
11056 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11057 * "code": "UNK",
11058 * "display": "Unknown"
11059 * },
11060 * "url": "ombCategory"
11061 * },
11063 * "valueString": "Unknown",
11064 * "url": "text"
11066 * },
11067 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11069 * },
11070 * "identifier": {
11072 * "use": "official",
11073 * "type": {
11074 * "coding": {
11076 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11077 * "code": "PT"
11080 * },
11081 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11082 * "value": "1"
11084 * },
11085 * "active": true,
11086 * "name": {
11088 * "use": "official",
11089 * "family": "Smith",
11090 * "given": {
11091 * "Brenda"
11094 * },
11095 * "gender": "female",
11096 * "birthDate": "2017-03-10",
11097 * "communication": {
11099 * "language": {
11100 * "coding": {
11102 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11103 * "code": "unknown",
11104 * "display": "Unknown"
11112 * ),
11113 * @OA\Response(
11114 * response="200",
11115 * description="Standard Response",
11116 * @OA\MediaType(
11117 * mediaType="application/json",
11118 * @OA\Schema(
11119 * @OA\Property(
11120 * property="json object",
11121 * description="FHIR Json object.",
11122 * type="object"
11123 * ),
11124 * example={
11125 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11126 * "meta": {
11127 * "versionId": "1",
11128 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11129 * },
11130 * "resourceType": "Patient",
11131 * "text": {
11132 * "status": "generated",
11133 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11134 * },
11135 * "extension": {
11137 * "valueCode": "F",
11138 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11139 * },
11141 * "extension": {
11143 * "valueCoding": {
11144 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11145 * "code": "UNK",
11146 * "display": "Unknown"
11147 * },
11148 * "url": "ombCategory"
11149 * },
11151 * "valueString": "Unknown",
11152 * "url": "text"
11154 * },
11155 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11157 * },
11158 * "identifier": {
11160 * "use": "official",
11161 * "type": {
11162 * "coding": {
11164 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11165 * "code": "PT"
11168 * },
11169 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11170 * "value": "1"
11172 * },
11173 * "active": true,
11174 * "name": {
11176 * "use": "official",
11177 * "family": "Smith",
11178 * "given": {
11179 * "Brenda"
11182 * },
11183 * "gender": "female",
11184 * "birthDate": "2017-03-10",
11185 * "communication": {
11187 * "language": {
11188 * "coding": {
11190 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11191 * "code": "unknown",
11192 * "display": "Unknown"
11201 * ),
11202 * @OA\Response(
11203 * response="400",
11204 * ref="#/components/responses/badrequest"
11205 * ),
11206 * @OA\Response(
11207 * response="401",
11208 * ref="#/components/responses/unauthorized"
11209 * ),
11210 * security={{"openemr_auth":{}}}
11213 "POST /fhir/Patient" => function (HttpRestRequest $request) {
11214 RestConfig::authorization_check("patients", "demo");
11215 $data = (array) (json_decode(file_get_contents("php://input"), true));
11216 $return = (new FhirPatientRestController())->post($data);
11217 RestConfig::apiLog($return, $data);
11218 return $return;
11222 * @OA\Put(
11223 * path="/fhir/Patient/{uuid}",
11224 * description="Modifies a Patient resource.",
11225 * tags={"fhir"},
11226 * @OA\Parameter(
11227 * name="uuid",
11228 * in="path",
11229 * description="The uuid for the Patient resource.",
11230 * required=true,
11231 * @OA\Schema(
11232 * type="string"
11234 * ),
11235 * @OA\RequestBody(
11236 * required=true,
11237 * @OA\MediaType(
11238 * mediaType="application/json",
11239 * @OA\Schema(
11240 * description="The json object for the Patient resource.",
11241 * type="object"
11242 * ),
11243 * example={
11244 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11245 * "meta": {
11246 * "versionId": "1",
11247 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11248 * },
11249 * "resourceType": "Patient",
11250 * "text": {
11251 * "status": "generated",
11252 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11253 * },
11254 * "extension": {
11256 * "valueCode": "F",
11257 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11258 * },
11260 * "extension": {
11262 * "valueCoding": {
11263 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11264 * "code": "UNK",
11265 * "display": "Unknown"
11266 * },
11267 * "url": "ombCategory"
11268 * },
11270 * "valueString": "Unknown",
11271 * "url": "text"
11273 * },
11274 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11276 * },
11277 * "identifier": {
11279 * "use": "official",
11280 * "type": {
11281 * "coding": {
11283 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11284 * "code": "PT"
11287 * },
11288 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11289 * "value": "1"
11291 * },
11292 * "active": true,
11293 * "name": {
11295 * "use": "official",
11296 * "family": "Smith",
11297 * "given": {
11298 * "Brenda"
11301 * },
11302 * "gender": "female",
11303 * "birthDate": "2017-03-10",
11304 * "communication": {
11306 * "language": {
11307 * "coding": {
11309 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11310 * "code": "unknown",
11311 * "display": "Unknown"
11319 * ),
11320 * @OA\Response(
11321 * response="201",
11322 * description="Standard Response",
11323 * @OA\MediaType(
11324 * mediaType="application/json",
11325 * @OA\Schema(
11326 * example={
11327 * "id": 2,
11328 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11332 * ),
11333 * @OA\Response(
11334 * response="400",
11335 * ref="#/components/responses/badrequest"
11336 * ),
11337 * @OA\Response(
11338 * response="401",
11339 * ref="#/components/responses/unauthorized"
11340 * ),
11341 * security={{"openemr_auth":{}}}
11344 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11345 RestConfig::authorization_check("patients", "demo");
11346 $data = (array) (json_decode(file_get_contents("php://input"), true));
11347 $return = (new FhirPatientRestController())->put($uuid, $data);
11348 RestConfig::apiLog($return, $data);
11349 return $return;
11353 * @OA\Get(
11354 * path="/fhir/Patient",
11355 * description="Returns a list of Patient resources.",
11356 * tags={"fhir"},
11357 * @OA\Parameter(
11358 * name="_id",
11359 * in="query",
11360 * description="The uuid for the Patient resource.",
11361 * required=false,
11362 * @OA\Schema(
11363 * type="string"
11365 * ),
11366 * @OA\Parameter(
11367 * name="identifier",
11368 * in="query",
11369 * description="The identifier of the Patient resource.",
11370 * required=false,
11371 * @OA\Schema(
11372 * type="string"
11374 * ),
11375 * @OA\Parameter(
11376 * name="name",
11377 * in="query",
11378 * description="The name of the Patient resource.",
11379 * required=false,
11380 * @OA\Schema(
11381 * type="string"
11383 * ),
11384 * @OA\Parameter(
11385 * name="birthdate",
11386 * in="query",
11387 * description="The birthdate of the Patient resource.",
11388 * required=false,
11389 * @OA\Schema(
11390 * type="string"
11392 * ),
11393 * @OA\Parameter(
11394 * name="gender",
11395 * in="query",
11396 * description="The gender of the Patient resource.",
11397 * required=false,
11398 * @OA\Schema(
11399 * type="string"
11401 * ),
11402 * @OA\Parameter(
11403 * name="address",
11404 * in="query",
11405 * description="The address of the Patient resource.",
11406 * required=false,
11407 * @OA\Schema(
11408 * type="string"
11410 * ),
11411 * @OA\Parameter(
11412 * name="address-city",
11413 * in="query",
11414 * description="The address-city of the Patient resource.",
11415 * required=false,
11416 * @OA\Schema(
11417 * type="string"
11419 * ),
11420 * @OA\Parameter(
11421 * name="address-postalcode",
11422 * in="query",
11423 * description="The address-postalcode of the Patient resource.",
11424 * required=false,
11425 * @OA\Schema(
11426 * type="string"
11428 * ),
11429 * @OA\Parameter(
11430 * name="address-state",
11431 * in="query",
11432 * description="The address-state of the Patient resource.",
11433 * required=false,
11434 * @OA\Schema(
11435 * type="string"
11437 * ),
11438 * @OA\Parameter(
11439 * name="email",
11440 * in="query",
11441 * description="The email of the Patient resource.",
11442 * required=false,
11443 * @OA\Schema(
11444 * type="string"
11446 * ),
11447 * @OA\Parameter(
11448 * name="family",
11449 * in="query",
11450 * description="The family name of the Patient resource.",
11451 * required=false,
11452 * @OA\Schema(
11453 * type="string"
11455 * ),
11456 * @OA\Parameter(
11457 * name="given",
11458 * in="query",
11459 * description="The given name of the Patient resource.",
11460 * required=false,
11461 * @OA\Schema(
11462 * type="string"
11464 * ),
11465 * @OA\Parameter(
11466 * name="phone",
11467 * in="query",
11468 * description="The phone number of the Patient resource.",
11469 * required=false,
11470 * @OA\Schema(
11471 * type="string"
11473 * ),
11474 * @OA\Parameter(
11475 * name="telecom",
11476 * in="query",
11477 * description="The fax number of the Patient resource.",
11478 * required=false,
11479 * @OA\Schema(
11480 * type="string"
11482 * ),
11483 * @OA\Parameter(
11484 * ref="#/components/parameters/_lastUpdated"
11485 * ),
11486 * @OA\Response(
11487 * response="200",
11488 * description="Standard Response",
11489 * @OA\MediaType(
11490 * mediaType="application/json",
11491 * @OA\Schema(
11492 * @OA\Property(
11493 * property="json object",
11494 * description="FHIR Json object.",
11495 * type="object"
11496 * ),
11497 * example={
11498 * "meta": {
11499 * "lastUpdated": "2021-09-14T09:13:51"
11500 * },
11501 * "resourceType": "Bundle",
11502 * "type": "collection",
11503 * "total": 0,
11504 * "link": {
11506 * "relation": "self",
11507 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11513 * ),
11514 * @OA\Response(
11515 * response="400",
11516 * ref="#/components/responses/badrequest"
11517 * ),
11518 * @OA\Response(
11519 * response="401",
11520 * ref="#/components/responses/unauthorized"
11521 * ),
11522 * security={{"openemr_auth":{}}}
11525 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11526 $params = $request->getQueryParams();
11527 if ($request->isPatientRequest()) {
11528 // only allow access to data of binded patient
11529 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11530 // need to use getAll rather than getOne)
11531 $params['_id'] = $request->getPatientUUIDString();
11532 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11533 } else {
11534 RestConfig::authorization_check("patients", "demo");
11535 $return = (new FhirPatientRestController())->getAll($params);
11537 RestConfig::apiLog($return);
11538 return $return;
11542 * @OA\Get(
11543 * path="/fhir/Patient/$export",
11544 * 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>",
11545 * tags={"fhir"},
11546 * @OA\Response(
11547 * response="200",
11548 * 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>"
11549 * ),
11550 * @OA\Response(
11551 * response="400",
11552 * ref="#/components/responses/badrequest"
11553 * ),
11554 * @OA\Response(
11555 * response="401",
11556 * ref="#/components/responses/unauthorized"
11557 * ),
11558 * security={{"openemr_auth":{}}}
11561 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11562 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11563 RestConfig::authorization_check("admin", "users");
11564 $fhirExportService = new FhirOperationExportRestController($request);
11565 $return = $fhirExportService->processExport(
11566 $request->getQueryParams(),
11567 'Patient',
11568 $request->getHeader('Accept')[0] ?? '',
11569 $request->getHeader('Prefer')[0] ?? ''
11571 RestConfig::apiLog($return);
11572 return $return;
11576 * @OA\Get(
11577 * path="/fhir/Patient/{uuid}",
11578 * description="Returns a single Patient resource.",
11579 * tags={"fhir"},
11580 * @OA\Parameter(
11581 * name="uuid",
11582 * in="path",
11583 * description="The uuid for the Patient resource.",
11584 * required=true,
11585 * @OA\Schema(
11586 * type="string"
11588 * ),
11589 * @OA\Response(
11590 * response="200",
11591 * description="Standard Response",
11592 * @OA\MediaType(
11593 * mediaType="application/json",
11594 * @OA\Schema(
11595 * @OA\Property(
11596 * property="json object",
11597 * description="FHIR Json object.",
11598 * type="object"
11599 * ),
11600 * example={
11601 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11602 * "meta": {
11603 * "versionId": "1",
11604 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11605 * },
11606 * "resourceType": "Patient",
11607 * "text": {
11608 * "status": "generated",
11609 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11610 * },
11611 * "extension": {
11613 * "valueCode": "F",
11614 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11615 * },
11617 * "extension": {
11619 * "valueCoding": {
11620 * "system": "urn:oid:2.16.840.1.113883.6.238",
11621 * "code": "1006-6",
11622 * "display": "Abenaki"
11623 * },
11624 * "url": "ombCategory"
11625 * },
11627 * "valueString": "Abenaki",
11628 * "url": "text"
11630 * },
11631 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11632 * },
11634 * "extension": {
11636 * "valueString": "Declined To Specify",
11637 * "url": "text"
11639 * },
11640 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11642 * },
11643 * "identifier": {
11645 * "use": "official",
11646 * "type": {
11647 * "coding": {
11649 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11650 * "code": "PT"
11653 * },
11654 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11655 * "value": "1"
11657 * },
11658 * "active": true,
11659 * "name": {
11661 * "use": "official",
11662 * "family": "Von197",
11663 * "given": {
11664 * "Aurore252"
11667 * },
11668 * "gender": "female",
11669 * "birthDate": "1970-07-03",
11670 * "address": {
11672 * "line": {
11673 * "245 Crona Wall"
11674 * },
11675 * "city": "Boston",
11676 * "state": "Massachusetts",
11677 * "postalCode": "02215",
11678 * "period": {
11679 * "start": "2020-09-21T17:08:03.532+00:00"
11682 * },
11683 * "communication": {
11685 * "language": {
11686 * "coding": {
11688 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11689 * "code": "unknown",
11690 * "display": "Unknown"
11699 * ),
11700 * @OA\Response(
11701 * response="400",
11702 * ref="#/components/responses/badrequest"
11703 * ),
11704 * @OA\Response(
11705 * response="401",
11706 * ref="#/components/responses/unauthorized"
11707 * ),
11708 * @OA\Response(
11709 * response="404",
11710 * ref="#/components/responses/uuidnotfound"
11711 * ),
11712 * security={{"openemr_auth":{}}}
11715 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11716 if ($request->isPatientRequest()) {
11717 // only allow access to data of binded patient
11718 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11719 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11721 $uuid = $request->getPatientUUIDString();
11722 } else {
11723 RestConfig::authorization_check("patients", "demo");
11725 $return = (new FhirPatientRestController())->getOne($uuid);
11726 RestConfig::apiLog($return);
11727 return $return;
11731 * @OA\Get(
11732 * path="/fhir/Person",
11733 * description="Returns a list of Person resources.",
11734 * tags={"fhir"},
11735 * @OA\Parameter(
11736 * name="name",
11737 * in="query",
11738 * description="The name of the Person resource.",
11739 * required=false,
11740 * @OA\Schema(
11741 * type="string"
11743 * ),
11744 * @OA\Parameter(
11745 * name="active",
11746 * in="query",
11747 * description="The active status of the Person resource.",
11748 * required=false,
11749 * @OA\Schema(
11750 * type="string"
11752 * ),
11753 * @OA\Parameter(
11754 * name="address",
11755 * in="query",
11756 * description="The address of the Person resource.",
11757 * required=false,
11758 * @OA\Schema(
11759 * type="string"
11761 * ),
11762 * @OA\Parameter(
11763 * name="address-city",
11764 * in="query",
11765 * description="The address-city of the Person resource.",
11766 * required=false,
11767 * @OA\Schema(
11768 * type="string"
11770 * ),
11771 * @OA\Parameter(
11772 * name="address-postalcode",
11773 * in="query",
11774 * description="The address-postalcode of the Person resource.",
11775 * required=false,
11776 * @OA\Schema(
11777 * type="string"
11779 * ),
11780 * @OA\Parameter(
11781 * name="address-state",
11782 * in="query",
11783 * description="The address-state of the Person resource.",
11784 * required=false,
11785 * @OA\Schema(
11786 * type="string"
11788 * ),
11789 * @OA\Parameter(
11790 * name="email",
11791 * in="query",
11792 * description="The email of the Person resource.",
11793 * required=false,
11794 * @OA\Schema(
11795 * type="string"
11797 * ),
11798 * @OA\Parameter(
11799 * name="family",
11800 * in="query",
11801 * description="The family name of the Person resource.",
11802 * required=false,
11803 * @OA\Schema(
11804 * type="string"
11806 * ),
11807 * @OA\Parameter(
11808 * name="given",
11809 * in="query",
11810 * description="The given name of the Person resource.",
11811 * required=false,
11812 * @OA\Schema(
11813 * type="string"
11815 * ),
11816 * @OA\Parameter(
11817 * name="phone",
11818 * in="query",
11819 * description="The phone number of the Person resource.",
11820 * required=false,
11821 * @OA\Schema(
11822 * type="string"
11824 * ),
11825 * @OA\Parameter(
11826 * name="telecom",
11827 * in="query",
11828 * description="The fax number of the Person resource.",
11829 * required=false,
11830 * @OA\Schema(
11831 * type="string"
11833 * ),
11834 * @OA\Response(
11835 * response="200",
11836 * description="Standard Response",
11837 * @OA\MediaType(
11838 * mediaType="application/json",
11839 * @OA\Schema(
11840 * @OA\Property(
11841 * property="json object",
11842 * description="FHIR Json object.",
11843 * type="object"
11844 * ),
11845 * example={
11846 * "meta": {
11847 * "lastUpdated": "2021-09-14T09:13:51"
11848 * },
11849 * "resourceType": "Bundle",
11850 * "type": "collection",
11851 * "total": 0,
11852 * "link": {
11854 * "relation": "self",
11855 * "url": "https://localhost:9300/apis/default/fhir/Person"
11861 * ),
11862 * @OA\Response(
11863 * response="400",
11864 * ref="#/components/responses/badrequest"
11865 * ),
11866 * @OA\Response(
11867 * response="401",
11868 * ref="#/components/responses/unauthorized"
11869 * ),
11870 * security={{"openemr_auth":{}}}
11873 "GET /fhir/Person" => function (HttpRestRequest $request) {
11874 RestConfig::authorization_check("admin", "users");
11875 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11876 RestConfig::apiLog($return);
11877 return $return;
11881 * @OA\Get(
11882 * path="/fhir/Person/{uuid}",
11883 * description="Returns a single Person resource.",
11884 * tags={"fhir"},
11885 * @OA\Parameter(
11886 * name="uuid",
11887 * in="path",
11888 * description="The uuid for the Person resource.",
11889 * required=true,
11890 * @OA\Schema(
11891 * type="string"
11893 * ),
11894 * @OA\Response(
11895 * response="200",
11896 * description="Standard Response",
11897 * @OA\MediaType(
11898 * mediaType="application/json",
11899 * @OA\Schema(
11900 * @OA\Property(
11901 * property="json object",
11902 * description="FHIR Json object.",
11903 * type="object"
11904 * ),
11905 * example={
11906 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11907 * "meta": {
11908 * "versionId": "1",
11909 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11910 * },
11911 * "resourceType": "Person",
11912 * "text": {
11913 * "status": "generated",
11914 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11915 * },
11916 * "name": {
11918 * "use": "official",
11919 * "family": "Administrator",
11920 * "given": {
11921 * "Administrator",
11922 * "Larry"
11925 * },
11926 * "telecom": {
11928 * "system": "phone",
11929 * "value": "1234567890",
11930 * "use": "home"
11931 * },
11933 * "system": "phone",
11934 * "value": "1234567890",
11935 * "use": "work"
11936 * },
11938 * "system": "phone",
11939 * "value": "1234567890",
11940 * "use": "mobile"
11941 * },
11943 * "system": "email",
11944 * "value": "hey@hey.com",
11945 * "use": "home"
11947 * },
11948 * "address": {
11950 * "line": {
11951 * "123 Lane Street"
11952 * },
11953 * "city": "Bellevue",
11954 * "state": "WA",
11955 * "period": {
11956 * "start": "2021-04-13T08:57:32.146+00:00"
11959 * },
11960 * "active": true
11964 * ),
11965 * @OA\Response(
11966 * response="400",
11967 * ref="#/components/responses/badrequest"
11968 * ),
11969 * @OA\Response(
11970 * response="401",
11971 * ref="#/components/responses/unauthorized"
11972 * ),
11973 * @OA\Response(
11974 * response="404",
11975 * ref="#/components/responses/uuidnotfound"
11976 * ),
11977 * security={{"openemr_auth":{}}}
11980 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11981 // if the api user is requesting their own user we need to let it through
11982 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11983 // for the currently logged in user
11984 if ($request->getRequestUserUUIDString() == $uuid) {
11985 $return = (new FhirPersonRestController())->getOne($uuid);
11986 } else if (!$request->isPatientRequest()) {
11987 // not a patient ,make sure we have access to the users ACL
11988 RestConfig::authorization_check("admin", "users");
11989 $return = (new FhirPersonRestController())->getOne($uuid);
11990 } else {
11991 // if we are a patient bound request we need to make sure we are only bound to the patient
11992 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
11995 RestConfig::apiLog($return);
11996 return $return;
12000 * @OA\Get(
12001 * path="/fhir/Practitioner",
12002 * description="Returns a list of Practitioner resources.",
12003 * tags={"fhir"},
12004 * @OA\Parameter(
12005 * name="_id",
12006 * in="query",
12007 * description="The uuid for the Practitioner resource.",
12008 * required=false,
12009 * @OA\Schema(
12010 * type="string"
12012 * ),
12013 * @OA\Parameter(
12014 * name="name",
12015 * in="query",
12016 * description="The name of the Practitioner resource.",
12017 * required=false,
12018 * @OA\Schema(
12019 * type="string"
12021 * ),
12022 * @OA\Parameter(
12023 * name="active",
12024 * in="query",
12025 * description="The active status of the Practitioner resource.",
12026 * required=false,
12027 * @OA\Schema(
12028 * type="string"
12030 * ),
12031 * @OA\Parameter(
12032 * name="address",
12033 * in="query",
12034 * description="The address of the Practitioner resource.",
12035 * required=false,
12036 * @OA\Schema(
12037 * type="string"
12039 * ),
12040 * @OA\Parameter(
12041 * name="address-city",
12042 * in="query",
12043 * description="The address-city of the Practitioner resource.",
12044 * required=false,
12045 * @OA\Schema(
12046 * type="string"
12048 * ),
12049 * @OA\Parameter(
12050 * name="address-postalcode",
12051 * in="query",
12052 * description="The address-postalcode of the Practitioner resource.",
12053 * required=false,
12054 * @OA\Schema(
12055 * type="string"
12057 * ),
12058 * @OA\Parameter(
12059 * name="address-state",
12060 * in="query",
12061 * description="The address-state of the Practitioner resource.",
12062 * required=false,
12063 * @OA\Schema(
12064 * type="string"
12066 * ),
12067 * @OA\Parameter(
12068 * name="email",
12069 * in="query",
12070 * description="The email of the Practitioner resource.",
12071 * required=false,
12072 * @OA\Schema(
12073 * type="string"
12075 * ),
12076 * @OA\Parameter(
12077 * name="family",
12078 * in="query",
12079 * description="The family name of the Practitioner resource.",
12080 * required=false,
12081 * @OA\Schema(
12082 * type="string"
12084 * ),
12085 * @OA\Parameter(
12086 * name="given",
12087 * in="query",
12088 * description="The given name of the Practitioner resource.",
12089 * required=false,
12090 * @OA\Schema(
12091 * type="string"
12093 * ),
12094 * @OA\Parameter(
12095 * name="phone",
12096 * in="query",
12097 * description="The phone number of the Practitioner resource.",
12098 * required=false,
12099 * @OA\Schema(
12100 * type="string"
12102 * ),
12103 * @OA\Parameter(
12104 * name="telecom",
12105 * in="query",
12106 * description="The fax number of the Practitioner resource.",
12107 * required=false,
12108 * @OA\Schema(
12109 * type="string"
12111 * ),
12112 * @OA\Response(
12113 * response="200",
12114 * description="Standard Response",
12115 * @OA\MediaType(
12116 * mediaType="application/json",
12117 * @OA\Schema(
12118 * @OA\Property(
12119 * property="json object",
12120 * description="FHIR Json object.",
12121 * type="object"
12122 * ),
12123 * example={
12124 * "meta": {
12125 * "lastUpdated": "2021-09-14T09:13:51"
12126 * },
12127 * "resourceType": "Bundle",
12128 * "type": "collection",
12129 * "total": 0,
12130 * "link": {
12132 * "relation": "self",
12133 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12139 * ),
12140 * @OA\Response(
12141 * response="400",
12142 * ref="#/components/responses/badrequest"
12143 * ),
12144 * @OA\Response(
12145 * response="401",
12146 * ref="#/components/responses/unauthorized"
12147 * ),
12148 * security={{"openemr_auth":{}}}
12151 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
12153 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12154 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12155 // I don't believe patients are assigned to a particular practitioner
12156 // should we allow just open api access to admin information? Should we restrict particular pieces
12157 // of data in the practitioner side (phone number, address information) based on a permission set?
12158 if (!$request->isPatientRequest()) {
12159 RestConfig::authorization_check("admin", "users");
12161 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12162 RestConfig::apiLog($return);
12163 return $return;
12167 * @OA\Get(
12168 * path="/fhir/Practitioner/{uuid}",
12169 * description="Returns a single Practitioner resource.",
12170 * tags={"fhir"},
12171 * @OA\Parameter(
12172 * name="uuid",
12173 * in="path",
12174 * description="The uuid for the Practitioner resource.",
12175 * required=true,
12176 * @OA\Schema(
12177 * type="string"
12179 * ),
12180 * @OA\Response(
12181 * response="200",
12182 * description="Standard Response",
12183 * @OA\MediaType(
12184 * mediaType="application/json",
12185 * @OA\Schema(
12186 * @OA\Property(
12187 * property="json object",
12188 * description="FHIR Json object.",
12189 * type="object"
12190 * ),
12191 * example={
12192 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12193 * "meta": {
12194 * "versionId": "1",
12195 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12196 * },
12197 * "resourceType": "Practitioner",
12198 * "text": {
12199 * "status": "generated",
12200 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12201 * },
12202 * "identifier": {
12204 * "system": "http://hl7.org/fhir/sid/us-npi",
12205 * "value": "11223344554543"
12207 * },
12208 * "active": true,
12209 * "name": {
12211 * "use": "official",
12212 * "family": "Smith",
12213 * "given": {
12214 * "Billy"
12221 * ),
12222 * @OA\Response(
12223 * response="400",
12224 * ref="#/components/responses/badrequest"
12225 * ),
12226 * @OA\Response(
12227 * response="401",
12228 * ref="#/components/responses/unauthorized"
12229 * ),
12230 * @OA\Response(
12231 * response="404",
12232 * ref="#/components/responses/uuidnotfound"
12233 * ),
12234 * security={{"openemr_auth":{}}}
12237 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12238 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12239 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12240 // I don't believe patients are assigned to a particular practitioner
12241 // should we allow just open api access to admin information? Should we restrict particular pieces
12242 // of data in the practitioner side (phone number, address information) based on a permission set?
12243 if (!$request->isPatientRequest()) {
12244 RestConfig::authorization_check("admin", "users");
12246 $return = (new FhirPractitionerRestController())->getOne($uuid);
12247 RestConfig::apiLog($return);
12248 return $return;
12252 * @OA\Post(
12253 * path="/fhir/Practitioner",
12254 * description="Adds a Practitioner resources.",
12255 * tags={"fhir"},
12256 * @OA\RequestBody(
12257 * required=true,
12258 * @OA\MediaType(
12259 * mediaType="application/json",
12260 * @OA\Schema(
12261 * description="The json object for the Practitioner resource.",
12262 * type="object"
12263 * ),
12264 * example={
12265 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12266 * "meta": {
12267 * "versionId": "1",
12268 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12269 * },
12270 * "resourceType": "Practitioner",
12271 * "text": {
12272 * "status": "generated",
12273 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12274 * },
12275 * "identifier": {
12277 * "system": "http://hl7.org/fhir/sid/us-npi",
12278 * "value": "11223344554543"
12280 * },
12281 * "active": true,
12282 * "name": {
12284 * "use": "official",
12285 * "family": "Smith",
12286 * "given": {
12287 * "Danny"
12293 * ),
12294 * @OA\Response(
12295 * response="200",
12296 * description="Standard Response",
12297 * @OA\MediaType(
12298 * mediaType="application/json",
12299 * @OA\Schema(
12300 * @OA\Property(
12301 * property="json object",
12302 * description="FHIR Json object.",
12303 * type="object"
12304 * ),
12305 * example={
12306 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12307 * "meta": {
12308 * "versionId": "1",
12309 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12310 * },
12311 * "resourceType": "Practitioner",
12312 * "text": {
12313 * "status": "generated",
12314 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12315 * },
12316 * "identifier": {
12318 * "system": "http://hl7.org/fhir/sid/us-npi",
12319 * "value": "11223344554543"
12321 * },
12322 * "active": true,
12323 * "name": {
12325 * "use": "official",
12326 * "family": "Smith",
12327 * "given": {
12328 * "Danny"
12335 * ),
12336 * @OA\Response(
12337 * response="400",
12338 * ref="#/components/responses/badrequest"
12339 * ),
12340 * @OA\Response(
12341 * response="401",
12342 * ref="#/components/responses/unauthorized"
12343 * ),
12344 * security={{"openemr_auth":{}}}
12347 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
12348 RestConfig::authorization_check("admin", "users");
12349 $data = (array) (json_decode(file_get_contents("php://input"), true));
12350 $return = (new FhirPractitionerRestController())->post($data);
12351 RestConfig::apiLog($return, $data);
12352 return $return;
12356 * @OA\Put(
12357 * path="/fhir/Practitioner/{uuid}",
12358 * description="Modify a Practitioner resource.",
12359 * tags={"fhir"},
12360 * @OA\Parameter(
12361 * name="uuid",
12362 * in="path",
12363 * description="The uuid for the Practitioner resource.",
12364 * required=true,
12365 * @OA\Schema(
12366 * type="string"
12368 * ),
12369 * @OA\RequestBody(
12370 * required=true,
12371 * @OA\MediaType(
12372 * mediaType="application/json",
12373 * @OA\Schema(
12374 * description="The json object for the Practitioner resource.",
12375 * type="object"
12376 * ),
12377 * example={
12378 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12379 * "meta": {
12380 * "versionId": "1",
12381 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12382 * },
12383 * "resourceType": "Practitioner",
12384 * "text": {
12385 * "status": "generated",
12386 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12387 * },
12388 * "identifier": {
12390 * "system": "http://hl7.org/fhir/sid/us-npi",
12391 * "value": "11223344554543"
12393 * },
12394 * "active": true,
12395 * "name": {
12397 * "use": "official",
12398 * "family": "Smith",
12399 * "given": {
12400 * "Billy"
12406 * ),
12407 * @OA\Response(
12408 * response="201",
12409 * description="Standard Response",
12410 * @OA\MediaType(
12411 * mediaType="application/json",
12412 * @OA\Schema(
12413 * example={
12414 * "id": 5,
12415 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12419 * ),
12420 * @OA\Response(
12421 * response="400",
12422 * ref="#/components/responses/badrequest"
12423 * ),
12424 * @OA\Response(
12425 * response="401",
12426 * ref="#/components/responses/unauthorized"
12427 * ),
12428 * security={{"openemr_auth":{}}}
12431 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12432 RestConfig::authorization_check("admin", "users");
12433 $data = (array) (json_decode(file_get_contents("php://input"), true));
12434 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12435 RestConfig::apiLog($return, $data);
12436 return $return;
12440 * @OA\Get(
12441 * path="/fhir/PractitionerRole",
12442 * description="Returns a list of PractitionerRole resources.",
12443 * tags={"fhir"},
12444 * @OA\Parameter(
12445 * name="specialty",
12446 * in="query",
12447 * description="The specialty of the PractitionerRole resource.",
12448 * required=false,
12449 * @OA\Schema(
12450 * type="string"
12452 * ),
12453 * @OA\Parameter(
12454 * name="practitioner",
12455 * in="query",
12456 * description="The practitioner of the PractitionerRole resource.",
12457 * required=false,
12458 * @OA\Schema(
12459 * type="string"
12461 * ),
12462 * @OA\Response(
12463 * response="200",
12464 * description="Standard Response",
12465 * @OA\MediaType(
12466 * mediaType="application/json",
12467 * @OA\Schema(
12468 * @OA\Property(
12469 * property="json object",
12470 * description="FHIR Json object.",
12471 * type="object"
12472 * ),
12473 * example={
12474 * "meta": {
12475 * "lastUpdated": "2021-09-14T09:13:51"
12476 * },
12477 * "resourceType": "Bundle",
12478 * "type": "collection",
12479 * "total": 0,
12480 * "link": {
12482 * "relation": "self",
12483 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12489 * ),
12490 * @OA\Response(
12491 * response="400",
12492 * ref="#/components/responses/badrequest"
12493 * ),
12494 * @OA\Response(
12495 * response="401",
12496 * ref="#/components/responses/unauthorized"
12497 * ),
12498 * security={{"openemr_auth":{}}}
12501 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12502 RestConfig::authorization_check("admin", "users");
12503 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12504 RestConfig::apiLog($return);
12505 return $return;
12509 * @OA\Get(
12510 * path="/fhir/PractitionerRole/{uuid}",
12511 * description="Returns a single PractitionerRole resource.",
12512 * tags={"fhir"},
12513 * @OA\Parameter(
12514 * name="uuid",
12515 * in="path",
12516 * description="The uuid for the PractitionerRole resource.",
12517 * required=true,
12518 * @OA\Schema(
12519 * type="string"
12521 * ),
12522 * @OA\Response(
12523 * response="200",
12524 * description="Standard Response",
12525 * @OA\MediaType(
12526 * mediaType="application/json",
12527 * @OA\Schema(
12528 * @OA\Property(
12529 * property="json object",
12530 * description="FHIR Json object.",
12531 * type="object"
12532 * ),
12533 * example={
12534 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12535 * "meta": {
12536 * "versionId": "1",
12537 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12538 * },
12539 * "resourceType": "PractitionerRole",
12540 * "practitioner": {
12541 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12542 * "display": "Administrator Administrator"
12543 * },
12544 * "organization": {
12545 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12546 * "display": "Your Clinic Name Here"
12547 * },
12548 * "code": {
12550 * "coding": {
12551 * "102L00000X"
12552 * },
12553 * "text": "Psychoanalyst"
12554 * },
12556 * "coding": {
12557 * "101Y00000X"
12558 * },
12559 * "text": "Counselor"
12565 * ),
12566 * @OA\Response(
12567 * response="400",
12568 * ref="#/components/responses/badrequest"
12569 * ),
12570 * @OA\Response(
12571 * response="401",
12572 * ref="#/components/responses/unauthorized"
12573 * ),
12574 * @OA\Response(
12575 * response="404",
12576 * ref="#/components/responses/uuidnotfound"
12577 * ),
12578 * security={{"openemr_auth":{}}}
12581 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12582 RestConfig::authorization_check("admin", "users");
12583 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12584 RestConfig::apiLog($return);
12585 return $return;
12589 * @OA\Get(
12590 * path="/fhir/Procedure",
12591 * description="Returns a list of Procedure resources.",
12592 * tags={"fhir"},
12593 * @OA\Parameter(
12594 * name="_id",
12595 * in="query",
12596 * description="The uuid for the Procedure resource.",
12597 * required=false,
12598 * @OA\Schema(
12599 * type="string"
12601 * ),
12602 * @OA\Parameter(
12603 * name="patient",
12604 * in="query",
12605 * description="The uuid for the patient.",
12606 * required=false,
12607 * @OA\Schema(
12608 * type="string"
12610 * ),
12611 * @OA\Parameter(
12612 * name="date",
12613 * in="query",
12614 * description="The datetime of the Procedure resource.",
12615 * required=false,
12616 * @OA\Schema(
12617 * type="string"
12619 * ),
12620 * @OA\Response(
12621 * response="200",
12622 * description="Standard Response",
12623 * @OA\MediaType(
12624 * mediaType="application/json",
12625 * @OA\Schema(
12626 * @OA\Property(
12627 * property="json object",
12628 * description="FHIR Json object.",
12629 * type="object"
12630 * ),
12631 * example={
12632 * "meta": {
12633 * "lastUpdated": "2021-09-14T09:13:51"
12634 * },
12635 * "resourceType": "Bundle",
12636 * "type": "collection",
12637 * "total": 0,
12638 * "link": {
12640 * "relation": "self",
12641 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12647 * ),
12648 * @OA\Response(
12649 * response="400",
12650 * ref="#/components/responses/badrequest"
12651 * ),
12652 * @OA\Response(
12653 * response="401",
12654 * ref="#/components/responses/unauthorized"
12655 * ),
12656 * security={{"openemr_auth":{}}}
12659 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12660 if ($request->isPatientRequest()) {
12661 // only allow access to data of binded patient
12662 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12663 } else {
12664 RestConfig::authorization_check("patients", "med");
12665 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12667 RestConfig::apiLog($return);
12668 return $return;
12672 * @OA\Get(
12673 * path="/fhir/Procedure/{uuid}",
12674 * description="Returns a single Procedure resource.",
12675 * tags={"fhir"},
12676 * @OA\Parameter(
12677 * name="uuid",
12678 * in="path",
12679 * description="The uuid for the Procedure resource.",
12680 * required=true,
12681 * @OA\Schema(
12682 * type="string"
12684 * ),
12685 * @OA\Response(
12686 * response="200",
12687 * description="Standard Response",
12688 * @OA\MediaType(
12689 * mediaType="application/json",
12690 * @OA\Schema(
12691 * @OA\Property(
12692 * property="json object",
12693 * description="FHIR Json object.",
12694 * type="object"
12695 * ),
12696 * example={
12697 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12698 * "meta": {
12699 * "versionId": "1",
12700 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12701 * },
12702 * "resourceType": "Procedure",
12703 * "status": "in-progress",
12704 * "subject": {
12705 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12706 * "type": "Patient"
12711 * ),
12712 * @OA\Response(
12713 * response="400",
12714 * ref="#/components/responses/badrequest"
12715 * ),
12716 * @OA\Response(
12717 * response="401",
12718 * ref="#/components/responses/unauthorized"
12719 * ),
12720 * @OA\Response(
12721 * response="404",
12722 * ref="#/components/responses/uuidnotfound"
12723 * ),
12724 * security={{"openemr_auth":{}}}
12727 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12728 if ($request->isPatientRequest()) {
12729 // only allow access to data of binded patient
12730 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12731 } else {
12732 RestConfig::authorization_check("patients", "med");
12733 $return = (new FhirProcedureRestController())->getOne($uuid);
12735 RestConfig::apiLog($return);
12736 return $return;
12740 * @OA\Get(
12741 * path="/fhir/Provenance/{uuid}",
12742 * description="Returns a single Provenance resource.",
12743 * tags={"fhir"},
12744 * @OA\Parameter(
12745 * name="uuid",
12746 * in="path",
12747 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12748 * required=true,
12749 * @OA\Schema(
12750 * type="string"
12752 * ),
12753 * @OA\Response(
12754 * response="200",
12755 * description="Standard Response",
12756 * @OA\MediaType(
12757 * mediaType="application/json",
12758 * @OA\Schema(
12759 * @OA\Property(
12760 * property="json object",
12761 * description="FHIR Json object.",
12762 * type="object"
12763 * ),
12764 * example={
12765 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12766 * "resourceType": "Provenance",
12767 * "target": {
12769 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12770 * "type": "AllergyIntolerance"
12772 * },
12773 * "recorded": "2022-03-26T22:43:30+00:00",
12774 * "agent": {
12776 * "type": {
12777 * "coding": {
12779 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12780 * "code": "author",
12781 * "display": "Author"
12784 * },
12785 * "who": {
12786 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12787 * "type": "Organization"
12788 * },
12789 * "onBehalfOf": {
12790 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12791 * "type": "Organization"
12793 * },
12795 * "type": {
12796 * "coding": {
12798 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12799 * "code": "transmitter",
12800 * "display": "Transmitter"
12804 * },
12805 * "who": {
12806 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12807 * "type": "Organization"
12808 * },
12809 * "onBehalfOf": {
12810 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12811 * "type": "Organization"
12817 * ),
12818 * @OA\Response(
12819 * response="400",
12820 * ref="#/components/responses/badrequest"
12821 * ),
12822 * @OA\Response(
12823 * response="401",
12824 * ref="#/components/responses/unauthorized"
12825 * ),
12826 * @OA\Response(
12827 * response="404",
12828 * ref="#/components/responses/uuidnotfound"
12829 * ),
12830 * security={{"openemr_auth":{}}}
12833 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12834 if ($request->isPatientRequest()) {
12835 // only allow access to data of binded patient
12836 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12837 } else {
12838 RestConfig::authorization_check("admin", "super");
12839 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12841 RestConfig::apiLog($return);
12842 return $return;
12846 * @OA\Get(
12847 * path="/fhir/Provenance",
12848 * description="Returns a list of Provenance resources.",
12849 * tags={"fhir"},
12850 * @OA\Parameter(
12851 * name="_id",
12852 * in="query",
12853 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12854 * required=false,
12855 * @OA\Schema(
12856 * type="string"
12858 * ),
12859 * @OA\Response(
12860 * response="200",
12861 * description="Standard Response",
12862 * @OA\MediaType(
12863 * mediaType="application/json",
12864 * @OA\Schema(
12865 * @OA\Property(
12866 * property="json object",
12867 * description="FHIR Json object.",
12868 * type="object"
12869 * ),
12870 * example={
12871 * "meta": {
12872 * "lastUpdated": "2021-09-14T09:13:51"
12873 * },
12874 * "resourceType": "Bundle",
12875 * "type": "collection",
12876 * "total": 0,
12877 * "link": {
12879 * "relation": "self",
12880 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12886 * ),
12887 * @OA\Response(
12888 * response="400",
12889 * ref="#/components/responses/badrequest"
12890 * ),
12891 * @OA\Response(
12892 * response="401",
12893 * ref="#/components/responses/unauthorized"
12894 * ),
12895 * security={{"openemr_auth":{}}}
12898 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12899 // property to support which is why this endpoint exists.
12900 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12901 if ($request->isPatientRequest()) {
12902 // only allow access to data of binded patient
12903 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12904 } else {
12905 // TODO: it seems like regular users should be able to grab authorship / provenance information
12906 RestConfig::authorization_check("admin", "super");
12907 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12909 RestConfig::apiLog($return);
12910 return $return;
12913 // other endpoints
12916 * @OA\Get(
12917 * path="/fhir/metadata",
12918 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12919 * tags={"fhir"},
12920 * @OA\Response(
12921 * response="200",
12922 * description="Return CapabilityStatement resource of the fhir server"
12926 "GET /fhir/metadata" => function () {
12927 $return = (new FhirMetaDataRestController())->getMetaData();
12928 RestConfig::apiLog($return);
12929 return $return;
12933 * @OA\Get(
12934 * path="/fhir/.well-known/smart-configuration",
12935 * description="Returns smart configuration of the fhir server.",
12936 * tags={"fhir"},
12937 * @OA\Response(
12938 * response="200",
12939 * description="Return smart configuration of the fhir server"
12943 "GET /fhir/.well-known/smart-configuration" => function () {
12944 $authController = new \OpenEMR\RestControllers\AuthorizationController();
12945 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
12946 RestConfig::apiLog($return);
12947 return $return;
12951 * @OA\Get(
12952 * path="/fhir/OperationDefinition",
12953 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
12954 * tags={"fhir"},
12955 * @OA\Response(
12956 * response="200",
12957 * description="Return list of OperationDefinition resources"
12961 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
12962 // for now we will just hard code the custom resources
12963 $operationDefinitionController = new FhirOperationDefinitionRestController();
12964 $return = $operationDefinitionController->getAll($request->getQueryParams());
12965 RestConfig::apiLog($return);
12966 return $return;
12970 * @OA\Get(
12971 * path="/fhir/OperationDefinition/{operation}",
12972 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
12973 * tags={"fhir"},
12974 * @OA\Parameter(
12975 * name="operation",
12976 * in="path",
12977 * description="The name of the operation to query. For example $bulkdata-status",
12978 * required=true,
12979 * @OA\Schema(
12980 * type="string"
12982 * ),
12983 * @OA\Response(
12984 * response="200",
12985 * description="Standard Response",
12986 * @OA\MediaType(
12987 * mediaType="application/json",
12988 * @OA\Schema(
12989 * @OA\Property(
12990 * property="json object",
12991 * description="FHIR Json object.",
12992 * type="object"
12993 * ),
12994 * example={
12995 * "resourceType": "OperationDefinition",
12996 * "name": "$bulkdata-status",
12997 * "status": "active",
12998 * "kind": "operation",
12999 * "parameter": {
13001 * "name": "job",
13002 * "use": "in",
13003 * "min": 1,
13004 * "max": 1,
13005 * "type": {
13006 * "system": "http://hl7.org/fhir/data-types",
13007 * "code": "string",
13008 * "display": "string"
13009 * },
13010 * "searchType": {
13011 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13012 * "code": "string",
13013 * "display": "string"
13020 * ),
13023 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
13024 // for now we will just hard code the custom resources
13025 $operationDefinitionController = new FhirOperationDefinitionRestController();
13026 $return = $operationDefinitionController->getOne($operation);
13027 RestConfig::apiLog($return);
13028 return $return;
13031 // FHIR root level operations
13034 * @OA\Get(
13035 * path="/fhir/$export",
13036 * 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>",
13037 * tags={"fhir"},
13038 * @OA\Response(
13039 * response="200",
13040 * 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>"
13041 * ),
13042 * @OA\Response(
13043 * response="400",
13044 * ref="#/components/responses/badrequest"
13045 * ),
13046 * @OA\Response(
13047 * response="401",
13048 * ref="#/components/responses/unauthorized"
13049 * ),
13050 * security={{"openemr_auth":{}}}
13053 'GET /fhir/$export' => function (HttpRestRequest $request) {
13054 RestConfig::authorization_check("admin", "users");
13055 $fhirExportService = new FhirOperationExportRestController($request);
13056 $return = $fhirExportService->processExport(
13057 $request->getQueryParams(),
13058 'System',
13059 $request->getHeader('Accept')[0] ?? '',
13060 $request->getHeader('Prefer')[0] ?? ''
13062 RestConfig::apiLog($return);
13063 return $return;
13066 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13067 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13068 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13071 * @OA\Get(
13072 * path="/fhir/$bulkdata-status",
13073 * 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>",
13074 * tags={"fhir"},
13075 * @OA\Response(
13076 * response="200",
13077 * 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>"
13078 * ),
13079 * @OA\Response(
13080 * response="400",
13081 * ref="#/components/responses/badrequest"
13082 * ),
13083 * @OA\Response(
13084 * response="401",
13085 * ref="#/components/responses/unauthorized"
13086 * ),
13087 * security={{"openemr_auth":{}}}
13090 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13091 RestConfig::authorization_check("admin", "users");
13092 $jobUuidString = $request->getQueryParam('job');
13093 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13094 // since OpenEMR data is so small we just return the JSON from the database
13095 $fhirExportService = new FhirOperationExportRestController($request);
13096 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13097 RestConfig::apiLog($return);
13098 return $return;
13102 * @OA\Delete(
13103 * path="/fhir/$bulkdata-status",
13104 * 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>",
13105 * tags={"fhir"},
13106 * @OA\Response(
13107 * response="200",
13108 * 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>"
13109 * ),
13110 * @OA\Response(
13111 * response="400",
13112 * ref="#/components/responses/badrequest"
13113 * ),
13114 * @OA\Response(
13115 * response="401",
13116 * ref="#/components/responses/unauthorized"
13117 * ),
13118 * security={{"openemr_auth":{}}}
13121 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13122 RestConfig::authorization_check("admin", "users");
13123 $job = $request->getQueryParam('job');
13124 $fhirExportService = new FhirOperationExportRestController($request);
13125 $return = $fhirExportService->processDeleteExportForJob($job);
13126 RestConfig::apiLog($return);
13127 return $return;
13131 // Note that the portal (api) route is only for patient role
13132 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13133 RestConfig::$PORTAL_ROUTE_MAP = array(
13135 * @OA\Get(
13136 * path="/portal/patient",
13137 * description="Returns the patient.",
13138 * tags={"standard-patient"},
13139 * @OA\Response(
13140 * response="200",
13141 * description="Standard response",
13142 * @OA\MediaType(
13143 * mediaType="application/json",
13144 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13146 * ),
13147 * @OA\Response(
13148 * response="401",
13149 * ref="#/components/responses/unauthorized"
13150 * ),
13151 * security={{"openemr_auth":{}}}
13154 "GET /portal/patient" => function (HttpRestRequest $request) {
13155 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13156 RestConfig::apiLog($return);
13157 return $return;
13161 * @OA\Get(
13162 * path="/portal/patient/encounter",
13163 * description="Returns encounters for the patient.",
13164 * tags={"standard-patient"},
13165 * @OA\Response(
13166 * response="200",
13167 * ref="#/components/responses/standard"
13168 * ),
13169 * @OA\Response(
13170 * response="400",
13171 * ref="#/components/responses/badrequest"
13172 * ),
13173 * @OA\Response(
13174 * response="401",
13175 * ref="#/components/responses/unauthorized"
13176 * ),
13177 * security={{"openemr_auth":{}}}
13180 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
13181 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13182 RestConfig::apiLog($return);
13183 return $return;
13187 * @OA\Get(
13188 * path="/portal/patient/encounter/{euuid}",
13189 * description="Returns a selected encounter by its uuid.",
13190 * tags={"standard-patient"},
13191 * @OA\Parameter(
13192 * name="euuid",
13193 * in="path",
13194 * description="The uuid for the encounter.",
13195 * required=true,
13196 * @OA\Schema(
13197 * type="string"
13199 * ),
13200 * @OA\Response(
13201 * response="200",
13202 * ref="#/components/responses/standard"
13203 * ),
13204 * @OA\Response(
13205 * response="400",
13206 * ref="#/components/responses/badrequest"
13207 * ),
13208 * @OA\Response(
13209 * response="401",
13210 * ref="#/components/responses/unauthorized"
13211 * ),
13212 * security={{"openemr_auth":{}}}
13215 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
13216 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13217 RestConfig::apiLog($return);
13218 return $return;
13222 * @OA\Get(
13223 * path="/portal/patient/appointment",
13224 * description="Retrieves all appointments for a patient",
13225 * tags={"standard-patient"},
13226 * @OA\Response(
13227 * response="200",
13228 * ref="#/components/responses/standard"
13229 * ),
13230 * @OA\Response(
13231 * response="400",
13232 * ref="#/components/responses/badrequest"
13233 * ),
13234 * @OA\Response(
13235 * response="401",
13236 * ref="#/components/responses/unauthorized"
13237 * ),
13238 * security={{"openemr_auth":{}}}
13241 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
13242 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13243 RestConfig::apiLog($return);
13244 return $return;
13249 * @OA\Get(
13250 * path="/portal/patient/appointment/{auuid}",
13251 * description="Returns a selected appointment by its uuid.",
13252 * tags={"standard-patient"},
13253 * @OA\Parameter(
13254 * name="auuid",
13255 * in="path",
13256 * description="The uuid for the appointment.",
13257 * required=true,
13258 * @OA\Schema(
13259 * type="string"
13261 * ),
13262 * @OA\Response(
13263 * response="200",
13264 * ref="#/components/responses/standard"
13265 * ),
13266 * @OA\Response(
13267 * response="400",
13268 * ref="#/components/responses/badrequest"
13269 * ),
13270 * @OA\Response(
13271 * response="401",
13272 * ref="#/components/responses/unauthorized"
13273 * ),
13274 * security={{"openemr_auth":{}}}
13277 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
13278 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13279 RestConfig::apiLog($return);
13280 return $return;