Some change to prior PR#7429 (#7447)
[openemr.git] / _rest_routes.inc.php
blobb2792744a90cde5702c51e3b87a3074d37a30699
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 * @author Stephen Nielson <snielson@discoverandchange.com>
14 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
15 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
16 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
17 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
18 * @copyright Copyright (c) 2024 Care Management Solutions, Inc. <stephen.waite@cmsvt.com>
19 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
22 /**
23 * @OA\Info(title="OpenEMR API", version="7.0.3")
24 * @OA\Server(url="/apis/default/")
25 * @OA\SecurityScheme(
26 * securityScheme="openemr_auth",
27 * type="oauth2",
28 * @OA\Flow(
29 * authorizationUrl="/oauth2/default/authorize",
30 * tokenUrl="/oauth2/default/token",
31 * refreshUrl="/oauth2/default/token",
32 * flow="authorizationCode",
33 * scopes={
34 * "openid": "Generic mandatory scope",
35 * "offline_access": "Will signal server to provide a refresh token",
36 * "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)",
37 * "api:fhir": "FHIR R4 API",
38 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
39 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
40 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
41 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
42 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
43 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
44 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
45 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
46 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
47 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
48 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
49 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
50 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
51 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
52 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
53 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
54 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
55 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
56 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
57 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
58 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
59 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
60 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
61 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
62 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
63 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
64 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
65 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
66 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
67 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
68 * "system/Device.read": "Read all device resources in the system (api:fhir)",
69 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
70 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
71 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
72 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
73 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
74 * "system/Group.read": "Read all group resources in the system (api:fhir)",
75 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
76 * "system/Location.read": "Read all location resources in the system (api:fhir)",
77 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
78 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
79 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
80 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
81 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
82 * "system/Person.read": "Read all person resources in the system (api:fhir)",
83 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
84 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
85 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
86 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
87 * "system/ValueSet.read": "Read all valueSet resources in the system (api:fhir)",
88 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
89 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
90 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
91 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
92 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
93 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
94 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
95 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
96 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
97 * "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)",
98 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
99 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
100 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
101 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
102 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
103 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
104 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
105 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
106 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
107 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
108 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
109 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
110 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
111 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
112 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
113 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
114 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
115 * "user/ValueSet.read": "Read all valueSet resources the user has access to (api:fhir)",
116 * "api:oemr": "Standard OpenEMR API",
117 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
118 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
119 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
120 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
121 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
122 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
123 * "user/document.read": "Read documents the user has access to (api:oemr)",
124 * "user/document.write": "Write documents the user has access to (api:oemr)",
125 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
126 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
127 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
128 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
129 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
130 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
131 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
132 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
133 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
134 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
135 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
136 * "user/list.read": "Read lists the user has access to (api:oemr)",
137 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
138 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
139 * "user/medication.read": "Read medications the user has access to (api:oemr)",
140 * "user/medication.write": "Write medications the user has access to (api:oemr)",
141 * "user/message.write": "Read messages the user has access to (api:oemr)",
142 * "user/patient.read": "Read patients the user has access to (api:oemr)",
143 * "user/patient.write": "Write patients the user has access to (api:oemr)",
144 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
145 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
146 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
147 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
148 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
149 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
150 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
151 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
152 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
153 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
154 * "user/user.read": "Read users the current user has access to (api:oemr)",
155 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
156 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
157 * "api:port": "Standard Patient Portal OpenEMR API",
158 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
159 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
160 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
164 * @OA\Tag(
165 * name="fhir",
166 * description="FHIR R4 API"
168 * @OA\Tag(
169 * name="standard",
170 * description="Standard OpenEMR API"
172 * @OA\Tag(
173 * name="standard-patient",
174 * description="Standard Patient Portal OpenEMR API"
176 * @OA\Parameter(
177 * name="_sort",
178 * in="query",
179 * parameter="_sort",
180 * 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)",
181 * required=false,
182 * @OA\Schema(
183 * type="string"
186 * @OA\Parameter(
187 * name="_lastUpdated",
188 * in="query",
189 * parameter="_lastUpdated",
190 * description="The date the resource was last updated.",
191 * required=false,
192 * @OA\Schema(
193 * type="string"
196 * @OA\Response(
197 * response="standard",
198 * description="Standard Response",
199 * @OA\MediaType(
200 * mediaType="application/json",
201 * @OA\Schema(
202 * @OA\Property(
203 * property="validationErrors",
204 * description="Validation errors.",
205 * type="array",
206 * @OA\Items(
207 * type="object",
208 * ),
209 * ),
210 * @OA\Property(
211 * property="internalErrors",
212 * description="Internal errors.",
213 * type="array",
214 * @OA\Items(
215 * type="object",
216 * ),
217 * ),
218 * @OA\Property(
219 * property="data",
220 * description="Returned data.",
221 * type="array",
222 * @OA\Items(
223 * type="object",
224 * ),
225 * ),
226 * example={
227 * "validationErrors": {},
228 * "error_description": {},
229 * "data": {}
234 * @OA\Response(
235 * response="badrequest",
236 * description="Bad Request",
237 * @OA\MediaType(
238 * mediaType="application/json",
239 * @OA\Schema(
240 * @OA\Property(
241 * property="validationErrors",
242 * description="Validation errors.",
243 * type="object"
244 * ),
245 * example={
246 * "validationErrors":
248 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
254 * @OA\Response(
255 * response="unauthorized",
256 * description="Unauthorized",
257 * @OA\MediaType(
258 * mediaType="application/json",
259 * @OA\Schema(
260 * @OA\Property(
261 * property="error",
262 * description="The error.",
263 * type="string"
264 * ),
265 * @OA\Property(
266 * property="error_description",
267 * description="The description of the error.",
268 * type="string"
269 * ),
270 * @OA\Property(
271 * property="hint",
272 * description="More specific information on the error.",
273 * type="string"
274 * ),
275 * @OA\Property(
276 * property="message",
277 * description="Message regarding the error.",
278 * type="string"
279 * ),
280 * example={
281 * "error": "access_denied",
282 * "error_description": "The resource owner or authorization server denied the request.",
283 * "hint": "Missing ""Authorization"" header",
284 * "message": "The resource owner or authorization server denied the request."
289 * @OA\Response(
290 * response="uuidnotfound",
291 * description="Not Found",
292 * @OA\MediaType(
293 * mediaType="application/json",
294 * @OA\Schema(
295 * @OA\Property(
296 * property="empty",
297 * description="empty",
298 * type="object"
299 * ),
300 * example={}
306 // Lets keep our controller classes with the routes.
308 use OpenEMR\Common\Acl\AccessDeniedException;
309 use OpenEMR\Common\Http\HttpRestRequest;
310 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
311 use OpenEMR\RestControllers\FacilityRestController;
312 use OpenEMR\RestControllers\VersionRestController;
313 use OpenEMR\RestControllers\ProductRegistrationRestController;
314 use OpenEMR\RestControllers\PatientRestController;
315 use OpenEMR\RestControllers\EncounterRestController;
316 use OpenEMR\RestControllers\PractitionerRestController;
317 use OpenEMR\RestControllers\ListRestController;
318 use OpenEMR\RestControllers\InsuranceCompanyRestController;
319 use OpenEMR\RestControllers\AppointmentRestController;
320 use OpenEMR\RestControllers\ConditionRestController;
321 use OpenEMR\RestControllers\ONoteRestController;
322 use OpenEMR\RestControllers\DocumentRestController;
323 use OpenEMR\RestControllers\DrugRestController;
324 use OpenEMR\RestControllers\EmployerRestController;
325 use OpenEMR\RestControllers\ImmunizationRestController;
326 use OpenEMR\RestControllers\InsuranceRestController;
327 use OpenEMR\RestControllers\MessageRestController;
328 use OpenEMR\RestControllers\PrescriptionRestController;
329 use OpenEMR\RestControllers\ProcedureRestController;
330 use OpenEMR\RestControllers\TransactionRestController;
331 use OpenEMR\RestControllers\UserRestController;
332 use OpenEMR\Services\Search\SearchQueryConfig;
334 // Note some Http clients may not send auth as json so a function
335 // is implemented to determine and parse encoding on auth route's.
337 // Note that the api route is only for users role
338 // (there is a mechanism in place to ensure only user role can access the api route)
339 RestConfig::$ROUTE_MAP = array(
341 * @OA\Get(
342 * path="/api/facility",
343 * description="Returns a single facility.",
344 * tags={"standard"},
345 * @OA\Parameter(
346 * name="name",
347 * in="query",
348 * description="The name for the facility.",
349 * required=false,
350 * @OA\Schema(
351 * type="string"
353 * ),
354 * @OA\Parameter(
355 * name="facility_npi",
356 * in="query",
357 * description="The facility_npi for the facility.",
358 * required=false,
359 * @OA\Schema(
360 * type="string"
362 * ),
363 * @OA\Parameter(
364 * name="phone",
365 * in="query",
366 * description="The phone for the facility.",
367 * required=false,
368 * @OA\Schema(
369 * type="string"
371 * ),
372 * @OA\Parameter(
373 * name="fax",
374 * in="query",
375 * description="The fax for the facility.",
376 * required=false,
377 * @OA\Schema(
378 * type="string"
380 * ),
381 * @OA\Parameter(
382 * name="street",
383 * in="query",
384 * description="The street for the facility.",
385 * required=false,
386 * @OA\Schema(
387 * type="string"
389 * ),
390 * @OA\Parameter(
391 * name="city",
392 * in="query",
393 * description="The city for the facility.",
394 * required=false,
395 * @OA\Schema(
396 * type="string"
398 * ),
399 * @OA\Parameter(
400 * name="state",
401 * in="query",
402 * description="The state for the facility.",
403 * required=false,
404 * @OA\Schema(
405 * type="string"
407 * ),
408 * @OA\Parameter(
409 * name="postal_code",
410 * in="query",
411 * description="The postal_code for the facility.",
412 * required=false,
413 * @OA\Schema(
414 * type="string"
416 * ),
417 * @OA\Parameter(
418 * name="country_code",
419 * in="query",
420 * description="The country_code for the facility.",
421 * required=false,
422 * @OA\Schema(
423 * type="string"
425 * ),
426 * @OA\Parameter(
427 * name="federal_ein",
428 * in="query",
429 * description="The federal_ein for the facility.",
430 * required=false,
431 * @OA\Schema(
432 * type="string"
434 * ),
435 * @OA\Parameter(
436 * name="website",
437 * in="query",
438 * description="The website for the facility.",
439 * required=false,
440 * @OA\Schema(
441 * type="string"
443 * ),
444 * @OA\Parameter(
445 * name="email",
446 * in="query",
447 * description="The email for the facility.",
448 * required=false,
449 * @OA\Schema(
450 * type="string"
452 * ),
453 * @OA\Parameter(
454 * name="domain_identifier",
455 * in="query",
456 * description="The domain_identifier for the facility.",
457 * required=false,
458 * @OA\Schema(
459 * type="string"
461 * ),
462 * @OA\Parameter(
463 * name="facility_taxonomy",
464 * in="query",
465 * description="The facility_taxonomy for the facility.",
466 * required=false,
467 * @OA\Schema(
468 * type="string"
470 * ),
471 * @OA\Parameter(
472 * name="facility_code",
473 * in="query",
474 * description="The facility_code for the facility.",
475 * required=false,
476 * @OA\Schema(
477 * type="string"
479 * ),
480 * @OA\Parameter(
481 * name="billing_location",
482 * in="query",
483 * description="The billing_location setting for the facility.",
484 * required=false,
485 * @OA\Schema(
486 * type="string"
488 * ),
489 * @OA\Parameter(
490 * name="accepts_assignment",
491 * in="query",
492 * description="The accepts_assignment setting for the facility.",
493 * required=false,
494 * @OA\Schema(
495 * type="string"
497 * ),
498 * @OA\Parameter(
499 * name="oid",
500 * in="query",
501 * description="The oid for the facility.",
502 * required=false,
503 * @OA\Schema(
504 * type="string"
506 * ),
507 * @OA\Parameter(
508 * name="service_location",
509 * in="query",
510 * description="The service_location setting for the facility.",
511 * required=false,
512 * @OA\Schema(
513 * type="string"
515 * ),
516 * @OA\Response(
517 * response="200",
518 * ref="#/components/responses/standard"
519 * ),
520 * @OA\Response(
521 * response="400",
522 * ref="#/components/responses/badrequest"
523 * ),
524 * @OA\Response(
525 * response="401",
526 * ref="#/components/responses/unauthorized"
527 * ),
528 * security={{"openemr_auth":{}}}
531 "GET /api/facility" => function () {
532 RestConfig::authorization_check("admin", "users");
533 $return = (new FacilityRestController())->getAll($_GET);
534 RestConfig::apiLog($return);
535 return $return;
539 * @OA\Get(
540 * path="/api/facility/{fuuid}",
541 * description="Returns a single facility.",
542 * tags={"standard"},
543 * @OA\Parameter(
544 * name="fuuid",
545 * in="path",
546 * description="The uuid for the facility.",
547 * required=true,
548 * @OA\Schema(
549 * type="string"
551 * ),
552 * @OA\Response(
553 * response="200",
554 * ref="#/components/responses/standard"
555 * ),
556 * @OA\Response(
557 * response="400",
558 * ref="#/components/responses/badrequest"
559 * ),
560 * @OA\Response(
561 * response="401",
562 * ref="#/components/responses/unauthorized"
563 * ),
564 * security={{"openemr_auth":{}}}
567 "GET /api/facility/:fuuid" => function ($fuuid) {
568 RestConfig::authorization_check("admin", "users");
569 $return = (new FacilityRestController())->getOne($fuuid);
570 RestConfig::apiLog($return);
571 return $return;
575 * @OA\Post(
576 * path="/api/facility",
577 * description="Creates a facility in the system",
578 * tags={"standard"},
579 * @OA\RequestBody(
580 * required=true,
581 * @OA\MediaType(
582 * mediaType="application/json",
583 * @OA\Schema(
584 * @OA\Property(
585 * property="name",
586 * description="The name for the facility.",
587 * type="string"
588 * ),
589 * @OA\Property(
590 * property="facility_npi",
591 * description="The facility_npi for the facility.",
592 * type="string"
593 * ),
594 * @OA\Property(
595 * property="phone",
596 * description="The phone for the facility.",
597 * type="string"
598 * ),
599 * @OA\Property(
600 * property="fax",
601 * description="The fax for the facility.",
602 * type="string"
603 * ),
604 * @OA\Property(
605 * property="street",
606 * description="The street for the facility.",
607 * type="string"
608 * ),
609 * @OA\Property(
610 * property="city",
611 * description="The city for the facility.",
612 * type="string"
613 * ),
614 * @OA\Property(
615 * property="state",
616 * description="The state for the facility.",
617 * type="string"
618 * ),
619 * @OA\Property(
620 * property="postal_code",
621 * description="The postal_code for the facility.",
622 * type="string"
623 * ),
624 * @OA\Property(
625 * property="country_code",
626 * description="The country_code for the facility.",
627 * type="string"
628 * ),
629 * @OA\Property(
630 * property="federal_ein",
631 * description="The federal_ein for the facility.",
632 * type="string"
633 * ),
634 * @OA\Property(
635 * property="website",
636 * description="The website for the facility.",
637 * type="string"
638 * ),
639 * @OA\Property(
640 * property="email",
641 * description="The email for the facility.",
642 * type="string"
643 * ),
644 * @OA\Property(
645 * property="domain_identifier",
646 * description="The domain_identifier for the facility.",
647 * type="string"
648 * ),
649 * @OA\Property(
650 * property="facility_taxonomy",
651 * description="The facility_taxonomy for the facility.",
652 * type="string"
653 * ),
654 * @OA\Property(
655 * property="facility_code",
656 * description="The facility_code for the facility.",
657 * type="string"
658 * ),
659 * @OA\Property(
660 * property="billing_location",
661 * description="The billing_location setting for the facility.",
662 * type="string"
663 * ),
664 * @OA\Property(
665 * property="accepts_assignment",
666 * description="The accepts_assignment setting for the facility.",
667 * type="string"
668 * ),
669 * @OA\Property(
670 * property="oid",
671 * description="The oid for the facility.",
672 * type="string"
673 * ),
674 * @OA\Property(
675 * property="service_location",
676 * description="The service_location setting for the facility.",
677 * type="string"
678 * ),
679 * required={"name", "facility_npi"},
680 * example={
681 * "name": "Aquaria",
682 * "facility_npi": "123456789123",
683 * "phone": "808-606-3030",
684 * "fax": "808-606-3031",
685 * "street": "1337 Bit Shifter Ln",
686 * "city": "San Lorenzo",
687 * "state": "ZZ",
688 * "postal_code": "54321",
689 * "country_code": "US",
690 * "federal_ein": "4343434",
691 * "website": "https://example.com",
692 * "email": "foo@bar.com",
693 * "domain_identifier": "",
694 * "facility_taxonomy": "",
695 * "facility_code": "",
696 * "billing_location": "1",
697 * "accepts_assignment": "1",
698 * "oid": "",
699 * "service_location": "1"
703 * ),
704 * @OA\Response(
705 * response="200",
706 * ref="#/components/responses/standard"
707 * ),
708 * @OA\Response(
709 * response="400",
710 * ref="#/components/responses/badrequest"
711 * ),
712 * @OA\Response(
713 * response="401",
714 * ref="#/components/responses/unauthorized"
715 * ),
716 * security={{"openemr_auth":{}}}
719 "POST /api/facility" => function () {
720 RestConfig::authorization_check("admin", "super");
721 $data = (array) (json_decode(file_get_contents("php://input")));
722 $return = (new FacilityRestController())->post($data);
723 RestConfig::apiLog($return, $data);
724 return $return;
728 * @OA\Put(
729 * path="/api/facility/{fuuid}",
730 * description="Updates a facility in the system",
731 * tags={"standard"},
732 * @OA\Parameter(
733 * name="fuuid",
734 * in="path",
735 * description="The uuid for the facility.",
736 * required=true,
737 * @OA\Schema(
738 * type="string"
740 * ),
741 * @OA\RequestBody(
742 * required=true,
743 * @OA\MediaType(
744 * mediaType="application/json",
745 * @OA\Schema(
746 * @OA\Property(
747 * property="name",
748 * description="The name for the facility.",
749 * type="string"
750 * ),
751 * @OA\Property(
752 * property="facility_npi",
753 * description="The facility_npi for the facility.",
754 * type="string"
755 * ),
756 * @OA\Property(
757 * property="phone",
758 * description="The phone for the facility.",
759 * type="string"
760 * ),
761 * @OA\Property(
762 * property="fax",
763 * description="The fax for the facility.",
764 * type="string"
765 * ),
766 * @OA\Property(
767 * property="street",
768 * description="The street for the facility.",
769 * type="string"
770 * ),
771 * @OA\Property(
772 * property="city",
773 * description="The city for the facility.",
774 * type="string"
775 * ),
776 * @OA\Property(
777 * property="state",
778 * description="The state for the facility.",
779 * type="string"
780 * ),
781 * @OA\Property(
782 * property="postal_code",
783 * description="The postal_code for the facility.",
784 * type="string"
785 * ),
786 * @OA\Property(
787 * property="country_code",
788 * description="The country_code for the facility.",
789 * type="string"
790 * ),
791 * @OA\Property(
792 * property="federal_ein",
793 * description="The federal_ein for the facility.",
794 * type="string"
795 * ),
796 * @OA\Property(
797 * property="website",
798 * description="The website for the facility.",
799 * type="string"
800 * ),
801 * @OA\Property(
802 * property="email",
803 * description="The email for the facility.",
804 * type="string"
805 * ),
806 * @OA\Property(
807 * property="domain_identifier",
808 * description="The domain_identifier for the facility.",
809 * type="string"
810 * ),
811 * @OA\Property(
812 * property="facility_taxonomy",
813 * description="The facility_taxonomy for the facility.",
814 * type="string"
815 * ),
816 * @OA\Property(
817 * property="facility_code",
818 * description="The facility_code for the facility.",
819 * type="string"
820 * ),
821 * @OA\Property(
822 * property="billing_location",
823 * description="The billing_location setting for the facility.",
824 * type="string"
825 * ),
826 * @OA\Property(
827 * property="accepts_assignment",
828 * description="The accepts_assignment setting for the facility.",
829 * type="string"
830 * ),
831 * @OA\Property(
832 * property="oid",
833 * description="The oid for the facility.",
834 * type="string"
835 * ),
836 * @OA\Property(
837 * property="service_location",
838 * description="The service_location setting for the facility.",
839 * type="string"
840 * ),
841 * example={
842 * "name": "Aquaria",
843 * "facility_npi": "123456789123",
844 * "phone": "808-606-3030",
845 * "fax": "808-606-3031",
846 * "street": "1337 Bit Shifter Ln",
847 * "city": "San Lorenzo",
848 * "state": "ZZ",
849 * "postal_code": "54321",
850 * "country_code": "US",
851 * "federal_ein": "4343434",
852 * "website": "https://example.com",
853 * "email": "foo@bar.com",
854 * "domain_identifier": "",
855 * "facility_taxonomy": "",
856 * "facility_code": "",
857 * "billing_location": "1",
858 * "accepts_assignment": "1",
859 * "oid": "",
860 * "service_location": "1"
864 * ),
865 * @OA\Response(
866 * response="200",
867 * ref="#/components/responses/standard"
868 * ),
869 * @OA\Response(
870 * response="400",
871 * ref="#/components/responses/badrequest"
872 * ),
873 * @OA\Response(
874 * response="401",
875 * ref="#/components/responses/unauthorized"
876 * ),
877 * security={{"openemr_auth":{}}}
880 "PUT /api/facility/:fuuid" => function ($fuuid) {
881 RestConfig::authorization_check("admin", "super");
882 $data = (array) (json_decode(file_get_contents("php://input")));
883 $return = (new FacilityRestController())->patch($fuuid, $data);
884 RestConfig::apiLog($return, $data);
885 return $return;
889 * @OA\Get(
890 * path="/api/patient",
891 * description="Retrieves a list of patients",
892 * tags={"standard"},
893 * @OA\Parameter(
894 * ref="#/components/parameters/_sort"
895 * ),
896 * @OA\Parameter(
897 * name="fname",
898 * in="query",
899 * description="The first name for the patient.",
900 * required=false,
901 * @OA\Schema(
902 * type="string"
904 * ),
905 * @OA\Parameter(
906 * name="lname",
907 * in="query",
908 * description="The last name for the patient.",
909 * required=false,
910 * @OA\Schema(
911 * type="string"
913 * ),
914 * @OA\Parameter(
915 * name="ss",
916 * in="query",
917 * description="The social security number for the patient.",
918 * required=false,
919 * @OA\Schema(
920 * type="string"
922 * ),
923 * @OA\Parameter(
924 * name="street",
925 * in="query",
926 * description="The street for the patient.",
927 * required=false,
928 * @OA\Schema(
929 * type="string"
931 * ),
932 * @OA\Parameter(
933 * name="postal_code",
934 * in="query",
935 * description="The postal code for the patient.",
936 * required=false,
937 * @OA\Schema(
938 * type="string"
940 * ),
941 * @OA\Parameter(
942 * name="city",
943 * in="query",
944 * description="The city for the patient.",
945 * required=false,
946 * @OA\Schema(
947 * type="string"
949 * ),
950 * @OA\Parameter(
951 * name="state",
952 * in="query",
953 * description="The state for the patient.",
954 * required=false,
955 * @OA\Schema(
956 * type="string"
958 * ),
959 * @OA\Parameter(
960 * name="phone_home",
961 * in="query",
962 * description="The home phone for the patient.",
963 * required=false,
964 * @OA\Schema(
965 * type="string"
967 * ),
968 * @OA\Parameter(
969 * name="phone_biz",
970 * in="query",
971 * description="The business phone for the patient.",
972 * required=false,
973 * @OA\Schema(
974 * type="string"
976 * ),
977 * @OA\Parameter(
978 * name="phone_cell",
979 * in="query",
980 * description="The cell phone for the patient.",
981 * required=false,
982 * @OA\Schema(
983 * type="string"
985 * ),
986 * @OA\Parameter(
987 * name="postal_contact",
988 * in="query",
989 * description="The postal_contact for the patient.",
990 * required=false,
991 * @OA\Schema(
992 * type="string"
994 * ),
995 * @OA\Parameter(
996 * name="sex",
997 * in="query",
998 * description="The gender for the patient.",
999 * required=false,
1000 * @OA\Schema(
1001 * type="string"
1003 * ),
1004 * @OA\Parameter(
1005 * name="country_code",
1006 * in="query",
1007 * description="The country code for the patient.",
1008 * required=false,
1009 * @OA\Schema(
1010 * type="string"
1012 * ),
1013 * @OA\Parameter(
1014 * name="email",
1015 * in="query",
1016 * description="The email for the patient.",
1017 * required=false,
1018 * @OA\Schema(
1019 * type="string"
1021 * ),
1022 * @OA\Parameter(
1023 * name="DOB",
1024 * in="query",
1025 * description="The DOB for the patient.",
1026 * required=false,
1027 * @OA\Schema(
1028 * type="string"
1030 * ),
1031 * @OA\Parameter(
1032 * name="date",
1033 * in="query",
1034 * description="The date this patient resource was last modified.",
1035 * required=false,
1036 * @OA\Schema(
1037 * type="string"
1039 * ),
1040 * @OA\Parameter(
1041 * name="_offset",
1042 * in="query",
1043 * description="The number of records to offset from this index in the search result.",
1044 * required=false,
1045 * @OA\Schema(
1046 * type="integer"
1048 * ),
1049 * @OA\Parameter(
1050 * name="_limit",
1051 * in="query",
1052 * description="The maximum number of resources to return in the result set. 0 means unlimited.",
1053 * required=false,
1054 * @OA\Schema(
1055 * type="integer"
1056 * ,minimum=0
1057 * ,maximum=200
1059 * ),
1060 * @OA\Response(
1061 * response="200",
1062 * ref="#/components/responses/standard"
1063 * ),
1064 * @OA\Response(
1065 * response="400",
1066 * ref="#/components/responses/badrequest"
1067 * ),
1068 * @OA\Response(
1069 * response="401",
1070 * ref="#/components/responses/unauthorized"
1071 * ),
1072 * security={{"openemr_auth":{}}}
1075 "GET /api/patient" => function () {
1076 RestConfig::authorization_check("patients", "demo");
1077 $config = SearchQueryConfig::createConfigFromQueryParams($_GET);
1078 $return = (new PatientRestController())->getAll($_GET, $config);
1079 RestConfig::apiLog($return);
1080 return $return;
1084 * Schema for the patient request
1086 * @OA\Schema(
1087 * schema="api_patient_request",
1088 * @OA\Property(
1089 * property="title",
1090 * description="The title of patient.",
1091 * type="string"
1092 * ),
1093 * @OA\Property(
1094 * property="fname",
1095 * description="The fname of patient.",
1096 * type="string"
1097 * ),
1098 * @OA\Property(
1099 * property="mname",
1100 * description="The mname of patient.",
1101 * type="string"
1102 * ),
1103 * @OA\Property(
1104 * property="lname",
1105 * description="The lname of patient.",
1106 * type="string"
1107 * ),
1108 * @OA\Property(
1109 * property="street",
1110 * description="The street address of patient.",
1111 * type="string"
1112 * ),
1113 * @OA\Property(
1114 * property="postal_code",
1115 * description="The postal code of patient.",
1116 * type="string"
1117 * ),
1118 * @OA\Property(
1119 * property="city",
1120 * description="The city of patient.",
1121 * type="string"
1122 * ),
1123 * @OA\Property(
1124 * property="state",
1125 * description="The state of patient.",
1126 * type="string"
1127 * ),
1128 * @OA\Property(
1129 * property="country_code",
1130 * description="The country code of patient.",
1131 * type="string"
1132 * ),
1133 * @OA\Property(
1134 * property="phone_contact",
1135 * description="The phone contact of patient.",
1136 * type="string"
1137 * ),
1138 * @OA\Property(
1139 * property="DOB",
1140 * description="The DOB of patient.",
1141 * type="string"
1142 * ),
1143 * @OA\Property(
1144 * property="sex",
1145 * description="The lname of patient.",
1146 * type="string"
1147 * ),
1148 * @OA\Property(
1149 * property="race",
1150 * description="The race of patient.",
1151 * type="string"
1152 * ),
1153 * @OA\Property(
1154 * property="ethnicity",
1155 * description="The ethnicity of patient.",
1156 * type="string"
1157 * ),
1158 * required={"fname", "lname", "DOB", "sex"},
1159 * example={
1160 * "title": "Mr",
1161 * "fname": "Foo",
1162 * "mname": "",
1163 * "lname": "Bar",
1164 * "street": "456 Tree Lane",
1165 * "postal_code": "08642",
1166 * "city": "FooTown",
1167 * "state": "FL",
1168 * "country_code": "US",
1169 * "phone_contact": "123-456-7890",
1170 * "DOB": "1992-02-02",
1171 * "sex": "Male",
1172 * "race": "",
1173 * "ethnicity": ""
1178 * @OA\Post(
1179 * path="/api/patient",
1180 * description="Creates a new patient",
1181 * tags={"standard"},
1182 * @OA\RequestBody(
1183 * required=true,
1184 * @OA\MediaType(
1185 * mediaType="application/json",
1186 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1188 * ),
1189 * @OA\Response(
1190 * response="200",
1191 * description="Standard response",
1192 * @OA\MediaType(
1193 * mediaType="application/json",
1194 * @OA\Schema(
1195 * @OA\Property(
1196 * property="validationErrors",
1197 * description="Validation errors.",
1198 * type="array",
1199 * @OA\Items(
1200 * type="object",
1201 * ),
1202 * ),
1203 * @OA\Property(
1204 * property="internalErrors",
1205 * description="Internal errors.",
1206 * type="array",
1207 * @OA\Items(
1208 * type="object",
1209 * ),
1210 * ),
1211 * @OA\Property(
1212 * property="data",
1213 * description="Returned data.",
1214 * type="array",
1215 * @OA\Items(
1216 * @OA\Property(
1217 * property="pid",
1218 * description="patient pid",
1219 * type="integer",
1221 * ),
1222 * ),
1223 * example={
1224 * "validationErrors": {},
1225 * "error_description": {},
1226 * "data": {
1227 * "pid": 1
1232 * ),
1233 * @OA\Response(
1234 * response="401",
1235 * ref="#/components/responses/unauthorized"
1236 * ),
1237 * security={{"openemr_auth":{}}}
1240 "POST /api/patient" => function () {
1241 RestConfig::authorization_check("patients", "demo");
1242 $data = (array) (json_decode(file_get_contents("php://input")));
1243 $return = (new PatientRestController())->post($data);
1244 RestConfig::apiLog($return, $data);
1245 return $return;
1249 * Schema for the patient response
1251 * @OA\Schema(
1252 * schema="api_patient_response",
1253 * @OA\Property(
1254 * property="validationErrors",
1255 * description="Validation errors.",
1256 * type="array",
1257 * @OA\Items(
1258 * type="object",
1259 * ),
1260 * ),
1261 * @OA\Property(
1262 * property="internalErrors",
1263 * description="Internal errors.",
1264 * type="array",
1265 * @OA\Items(
1266 * type="object",
1267 * ),
1268 * ),
1269 * @OA\Property(
1270 * property="data",
1271 * description="Returned data.",
1272 * type="array",
1273 * @OA\Items(
1274 * @OA\Property(
1275 * property="id",
1276 * description="patient id",
1277 * type="string",
1278 * ),
1279 * @OA\Property(
1280 * property="pid",
1281 * description="patient pid",
1282 * type="string",
1283 * ),
1284 * @OA\Property(
1285 * property="pubpid",
1286 * description="patient public id",
1287 * type="string",
1288 * ),
1289 * @OA\Property(
1290 * property="title",
1291 * description="patient title",
1292 * type="string",
1293 * ),
1294 * @OA\Property(
1295 * property="fname",
1296 * description="patient first name",
1297 * type="string",
1298 * ),
1299 * @OA\Property(
1300 * property="mname",
1301 * description="patient middle name",
1302 * type="string",
1303 * ),
1304 * @OA\Property(
1305 * property="lname",
1306 * description="patient last name",
1307 * type="string",
1308 * ),
1309 * @OA\Property(
1310 * property="ss",
1311 * description="patient social security number",
1312 * type="string",
1313 * ),
1314 * @OA\Property(
1315 * property="street",
1316 * description="patient street address",
1317 * type="string",
1318 * ),
1319 * @OA\Property(
1320 * property="postal_code",
1321 * description="patient postal code",
1322 * type="string",
1323 * ),
1324 * @OA\Property(
1325 * property="city",
1326 * description="patient city",
1327 * type="string",
1328 * ),
1329 * @OA\Property(
1330 * property="state",
1331 * description="patient state",
1332 * type="string",
1333 * ),
1334 * @OA\Property(
1335 * property="county",
1336 * description="patient county",
1337 * type="string",
1338 * ),
1339 * @OA\Property(
1340 * property="country_code",
1341 * description="patient country code",
1342 * type="string",
1343 * ),
1344 * @OA\Property(
1345 * property="drivers_license",
1346 * description="patient drivers license id",
1347 * type="string",
1348 * ),
1349 * @OA\Property(
1350 * property="contact_relationship",
1351 * description="patient contact relationship",
1352 * type="string",
1353 * ),
1354 * @OA\Property(
1355 * property="phone_contact",
1356 * description="patient phone contact",
1357 * type="string",
1358 * ),
1359 * @OA\Property(
1360 * property="phone_home",
1361 * description="patient home phone",
1362 * type="string",
1363 * ),
1364 * @OA\Property(
1365 * property="phone_biz",
1366 * description="patient work phone",
1367 * type="string",
1368 * ),
1369 * @OA\Property(
1370 * property="phone_cell",
1371 * description="patient mobile phone",
1372 * type="string",
1373 * ),
1374 * @OA\Property(
1375 * property="email",
1376 * description="patient email",
1377 * type="string",
1378 * ),
1379 * @OA\Property(
1380 * property="DOB",
1381 * description="patient DOB",
1382 * type="string",
1383 * ),
1384 * @OA\Property(
1385 * property="sex",
1386 * description="patient sex (gender)",
1387 * type="string",
1388 * ),
1389 * @OA\Property(
1390 * property="race",
1391 * description="patient race",
1392 * type="string",
1393 * ),
1394 * @OA\Property(
1395 * property="ethnicity",
1396 * description="patient ethnicity",
1397 * type="string",
1398 * ),
1399 * @OA\Property(
1400 * property="status",
1401 * description="patient status",
1402 * type="string",
1403 * ),
1404 * ),
1405 * ),
1406 * example={
1407 * "validationErrors": {},
1408 * "error_description": {},
1409 * "data": {
1410 * "id": "193",
1411 * "pid": "1",
1412 * "pubpid": "",
1413 * "title": "Mr",
1414 * "fname": "Baz",
1415 * "mname": "",
1416 * "lname": "Bop",
1417 * "ss": "",
1418 * "street": "456 Tree Lane",
1419 * "postal_code": "08642",
1420 * "city": "FooTown",
1421 * "state": "FL",
1422 * "county": "",
1423 * "country_code": "US",
1424 * "drivers_license": "",
1425 * "contact_relationship": "",
1426 * "phone_contact": "123-456-7890",
1427 * "phone_home": "",
1428 * "phone_biz": "",
1429 * "phone_cell": "",
1430 * "email": "",
1431 * "DOB": "1992-02-03",
1432 * "sex": "Male",
1433 * "race": "",
1434 * "ethnicity": "",
1435 * "status": ""
1441 * @OA\Put(
1442 * path="/api/patient/{puuid}",
1443 * description="Updates a patient",
1444 * tags={"standard"},
1445 * @OA\Parameter(
1446 * name="puuid",
1447 * in="path",
1448 * description="The uuid for the patient.",
1449 * required=true,
1450 * @OA\Schema(
1451 * type="string"
1453 * ),
1454 * @OA\RequestBody(
1455 * required=true,
1456 * @OA\MediaType(
1457 * mediaType="application/json",
1458 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1460 * ),
1461 * @OA\Response(
1462 * response="200",
1463 * description="Standard response",
1464 * @OA\MediaType(
1465 * mediaType="application/json",
1466 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1468 * ),
1469 * @OA\Response(
1470 * response="401",
1471 * ref="#/components/responses/unauthorized"
1472 * ),
1473 * security={{"openemr_auth":{}}}
1476 "PUT /api/patient/:puuid" => function ($puuid) {
1477 RestConfig::authorization_check("patients", "demo");
1478 $data = (array) (json_decode(file_get_contents("php://input")));
1479 $return = (new PatientRestController())->put($puuid, $data);
1480 RestConfig::apiLog($return, $data);
1481 return $return;
1485 * @OA\Get(
1486 * path="/api/patient/{puuid}",
1487 * description="Retrieves a single patient by their uuid",
1488 * tags={"standard"},
1489 * @OA\Parameter(
1490 * name="puuid",
1491 * in="path",
1492 * description="The uuid for the patient.",
1493 * required=true,
1494 * @OA\Schema(
1495 * type="string"
1497 * ),
1498 * @OA\Response(
1499 * response="200",
1500 * description="Standard response",
1501 * @OA\MediaType(
1502 * mediaType="application/json",
1503 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1505 * ),
1506 * @OA\Response(
1507 * response="401",
1508 * ref="#/components/responses/unauthorized"
1509 * ),
1510 * security={{"openemr_auth":{}}}
1513 "GET /api/patient/:puuid" => function ($puuid) {
1514 RestConfig::authorization_check("patients", "demo");
1515 $return = (new PatientRestController())->getOne($puuid);
1516 RestConfig::apiLog($return);
1517 return $return;
1521 * @OA\Get(
1522 * path="/api/patient/{puuid}/encounter",
1523 * description="Retrieves a list of encounters for a single patient",
1524 * tags={"standard"},
1525 * @OA\Parameter(
1526 * name="puuid",
1527 * in="path",
1528 * description="The uuid for the patient.",
1529 * required=true,
1530 * @OA\Schema(
1531 * type="string"
1533 * ),
1534 * @OA\Response(
1535 * response="200",
1536 * ref="#/components/responses/standard"
1537 * ),
1538 * @OA\Response(
1539 * response="400",
1540 * ref="#/components/responses/badrequest"
1541 * ),
1542 * @OA\Response(
1543 * response="401",
1544 * ref="#/components/responses/unauthorized"
1545 * ),
1546 * security={{"openemr_auth":{}}}
1549 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1550 RestConfig::authorization_check("encounters", "auth_a");
1551 $return = (new EncounterRestController())->getAll($puuid);
1552 RestConfig::apiLog($return);
1553 return $return;
1557 * Schema for the encounter request
1559 * @OA\Schema(
1560 * schema="api_encounter_request",
1561 * @OA\Property(
1562 * property="date",
1563 * description="The date of encounter.",
1564 * type="string"
1565 * ),
1566 * @OA\Property(
1567 * property="onset_date",
1568 * description="The onset date of encounter.",
1569 * type="string"
1570 * ),
1571 * @OA\Property(
1572 * property="reason",
1573 * description="The reason of encounter.",
1574 * type="string"
1575 * ),
1576 * @OA\Property(
1577 * property="facility",
1578 * description="The facility of encounter.",
1579 * type="string"
1580 * ),
1581 * @OA\Property(
1582 * property="pc_catid",
1583 * description="The pc_catid of encounter.",
1584 * type="string"
1585 * ),
1586 * @OA\Property(
1587 * property="facility_id",
1588 * description="The facility id of encounter.",
1589 * type="string"
1590 * ),
1591 * @OA\Property(
1592 * property="billing_facility",
1593 * description="The billing facility id of encounter.",
1594 * type="string"
1595 * ),
1596 * @OA\Property(
1597 * property="sensitivity",
1598 * description="The sensitivity of encounter.",
1599 * type="string"
1600 * ),
1601 * @OA\Property(
1602 * property="referral_source",
1603 * description="The referral source of encounter.",
1604 * type="string"
1605 * ),
1606 * @OA\Property(
1607 * property="pos_code",
1608 * description="The pos_code of encounter.",
1609 * type="string"
1610 * ),
1611 * @OA\Property(
1612 * property="external_id",
1613 * description="The external id of encounter.",
1614 * type="string"
1615 * ),
1616 * @OA\Property(
1617 * property="provider_id",
1618 * description="The provider id of encounter.",
1619 * type="string"
1620 * ),
1621 * @OA\Property(
1622 * property="class_code",
1623 * description="The class_code of encounter.",
1624 * type="string"
1625 * ),
1626 * required={"pc_catid", "class_code"},
1627 * example={
1628 * "date":"2020-11-10",
1629 * "onset_date": "",
1630 * "reason": "Pregnancy Test",
1631 * "facility": "Owerri General Hospital",
1632 * "pc_catid": "5",
1633 * "facility_id": "3",
1634 * "billing_facility": "3",
1635 * "sensitivity": "normal",
1636 * "referral_source": "",
1637 * "pos_code": "0",
1638 * "external_id": "",
1639 * "provider_id": "1",
1640 * "class_code" : "AMB"
1645 * @OA\Post(
1646 * path="/api/patient/{puuid}/encounter",
1647 * description="Creates a new encounter",
1648 * tags={"standard"},
1649 * @OA\Parameter(
1650 * name="puuid",
1651 * in="path",
1652 * description="The uuid for the patient.",
1653 * required=true,
1654 * @OA\Schema(
1655 * type="string"
1657 * ),
1658 * @OA\RequestBody(
1659 * required=true,
1660 * @OA\MediaType(
1661 * mediaType="application/json",
1662 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1664 * ),
1665 * @OA\Response(
1666 * response="200",
1667 * description="Standard response",
1668 * @OA\MediaType(
1669 * mediaType="application/json",
1670 * @OA\Schema(
1671 * @OA\Property(
1672 * property="validationErrors",
1673 * description="Validation errors.",
1674 * type="array",
1675 * @OA\Items(
1676 * type="object",
1677 * ),
1678 * ),
1679 * @OA\Property(
1680 * property="internalErrors",
1681 * description="Internal errors.",
1682 * type="array",
1683 * @OA\Items(
1684 * type="object",
1685 * ),
1686 * ),
1687 * @OA\Property(
1688 * property="data",
1689 * description="Returned data.",
1690 * type="array",
1691 * @OA\Items(
1692 * @OA\Property(
1693 * property="encounter",
1694 * description="encounter id",
1695 * type="integer",
1696 * ),
1697 * @OA\Property(
1698 * property="uuid",
1699 * description="encounter uuid",
1700 * type="string",
1702 * ),
1703 * ),
1704 * example={
1705 * "validationErrors": {},
1706 * "error_description": {},
1707 * "data": {
1708 * "encounter": 1,
1709 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1714 * ),
1715 * @OA\Response(
1716 * response="401",
1717 * ref="#/components/responses/unauthorized"
1718 * ),
1719 * security={{"openemr_auth":{}}}
1722 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1723 RestConfig::authorization_check("encounters", "auth_a");
1724 $data = (array) (json_decode(file_get_contents("php://input")));
1725 $return = (new EncounterRestController())->post($puuid, $data);
1726 RestConfig::apiLog($return, $data);
1727 return $return;
1731 * Schema for the encounter response
1733 * @OA\Schema(
1734 * schema="api_encounter_response",
1735 * @OA\Property(
1736 * property="validationErrors",
1737 * description="Validation errors.",
1738 * type="array",
1739 * @OA\Items(
1740 * type="object",
1741 * ),
1742 * ),
1743 * @OA\Property(
1744 * property="internalErrors",
1745 * description="Internal errors.",
1746 * type="array",
1747 * @OA\Items(
1748 * type="object",
1749 * ),
1750 * ),
1751 * @OA\Property(
1752 * property="data",
1753 * description="Returned data.",
1754 * type="array",
1755 * @OA\Items(
1756 * @OA\Property(
1757 * property="id",
1758 * description="encounter id",
1759 * type="string",
1760 * ),
1761 * @OA\Property(
1762 * property="uuid",
1763 * description="encounter uuid",
1764 * type="string",
1765 * ),
1766 * @OA\Property(
1767 * property="date",
1768 * description="encounter date",
1769 * type="string",
1770 * ),
1771 * @OA\Property(
1772 * property="reason",
1773 * description="encounter reason",
1774 * type="string",
1775 * ),
1776 * @OA\Property(
1777 * property="facility",
1778 * description="encounter facility name",
1779 * type="string",
1780 * ),
1781 * @OA\Property(
1782 * property="facility_id",
1783 * description="encounter facility id name",
1784 * type="string",
1785 * ),
1786 * @OA\Property(
1787 * property="pid",
1788 * description="encounter for patient pid",
1789 * type="string",
1790 * ),
1791 * @OA\Property(
1792 * property="onset_date",
1793 * description="encounter onset date",
1794 * type="string",
1795 * ),
1796 * @OA\Property(
1797 * property="sensitivity",
1798 * description="encounter sensitivity",
1799 * type="string",
1800 * ),
1801 * @OA\Property(
1802 * property="billing_note",
1803 * description="encounter billing note",
1804 * type="string",
1805 * ),
1806 * @OA\Property(
1807 * property="pc_catid",
1808 * description="encounter pc_catid",
1809 * type="string",
1810 * ),
1811 * @OA\Property(
1812 * property="last_level_billed",
1813 * description="encounter last_level_billed",
1814 * type="string",
1815 * ),
1816 * @OA\Property(
1817 * property="last_level_closed",
1818 * description="encounter last_level_closed",
1819 * type="string",
1820 * ),
1821 * @OA\Property(
1822 * property="last_stmt_date",
1823 * description="encounter last_stmt_date",
1824 * type="string",
1825 * ),
1826 * @OA\Property(
1827 * property="stmt_count",
1828 * description="encounter stmt_count",
1829 * type="string",
1830 * ),
1831 * @OA\Property(
1832 * property="provider_id",
1833 * description="provider id",
1834 * type="string",
1835 * ),
1836 * @OA\Property(
1837 * property="supervisor_id",
1838 * description="encounter supervisor id",
1839 * type="string",
1840 * ),
1841 * @OA\Property(
1842 * property="invoice_refno",
1843 * description="encounter invoice_refno",
1844 * type="string",
1845 * ),
1846 * @OA\Property(
1847 * property="referral_source",
1848 * description="encounter referral source",
1849 * type="string",
1850 * ),
1851 * @OA\Property(
1852 * property="billing_facility",
1853 * description="encounter billing facility id",
1854 * type="string",
1855 * ),
1856 * @OA\Property(
1857 * property="external_id",
1858 * description="encounter external id",
1859 * type="string",
1860 * ),
1861 * @OA\Property(
1862 * property="pos_code",
1863 * description="encounter pos_code",
1864 * type="string",
1865 * ),
1866 * @OA\Property(
1867 * property="class_code",
1868 * description="encounter class_code",
1869 * type="string",
1870 * ),
1871 * @OA\Property(
1872 * property="class_title",
1873 * description="encounter class_title",
1874 * type="string",
1875 * ),
1876 * @OA\Property(
1877 * property="pc_catname",
1878 * description="encounter pc_catname",
1879 * type="string",
1880 * ),
1881 * @OA\Property(
1882 * property="billing_facility_name",
1883 * description="encounter billing facility name",
1884 * type="string",
1885 * ),
1886 * ),
1887 * ),
1888 * example={
1889 * "validationErrors": {},
1890 * "error_description": {},
1891 * "data": {
1892 * "id": "1",
1893 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1894 * "date": "2019-09-14 00:00:00",
1895 * "reason": "Pregnancy Test",
1896 * "facility": "Owerri General Hospital",
1897 * "facility_id": "3",
1898 * "pid": "1",
1899 * "onset_date": "2019-04-20 00:00:00",
1900 * "sensitivity": "normal",
1901 * "billing_note": null,
1902 * "pc_catid": "5",
1903 * "last_level_billed": "0",
1904 * "last_level_closed": "0",
1905 * "last_stmt_date": null,
1906 * "stmt_count": "0",
1907 * "provider_id": "1",
1908 * "supervisor_id": "0",
1909 * "invoice_refno": "",
1910 * "referral_source": "",
1911 * "billing_facility": "3",
1912 * "external_id": "",
1913 * "pos_code": "0",
1914 * "class_code": "AMB",
1915 * "class_title": "ambulatory",
1916 * "pc_catname": "Office Visit",
1917 * "billing_facility_name": "Owerri General Hospital"
1923 * @OA\Put(
1924 * path="/api/patient/{puuid}/encounter/{euuid}",
1925 * description="Modify a encounter",
1926 * tags={"standard"},
1927 * @OA\Parameter(
1928 * name="puuid",
1929 * in="path",
1930 * description="The uuid for the patient.",
1931 * required=true,
1932 * @OA\Schema(
1933 * type="string"
1935 * ),
1936 * @OA\Parameter(
1937 * name="euuid",
1938 * in="path",
1939 * description="The uuid for the encounter.",
1940 * required=true,
1941 * @OA\Schema(
1942 * type="string"
1944 * ),
1945 * @OA\RequestBody(
1946 * required=true,
1947 * @OA\MediaType(
1948 * mediaType="application/json",
1949 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1951 * ),
1952 * @OA\Response(
1953 * response="200",
1954 * description="Standard response",
1955 * @OA\MediaType(
1956 * mediaType="application/json",
1957 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1959 * ),
1960 * @OA\Response(
1961 * response="401",
1962 * ref="#/components/responses/unauthorized"
1963 * ),
1964 * security={{"openemr_auth":{}}}
1967 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1968 RestConfig::authorization_check("encounters", "auth_a");
1969 $data = (array) (json_decode(file_get_contents("php://input")));
1970 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1971 RestConfig::apiLog($return, $data);
1972 return $return;
1976 * @OA\Get(
1977 * path="/api/patient/{puuid}/encounter/{euuid}",
1978 * description="Retrieves a single encounter for a patient",
1979 * tags={"standard"},
1980 * @OA\Parameter(
1981 * name="puuid",
1982 * in="path",
1983 * description="The uuid for the patient.",
1984 * required=true,
1985 * @OA\Schema(
1986 * type="string"
1988 * ),
1989 * @OA\Parameter(
1990 * name="euuid",
1991 * in="path",
1992 * description="The uuid for the encounter.",
1993 * required=true,
1994 * @OA\Schema(
1995 * type="string"
1997 * ),
1998 * @OA\Response(
1999 * response="200",
2000 * description="Standard response",
2001 * @OA\MediaType(
2002 * mediaType="application/json",
2003 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
2005 * ),
2006 * @OA\Response(
2007 * response="401",
2008 * ref="#/components/responses/unauthorized"
2009 * ),
2010 * security={{"openemr_auth":{}}}
2013 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
2014 RestConfig::authorization_check("encounters", "auth_a");
2015 $return = (new EncounterRestController())->getOne($puuid, $euuid);
2016 RestConfig::apiLog($return);
2017 return $return;
2021 * @OA\Get(
2022 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2023 * description="Retrieves soap notes from an encounter for a patient",
2024 * tags={"standard"},
2025 * @OA\Parameter(
2026 * name="pid",
2027 * in="path",
2028 * description="The pid for the patient.",
2029 * required=true,
2030 * @OA\Schema(
2031 * type="string"
2033 * ),
2034 * @OA\Parameter(
2035 * name="eid",
2036 * in="path",
2037 * description="The id for the encounter.",
2038 * required=true,
2039 * @OA\Schema(
2040 * type="string"
2042 * ),
2043 * @OA\Response(
2044 * response="200",
2045 * ref="#/components/responses/standard"
2046 * ),
2047 * @OA\Response(
2048 * response="400",
2049 * ref="#/components/responses/badrequest"
2050 * ),
2051 * @OA\Response(
2052 * response="401",
2053 * ref="#/components/responses/unauthorized"
2054 * ),
2055 * security={{"openemr_auth":{}}}
2058 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2059 RestConfig::authorization_check("encounters", "notes");
2060 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2061 RestConfig::apiLog($return);
2062 return $return;
2066 * Schema for the vital request
2068 * @OA\Schema(
2069 * schema="api_vital_request",
2070 * @OA\Property(
2071 * property="bps",
2072 * description="The bps of vitals.",
2073 * type="string"
2074 * ),
2075 * @OA\Property(
2076 * property="bpd",
2077 * description="The bpd of vitals.",
2078 * type="string"
2079 * ),
2080 * @OA\Property(
2081 * property="weight",
2082 * description="The weight of vitals. (unit is lb)",
2083 * type="string"
2084 * ),
2085 * @OA\Property(
2086 * property="height",
2087 * description="The height of vitals. (unit is inches)",
2088 * type="string"
2089 * ),
2090 * @OA\Property(
2091 * property="temperature",
2092 * description="The temperature of temperature. (unit is F)",
2093 * type="string"
2094 * ),
2095 * @OA\Property(
2096 * property="temp_method",
2097 * description="The temp_method of vitals.",
2098 * type="string"
2099 * ),
2100 * @OA\Property(
2101 * property="pulse",
2102 * description="The pulse of vitals.",
2103 * type="string"
2104 * ),
2105 * @OA\Property(
2106 * property="respiration",
2107 * description="The respiration of vitals.",
2108 * type="string"
2109 * ),
2110 * @OA\Property(
2111 * property="note",
2112 * description="The note (ie. comments) of vitals.",
2113 * type="string"
2114 * ),
2115 * @OA\Property(
2116 * property="waist_circ",
2117 * description="The waist circumference of vitals. (unit is inches)",
2118 * type="string"
2119 * ),
2120 * @OA\Property(
2121 * property="head_circ",
2122 * description="The head circumference of vitals. (unit is inches)",
2123 * type="string"
2124 * ),
2125 * @OA\Property(
2126 * property="oxygen_saturation",
2127 * description="The oxygen_saturation of vitals.",
2128 * type="string"
2129 * ),
2130 * example={
2131 * "bps": "130",
2132 * "bpd": "80",
2133 * "weight": "220",
2134 * "height": "70",
2135 * "temperature": "98",
2136 * "temp_method": "Oral",
2137 * "pulse": "60",
2138 * "respiration": "20",
2139 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2140 * "waist_circ": "37",
2141 * "head_circ": "22.2",
2142 * "oxygen_saturation": "96"
2147 * @OA\Post(
2148 * path="/api/patient/{pid}/encounter/{eid}/vital",
2149 * description="Submits a new vitals form",
2150 * tags={"standard"},
2151 * @OA\Parameter(
2152 * name="pid",
2153 * in="path",
2154 * description="The id for the patient.",
2155 * required=true,
2156 * @OA\Schema(
2157 * type="string"
2159 * ),
2160 * @OA\Parameter(
2161 * name="eid",
2162 * in="path",
2163 * description="The id for the encounter.",
2164 * required=true,
2165 * @OA\Schema(
2166 * type="string"
2168 * ),
2169 * @OA\RequestBody(
2170 * required=true,
2171 * @OA\MediaType(
2172 * mediaType="application/json",
2173 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2175 * ),
2176 * @OA\Response(
2177 * response="200",
2178 * ref="#/components/responses/standard"
2179 * ),
2180 * @OA\Response(
2181 * response="400",
2182 * ref="#/components/responses/badrequest"
2183 * ),
2184 * @OA\Response(
2185 * response="401",
2186 * ref="#/components/responses/unauthorized"
2187 * ),
2188 * security={{"openemr_auth":{}}}
2191 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2192 RestConfig::authorization_check("encounters", "notes");
2193 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2194 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2195 RestConfig::apiLog($return, $data);
2196 return $return;
2200 * @OA\Put(
2201 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2202 * description="Edit a vitals form",
2203 * tags={"standard"},
2204 * @OA\Parameter(
2205 * name="pid",
2206 * in="path",
2207 * description="The id for the patient.",
2208 * required=true,
2209 * @OA\Schema(
2210 * type="string"
2212 * ),
2213 * @OA\Parameter(
2214 * name="eid",
2215 * in="path",
2216 * description="The id for the encounter.",
2217 * required=true,
2218 * @OA\Schema(
2219 * type="string"
2221 * ),
2222 * @OA\Parameter(
2223 * name="vid",
2224 * in="path",
2225 * description="The id for the vitalss form.",
2226 * required=true,
2227 * @OA\Schema(
2228 * type="string"
2230 * ),
2231 * @OA\RequestBody(
2232 * required=true,
2233 * @OA\MediaType(
2234 * mediaType="application/json",
2235 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2237 * ),
2238 * @OA\Response(
2239 * response="200",
2240 * ref="#/components/responses/standard"
2241 * ),
2242 * @OA\Response(
2243 * response="400",
2244 * ref="#/components/responses/badrequest"
2245 * ),
2246 * @OA\Response(
2247 * response="401",
2248 * ref="#/components/responses/unauthorized"
2249 * ),
2250 * security={{"openemr_auth":{}}}
2253 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2254 RestConfig::authorization_check("encounters", "notes");
2255 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2256 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2257 RestConfig::apiLog($return, $data);
2258 return $return;
2262 * @OA\Get(
2263 * path="/api/patient/{pid}/encounter/{eid}/vital",
2264 * description="Retrieves all vitals from an encounter for a patient",
2265 * tags={"standard"},
2266 * @OA\Parameter(
2267 * name="pid",
2268 * in="path",
2269 * description="The pid for the patient.",
2270 * required=true,
2271 * @OA\Schema(
2272 * type="string"
2274 * ),
2275 * @OA\Parameter(
2276 * name="eid",
2277 * in="path",
2278 * description="The id for the encounter.",
2279 * required=true,
2280 * @OA\Schema(
2281 * type="string"
2283 * ),
2284 * @OA\Response(
2285 * response="200",
2286 * ref="#/components/responses/standard"
2287 * ),
2288 * @OA\Response(
2289 * response="400",
2290 * ref="#/components/responses/badrequest"
2291 * ),
2292 * @OA\Response(
2293 * response="401",
2294 * ref="#/components/responses/unauthorized"
2295 * ),
2296 * security={{"openemr_auth":{}}}
2299 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2300 RestConfig::authorization_check("encounters", "notes");
2301 $return = (new EncounterRestController())->getVitals($pid, $eid);
2302 RestConfig::apiLog($return);
2303 return $return;
2307 * @OA\Get(
2308 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2309 * description="Retrieves a vitals form from an encounter for a patient",
2310 * tags={"standard"},
2311 * @OA\Parameter(
2312 * name="pid",
2313 * in="path",
2314 * description="The pid for the patient.",
2315 * required=true,
2316 * @OA\Schema(
2317 * type="string"
2319 * ),
2320 * @OA\Parameter(
2321 * name="eid",
2322 * in="path",
2323 * description="The id for the encounter.",
2324 * required=true,
2325 * @OA\Schema(
2326 * type="string"
2328 * ),
2329 * @OA\Parameter(
2330 * name="vid",
2331 * in="path",
2332 * description="The id for the vitals form.",
2333 * required=true,
2334 * @OA\Schema(
2335 * type="string"
2337 * ),
2338 * @OA\Response(
2339 * response="200",
2340 * ref="#/components/responses/standard"
2341 * ),
2342 * @OA\Response(
2343 * response="400",
2344 * ref="#/components/responses/badrequest"
2345 * ),
2346 * @OA\Response(
2347 * response="401",
2348 * ref="#/components/responses/unauthorized"
2349 * ),
2350 * security={{"openemr_auth":{}}}
2353 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2354 RestConfig::authorization_check("encounters", "notes");
2355 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2356 RestConfig::apiLog($return);
2357 return $return;
2361 * @OA\Get(
2362 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2363 * description="Retrieves a soap note from an encounter for a patient",
2364 * tags={"standard"},
2365 * @OA\Parameter(
2366 * name="pid",
2367 * in="path",
2368 * description="The pid for the patient.",
2369 * required=true,
2370 * @OA\Schema(
2371 * type="string"
2373 * ),
2374 * @OA\Parameter(
2375 * name="eid",
2376 * in="path",
2377 * description="The id for the encounter.",
2378 * required=true,
2379 * @OA\Schema(
2380 * type="string"
2382 * ),
2383 * @OA\Parameter(
2384 * name="sid",
2385 * in="path",
2386 * description="The id for the soap note.",
2387 * required=true,
2388 * @OA\Schema(
2389 * type="string"
2391 * ),
2392 * @OA\Response(
2393 * response="200",
2394 * ref="#/components/responses/standard"
2395 * ),
2396 * @OA\Response(
2397 * response="400",
2398 * ref="#/components/responses/badrequest"
2399 * ),
2400 * @OA\Response(
2401 * response="401",
2402 * ref="#/components/responses/unauthorized"
2403 * ),
2404 * security={{"openemr_auth":{}}}
2407 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2408 RestConfig::authorization_check("encounters", "notes");
2409 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2410 RestConfig::apiLog($return);
2411 return $return;
2415 * Schema for the soap_note request
2417 * @OA\Schema(
2418 * schema="api_soap_note_request",
2419 * @OA\Property(
2420 * property="subjective",
2421 * description="The subjective of soap note.",
2422 * type="string"
2423 * ),
2424 * @OA\Property(
2425 * property="objective",
2426 * description="The objective of soap note.",
2427 * type="string"
2428 * ),
2429 * @OA\Property(
2430 * property="assessment",
2431 * description="The assessment of soap note.",
2432 * type="string"
2433 * ),
2434 * @OA\Property(
2435 * property="plan",
2436 * description="The plan of soap note.",
2437 * type="string"
2438 * ),
2439 * example={
2440 * "subjective": "The patient with mechanical fall and cut finger.",
2441 * "objective": "The patient with finger laceration on exam.",
2442 * "assessment": "The patient with finger laceration requiring sutures.",
2443 * "plan": "Sutured finger laceration."
2448 * @OA\Post(
2449 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2450 * description="Submits a new soap note",
2451 * tags={"standard"},
2452 * @OA\Parameter(
2453 * name="pid",
2454 * in="path",
2455 * description="The id for the patient.",
2456 * required=true,
2457 * @OA\Schema(
2458 * type="string"
2460 * ),
2461 * @OA\Parameter(
2462 * name="eid",
2463 * in="path",
2464 * description="The id for the encounter.",
2465 * required=true,
2466 * @OA\Schema(
2467 * type="string"
2469 * ),
2470 * @OA\RequestBody(
2471 * required=true,
2472 * @OA\MediaType(
2473 * mediaType="application/json",
2474 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2476 * ),
2477 * @OA\Response(
2478 * response="200",
2479 * ref="#/components/responses/standard"
2480 * ),
2481 * @OA\Response(
2482 * response="400",
2483 * ref="#/components/responses/badrequest"
2484 * ),
2485 * @OA\Response(
2486 * response="401",
2487 * ref="#/components/responses/unauthorized"
2488 * ),
2489 * security={{"openemr_auth":{}}}
2492 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2493 RestConfig::authorization_check("encounters", "notes");
2494 $data = (array) (json_decode(file_get_contents("php://input")));
2495 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2496 RestConfig::apiLog($return, $data);
2497 return $return;
2501 * @OA\Put(
2502 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2503 * description="Edit a soap note",
2504 * tags={"standard"},
2505 * @OA\Parameter(
2506 * name="pid",
2507 * in="path",
2508 * description="The id for the patient.",
2509 * required=true,
2510 * @OA\Schema(
2511 * type="string"
2513 * ),
2514 * @OA\Parameter(
2515 * name="eid",
2516 * in="path",
2517 * description="The id for the encounter.",
2518 * required=true,
2519 * @OA\Schema(
2520 * type="string"
2522 * ),
2523 * @OA\Parameter(
2524 * name="sid",
2525 * in="path",
2526 * description="The id for the soap noted.",
2527 * required=true,
2528 * @OA\Schema(
2529 * type="string"
2531 * ),
2532 * @OA\RequestBody(
2533 * required=true,
2534 * @OA\MediaType(
2535 * mediaType="application/json",
2536 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2538 * ),
2539 * @OA\Response(
2540 * response="200",
2541 * ref="#/components/responses/standard"
2542 * ),
2543 * @OA\Response(
2544 * response="400",
2545 * ref="#/components/responses/badrequest"
2546 * ),
2547 * @OA\Response(
2548 * response="401",
2549 * ref="#/components/responses/unauthorized"
2550 * ),
2551 * security={{"openemr_auth":{}}}
2554 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2555 RestConfig::authorization_check("encounters", "notes");
2556 $data = (array) (json_decode(file_get_contents("php://input")));
2557 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2558 RestConfig::apiLog($return, $data);
2559 return $return;
2564 * @OA\Get(
2565 * path="/api/practitioner",
2566 * description="Retrieves a list of practitioners",
2567 * tags={"standard"},
2568 * @OA\Parameter(
2569 * name="title",
2570 * in="query",
2571 * description="The title for the practitioner.",
2572 * required=false,
2573 * @OA\Schema(
2574 * type="string"
2576 * ),
2577 * @OA\Parameter(
2578 * name="fname",
2579 * in="query",
2580 * description="The first name for the practitioner.",
2581 * required=false,
2582 * @OA\Schema(
2583 * type="string"
2585 * ),
2586 * @OA\Parameter(
2587 * name="lname",
2588 * in="query",
2589 * description="The last name for the practitioner.",
2590 * required=false,
2591 * @OA\Schema(
2592 * type="string"
2594 * ),
2595 * @OA\Parameter(
2596 * name="mname",
2597 * in="query",
2598 * description="The middle name for the practitioner.",
2599 * required=false,
2600 * @OA\Schema(
2601 * type="string"
2603 * ),
2604 * @OA\Parameter(
2605 * name="federaltaxid",
2606 * in="query",
2607 * description="The federal tax id for the practitioner.",
2608 * required=false,
2609 * @OA\Schema(
2610 * type="string"
2612 * ),
2613 * @OA\Parameter(
2614 * name="federaldrugid",
2615 * in="query",
2616 * description="The federal drug id for the practitioner.",
2617 * required=false,
2618 * @OA\Schema(
2619 * type="string"
2621 * ),
2622 * @OA\Parameter(
2623 * name="upin",
2624 * in="query",
2625 * description="The upin for the practitioner.",
2626 * required=false,
2627 * @OA\Schema(
2628 * type="string"
2630 * ),
2631 * @OA\Parameter(
2632 * name="facility_id",
2633 * in="query",
2634 * description="The facility id for the practitioner.",
2635 * required=false,
2636 * @OA\Schema(
2637 * type="string"
2639 * ),
2640 * @OA\Parameter(
2641 * name="facility",
2642 * in="query",
2643 * description="The facility for the practitioner.",
2644 * required=false,
2645 * @OA\Schema(
2646 * type="string"
2648 * ),
2649 * @OA\Parameter(
2650 * name="npi",
2651 * in="query",
2652 * description="The npi for the practitioner.",
2653 * required=false,
2654 * @OA\Schema(
2655 * type="string"
2657 * ),
2658 * @OA\Parameter(
2659 * name="email",
2660 * in="query",
2661 * description="The email for the practitioner.",
2662 * required=false,
2663 * @OA\Schema(
2664 * type="string"
2666 * ),
2667 * @OA\Parameter(
2668 * name="specialty",
2669 * in="query",
2670 * description="The specialty for the practitioner.",
2671 * required=false,
2672 * @OA\Schema(
2673 * type="string"
2675 * ),
2676 * @OA\Parameter(
2677 * name="billname",
2678 * in="query",
2679 * description="The billname for the practitioner.",
2680 * required=false,
2681 * @OA\Schema(
2682 * type="string"
2684 * ),
2685 * @OA\Parameter(
2686 * name="url",
2687 * in="query",
2688 * description="The url for the practitioner.",
2689 * required=false,
2690 * @OA\Schema(
2691 * type="string"
2693 * ),
2694 * @OA\Parameter(
2695 * name="assistant",
2696 * in="query",
2697 * description="The assistant for the practitioner.",
2698 * required=false,
2699 * @OA\Schema(
2700 * type="string"
2702 * ),
2703 * @OA\Parameter(
2704 * name="organization",
2705 * in="query",
2706 * description="The organization for the practitioner.",
2707 * required=false,
2708 * @OA\Schema(
2709 * type="string"
2711 * ),
2712 * @OA\Parameter(
2713 * name="valedictory",
2714 * in="query",
2715 * description="The valedictory for the practitioner.",
2716 * required=false,
2717 * @OA\Schema(
2718 * type="string"
2720 * ),
2721 * @OA\Parameter(
2722 * name="street",
2723 * in="query",
2724 * description="The street for the practitioner.",
2725 * required=false,
2726 * @OA\Schema(
2727 * type="string"
2729 * ),
2730 * @OA\Parameter(
2731 * name="streetb",
2732 * in="query",
2733 * description="The street (line 2) for the practitioner.",
2734 * required=false,
2735 * @OA\Schema(
2736 * type="string"
2738 * ),
2739 * @OA\Parameter(
2740 * name="city",
2741 * in="query",
2742 * description="The city for the practitioner.",
2743 * required=false,
2744 * @OA\Schema(
2745 * type="string"
2747 * ),
2748 * @OA\Parameter(
2749 * name="state",
2750 * in="query",
2751 * description="The state for the practitioner.",
2752 * required=false,
2753 * @OA\Schema(
2754 * type="string"
2756 * ),
2757 * @OA\Parameter(
2758 * name="zip",
2759 * in="query",
2760 * description="The zip for the practitioner.",
2761 * required=false,
2762 * @OA\Schema(
2763 * type="string"
2765 * ),
2766 * @OA\Parameter(
2767 * name="phone",
2768 * in="query",
2769 * description="The phone for the practitioner.",
2770 * required=false,
2771 * @OA\Schema(
2772 * type="string"
2774 * ),
2775 * @OA\Parameter(
2776 * name="fax",
2777 * in="query",
2778 * description="The fax for the practitioner.",
2779 * required=false,
2780 * @OA\Schema(
2781 * type="string"
2783 * ),
2784 * @OA\Parameter(
2785 * name="phonew1",
2786 * in="query",
2787 * description="The phonew1 for the practitioner.",
2788 * required=false,
2789 * @OA\Schema(
2790 * type="string"
2792 * ),
2793 * @OA\Parameter(
2794 * name="phonecell",
2795 * in="query",
2796 * description="The phonecell for the practitioner.",
2797 * required=false,
2798 * @OA\Schema(
2799 * type="string"
2801 * ),
2802 * @OA\Parameter(
2803 * name="notes",
2804 * in="query",
2805 * description="The notes for the practitioner.",
2806 * required=false,
2807 * @OA\Schema(
2808 * type="string"
2810 * ),
2811 * @OA\Parameter(
2812 * name="state_license_number2",
2813 * in="query",
2814 * description="The state license number for the practitioner.",
2815 * required=false,
2816 * @OA\Schema(
2817 * type="string"
2819 * ),
2820 * @OA\Parameter(
2821 * name="username",
2822 * in="query",
2823 * description="The username for the practitioner.",
2824 * required=false,
2825 * @OA\Schema(
2826 * type="string"
2828 * ),
2829 * @OA\Response(
2830 * response="200",
2831 * ref="#/components/responses/standard"
2832 * ),
2833 * @OA\Response(
2834 * response="400",
2835 * ref="#/components/responses/badrequest"
2836 * ),
2837 * @OA\Response(
2838 * response="401",
2839 * ref="#/components/responses/unauthorized"
2840 * ),
2841 * security={{"openemr_auth":{}}}
2844 "GET /api/practitioner" => function () {
2845 RestConfig::authorization_check("admin", "users");
2846 $return = (new PractitionerRestController())->getAll($_GET);
2847 RestConfig::apiLog($return);
2848 return $return;
2852 * @OA\Get(
2853 * path="/api/practitioner/{pruuid}",
2854 * description="Retrieves a single practitioner by their uuid",
2855 * tags={"standard"},
2856 * @OA\Parameter(
2857 * name="pruuid",
2858 * in="path",
2859 * description="The uuid for the practitioner.",
2860 * required=true,
2861 * @OA\Schema(
2862 * type="string"
2864 * ),
2865 * @OA\Response(
2866 * response="200",
2867 * ref="#/components/responses/standard"
2868 * ),
2869 * @OA\Response(
2870 * response="400",
2871 * ref="#/components/responses/badrequest"
2872 * ),
2873 * @OA\Response(
2874 * response="401",
2875 * ref="#/components/responses/unauthorized"
2876 * ),
2877 * security={{"openemr_auth":{}}}
2880 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2881 RestConfig::authorization_check("admin", "users");
2882 $return = (new PractitionerRestController())->getOne($pruuid);
2883 RestConfig::apiLog($return);
2884 return $return;
2888 * @OA\Post(
2889 * path="/api/practitioner",
2890 * description="Submits a new practitioner",
2891 * tags={"standard"},
2892 * @OA\RequestBody(
2893 * required=true,
2894 * @OA\MediaType(
2895 * mediaType="application/json",
2896 * @OA\Schema(
2897 * @OA\Property(
2898 * property="title",
2899 * description="The title for the practitioner.",
2900 * type="string"
2901 * ),
2902 * @OA\Property(
2903 * property="fname",
2904 * description="The first name for the practitioner.",
2905 * type="string"
2906 * ),
2907 * @OA\Property(
2908 * property="mname",
2909 * description="The middle name for the practitioner.",
2910 * type="string"
2911 * ),
2912 * @OA\Property(
2913 * property="lname",
2914 * description="The last name for the practitioner.",
2915 * type="string"
2916 * ),
2917 * @OA\Property(
2918 * property="federaltaxid",
2919 * description="The federal tax id for the practitioner.",
2920 * type="string"
2921 * ),
2922 * @OA\Property(
2923 * property="federaldrugid",
2924 * description="The federal drug id for the practitioner.",
2925 * type="string"
2926 * ),
2927 * @OA\Property(
2928 * property="upin",
2929 * description="The upin for the practitioner.",
2930 * type="string"
2931 * ),
2932 * @OA\Property(
2933 * property="facility_id",
2934 * description="The facility_id for the practitioner.",
2935 * type="string"
2936 * ),
2937 * @OA\Property(
2938 * property="facility",
2939 * description="The facility name for the practitioner.",
2940 * type="string"
2941 * ),
2942 * @OA\Property(
2943 * property="npi",
2944 * description="The npi for the practitioner.",
2945 * type="string"
2946 * ),
2947 * @OA\Property(
2948 * property="email",
2949 * description="The email for the practitioner.",
2950 * type="string"
2951 * ),
2952 * @OA\Property(
2953 * property="specialty",
2954 * description="The specialty for the practitioner.",
2955 * type="string"
2956 * ),
2957 * @OA\Property(
2958 * property="billname",
2959 * description="The billname for the practitioner.",
2960 * type="string"
2961 * ),
2962 * @OA\Property(
2963 * property="url",
2964 * description="The url for the practitioner.",
2965 * type="string"
2966 * ),
2967 * @OA\Property(
2968 * property="assistant",
2969 * description="The assistant for the practitioner.",
2970 * type="string"
2971 * ),
2972 * @OA\Property(
2973 * property="valedictory",
2974 * description="The valedictory for the practitioner.",
2975 * type="string"
2976 * ),
2977 * @OA\Property(
2978 * property="street",
2979 * description="The street address for the practitioner.",
2980 * type="string"
2981 * ),
2982 * @OA\Property(
2983 * property="streetb",
2984 * description="The streetb address for the practitioner.",
2985 * type="string"
2986 * ),
2987 * @OA\Property(
2988 * property="city",
2989 * description="The city for the practitioner.",
2990 * type="string"
2991 * ),
2992 * @OA\Property(
2993 * property="state",
2994 * description="The state for the practitioner.",
2995 * type="string"
2996 * ),
2997 * @OA\Property(
2998 * property="zip",
2999 * description="The zip for the practitioner.",
3000 * type="string"
3001 * ),
3002 * @OA\Property(
3003 * property="phone",
3004 * description="The phone for the practitioner.",
3005 * type="string"
3006 * ),
3007 * @OA\Property(
3008 * property="fax",
3009 * description="The fax for the practitioner.",
3010 * type="string"
3011 * ),
3012 * @OA\Property(
3013 * property="phonew1",
3014 * description="The phonew1 for the practitioner.",
3015 * type="string"
3016 * ),
3017 * @OA\Property(
3018 * property="phonecell",
3019 * description="The phonecell for the practitioner.",
3020 * type="string"
3021 * ),
3022 * @OA\Property(
3023 * property="notes",
3024 * description="The notes for the practitioner.",
3025 * type="string"
3026 * ),
3027 * @OA\Property(
3028 * property="state_license_number",
3029 * description="The state license number for the practitioner.",
3030 * type="string"
3031 * ),
3032 * @OA\Property(
3033 * property="username",
3034 * description="The username for the practitioner.",
3035 * type="string"
3036 * ),
3037 * required={"fname", "lname", "npi"},
3038 * example={
3039 * "title": "Mrs.",
3040 * "fname": "Eduardo",
3041 * "mname": "Kathy",
3042 * "lname": "Perez",
3043 * "federaltaxid": "",
3044 * "federaldrugid": "",
3045 * "upin": "",
3046 * "facility_id": "3",
3047 * "facility": "Your Clinic Name Here",
3048 * "npi": "12345678901",
3049 * "email": "info@pennfirm.com",
3050 * "specialty": "",
3051 * "billname": null,
3052 * "url": null,
3053 * "assistant": null,
3054 * "organization": null,
3055 * "valedictory": null,
3056 * "street": "789 Third Avenue",
3057 * "streetb": "123 Cannaut Street",
3058 * "city": "San Diego",
3059 * "state": "CA",
3060 * "zip": "90210",
3061 * "phone": "(619) 555-9827",
3062 * "fax": null,
3063 * "phonew1": "(619) 555-7822",
3064 * "phonecell": "(619) 555-7821",
3065 * "notes": null,
3066 * "state_license_number": "123456",
3067 * "username": "eduardoperez"
3071 * ),
3072 * @OA\Response(
3073 * response="200",
3074 * description="Standard response",
3075 * @OA\MediaType(
3076 * mediaType="application/json",
3077 * @OA\Schema(
3078 * @OA\Property(
3079 * property="validationErrors",
3080 * description="Validation errors.",
3081 * type="array",
3082 * @OA\Items(
3083 * type="object",
3084 * ),
3085 * ),
3086 * @OA\Property(
3087 * property="internalErrors",
3088 * description="Internal errors.",
3089 * type="array",
3090 * @OA\Items(
3091 * type="object",
3092 * ),
3093 * ),
3094 * @OA\Property(
3095 * property="data",
3096 * description="Returned data.",
3097 * type="array",
3098 * @OA\Items(
3099 * @OA\Property(
3100 * property="id",
3101 * description="practitioner id",
3102 * type="integer",
3103 * ),
3104 * @OA\Property(
3105 * property="uuid",
3106 * description="practitioner uuid",
3107 * type="string",
3108 * ),
3109 * ),
3110 * ),
3111 * example={
3112 * "validationErrors": {},
3113 * "error_description": {},
3114 * "data": {
3115 * "id": 7,
3116 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3121 * ),
3122 * @OA\Response(
3123 * response="401",
3124 * ref="#/components/responses/unauthorized"
3125 * ),
3126 * security={{"openemr_auth":{}}}
3129 "POST /api/practitioner" => function () {
3130 RestConfig::authorization_check("admin", "users");
3131 $data = (array) (json_decode(file_get_contents("php://input")));
3132 $return = (new PractitionerRestController())->post($data);
3133 RestConfig::apiLog($return, $data);
3134 return $return;
3138 * @OA\Put(
3139 * path="/api/practitioner/{pruuid}",
3140 * description="Edit a practitioner",
3141 * tags={"standard"},
3142 * @OA\Parameter(
3143 * name="pruuid",
3144 * in="path",
3145 * description="The uuid for the practitioner.",
3146 * required=true,
3147 * @OA\Schema(
3148 * type="string"
3150 * ),
3151 * @OA\RequestBody(
3152 * required=true,
3153 * @OA\MediaType(
3154 * mediaType="application/json",
3155 * @OA\Schema(
3156 * @OA\Property(
3157 * property="title",
3158 * description="The title for the practitioner.",
3159 * type="string"
3160 * ),
3161 * @OA\Property(
3162 * property="fname",
3163 * description="The first name for the practitioner.",
3164 * type="string"
3165 * ),
3166 * @OA\Property(
3167 * property="mname",
3168 * description="The middle name for the practitioner.",
3169 * type="string"
3170 * ),
3171 * @OA\Property(
3172 * property="lname",
3173 * description="The last name for the practitioner.",
3174 * type="string"
3175 * ),
3176 * @OA\Property(
3177 * property="federaltaxid",
3178 * description="The federal tax id for the practitioner.",
3179 * type="string"
3180 * ),
3181 * @OA\Property(
3182 * property="federaldrugid",
3183 * description="The federal drug id for the practitioner.",
3184 * type="string"
3185 * ),
3186 * @OA\Property(
3187 * property="upin",
3188 * description="The upin for the practitioner.",
3189 * type="string"
3190 * ),
3191 * @OA\Property(
3192 * property="facility_id",
3193 * description="The facility_id for the practitioner.",
3194 * type="string"
3195 * ),
3196 * @OA\Property(
3197 * property="facility",
3198 * description="The facility name for the practitioner.",
3199 * type="string"
3200 * ),
3201 * @OA\Property(
3202 * property="npi",
3203 * description="The npi for the practitioner.",
3204 * type="string"
3205 * ),
3206 * @OA\Property(
3207 * property="email",
3208 * description="The email for the practitioner.",
3209 * type="string"
3210 * ),
3211 * @OA\Property(
3212 * property="specialty",
3213 * description="The specialty for the practitioner.",
3214 * type="string"
3215 * ),
3216 * @OA\Property(
3217 * property="billname",
3218 * description="The billname for the practitioner.",
3219 * type="string"
3220 * ),
3221 * @OA\Property(
3222 * property="url",
3223 * description="The url for the practitioner.",
3224 * type="string"
3225 * ),
3226 * @OA\Property(
3227 * property="assistant",
3228 * description="The assistant for the practitioner.",
3229 * type="string"
3230 * ),
3231 * @OA\Property(
3232 * property="valedictory",
3233 * description="The valedictory for the practitioner.",
3234 * type="string"
3235 * ),
3236 * @OA\Property(
3237 * property="street",
3238 * description="The street address for the practitioner.",
3239 * type="string"
3240 * ),
3241 * @OA\Property(
3242 * property="streetb",
3243 * description="The streetb address for the practitioner.",
3244 * type="string"
3245 * ),
3246 * @OA\Property(
3247 * property="city",
3248 * description="The city for the practitioner.",
3249 * type="string"
3250 * ),
3251 * @OA\Property(
3252 * property="state",
3253 * description="The state for the practitioner.",
3254 * type="string"
3255 * ),
3256 * @OA\Property(
3257 * property="zip",
3258 * description="The zip for the practitioner.",
3259 * type="string"
3260 * ),
3261 * @OA\Property(
3262 * property="phone",
3263 * description="The phone for the practitioner.",
3264 * type="string"
3265 * ),
3266 * @OA\Property(
3267 * property="fax",
3268 * description="The fax for the practitioner.",
3269 * type="string"
3270 * ),
3271 * @OA\Property(
3272 * property="phonew1",
3273 * description="The phonew1 for the practitioner.",
3274 * type="string"
3275 * ),
3276 * @OA\Property(
3277 * property="phonecell",
3278 * description="The phonecell for the practitioner.",
3279 * type="string"
3280 * ),
3281 * @OA\Property(
3282 * property="notes",
3283 * description="The notes for the practitioner.",
3284 * type="string"
3285 * ),
3286 * @OA\Property(
3287 * property="state_license_number",
3288 * description="The state license number for the practitioner.",
3289 * type="string"
3290 * ),
3291 * @OA\Property(
3292 * property="username",
3293 * description="The username for the practitioner.",
3294 * type="string"
3295 * ),
3296 * example={
3297 * "title": "Mr",
3298 * "fname": "Baz",
3299 * "mname": "",
3300 * "lname": "Bop",
3301 * "street": "456 Tree Lane",
3302 * "zip": "08642",
3303 * "city": "FooTown",
3304 * "state": "FL",
3305 * "phone": "123-456-7890"
3309 * ),
3310 * @OA\Response(
3311 * response="200",
3312 * description="Standard response",
3313 * @OA\MediaType(
3314 * mediaType="application/json",
3315 * @OA\Schema(
3316 * @OA\Property(
3317 * property="validationErrors",
3318 * description="Validation errors.",
3319 * type="array",
3320 * @OA\Items(
3321 * type="object",
3322 * ),
3323 * ),
3324 * @OA\Property(
3325 * property="internalErrors",
3326 * description="Internal errors.",
3327 * type="array",
3328 * @OA\Items(
3329 * type="object",
3330 * ),
3331 * ),
3332 * @OA\Property(
3333 * property="data",
3334 * description="Returned data.",
3335 * type="array",
3336 * @OA\Items(
3337 * @OA\Property(
3338 * property="id",
3339 * description="practitioner id",
3340 * type="string",
3341 * ),
3342 * @OA\Property(
3343 * property="uuid",
3344 * description="practitioner uuid",
3345 * type="string",
3346 * ),
3347 * @OA\Property(
3348 * property="title",
3349 * description="practitioner title",
3350 * type="string",
3351 * ),
3352 * @OA\Property(
3353 * property="fname",
3354 * description="practitioner fname",
3355 * type="string",
3356 * ),
3357 * @OA\Property(
3358 * property="lname",
3359 * description="practitioner lname",
3360 * type="string",
3361 * ),
3362 * @OA\Property(
3363 * property="mname",
3364 * description="practitioner mname",
3365 * type="string",
3366 * ),
3367 * @OA\Property(
3368 * property="federaltaxid",
3369 * description="practitioner federaltaxid",
3370 * type="string",
3371 * ),
3372 * @OA\Property(
3373 * property="federaldrugid",
3374 * description="practitioner federaldrugid",
3375 * type="string",
3376 * ),
3377 * @OA\Property(
3378 * property="upin",
3379 * description="practitioner upin",
3380 * type="string",
3381 * ),
3382 * @OA\Property(
3383 * property="facility_id",
3384 * description="practitioner facility_id",
3385 * type="string",
3386 * ),
3387 * @OA\Property(
3388 * property="facility",
3389 * description="practitioner facility",
3390 * type="string",
3391 * ),
3392 * @OA\Property(
3393 * property="npi",
3394 * description="practitioner npi",
3395 * type="string",
3396 * ),
3397 * @OA\Property(
3398 * property="email",
3399 * description="practitioner email",
3400 * type="string",
3401 * ),
3402 * @OA\Property(
3403 * property="active",
3404 * description="practitioner active setting",
3405 * type="string",
3406 * ),
3407 * @OA\Property(
3408 * property="specialty",
3409 * description="practitioner specialty",
3410 * type="string",
3411 * ),
3412 * @OA\Property(
3413 * property="billname",
3414 * description="practitioner billname",
3415 * type="string",
3416 * ),
3417 * @OA\Property(
3418 * property="url",
3419 * description="practitioner url",
3420 * type="string",
3421 * ),
3422 * @OA\Property(
3423 * property="assistant",
3424 * description="practitioner assistant",
3425 * type="string",
3426 * ),
3427 * @OA\Property(
3428 * property="organization",
3429 * description="practitioner organization",
3430 * type="string",
3431 * ),
3432 * @OA\Property(
3433 * property="valedictory",
3434 * description="practitioner valedictory",
3435 * type="string",
3436 * ),
3437 * @OA\Property(
3438 * property="street",
3439 * description="practitioner street",
3440 * type="string",
3441 * ),
3442 * @OA\Property(
3443 * property="streetb",
3444 * description="practitioner streetb",
3445 * type="string",
3446 * ),
3447 * @OA\Property(
3448 * property="city",
3449 * description="practitioner city",
3450 * type="string",
3451 * ),
3452 * @OA\Property(
3453 * property="state",
3454 * description="practitioner state",
3455 * type="string",
3456 * ),
3457 * @OA\Property(
3458 * property="zip",
3459 * description="practitioner zip",
3460 * type="string",
3461 * ),
3462 * @OA\Property(
3463 * property="phone",
3464 * description="practitioner phone",
3465 * type="string",
3466 * ),
3467 * @OA\Property(
3468 * property="fax",
3469 * description="fax",
3470 * type="string",
3471 * ),
3472 * @OA\Property(
3473 * property="phonew1",
3474 * description="practitioner phonew1",
3475 * type="string",
3476 * ),
3477 * @OA\Property(
3478 * property="phonecell",
3479 * description="practitioner phonecell",
3480 * type="string",
3481 * ),
3482 * @OA\Property(
3483 * property="notes",
3484 * description="practitioner notes",
3485 * type="string",
3486 * ),
3487 * @OA\Property(
3488 * property="state_license_number",
3489 * description="practitioner state license number",
3490 * type="string",
3491 * ),
3492 * @OA\Property(
3493 * property="abook_title",
3494 * description="practitioner abook title",
3495 * type="string",
3496 * ),
3497 * @OA\Property(
3498 * property="physician_title",
3499 * description="practitioner physician title",
3500 * type="string",
3501 * ),
3502 * @OA\Property(
3503 * property="physician_code",
3504 * description="practitioner physician code",
3505 * type="string",
3507 * ),
3508 * ),
3509 * example={
3510 * "validationErrors": {},
3511 * "error_description": {},
3512 * "data": {
3513 * "id": 7,
3514 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3515 * "title": "Mr",
3516 * "fname": "Baz",
3517 * "lname": "Bop",
3518 * "mname": "",
3519 * "federaltaxid": "",
3520 * "federaldrugid": "",
3521 * "upin": "",
3522 * "facility_id": "3",
3523 * "facility": "Your Clinic Name Here",
3524 * "npi": "0123456789",
3525 * "email": "info@pennfirm.com",
3526 * "active": "1",
3527 * "specialty": "",
3528 * "billname": "",
3529 * "url": "",
3530 * "assistant": "",
3531 * "organization": "",
3532 * "valedictory": "",
3533 * "street": "456 Tree Lane",
3534 * "streetb": "123 Cannaut Street",
3535 * "city": "FooTown",
3536 * "state": "FL",
3537 * "zip": "08642",
3538 * "phone": "123-456-7890",
3539 * "fax": "",
3540 * "phonew1": "(619) 555-7822",
3541 * "phonecell": "(619) 555-7821",
3542 * "notes": "",
3543 * "state_license_number": "123456",
3544 * "abook_title": null,
3545 * "physician_title": null,
3546 * "physician_code": null
3551 * ),
3552 * @OA\Response(
3553 * response="401",
3554 * ref="#/components/responses/unauthorized"
3555 * ),
3556 * security={{"openemr_auth":{}}}
3559 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3560 RestConfig::authorization_check("admin", "users");
3561 $data = (array) (json_decode(file_get_contents("php://input")));
3562 $return = (new PractitionerRestController())->patch($pruuid, $data);
3563 RestConfig::apiLog($return, $data);
3564 return $return;
3568 * @OA\Get(
3569 * path="/api/medical_problem",
3570 * description="Retrieves a list of medical problems",
3571 * tags={"standard"},
3572 * @OA\Parameter(
3573 * name="puuid",
3574 * in="query",
3575 * description="The uuid for the patient.",
3576 * required=false,
3577 * @OA\Schema(
3578 * type="string"
3580 * ),
3581 * @OA\Parameter(
3582 * name="condition_uuid",
3583 * in="query",
3584 * description="The uuid for the medical problem.",
3585 * required=false,
3586 * @OA\Schema(
3587 * type="string"
3589 * ),
3590 * @OA\Parameter(
3591 * name="title",
3592 * in="query",
3593 * description="The title for the medical problem.",
3594 * required=false,
3595 * @OA\Schema(
3596 * type="string"
3598 * ),
3599 * @OA\Parameter(
3600 * name="begdate",
3601 * in="query",
3602 * description="The start date for the medical problem.",
3603 * required=false,
3604 * @OA\Schema(
3605 * type="string"
3607 * ),
3608 * @OA\Parameter(
3609 * name="enddate",
3610 * in="query",
3611 * description="The end date for the medical problem.",
3612 * required=false,
3613 * @OA\Schema(
3614 * type="string"
3616 * ),
3617 * @OA\Parameter(
3618 * name="diagnosis",
3619 * in="query",
3620 * description="The diagnosis for the medical problem.",
3621 * required=false,
3622 * @OA\Schema(
3623 * type="string"
3625 * ),
3626 * @OA\Response(
3627 * response="200",
3628 * ref="#/components/responses/standard"
3629 * ),
3630 * @OA\Response(
3631 * response="400",
3632 * ref="#/components/responses/badrequest"
3633 * ),
3634 * @OA\Response(
3635 * response="401",
3636 * ref="#/components/responses/unauthorized"
3637 * ),
3638 * security={{"openemr_auth":{}}}
3641 "GET /api/medical_problem" => function () {
3642 RestConfig::authorization_check("encounters", "notes");
3643 $return = (new ConditionRestController())->getAll();
3644 RestConfig::apiLog($return);
3645 return $return;
3649 * @OA\Get(
3650 * path="/api/medical_problem/{muuid}",
3651 * description="Retrieves a single medical problem by their uuid",
3652 * tags={"standard"},
3653 * @OA\Parameter(
3654 * name="muuid",
3655 * in="path",
3656 * description="The uuid for the medical problem.",
3657 * required=true,
3658 * @OA\Schema(
3659 * type="string"
3661 * ),
3662 * @OA\Response(
3663 * response="200",
3664 * ref="#/components/responses/standard"
3665 * ),
3666 * @OA\Response(
3667 * response="400",
3668 * ref="#/components/responses/badrequest"
3669 * ),
3670 * @OA\Response(
3671 * response="401",
3672 * ref="#/components/responses/unauthorized"
3673 * ),
3674 * security={{"openemr_auth":{}}}
3677 "GET /api/medical_problem/:muuid" => function ($muuid) {
3678 RestConfig::authorization_check("encounters", "notes");
3679 $return = (new ConditionRestController())->getOne($muuid);
3680 RestConfig::apiLog($return);
3681 return $return;
3685 * @OA\Get(
3686 * path="/api/patient/{puuid}/medical_problem",
3687 * description="Retrieves all medical problems for a patient",
3688 * tags={"standard"},
3689 * @OA\Parameter(
3690 * name="puuid",
3691 * in="path",
3692 * description="The uuid for the patient.",
3693 * required=true,
3694 * @OA\Schema(
3695 * type="string"
3697 * ),
3698 * @OA\Response(
3699 * response="200",
3700 * ref="#/components/responses/standard"
3701 * ),
3702 * @OA\Response(
3703 * response="400",
3704 * ref="#/components/responses/badrequest"
3705 * ),
3706 * @OA\Response(
3707 * response="401",
3708 * ref="#/components/responses/unauthorized"
3709 * ),
3710 * security={{"openemr_auth":{}}}
3713 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3714 RestConfig::authorization_check("encounters", "notes");
3715 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3716 RestConfig::apiLog($return);
3717 return $return;
3721 * @OA\Get(
3722 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3723 * description="Retrieves a medical problem for a patient",
3724 * tags={"standard"},
3725 * @OA\Parameter(
3726 * name="puuid",
3727 * in="path",
3728 * description="The uuid for the patient.",
3729 * required=true,
3730 * @OA\Schema(
3731 * type="string"
3733 * ),
3734 * @OA\Parameter(
3735 * name="muuid",
3736 * in="path",
3737 * description="The uuid for the medical problem.",
3738 * required=true,
3739 * @OA\Schema(
3740 * type="string"
3742 * ),
3743 * @OA\Response(
3744 * response="200",
3745 * ref="#/components/responses/standard"
3746 * ),
3747 * @OA\Response(
3748 * response="400",
3749 * ref="#/components/responses/badrequest"
3750 * ),
3751 * @OA\Response(
3752 * response="401",
3753 * ref="#/components/responses/unauthorized"
3754 * ),
3755 * security={{"openemr_auth":{}}}
3758 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3759 RestConfig::authorization_check("patients", "med");
3760 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3761 RestConfig::apiLog($return);
3762 return $return;
3766 * Schema for the medical_problem request
3768 * @OA\Schema(
3769 * schema="api_medical_problem_request",
3770 * @OA\Property(
3771 * property="title",
3772 * description="The title of medical problem.",
3773 * type="string"
3774 * ),
3775 * @OA\Property(
3776 * property="begdate",
3777 * description="The beginning date of medical problem.",
3778 * type="string"
3779 * ),
3780 * @OA\Property(
3781 * property="enddate",
3782 * description="The end date of medical problem.",
3783 * type="string"
3784 * ),
3785 * @OA\Property(
3786 * property="diagnosis",
3787 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3788 * type="string"
3789 * ),
3790 * required={"title", "begdate"},
3791 * example={
3792 * "title": "Dermatochalasis",
3793 * "begdate": "2010-10-13",
3794 * "enddate": null,
3795 * "diagnosis": "ICD10:H02.839"
3800 * @OA\Post(
3801 * path="/api/patient/{puuid}/medical_problem",
3802 * description="Submits a new medical problem",
3803 * tags={"standard"},
3804 * @OA\Parameter(
3805 * name="puuid",
3806 * in="path",
3807 * description="The uuid for the patient.",
3808 * required=true,
3809 * @OA\Schema(
3810 * type="string"
3812 * ),
3813 * @OA\RequestBody(
3814 * required=true,
3815 * @OA\MediaType(
3816 * mediaType="application/json",
3817 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3819 * ),
3820 * @OA\Response(
3821 * response="200",
3822 * ref="#/components/responses/standard"
3823 * ),
3824 * @OA\Response(
3825 * response="400",
3826 * ref="#/components/responses/badrequest"
3827 * ),
3828 * @OA\Response(
3829 * response="401",
3830 * ref="#/components/responses/unauthorized"
3831 * ),
3832 * security={{"openemr_auth":{}}}
3835 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3836 RestConfig::authorization_check("patients", "med");
3837 $data = (array) (json_decode(file_get_contents("php://input")));
3838 $return = (new ConditionRestController())->post($puuid, $data);
3839 RestConfig::apiLog($return, $data);
3840 return $return;
3844 * @OA\Put(
3845 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3846 * description="Edit a medical problem",
3847 * tags={"standard"},
3848 * @OA\Parameter(
3849 * name="puuid",
3850 * in="path",
3851 * description="The uuid for the patient.",
3852 * required=true,
3853 * @OA\Schema(
3854 * type="string"
3856 * ),
3857 * @OA\Parameter(
3858 * name="muuid",
3859 * in="path",
3860 * description="The uuid for the medical problem.",
3861 * required=true,
3862 * @OA\Schema(
3863 * type="string"
3865 * ),
3866 * @OA\RequestBody(
3867 * required=true,
3868 * @OA\MediaType(
3869 * mediaType="application/json",
3870 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3872 * ),
3873 * @OA\Response(
3874 * response="200",
3875 * ref="#/components/responses/standard"
3876 * ),
3877 * @OA\Response(
3878 * response="400",
3879 * ref="#/components/responses/badrequest"
3880 * ),
3881 * @OA\Response(
3882 * response="401",
3883 * ref="#/components/responses/unauthorized"
3884 * ),
3885 * security={{"openemr_auth":{}}}
3888 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3889 RestConfig::authorization_check("patients", "med");
3890 $data = (array) (json_decode(file_get_contents("php://input")));
3891 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3892 RestConfig::apiLog($return, $data);
3893 return $return;
3897 * @OA\Delete(
3898 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3899 * description="Delete a medical problem",
3900 * tags={"standard"},
3901 * @OA\Parameter(
3902 * name="puuid",
3903 * in="path",
3904 * description="The uuid for the patient.",
3905 * required=true,
3906 * @OA\Schema(
3907 * type="string"
3909 * ),
3910 * @OA\Parameter(
3911 * name="muuid",
3912 * in="path",
3913 * description="The uuid for the medical problem.",
3914 * required=true,
3915 * @OA\Schema(
3916 * type="string"
3918 * ),
3919 * @OA\Response(
3920 * response="200",
3921 * ref="#/components/responses/standard"
3922 * ),
3923 * @OA\Response(
3924 * response="400",
3925 * ref="#/components/responses/badrequest"
3926 * ),
3927 * @OA\Response(
3928 * response="401",
3929 * ref="#/components/responses/unauthorized"
3930 * ),
3931 * security={{"openemr_auth":{}}}
3934 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3935 RestConfig::authorization_check("patients", "med");
3936 $return = (new ConditionRestController())->delete($puuid, $muuid);
3937 RestConfig::apiLog($return);
3938 return $return;
3942 * @OA\Get(
3943 * path="/api/allergy",
3944 * description="Retrieves a list of allergies",
3945 * tags={"standard"},
3946 * @OA\Parameter(
3947 * name="lists.pid",
3948 * in="query",
3949 * description="The uuid for the patient.",
3950 * required=false,
3951 * @OA\Schema(
3952 * type="string"
3954 * ),
3955 * @OA\Parameter(
3956 * name="lists.id",
3957 * in="query",
3958 * description="The uuid for the allergy.",
3959 * required=false,
3960 * @OA\Schema(
3961 * type="string"
3963 * ),
3964 * @OA\Parameter(
3965 * name="title",
3966 * in="query",
3967 * description="The title for the allergy.",
3968 * required=false,
3969 * @OA\Schema(
3970 * type="string"
3972 * ),
3973 * @OA\Parameter(
3974 * name="begdate",
3975 * in="query",
3976 * description="The start date for the allergy.",
3977 * required=false,
3978 * @OA\Schema(
3979 * type="string"
3981 * ),
3982 * @OA\Parameter(
3983 * name="enddate",
3984 * in="query",
3985 * description="The end date for the allergy.",
3986 * required=false,
3987 * @OA\Schema(
3988 * type="string"
3990 * ),
3991 * @OA\Parameter(
3992 * name="diagnosis",
3993 * in="query",
3994 * description="The diagnosis for the allergy.",
3995 * required=false,
3996 * @OA\Schema(
3997 * type="string"
3999 * ),
4000 * @OA\Response(
4001 * response="200",
4002 * ref="#/components/responses/standard"
4003 * ),
4004 * @OA\Response(
4005 * response="400",
4006 * ref="#/components/responses/badrequest"
4007 * ),
4008 * @OA\Response(
4009 * response="401",
4010 * ref="#/components/responses/unauthorized"
4011 * ),
4012 * security={{"openemr_auth":{}}}
4015 "GET /api/allergy" => function () {
4016 RestConfig::authorization_check("patients", "med");
4017 $return = (new AllergyIntoleranceRestController())->getAll();
4018 RestConfig::apiLog($return);
4019 return $return;
4023 * @OA\Get(
4024 * path="/api/allergy/{auuid}",
4025 * description="Retrieves a single allergy by their uuid",
4026 * tags={"standard"},
4027 * @OA\Parameter(
4028 * name="auuid",
4029 * in="path",
4030 * description="The uuid for the allergy.",
4031 * required=true,
4032 * @OA\Schema(
4033 * type="string"
4035 * ),
4036 * @OA\Response(
4037 * response="200",
4038 * ref="#/components/responses/standard"
4039 * ),
4040 * @OA\Response(
4041 * response="400",
4042 * ref="#/components/responses/badrequest"
4043 * ),
4044 * @OA\Response(
4045 * response="401",
4046 * ref="#/components/responses/unauthorized"
4047 * ),
4048 * security={{"openemr_auth":{}}}
4051 "GET /api/allergy/:auuid" => function ($auuid) {
4052 RestConfig::authorization_check("patients", "med");
4053 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
4054 RestConfig::apiLog($return);
4055 return $return;
4059 * @OA\Get(
4060 * path="/api/patient/{puuid}/allergy",
4061 * description="Retrieves all allergies for a patient",
4062 * tags={"standard"},
4063 * @OA\Parameter(
4064 * name="puuid",
4065 * in="path",
4066 * description="The uuid for the patient.",
4067 * required=true,
4068 * @OA\Schema(
4069 * type="string"
4071 * ),
4072 * @OA\Response(
4073 * response="200",
4074 * ref="#/components/responses/standard"
4075 * ),
4076 * @OA\Response(
4077 * response="400",
4078 * ref="#/components/responses/badrequest"
4079 * ),
4080 * @OA\Response(
4081 * response="401",
4082 * ref="#/components/responses/unauthorized"
4083 * ),
4084 * security={{"openemr_auth":{}}}
4087 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4088 RestConfig::authorization_check("patients", "med");
4089 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4090 RestConfig::apiLog($return);
4091 return $return;
4095 * @OA\Get(
4096 * path="/api/patient/{puuid}/allergy/{auuid}",
4097 * description="Retrieves a allergy for a patient",
4098 * tags={"standard"},
4099 * @OA\Parameter(
4100 * name="puuid",
4101 * in="path",
4102 * description="The uuid for the patient.",
4103 * required=true,
4104 * @OA\Schema(
4105 * type="string"
4107 * ),
4108 * @OA\Parameter(
4109 * name="auuid",
4110 * in="path",
4111 * description="The uuid for the allergy.",
4112 * required=true,
4113 * @OA\Schema(
4114 * type="string"
4116 * ),
4117 * @OA\Response(
4118 * response="200",
4119 * ref="#/components/responses/standard"
4120 * ),
4121 * @OA\Response(
4122 * response="400",
4123 * ref="#/components/responses/badrequest"
4124 * ),
4125 * @OA\Response(
4126 * response="401",
4127 * ref="#/components/responses/unauthorized"
4128 * ),
4129 * security={{"openemr_auth":{}}}
4132 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4133 RestConfig::authorization_check("patients", "med");
4134 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4135 RestConfig::apiLog($return);
4136 return $return;
4140 * Schema for the allergy request
4142 * @OA\Schema(
4143 * schema="api_allergy_request",
4144 * @OA\Property(
4145 * property="title",
4146 * description="The title of allergy.",
4147 * type="string"
4148 * ),
4149 * @OA\Property(
4150 * property="begdate",
4151 * description="The beginning date of allergy.",
4152 * type="string"
4153 * ),
4154 * @OA\Property(
4155 * property="enddate",
4156 * description="The end date of allergy.",
4157 * type="string"
4158 * ),
4159 * @OA\Property(
4160 * property="diagnosis",
4161 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4162 * type="string"
4163 * ),
4164 * required={"title", "begdate"},
4165 * example={
4166 * "title": "Iodine",
4167 * "begdate": "2010-10-13",
4168 * "enddate": null
4173 * @OA\Post(
4174 * path="/api/patient/{puuid}/allergy",
4175 * description="Submits a new allergy",
4176 * tags={"standard"},
4177 * @OA\Parameter(
4178 * name="puuid",
4179 * in="path",
4180 * description="The uuid for the patient.",
4181 * required=true,
4182 * @OA\Schema(
4183 * type="string"
4185 * ),
4186 * @OA\RequestBody(
4187 * required=true,
4188 * @OA\MediaType(
4189 * mediaType="application/json",
4190 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4192 * ),
4193 * @OA\Response(
4194 * response="200",
4195 * ref="#/components/responses/standard"
4196 * ),
4197 * @OA\Response(
4198 * response="400",
4199 * ref="#/components/responses/badrequest"
4200 * ),
4201 * @OA\Response(
4202 * response="401",
4203 * ref="#/components/responses/unauthorized"
4204 * ),
4205 * security={{"openemr_auth":{}}}
4208 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4209 RestConfig::authorization_check("patients", "med");
4210 $data = (array) (json_decode(file_get_contents("php://input")));
4211 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4212 RestConfig::apiLog($return, $data);
4213 return $return;
4217 * @OA\Put(
4218 * path="/api/patient/{puuid}/allergy/{auuid}",
4219 * description="Edit a allergy",
4220 * tags={"standard"},
4221 * @OA\Parameter(
4222 * name="puuid",
4223 * in="path",
4224 * description="The uuid for the patient.",
4225 * required=true,
4226 * @OA\Schema(
4227 * type="string"
4229 * ),
4230 * @OA\Parameter(
4231 * name="auuid",
4232 * in="path",
4233 * description="The uuid for the allergy.",
4234 * required=true,
4235 * @OA\Schema(
4236 * type="string"
4238 * ),
4239 * @OA\RequestBody(
4240 * required=true,
4241 * @OA\MediaType(
4242 * mediaType="application/json",
4243 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4245 * ),
4246 * @OA\Response(
4247 * response="200",
4248 * ref="#/components/responses/standard"
4249 * ),
4250 * @OA\Response(
4251 * response="400",
4252 * ref="#/components/responses/badrequest"
4253 * ),
4254 * @OA\Response(
4255 * response="401",
4256 * ref="#/components/responses/unauthorized"
4257 * ),
4258 * security={{"openemr_auth":{}}}
4261 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4262 RestConfig::authorization_check("patients", "med");
4263 $data = (array) (json_decode(file_get_contents("php://input")));
4264 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4265 RestConfig::apiLog($return, $data);
4266 return $return;
4270 * @OA\Delete(
4271 * path="/api/patient/{puuid}/allergy/{auuid}",
4272 * description="Delete a medical problem",
4273 * tags={"standard"},
4274 * @OA\Parameter(
4275 * name="puuid",
4276 * in="path",
4277 * description="The uuid for the patient.",
4278 * required=true,
4279 * @OA\Schema(
4280 * type="string"
4282 * ),
4283 * @OA\Parameter(
4284 * name="auuid",
4285 * in="path",
4286 * description="The uuid for the allergy.",
4287 * required=true,
4288 * @OA\Schema(
4289 * type="string"
4291 * ),
4292 * @OA\Response(
4293 * response="200",
4294 * ref="#/components/responses/standard"
4295 * ),
4296 * @OA\Response(
4297 * response="400",
4298 * ref="#/components/responses/badrequest"
4299 * ),
4300 * @OA\Response(
4301 * response="401",
4302 * ref="#/components/responses/unauthorized"
4303 * ),
4304 * security={{"openemr_auth":{}}}
4307 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4308 RestConfig::authorization_check("patients", "med");
4309 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4310 RestConfig::apiLog($return);
4311 return $return;
4315 * @OA\Get(
4316 * path="/api/patient/{pid}/medication",
4317 * description="Retrieves all medications for a patient",
4318 * tags={"standard"},
4319 * @OA\Parameter(
4320 * name="pid",
4321 * in="path",
4322 * description="The pid for the patient.",
4323 * required=true,
4324 * @OA\Schema(
4325 * type="string"
4327 * ),
4328 * @OA\Response(
4329 * response="200",
4330 * ref="#/components/responses/standard"
4331 * ),
4332 * @OA\Response(
4333 * response="400",
4334 * ref="#/components/responses/badrequest"
4335 * ),
4336 * @OA\Response(
4337 * response="401",
4338 * ref="#/components/responses/unauthorized"
4339 * ),
4340 * security={{"openemr_auth":{}}}
4343 "GET /api/patient/:pid/medication" => function ($pid) {
4344 RestConfig::authorization_check("patients", "med");
4345 $return = (new ListRestController())->getAll($pid, "medication");
4346 RestConfig::apiLog($return);
4347 return $return;
4351 * Schema for the medication request
4353 * @OA\Schema(
4354 * schema="api_medication_request",
4355 * @OA\Property(
4356 * property="title",
4357 * description="The title of medication.",
4358 * type="string"
4359 * ),
4360 * @OA\Property(
4361 * property="begdate",
4362 * description="The beginning date of medication.",
4363 * type="string"
4364 * ),
4365 * @OA\Property(
4366 * property="enddate",
4367 * description="The end date of medication.",
4368 * type="string"
4369 * ),
4370 * @OA\Property(
4371 * property="diagnosis",
4372 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4373 * type="string"
4374 * ),
4375 * required={"title", "begdate"},
4376 * example={
4377 * "title": "Norvasc",
4378 * "begdate": "2013-04-13",
4379 * "enddate": null
4384 * @OA\Post(
4385 * path="/api/patient/{pid}/medication",
4386 * description="Submits a new medication",
4387 * tags={"standard"},
4388 * @OA\Parameter(
4389 * name="pid",
4390 * in="path",
4391 * description="The pid for the patient.",
4392 * required=true,
4393 * @OA\Schema(
4394 * type="string"
4396 * ),
4397 * @OA\RequestBody(
4398 * required=true,
4399 * @OA\MediaType(
4400 * mediaType="application/json",
4401 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4403 * ),
4404 * @OA\Response(
4405 * response="200",
4406 * ref="#/components/responses/standard"
4407 * ),
4408 * @OA\Response(
4409 * response="400",
4410 * ref="#/components/responses/badrequest"
4411 * ),
4412 * @OA\Response(
4413 * response="401",
4414 * ref="#/components/responses/unauthorized"
4415 * ),
4416 * security={{"openemr_auth":{}}}
4419 "POST /api/patient/:pid/medication" => function ($pid) {
4420 RestConfig::authorization_check("patients", "med");
4421 $data = (array) (json_decode(file_get_contents("php://input")));
4422 $return = (new ListRestController())->post($pid, "medication", $data);
4423 RestConfig::apiLog($return, $data);
4424 return $return;
4428 * @OA\Put(
4429 * path="/api/patient/{pid}/medication/{mid}",
4430 * description="Edit a medication",
4431 * tags={"standard"},
4432 * @OA\Parameter(
4433 * name="pid",
4434 * in="path",
4435 * description="The pid for the patient.",
4436 * required=true,
4437 * @OA\Schema(
4438 * type="string"
4440 * ),
4441 * @OA\Parameter(
4442 * name="mid",
4443 * in="path",
4444 * description="The id for the medication.",
4445 * required=true,
4446 * @OA\Schema(
4447 * type="string"
4449 * ),
4450 * @OA\RequestBody(
4451 * required=true,
4452 * @OA\MediaType(
4453 * mediaType="application/json",
4454 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4456 * ),
4457 * @OA\Response(
4458 * response="200",
4459 * ref="#/components/responses/standard"
4460 * ),
4461 * @OA\Response(
4462 * response="400",
4463 * ref="#/components/responses/badrequest"
4464 * ),
4465 * @OA\Response(
4466 * response="401",
4467 * ref="#/components/responses/unauthorized"
4468 * ),
4469 * security={{"openemr_auth":{}}}
4472 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4473 RestConfig::authorization_check("patients", "med");
4474 $data = (array) (json_decode(file_get_contents("php://input")));
4475 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4476 RestConfig::apiLog($return, $data);
4477 return $return;
4481 * @OA\Get(
4482 * path="/api/patient/{pid}/medication/{mid}",
4483 * description="Retrieves a medication for a patient",
4484 * tags={"standard"},
4485 * @OA\Parameter(
4486 * name="pid",
4487 * in="path",
4488 * description="The id for the patient.",
4489 * required=true,
4490 * @OA\Schema(
4491 * type="string"
4493 * ),
4494 * @OA\Parameter(
4495 * name="mid",
4496 * in="path",
4497 * description="The id for the medication.",
4498 * required=true,
4499 * @OA\Schema(
4500 * type="string"
4502 * ),
4503 * @OA\Response(
4504 * response="200",
4505 * ref="#/components/responses/standard"
4506 * ),
4507 * @OA\Response(
4508 * response="400",
4509 * ref="#/components/responses/badrequest"
4510 * ),
4511 * @OA\Response(
4512 * response="401",
4513 * ref="#/components/responses/unauthorized"
4514 * ),
4515 * security={{"openemr_auth":{}}}
4518 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4519 RestConfig::authorization_check("patients", "med");
4520 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4521 RestConfig::apiLog($return);
4522 return $return;
4526 * @OA\Delete(
4527 * path="/api/patient/{pid}/medication/{mid}",
4528 * description="Delete a medication",
4529 * tags={"standard"},
4530 * @OA\Parameter(
4531 * name="pid",
4532 * in="path",
4533 * description="The id for the patient.",
4534 * required=true,
4535 * @OA\Schema(
4536 * type="string"
4538 * ),
4539 * @OA\Parameter(
4540 * name="mid",
4541 * in="path",
4542 * description="The id for the medication.",
4543 * required=true,
4544 * @OA\Schema(
4545 * type="string"
4547 * ),
4548 * @OA\Response(
4549 * response="200",
4550 * ref="#/components/responses/standard"
4551 * ),
4552 * @OA\Response(
4553 * response="400",
4554 * ref="#/components/responses/badrequest"
4555 * ),
4556 * @OA\Response(
4557 * response="401",
4558 * ref="#/components/responses/unauthorized"
4559 * ),
4560 * security={{"openemr_auth":{}}}
4563 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4564 RestConfig::authorization_check("patients", "med");
4565 $return = (new ListRestController())->delete($pid, $mid, "medication");
4566 RestConfig::apiLog($return);
4567 return $return;
4571 * @OA\Get(
4572 * path="/api/patient/{pid}/surgery",
4573 * description="Retrieves all surgeries for a patient",
4574 * tags={"standard"},
4575 * @OA\Parameter(
4576 * name="pid",
4577 * in="path",
4578 * description="The pid for the patient.",
4579 * required=true,
4580 * @OA\Schema(
4581 * type="string"
4583 * ),
4584 * @OA\Response(
4585 * response="200",
4586 * ref="#/components/responses/standard"
4587 * ),
4588 * @OA\Response(
4589 * response="400",
4590 * ref="#/components/responses/badrequest"
4591 * ),
4592 * @OA\Response(
4593 * response="401",
4594 * ref="#/components/responses/unauthorized"
4595 * ),
4596 * security={{"openemr_auth":{}}}
4599 "GET /api/patient/:pid/surgery" => function ($pid) {
4600 RestConfig::authorization_check("patients", "med");
4601 $return = (new ListRestController())->getAll($pid, "surgery");
4602 RestConfig::apiLog($return);
4603 return $return;
4607 * @OA\Get(
4608 * path="/api/patient/{pid}/surgery/{sid}",
4609 * description="Retrieves a surgery for a patient",
4610 * tags={"standard"},
4611 * @OA\Parameter(
4612 * name="pid",
4613 * in="path",
4614 * description="The id for the patient.",
4615 * required=true,
4616 * @OA\Schema(
4617 * type="string"
4619 * ),
4620 * @OA\Parameter(
4621 * name="sid",
4622 * in="path",
4623 * description="The id for the surgery.",
4624 * required=true,
4625 * @OA\Schema(
4626 * type="string"
4628 * ),
4629 * @OA\Response(
4630 * response="200",
4631 * ref="#/components/responses/standard"
4632 * ),
4633 * @OA\Response(
4634 * response="400",
4635 * ref="#/components/responses/badrequest"
4636 * ),
4637 * @OA\Response(
4638 * response="401",
4639 * ref="#/components/responses/unauthorized"
4640 * ),
4641 * security={{"openemr_auth":{}}}
4644 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4645 RestConfig::authorization_check("patients", "med");
4646 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4647 RestConfig::apiLog($return);
4648 return $return;
4652 * @OA\Delete(
4653 * path="/api/patient/{pid}/surgery/{sid}",
4654 * description="Delete a surgery",
4655 * tags={"standard"},
4656 * @OA\Parameter(
4657 * name="pid",
4658 * in="path",
4659 * description="The id for the patient.",
4660 * required=true,
4661 * @OA\Schema(
4662 * type="string"
4664 * ),
4665 * @OA\Parameter(
4666 * name="sid",
4667 * in="path",
4668 * description="The id for the surgery.",
4669 * required=true,
4670 * @OA\Schema(
4671 * type="string"
4673 * ),
4674 * @OA\Response(
4675 * response="200",
4676 * ref="#/components/responses/standard"
4677 * ),
4678 * @OA\Response(
4679 * response="400",
4680 * ref="#/components/responses/badrequest"
4681 * ),
4682 * @OA\Response(
4683 * response="401",
4684 * ref="#/components/responses/unauthorized"
4685 * ),
4686 * security={{"openemr_auth":{}}}
4689 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4690 RestConfig::authorization_check("patients", "med");
4691 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4692 RestConfig::apiLog($return);
4693 return $return;
4697 * Schema for the surgery request
4699 * @OA\Schema(
4700 * schema="api_surgery_request",
4701 * @OA\Property(
4702 * property="title",
4703 * description="The title of surgery.",
4704 * type="string"
4705 * ),
4706 * @OA\Property(
4707 * property="begdate",
4708 * description="The beginning date of surgery.",
4709 * type="string"
4710 * ),
4711 * @OA\Property(
4712 * property="enddate",
4713 * description="The end date of surgery.",
4714 * type="string"
4715 * ),
4716 * @OA\Property(
4717 * property="diagnosis",
4718 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4719 * type="string"
4720 * ),
4721 * required={"title", "begdate"},
4722 * example={
4723 * "title": "Blepharoplasty",
4724 * "begdate": "2013-10-14",
4725 * "enddate": null,
4726 * "diagnosis": "CPT4:15823-50"
4731 * @OA\Post(
4732 * path="/api/patient/{pid}/surgery",
4733 * description="Submits a new surgery",
4734 * tags={"standard"},
4735 * @OA\Parameter(
4736 * name="pid",
4737 * in="path",
4738 * description="The pid for the patient.",
4739 * required=true,
4740 * @OA\Schema(
4741 * type="string"
4743 * ),
4744 * @OA\RequestBody(
4745 * required=true,
4746 * @OA\MediaType(
4747 * mediaType="application/json",
4748 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4750 * ),
4751 * @OA\Response(
4752 * response="200",
4753 * ref="#/components/responses/standard"
4754 * ),
4755 * @OA\Response(
4756 * response="400",
4757 * ref="#/components/responses/badrequest"
4758 * ),
4759 * @OA\Response(
4760 * response="401",
4761 * ref="#/components/responses/unauthorized"
4762 * ),
4763 * security={{"openemr_auth":{}}}
4766 "POST /api/patient/:pid/surgery" => function ($pid) {
4767 RestConfig::authorization_check("patients", "med");
4768 $data = (array) (json_decode(file_get_contents("php://input")));
4769 $return = (new ListRestController())->post($pid, "surgery", $data);
4770 RestConfig::apiLog($return, $data);
4771 return $return;
4775 * @OA\Put(
4776 * path="/api/patient/{pid}/surgery/{sid}",
4777 * description="Edit a surgery",
4778 * tags={"standard"},
4779 * @OA\Parameter(
4780 * name="pid",
4781 * in="path",
4782 * description="The pid for the patient.",
4783 * required=true,
4784 * @OA\Schema(
4785 * type="string"
4787 * ),
4788 * @OA\Parameter(
4789 * name="sid",
4790 * in="path",
4791 * description="The id for the surgery.",
4792 * required=true,
4793 * @OA\Schema(
4794 * type="string"
4796 * ),
4797 * @OA\RequestBody(
4798 * required=true,
4799 * @OA\MediaType(
4800 * mediaType="application/json",
4801 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4803 * ),
4804 * @OA\Response(
4805 * response="200",
4806 * ref="#/components/responses/standard"
4807 * ),
4808 * @OA\Response(
4809 * response="400",
4810 * ref="#/components/responses/badrequest"
4811 * ),
4812 * @OA\Response(
4813 * response="401",
4814 * ref="#/components/responses/unauthorized"
4815 * ),
4816 * security={{"openemr_auth":{}}}
4819 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4820 RestConfig::authorization_check("patients", "med");
4821 $data = (array) (json_decode(file_get_contents("php://input")));
4822 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4823 RestConfig::apiLog($return, $data);
4824 return $return;
4828 * @OA\Get(
4829 * path="/api/patient/{pid}/dental_issue",
4830 * description="Retrieves all dental issues for a patient",
4831 * tags={"standard"},
4832 * @OA\Parameter(
4833 * name="pid",
4834 * in="path",
4835 * description="The pid for the patient.",
4836 * required=true,
4837 * @OA\Schema(
4838 * type="string"
4840 * ),
4841 * @OA\Response(
4842 * response="200",
4843 * ref="#/components/responses/standard"
4844 * ),
4845 * @OA\Response(
4846 * response="400",
4847 * ref="#/components/responses/badrequest"
4848 * ),
4849 * @OA\Response(
4850 * response="401",
4851 * ref="#/components/responses/unauthorized"
4852 * ),
4853 * security={{"openemr_auth":{}}}
4856 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4857 RestConfig::authorization_check("patients", "med");
4858 $return = (new ListRestController())->getAll($pid, "dental");
4859 RestConfig::apiLog($return);
4860 return $return;
4864 * @OA\Get(
4865 * path="/api/patient/{pid}/dental_issue/{did}",
4866 * description="Retrieves a dental issue for a patient",
4867 * tags={"standard"},
4868 * @OA\Parameter(
4869 * name="pid",
4870 * in="path",
4871 * description="The id for the patient.",
4872 * required=true,
4873 * @OA\Schema(
4874 * type="string"
4876 * ),
4877 * @OA\Parameter(
4878 * name="did",
4879 * in="path",
4880 * description="The id for the dental issue.",
4881 * required=true,
4882 * @OA\Schema(
4883 * type="string"
4885 * ),
4886 * @OA\Response(
4887 * response="200",
4888 * ref="#/components/responses/standard"
4889 * ),
4890 * @OA\Response(
4891 * response="400",
4892 * ref="#/components/responses/badrequest"
4893 * ),
4894 * @OA\Response(
4895 * response="401",
4896 * ref="#/components/responses/unauthorized"
4897 * ),
4898 * security={{"openemr_auth":{}}}
4901 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4902 RestConfig::authorization_check("patients", "med");
4903 $return = (new ListRestController())->getOne($pid, "dental", $did);
4904 RestConfig::apiLog($return);
4905 return $return;
4909 * @OA\Delete(
4910 * path="/api/patient/{pid}/dental_issue/{did}",
4911 * description="Delete a dental issue",
4912 * tags={"standard"},
4913 * @OA\Parameter(
4914 * name="pid",
4915 * in="path",
4916 * description="The id for the patient.",
4917 * required=true,
4918 * @OA\Schema(
4919 * type="string"
4921 * ),
4922 * @OA\Parameter(
4923 * name="did",
4924 * in="path",
4925 * description="The id for the dental issue.",
4926 * required=true,
4927 * @OA\Schema(
4928 * type="string"
4930 * ),
4931 * @OA\Response(
4932 * response="200",
4933 * ref="#/components/responses/standard"
4934 * ),
4935 * @OA\Response(
4936 * response="400",
4937 * ref="#/components/responses/badrequest"
4938 * ),
4939 * @OA\Response(
4940 * response="401",
4941 * ref="#/components/responses/unauthorized"
4942 * ),
4943 * security={{"openemr_auth":{}}}
4946 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4947 RestConfig::authorization_check("patients", "med");
4948 $return = (new ListRestController())->delete($pid, $did, "dental");
4949 RestConfig::apiLog($return);
4950 return $return;
4954 * Schema for the dental_issue request
4956 * @OA\Schema(
4957 * schema="api_dental_issue_request",
4958 * @OA\Property(
4959 * property="title",
4960 * description="The title of dental issue.",
4961 * type="string"
4962 * ),
4963 * @OA\Property(
4964 * property="begdate",
4965 * description="The beginning date of dental issue.",
4966 * type="string"
4967 * ),
4968 * @OA\Property(
4969 * property="enddate",
4970 * description="The end date of dental issue.",
4971 * type="string"
4972 * ),
4973 * @OA\Property(
4974 * property="diagnosis",
4975 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4976 * type="string"
4977 * ),
4978 * required={"title", "begdate"},
4979 * example={
4980 * "title": "Halitosis",
4981 * "begdate": "2015-03-17",
4982 * "enddate": null,
4987 * @OA\Post(
4988 * path="/api/patient/{pid}/dental_issue",
4989 * description="Submits a new dental issue",
4990 * tags={"standard"},
4991 * @OA\Parameter(
4992 * name="pid",
4993 * in="path",
4994 * description="The pid for the patient.",
4995 * required=true,
4996 * @OA\Schema(
4997 * type="string"
4999 * ),
5000 * @OA\RequestBody(
5001 * required=true,
5002 * @OA\MediaType(
5003 * mediaType="application/json",
5004 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5006 * ),
5007 * @OA\Response(
5008 * response="200",
5009 * ref="#/components/responses/standard"
5010 * ),
5011 * @OA\Response(
5012 * response="400",
5013 * ref="#/components/responses/badrequest"
5014 * ),
5015 * @OA\Response(
5016 * response="401",
5017 * ref="#/components/responses/unauthorized"
5018 * ),
5019 * security={{"openemr_auth":{}}}
5022 "POST /api/patient/:pid/dental_issue" => function ($pid) {
5023 RestConfig::authorization_check("patients", "med");
5024 $data = (array) (json_decode(file_get_contents("php://input")));
5025 $return = (new ListRestController())->post($pid, "dental", $data);
5026 RestConfig::apiLog($return, $data);
5027 return $return;
5031 * @OA\Put(
5032 * path="/api/patient/{pid}/dental_issue/{did}",
5033 * description="Edit a dental issue",
5034 * tags={"standard"},
5035 * @OA\Parameter(
5036 * name="pid",
5037 * in="path",
5038 * description="The pid for the patient.",
5039 * required=true,
5040 * @OA\Schema(
5041 * type="string"
5043 * ),
5044 * @OA\Parameter(
5045 * name="did",
5046 * in="path",
5047 * description="The id for the dental issue.",
5048 * required=true,
5049 * @OA\Schema(
5050 * type="string"
5052 * ),
5053 * @OA\RequestBody(
5054 * required=true,
5055 * @OA\MediaType(
5056 * mediaType="application/json",
5057 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5059 * ),
5060 * @OA\Response(
5061 * response="200",
5062 * ref="#/components/responses/standard"
5063 * ),
5064 * @OA\Response(
5065 * response="400",
5066 * ref="#/components/responses/badrequest"
5067 * ),
5068 * @OA\Response(
5069 * response="401",
5070 * ref="#/components/responses/unauthorized"
5071 * ),
5072 * security={{"openemr_auth":{}}}
5075 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5076 RestConfig::authorization_check("patients", "med");
5077 $data = (array) (json_decode(file_get_contents("php://input")));
5078 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5079 RestConfig::apiLog($return, $data);
5080 return $return;
5084 * @OA\Get(
5085 * path="/api/patient/{pid}/appointment",
5086 * description="Retrieves all appointments for a patient",
5087 * tags={"standard"},
5088 * @OA\Parameter(
5089 * name="pid",
5090 * in="path",
5091 * description="The pid for the patient.",
5092 * required=true,
5093 * @OA\Schema(
5094 * type="string"
5096 * ),
5097 * @OA\Response(
5098 * response="200",
5099 * ref="#/components/responses/standard"
5100 * ),
5101 * @OA\Response(
5102 * response="400",
5103 * ref="#/components/responses/badrequest"
5104 * ),
5105 * @OA\Response(
5106 * response="401",
5107 * ref="#/components/responses/unauthorized"
5108 * ),
5109 * security={{"openemr_auth":{}}}
5112 "GET /api/patient/:pid/appointment" => function ($pid) {
5113 RestConfig::authorization_check("patients", "appt");
5114 $return = (new AppointmentRestController())->getAllForPatient($pid);
5115 RestConfig::apiLog($return);
5116 return $return;
5120 * @OA\Post(
5121 * path="/api/patient/{pid}/appointment",
5122 * description="Submits a new appointment",
5123 * tags={"standard"},
5124 * @OA\Parameter(
5125 * name="pid",
5126 * in="path",
5127 * description="The id for the patient.",
5128 * required=true,
5129 * @OA\Schema(
5130 * type="string"
5132 * ),
5133 * @OA\RequestBody(
5134 * required=true,
5135 * @OA\MediaType(
5136 * mediaType="application/json",
5137 * @OA\Schema(
5138 * @OA\Property(
5139 * property="pc_catid",
5140 * description="The category of the appointment.",
5141 * type="string"
5142 * ),
5143 * @OA\Property(
5144 * property="pc_title",
5145 * description="The title of the appointment.",
5146 * type="string"
5147 * ),
5148 * @OA\Property(
5149 * property="pc_duration",
5150 * description="The duration of the appointment.",
5151 * type="string"
5152 * ),
5153 * @OA\Property(
5154 * property="pc_hometext",
5155 * description="Comments for the appointment.",
5156 * type="string"
5157 * ),
5158 * @OA\Property(
5159 * property="pc_apptstatus",
5160 * description="use an option from resource=/api/list/apptstat",
5161 * type="string"
5162 * ),
5163 * @OA\Property(
5164 * property="pc_eventDate",
5165 * description="The date of the appointment.",
5166 * type="string"
5167 * ),
5168 * @OA\Property(
5169 * property="pc_startTime",
5170 * description="The time of the appointment.",
5171 * type="string"
5172 * ),
5173 * @OA\Property(
5174 * property="pc_facility",
5175 * description="The facility id of the appointment.",
5176 * type="string"
5177 * ),
5178 * @OA\Property(
5179 * property="pc_billing_location",
5180 * description="The billinag location id of the appointment.",
5181 * type="string"
5182 * ),
5183 * @OA\Property(
5184 * property="pc_aid",
5185 * description="The provider id for the appointment.",
5186 * type="string"
5187 * ),
5188 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5189 * example={
5190 * "pc_catid": "5",
5191 * "pc_title": "Office Visit",
5192 * "pc_duration": "900",
5193 * "pc_hometext": "Test",
5194 * "pc_apptstatus": "-",
5195 * "pc_eventDate": "2018-10-19",
5196 * "pc_startTime": "09:00",
5197 * "pc_facility": "9",
5198 * "pc_billing_location": "10",
5199 * "pc_aid": "1"
5203 * ),
5204 * @OA\Response(
5205 * response="200",
5206 * ref="#/components/responses/standard"
5207 * ),
5208 * @OA\Response(
5209 * response="400",
5210 * ref="#/components/responses/badrequest"
5211 * ),
5212 * @OA\Response(
5213 * response="401",
5214 * ref="#/components/responses/unauthorized"
5215 * ),
5216 * security={{"openemr_auth":{}}}
5219 "POST /api/patient/:pid/appointment" => function ($pid) {
5220 RestConfig::authorization_check("patients", "appt");
5221 $data = (array) (json_decode(file_get_contents("php://input")));
5222 $return = (new AppointmentRestController())->post($pid, $data);
5223 RestConfig::apiLog($return, $data);
5224 return $return;
5228 * @OA\Get(
5229 * path="/api/appointment",
5230 * description="Retrieves all appointments",
5231 * tags={"standard"},
5232 * @OA\Response(
5233 * response="200",
5234 * ref="#/components/responses/standard"
5235 * ),
5236 * @OA\Response(
5237 * response="400",
5238 * ref="#/components/responses/badrequest"
5239 * ),
5240 * @OA\Response(
5241 * response="401",
5242 * ref="#/components/responses/unauthorized"
5243 * ),
5244 * security={{"openemr_auth":{}}}
5247 "GET /api/appointment" => function () {
5248 RestConfig::authorization_check("patients", "appt");
5249 $return = (new AppointmentRestController())->getAll();
5250 RestConfig::apiLog($return);
5251 return $return;
5255 * @OA\Get(
5256 * path="/api/appointment/{eid}",
5257 * description="Retrieves an appointment",
5258 * tags={"standard"},
5259 * @OA\Parameter(
5260 * name="eid",
5261 * in="path",
5262 * description="The eid for the appointment.",
5263 * required=true,
5264 * @OA\Schema(
5265 * type="string"
5267 * ),
5268 * @OA\Response(
5269 * response="200",
5270 * ref="#/components/responses/standard"
5271 * ),
5272 * @OA\Response(
5273 * response="400",
5274 * ref="#/components/responses/badrequest"
5275 * ),
5276 * @OA\Response(
5277 * response="401",
5278 * ref="#/components/responses/unauthorized"
5279 * ),
5280 * security={{"openemr_auth":{}}}
5283 "GET /api/appointment/:eid" => function ($eid) {
5284 RestConfig::authorization_check("patients", "appt");
5285 $return = (new AppointmentRestController())->getOne($eid);
5286 RestConfig::apiLog($return);
5287 return $return;
5291 * @OA\Delete(
5292 * path="/api/patient/{pid}/appointment/{eid}",
5293 * description="Delete a appointment",
5294 * tags={"standard"},
5295 * @OA\Parameter(
5296 * name="pid",
5297 * in="path",
5298 * description="The id for the patient.",
5299 * required=true,
5300 * @OA\Schema(
5301 * type="string"
5303 * ),
5304 * @OA\Parameter(
5305 * name="eid",
5306 * in="path",
5307 * description="The eid for the appointment.",
5308 * required=true,
5309 * @OA\Schema(
5310 * type="string"
5312 * ),
5313 * @OA\Response(
5314 * response="200",
5315 * ref="#/components/responses/standard"
5316 * ),
5317 * @OA\Response(
5318 * response="400",
5319 * ref="#/components/responses/badrequest"
5320 * ),
5321 * @OA\Response(
5322 * response="401",
5323 * ref="#/components/responses/unauthorized"
5324 * ),
5325 * security={{"openemr_auth":{}}}
5328 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5329 RestConfig::authorization_check("patients", "appt");
5330 $return = (new AppointmentRestController())->delete($eid);
5331 RestConfig::apiLog($return);
5332 return $return;
5336 * @OA\Get(
5337 * path="/api/patient/{pid}/appointment/{eid}",
5338 * description="Retrieves a appointment for a patient",
5339 * tags={"standard"},
5340 * @OA\Parameter(
5341 * name="pid",
5342 * in="path",
5343 * description="The id for the patient.",
5344 * required=true,
5345 * @OA\Schema(
5346 * type="string"
5348 * ),
5349 * @OA\Parameter(
5350 * name="eid",
5351 * in="path",
5352 * description="The eid for the appointment.",
5353 * required=true,
5354 * @OA\Schema(
5355 * type="string"
5357 * ),
5358 * @OA\Response(
5359 * response="200",
5360 * ref="#/components/responses/standard"
5361 * ),
5362 * @OA\Response(
5363 * response="400",
5364 * ref="#/components/responses/badrequest"
5365 * ),
5366 * @OA\Response(
5367 * response="401",
5368 * ref="#/components/responses/unauthorized"
5369 * ),
5370 * security={{"openemr_auth":{}}}
5373 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5374 RestConfig::authorization_check("patients", "appt");
5375 $return = (new AppointmentRestController())->getOne($eid);
5376 RestConfig::apiLog($return);
5377 return $return;
5381 * @OA\Get(
5382 * path="/api/list/{list_name}",
5383 * description="Retrieves a list",
5384 * tags={"standard"},
5385 * @OA\Parameter(
5386 * name="list_name",
5387 * in="path",
5388 * description="The list_id of the list.",
5389 * required=true,
5390 * @OA\Schema(
5391 * type="string"
5393 * ),
5394 * @OA\Response(
5395 * response="200",
5396 * ref="#/components/responses/standard"
5397 * ),
5398 * @OA\Response(
5399 * response="400",
5400 * ref="#/components/responses/badrequest"
5401 * ),
5402 * @OA\Response(
5403 * response="401",
5404 * ref="#/components/responses/unauthorized"
5405 * ),
5406 * security={{"openemr_auth":{}}}
5409 "GET /api/list/:list_name" => function ($list_name) {
5410 RestConfig::authorization_check("lists", "default");
5411 $return = (new ListRestController())->getOptions($list_name);
5412 RestConfig::apiLog($return);
5413 return $return;
5417 * @OA\Get(
5418 * path="/api/user",
5419 * description="Retrieves a list of users",
5420 * tags={"standard"},
5421 * @OA\Parameter(
5422 * name="id",
5423 * in="query",
5424 * description="The id for the user.",
5425 * required=false,
5426 * @OA\Schema(
5427 * type="string"
5429 * ),
5430 * @OA\Parameter(
5431 * name="title",
5432 * in="query",
5433 * description="The title for the user.",
5434 * required=false,
5435 * @OA\Schema(
5436 * type="string"
5438 * ),
5439 * @OA\Parameter(
5440 * name="fname",
5441 * in="query",
5442 * description="The first name for the user.",
5443 * required=false,
5444 * @OA\Schema(
5445 * type="string"
5447 * ),
5448 * @OA\Parameter(
5449 * name="lname",
5450 * in="query",
5451 * description="The last name for the user.",
5452 * required=false,
5453 * @OA\Schema(
5454 * type="string"
5456 * ),
5457 * @OA\Parameter(
5458 * name="mname",
5459 * in="query",
5460 * description="The middle name for the user.",
5461 * required=false,
5462 * @OA\Schema(
5463 * type="string"
5465 * ),
5466 * @OA\Parameter(
5467 * name="federaltaxid",
5468 * in="query",
5469 * description="The federal tax id for the user.",
5470 * required=false,
5471 * @OA\Schema(
5472 * type="string"
5474 * ),
5475 * @OA\Parameter(
5476 * name="federaldrugid",
5477 * in="query",
5478 * description="The federal drug id for the user.",
5479 * required=false,
5480 * @OA\Schema(
5481 * type="string"
5483 * ),
5484 * @OA\Parameter(
5485 * name="upin",
5486 * in="query",
5487 * description="The upin for the user.",
5488 * required=false,
5489 * @OA\Schema(
5490 * type="string"
5492 * ),
5493 * @OA\Parameter(
5494 * name="facility_id",
5495 * in="query",
5496 * description="The facility id for the user.",
5497 * required=false,
5498 * @OA\Schema(
5499 * type="string"
5501 * ),
5502 * @OA\Parameter(
5503 * name="facility",
5504 * in="query",
5505 * description="The facility for the user.",
5506 * required=false,
5507 * @OA\Schema(
5508 * type="string"
5510 * ),
5511 * @OA\Parameter(
5512 * name="npi",
5513 * in="query",
5514 * description="The npi for the user.",
5515 * required=false,
5516 * @OA\Schema(
5517 * type="string"
5519 * ),
5520 * @OA\Parameter(
5521 * name="email",
5522 * in="query",
5523 * description="The email for the user.",
5524 * required=false,
5525 * @OA\Schema(
5526 * type="string"
5528 * ),
5529 * @OA\Parameter(
5530 * name="specialty",
5531 * in="query",
5532 * description="The specialty for the user.",
5533 * required=false,
5534 * @OA\Schema(
5535 * type="string"
5537 * ),
5538 * @OA\Parameter(
5539 * name="billname",
5540 * in="query",
5541 * description="The billname for the user.",
5542 * required=false,
5543 * @OA\Schema(
5544 * type="string"
5546 * ),
5547 * @OA\Parameter(
5548 * name="url",
5549 * in="query",
5550 * description="The url for the user.",
5551 * required=false,
5552 * @OA\Schema(
5553 * type="string"
5555 * ),
5556 * @OA\Parameter(
5557 * name="assistant",
5558 * in="query",
5559 * description="The assistant for the user.",
5560 * required=false,
5561 * @OA\Schema(
5562 * type="string"
5564 * ),
5565 * @OA\Parameter(
5566 * name="organization",
5567 * in="query",
5568 * description="The organization for the user.",
5569 * required=false,
5570 * @OA\Schema(
5571 * type="string"
5573 * ),
5574 * @OA\Parameter(
5575 * name="valedictory",
5576 * in="query",
5577 * description="The valedictory for the user.",
5578 * required=false,
5579 * @OA\Schema(
5580 * type="string"
5582 * ),
5583 * @OA\Parameter(
5584 * name="street",
5585 * in="query",
5586 * description="The street for the user.",
5587 * required=false,
5588 * @OA\Schema(
5589 * type="string"
5591 * ),
5592 * @OA\Parameter(
5593 * name="streetb",
5594 * in="query",
5595 * description="The street (line 2) for the user.",
5596 * required=false,
5597 * @OA\Schema(
5598 * type="string"
5600 * ),
5601 * @OA\Parameter(
5602 * name="city",
5603 * in="query",
5604 * description="The city for the user.",
5605 * required=false,
5606 * @OA\Schema(
5607 * type="string"
5609 * ),
5610 * @OA\Parameter(
5611 * name="state",
5612 * in="query",
5613 * description="The state for the user.",
5614 * required=false,
5615 * @OA\Schema(
5616 * type="string"
5618 * ),
5619 * @OA\Parameter(
5620 * name="zip",
5621 * in="query",
5622 * description="The zip for the user.",
5623 * required=false,
5624 * @OA\Schema(
5625 * type="string"
5627 * ),
5628 * @OA\Parameter(
5629 * name="phone",
5630 * in="query",
5631 * description="The phone for the user.",
5632 * required=false,
5633 * @OA\Schema(
5634 * type="string"
5636 * ),
5637 * @OA\Parameter(
5638 * name="fax",
5639 * in="query",
5640 * description="The fax for the user.",
5641 * required=false,
5642 * @OA\Schema(
5643 * type="string"
5645 * ),
5646 * @OA\Parameter(
5647 * name="phonew1",
5648 * in="query",
5649 * description="The phonew1 for the user.",
5650 * required=false,
5651 * @OA\Schema(
5652 * type="string"
5654 * ),
5655 * @OA\Parameter(
5656 * name="phonecell",
5657 * in="query",
5658 * description="The phonecell for the user.",
5659 * required=false,
5660 * @OA\Schema(
5661 * type="string"
5663 * ),
5664 * @OA\Parameter(
5665 * name="notes",
5666 * in="query",
5667 * description="The notes for the user.",
5668 * required=false,
5669 * @OA\Schema(
5670 * type="string"
5672 * ),
5673 * @OA\Parameter(
5674 * name="state_license_number2",
5675 * in="query",
5676 * description="The state license number for the user.",
5677 * required=false,
5678 * @OA\Schema(
5679 * type="string"
5681 * ),
5682 * @OA\Parameter(
5683 * name="username",
5684 * in="query",
5685 * description="The username for the user.",
5686 * required=false,
5687 * @OA\Schema(
5688 * type="string"
5690 * ),
5691 * @OA\Response(
5692 * response="200",
5693 * ref="#/components/responses/standard"
5694 * ),
5695 * @OA\Response(
5696 * response="400",
5697 * ref="#/components/responses/badrequest"
5698 * ),
5699 * @OA\Response(
5700 * response="401",
5701 * ref="#/components/responses/unauthorized"
5702 * ),
5703 * security={{"openemr_auth":{}}}
5706 "GET /api/user" => function () {
5707 RestConfig::authorization_check("admin", "users");
5708 $return = (new UserRestController())->getAll($_GET);
5709 RestConfig::apiLog($return);
5710 return $return;
5714 * @OA\Get(
5715 * path="/api/user/{uuid}",
5716 * description="Retrieves a single user by their uuid",
5717 * tags={"standard"},
5718 * @OA\Parameter(
5719 * name="uuid",
5720 * in="path",
5721 * description="The uuid for the user.",
5722 * required=true,
5723 * @OA\Schema(
5724 * type="string"
5726 * ),
5727 * @OA\Response(
5728 * response="200",
5729 * ref="#/components/responses/standard"
5730 * ),
5731 * @OA\Response(
5732 * response="400",
5733 * ref="#/components/responses/badrequest"
5734 * ),
5735 * @OA\Response(
5736 * response="401",
5737 * ref="#/components/responses/unauthorized"
5738 * ),
5739 * security={{"openemr_auth":{}}}
5742 "GET /api/user/:uuid" => function ($uuid) {
5743 RestConfig::authorization_check("admin", "users");
5744 $return = (new UserRestController())->getOne($uuid);
5745 RestConfig::apiLog($return);
5746 return $return;
5750 * @OA\Get(
5751 * path="/api/version",
5752 * description="Retrieves the OpenEMR version information",
5753 * tags={"standard"},
5754 * @OA\Response(
5755 * response="200",
5756 * ref="#/components/responses/standard"
5757 * ),
5758 * @OA\Response(
5759 * response="400",
5760 * ref="#/components/responses/badrequest"
5761 * ),
5762 * @OA\Response(
5763 * response="401",
5764 * ref="#/components/responses/unauthorized"
5765 * ),
5766 * security={{"openemr_auth":{}}}
5769 "GET /api/version" => function () {
5770 $return = (new VersionRestController())->getOne();
5771 RestConfig::apiLog($return);
5772 return $return;
5776 * @OA\Get(
5777 * path="/api/product",
5778 * description="Retrieves the OpenEMR product registration information",
5779 * tags={"standard"},
5780 * @OA\Response(
5781 * response="200",
5782 * ref="#/components/responses/standard"
5783 * ),
5784 * @OA\Response(
5785 * response="400",
5786 * ref="#/components/responses/badrequest"
5787 * ),
5788 * @OA\Response(
5789 * response="401",
5790 * ref="#/components/responses/unauthorized"
5791 * ),
5792 * security={{"openemr_auth":{}}}
5795 "GET /api/product" => function () {
5796 $return = (new ProductRegistrationRestController())->getOne();
5797 RestConfig::apiLog($return);
5798 return $return;
5802 * @OA\Get(
5803 * path="/api/insurance_company",
5804 * description="Retrieves all insurance companies",
5805 * tags={"standard"},
5806 * @OA\Response(
5807 * response="200",
5808 * ref="#/components/responses/standard"
5809 * ),
5810 * @OA\Response(
5811 * response="400",
5812 * ref="#/components/responses/badrequest"
5813 * ),
5814 * @OA\Response(
5815 * response="401",
5816 * ref="#/components/responses/unauthorized"
5817 * ),
5818 * security={{"openemr_auth":{}}}
5821 "GET /api/insurance_company" => function () {
5822 $return = (new InsuranceCompanyRestController())->getAll();
5823 RestConfig::apiLog($return);
5824 return $return;
5828 * @OA\Get(
5829 * path="/api/insurance_company/{iid}",
5830 * description="Retrieves insurance company",
5831 * tags={"standard"},
5832 * @OA\Parameter(
5833 * name="iid",
5834 * in="path",
5835 * description="The id of the insurance company.",
5836 * required=true,
5837 * @OA\Schema(
5838 * type="string"
5840 * ),
5841 * @OA\Response(
5842 * response="200",
5843 * ref="#/components/responses/standard"
5844 * ),
5845 * @OA\Response(
5846 * response="400",
5847 * ref="#/components/responses/badrequest"
5848 * ),
5849 * @OA\Response(
5850 * response="401",
5851 * ref="#/components/responses/unauthorized"
5852 * ),
5853 * security={{"openemr_auth":{}}}
5856 "GET /api/insurance_company/:iid" => function ($iid) {
5857 $return = (new InsuranceCompanyRestController())->getOne($iid);
5858 RestConfig::apiLog($return);
5859 return $return;
5863 * @OA\Get(
5864 * path="/api/insurance_type",
5865 * description="Retrieves all insurance types",
5866 * tags={"standard"},
5867 * @OA\Response(
5868 * response="200",
5869 * ref="#/components/responses/standard"
5870 * ),
5871 * @OA\Response(
5872 * response="400",
5873 * ref="#/components/responses/badrequest"
5874 * ),
5875 * @OA\Response(
5876 * response="401",
5877 * ref="#/components/responses/unauthorized"
5878 * ),
5879 * security={{"openemr_auth":{}}}
5882 "GET /api/insurance_type" => function () {
5883 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5884 RestConfig::apiLog($return);
5885 return $return;
5889 * Schema for the insurance_company request
5891 * @OA\Schema(
5892 * schema="api_insurance_company_request",
5893 * @OA\Property(
5894 * property="name",
5895 * description="The name of insurance company.",
5896 * type="string"
5897 * ),
5898 * @OA\Property(
5899 * property="attn",
5900 * description="The attn of insurance company.",
5901 * type="string"
5902 * ),
5903 * @OA\Property(
5904 * property="cms_id",
5905 * description="The cms id of insurance company.",
5906 * type="string"
5907 * ),
5908 * @OA\Property(
5909 * property="ins_type_code",
5910 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5911 * type="string"
5912 * ),
5913 * @OA\Property(
5914 * property="x12_receiver_id",
5915 * description="The x12 receiver id of insurance company.",
5916 * type="string"
5917 * ),
5918 * @OA\Property(
5919 * property="x12_default_partner_id",
5920 * description="The x12 default partner id of insurance company.",
5921 * type="string"
5922 * ),
5923 * @OA\Property(
5924 * property="alt_cms_id",
5925 * description="The alternate cms id of insurance company.",
5926 * type="string"
5927 * ),
5928 * @OA\Property(
5929 * property="line1",
5930 * description="The line1 address of insurance company.",
5931 * type="string"
5932 * ),
5933 * @OA\Property(
5934 * property="line2",
5935 * description="The line2 address of insurance company.",
5936 * type="string"
5937 * ),
5938 * @OA\Property(
5939 * property="city",
5940 * description="The city of insurance company.",
5941 * type="string"
5942 * ),
5943 * @OA\Property(
5944 * property="state",
5945 * description="The state of insurance company.",
5946 * type="string"
5947 * ),
5948 * @OA\Property(
5949 * property="zip",
5950 * description="The zip of insurance company.",
5951 * type="string"
5952 * ),
5953 * @OA\Property(
5954 * property="country",
5955 * description="The country of insurance company.",
5956 * type="string"
5957 * ),
5958 * required={"name"},
5959 * example={
5960 * "name": "Cool Insurance Company",
5961 * "attn": null,
5962 * "cms_id": null,
5963 * "ins_type_code": "2",
5964 * "x12_receiver_id": null,
5965 * "x12_default_partner_id": null,
5966 * "alt_cms_id": "",
5967 * "line1": "123 Cool Lane",
5968 * "line2": "Suite 123",
5969 * "city": "Cooltown",
5970 * "state": "CA",
5971 * "zip": "12245",
5972 * "country": "USA"
5977 * @OA\Post(
5978 * path="/api/insurance_company",
5979 * description="Submits a new insurance company",
5980 * tags={"standard"},
5981 * @OA\RequestBody(
5982 * required=true,
5983 * @OA\MediaType(
5984 * mediaType="application/json",
5985 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5987 * ),
5988 * @OA\Response(
5989 * response="200",
5990 * ref="#/components/responses/standard"
5991 * ),
5992 * @OA\Response(
5993 * response="400",
5994 * ref="#/components/responses/badrequest"
5995 * ),
5996 * @OA\Response(
5997 * response="401",
5998 * ref="#/components/responses/unauthorized"
5999 * ),
6000 * security={{"openemr_auth":{}}}
6003 "POST /api/insurance_company" => function () {
6004 $data = (array) (json_decode(file_get_contents("php://input")));
6005 $return = (new InsuranceCompanyRestController())->post($data);
6006 RestConfig::apiLog($return, $data);
6007 return $return;
6011 * @OA\Put(
6012 * path="/api/insurance_company/{iid}",
6013 * description="Edit a insurance company",
6014 * tags={"standard"},
6015 * @OA\Parameter(
6016 * name="iid",
6017 * in="path",
6018 * description="The id for the insurance company.",
6019 * required=true,
6020 * @OA\Schema(
6021 * type="string"
6023 * ),
6024 * @OA\RequestBody(
6025 * required=true,
6026 * @OA\MediaType(
6027 * mediaType="application/json",
6028 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
6030 * ),
6031 * @OA\Response(
6032 * response="200",
6033 * ref="#/components/responses/standard"
6034 * ),
6035 * @OA\Response(
6036 * response="400",
6037 * ref="#/components/responses/badrequest"
6038 * ),
6039 * @OA\Response(
6040 * response="401",
6041 * ref="#/components/responses/unauthorized"
6042 * ),
6043 * security={{"openemr_auth":{}}}
6046 "PUT /api/insurance_company/:iid" => function ($iid) {
6047 $data = (array) (json_decode(file_get_contents("php://input")));
6048 $return = (new InsuranceCompanyRestController())->put($iid, $data);
6049 RestConfig::apiLog($return, $data);
6050 return $return;
6054 * @OA\Post(
6055 * path="/api/patient/{pid}/document",
6056 * description="Submits a new patient document",
6057 * tags={"standard"},
6058 * @OA\Parameter(
6059 * name="pid",
6060 * in="path",
6061 * description="The pid for the patient.",
6062 * required=true,
6063 * @OA\Schema(
6064 * type="string"
6066 * ),
6067 * @OA\Parameter(
6068 * name="path",
6069 * in="query",
6070 * description="The category of the document.",
6071 * required=true,
6072 * @OA\Schema(
6073 * type="string"
6075 * ),
6076 * @OA\RequestBody(
6077 * required=true,
6078 * @OA\MediaType(
6079 * mediaType="multipart/form-data",
6080 * @OA\Schema(
6081 * @OA\Property(
6082 * property="document",
6083 * description="document",
6084 * type="string",
6085 * format="binary"
6086 * ),
6087 * ),
6088 * ),
6089 * ),
6090 * @OA\Response(
6091 * response="200",
6092 * ref="#/components/responses/standard"
6093 * ),
6094 * @OA\Response(
6095 * response="400",
6096 * ref="#/components/responses/badrequest"
6097 * ),
6098 * @OA\Response(
6099 * response="401",
6100 * ref="#/components/responses/unauthorized"
6101 * ),
6102 * security={{"openemr_auth":{}}}
6105 "POST /api/patient/:pid/document" => function ($pid) {
6106 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6107 RestConfig::apiLog($return);
6108 return $return;
6112 * @OA\Get(
6113 * path="/api/patient/{pid}/document",
6114 * description="Retrieves all file information of documents from a category for a patient",
6115 * tags={"standard"},
6116 * @OA\Parameter(
6117 * name="pid",
6118 * in="path",
6119 * description="The pid for the patient.",
6120 * required=true,
6121 * @OA\Schema(
6122 * type="string"
6124 * ),
6125 * @OA\Parameter(
6126 * name="path",
6127 * in="query",
6128 * description="The category of the documents.",
6129 * required=true,
6130 * @OA\Schema(
6131 * type="string"
6133 * ),
6134 * @OA\Response(
6135 * response="200",
6136 * ref="#/components/responses/standard"
6137 * ),
6138 * @OA\Response(
6139 * response="400",
6140 * ref="#/components/responses/badrequest"
6141 * ),
6142 * @OA\Response(
6143 * response="401",
6144 * ref="#/components/responses/unauthorized"
6145 * ),
6146 * security={{"openemr_auth":{}}}
6149 "GET /api/patient/:pid/document" => function ($pid) {
6150 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6151 RestConfig::apiLog($return);
6152 return $return;
6156 * @OA\Get(
6157 * path="/api/patient/{pid}/document/{did}",
6158 * description="Retrieves a document for a patient",
6159 * tags={"standard"},
6160 * @OA\Parameter(
6161 * name="pid",
6162 * in="path",
6163 * description="The pid for the patient.",
6164 * required=true,
6165 * @OA\Schema(
6166 * type="string"
6168 * ),
6169 * @OA\Parameter(
6170 * name="did",
6171 * in="path",
6172 * description="The id for the patient document.",
6173 * required=true,
6174 * @OA\Schema(
6175 * type="string"
6177 * ),
6178 * @OA\Response(
6179 * response="200",
6180 * ref="#/components/responses/standard"
6181 * ),
6182 * @OA\Response(
6183 * response="400",
6184 * ref="#/components/responses/badrequest"
6185 * ),
6186 * @OA\Response(
6187 * response="401",
6188 * ref="#/components/responses/unauthorized"
6189 * ),
6190 * security={{"openemr_auth":{}}}
6193 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6194 $return = (new DocumentRestController())->downloadFile($pid, $did);
6195 RestConfig::apiLog($return);
6196 return $return;
6200 * @OA\Get(
6201 * path="/api/patient/{puuid}/employer",
6202 * description="Retrieves all the employer data for a patient. Returns an array of the employer data for the patient.",
6203 * tags={"standard"},
6204 * @OA\Parameter(
6205 * name="pid",
6206 * in="path",
6207 * description="The uuid for the patient.",
6208 * required=true,
6209 * @OA\Schema(
6210 * type="string"
6212 * ),
6213 * @OA\Response(
6214 * response="200",
6215 * ref="#/components/responses/standard"
6216 * ),
6217 * @OA\Response(
6218 * response="400",
6219 * ref="#/components/responses/badrequest"
6220 * ),
6221 * @OA\Response(
6222 * response="401",
6223 * ref="#/components/responses/unauthorized"
6224 * ),
6225 * security={{"openemr_auth":{}}}
6228 "GET /api/patient/:puuid/employer" => function ($puuid, HttpRestRequest $request) {
6229 $searchParams = $request->getQueryParams();
6230 $searchParams['puuid'] = $puuid;
6231 if ($request->isPatientRequest()) {
6232 $searchParams['puuid'] = $request->getPatientUUIDString();
6234 $return = (new EmployerRestController())->getAll($searchParams);
6235 RestConfig::apiLog($return);
6236 return $return;
6240 * @OA\Get(
6241 * path="/api/patient/{puuid}/insurance",
6242 * description="Retrieves all insurances for a patient",
6243 * tags={"standard"},
6244 * @OA\Parameter(
6245 * name="pid",
6246 * in="path",
6247 * description="The uuid for the patient.",
6248 * required=true,
6249 * @OA\Schema(
6250 * type="string"
6252 * ),
6253 * @OA\Response(
6254 * response="200",
6255 * ref="#/components/responses/standard"
6256 * ),
6257 * @OA\Response(
6258 * response="400",
6259 * ref="#/components/responses/badrequest"
6260 * ),
6261 * @OA\Response(
6262 * response="401",
6263 * ref="#/components/responses/unauthorized"
6264 * ),
6265 * security={{"openemr_auth":{}}}
6268 "GET /api/patient/:puuid/insurance" => function ($puuid, HttpRestRequest $request) {
6269 $searchParams = $request->getQueryParams();
6270 $searchParams['puuid'] = $puuid;
6271 if ($request->isPatientRequest()) {
6272 $searchParams['puuid'] = $request->getPatientUUIDString();
6274 $return = (new InsuranceRestController())->getAll($searchParams);
6275 RestConfig::apiLog($return);
6276 return $return;
6280 * @OA\Get(
6281 * path="/api/patient/{puuid}/insurance/$swap-insurance",
6282 * description="Updates the insurance for the passed in uuid to be a policy of type `type` and updates (if one exists) the current or most recent insurance for the passed in `type` for a patient to be the `type` of the insurance for the given `uuid`. Validations on the swap operation are performed to make sure the effective `date` of the src and target policies being swapped can be received in each given policy `type` as a policy `type` and `date` must together be unique per patient.",
6283 * tags={"standard"},
6284 * @OA\Parameter(
6285 * name="pid",
6286 * in="path",
6287 * description="The uuid for the patient.",
6288 * required=true,
6289 * @OA\Schema(
6290 * type="string"
6292 * ),
6293 * @OA\Parameter(
6294 * name="type",
6295 * in="query",
6296 * description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'.",
6297 * required=true,
6298 * @OA\Schema(
6299 * type="string"
6301 * ),
6302 * @OA\Parameter(
6303 * name="uuid",
6304 * in="query",
6305 * description="The insurance uuid that will be swapped into the list of insurances for the type query parameter",
6306 * required=true,
6307 * @OA\Schema(
6308 * type="string"
6310 * ),
6311 * @OA\Response(
6312 * response="200",
6313 * ref="#/components/responses/standard"
6314 * ),
6315 * @OA\Response(
6316 * response="400",
6317 * ref="#/components/responses/badrequest"
6318 * ),
6319 * @OA\Response(
6320 * response="401",
6321 * ref="#/components/responses/unauthorized"
6322 * ),
6323 * security={{"openemr_auth":{}}}
6326 'GET /api/patient/:puuid/insurance/$swap-insurance' => function ($puuid, HttpRestRequest $request) {
6327 if ($request->isPatientRequest()) {
6328 $puuid = $request->getPatientUUIDString();
6330 $type = $request->getQueryParam('type');
6331 $insuranceUuid = $request->getQueryParam('uuid');
6333 $return = (new InsuranceRestController())->operationSwapInsurance($puuid, $type, $insuranceUuid);
6334 RestConfig::apiLog($return);
6335 return $return;
6339 * @OA\Get(
6340 * path="/api/patient/{puuid}/insurance/{uuid}",
6341 * description="Retrieves all insurances for a patient",
6342 * tags={"standard"},
6343 * @OA\Parameter(
6344 * name="pid",
6345 * in="path",
6346 * description="The uuid for the patient.",
6347 * required=true,
6348 * @OA\Schema(
6349 * type="string"
6351 * ),
6352 * @OA\Response(
6353 * response="200",
6354 * ref="#/components/responses/standard"
6355 * ),
6356 * @OA\Response(
6357 * response="400",
6358 * ref="#/components/responses/badrequest"
6359 * ),
6360 * @OA\Response(
6361 * response="401",
6362 * ref="#/components/responses/unauthorized"
6363 * ),
6364 * security={{"openemr_auth":{}}}
6367 "GET /api/patient/:puuid/insurance/:uuid" => function ($puuid, $uuid, HttpRestRequest $request) {
6368 if ($request->isPatientRequest()) {
6369 $puuid = $request->getPatientUUIDString();
6371 $return = (new InsuranceRestController())->getOne($uuid, $puuid);
6372 RestConfig::apiLog($return);
6373 return $return;
6377 * Schema for the insurance request. Note the following additional validation checks on the request.
6378 * If the subscriber_relationship value is of type 'self' then the subscriber_fname and subscriber_lname fields
6379 * must match the patient's first and last name or a patient's previous first and last name.
6381 * If the subscriber_relationship value is of type 'self' then the subscriber_ss field must match the patient's
6382 * social security number.
6384 * If the subscriber_relationship value is not of type 'self' then the subscriber_ss field MUST not be the current patient's social security number.
6386 * If the system's global configuration permits only a single insurance type option then any insurance rquest where the type is NOT 'primary' will fail.
6388 * An insurance is considered the current policy for the policy type if the policy date_end field is null. Only one of these records per policy type can exist for a patient.
6389 * @OA\Schema(
6390 * schema="api_insurance_request",
6391 * @OA\Property(
6392 * property="provider",
6393 * description="The insurance company id.",
6394 * type="string"
6395 * ),
6396 * @OA\Property(
6397 * property="plan_name",
6398 * description="The plan name of insurance. (2-255 characters)",
6399 * type="string"
6400 * ),
6401 * @OA\Property(
6402 * property="policy_number",
6403 * description="The policy number of insurance. (2-255 characters)",
6404 * type="string"
6405 * ),
6406 * @OA\Property(
6407 * property="group_number",
6408 * description="The group number of insurance.(2-255 characters)",
6409 * type="string"
6410 * ),
6411 * @OA\Property(
6412 * property="subscriber_lname",
6413 * description="The subscriber last name of insurance.(2-255 characters).",
6414 * type="string"
6415 * ),
6416 * @OA\Property(
6417 * property="subscriber_mname",
6418 * description="The subscriber middle name of insurance.",
6419 * type="string"
6420 * ),
6421 * @OA\Property(
6422 * property="subscriber_fname",
6423 * description="The subscriber first name of insurance.",
6424 * type="string"
6425 * ),
6426 * @OA\Property(
6427 * property="subscriber_relationship",
6428 * description="The subscriber relationship of insurance. `subscriber_relationship` can be found by querying `resource=/api/list/subscriber_relationship`",
6429 * type="string"
6430 * ),
6431 * @OA\Property(
6432 * property="subscriber_ss",
6433 * description="The subscriber ss number of insurance.",
6434 * type="string"
6435 * ),
6436 * @OA\Property(
6437 * property="subscriber_DOB",
6438 * description="The subscriber DOB of insurance.",
6439 * type="string"
6440 * ),
6441 * @OA\Property(
6442 * property="subscriber_street",
6443 * description="The subscriber street address of insurance.",
6444 * type="string"
6445 * ),
6446 * @OA\Property(
6447 * property="subscriber_postal_code",
6448 * description="The subscriber postal code of insurance.",
6449 * type="string"
6450 * ),
6451 * @OA\Property(
6452 * property="subscriber_city",
6453 * description="The subscriber city of insurance.",
6454 * type="string"
6455 * ),
6456 * @OA\Property(
6457 * property="subscriber_state",
6458 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6459 * type="string"
6460 * ),
6461 * @OA\Property(
6462 * property="subscriber_country",
6463 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6464 * type="string"
6465 * ),
6466 * @OA\Property(
6467 * property="subscriber_phone",
6468 * description="The subscriber phone of insurance.",
6469 * type="string"
6470 * ),
6471 * @OA\Property(
6472 * property="subscriber_employer",
6473 * description="The subscriber employer of insurance.",
6474 * type="string"
6475 * ),
6476 * @OA\Property(
6477 * property="subscriber_employer_street",
6478 * description="The subscriber employer street of insurance.",
6479 * type="string"
6480 * ),
6481 * @OA\Property(
6482 * property="subscriber_employer_postal_code",
6483 * description="The subscriber employer postal code of insurance.",
6484 * type="string"
6485 * ),
6486 * @OA\Property(
6487 * property="subscriber_employer_state",
6488 * description="The subscriber employer state of insurance.",
6489 * type="string"
6490 * ),
6491 * @OA\Property(
6492 * property="subscriber_employer_country",
6493 * description="The subscriber employer country of insurance.",
6494 * type="string"
6495 * ),
6496 * @OA\Property(
6497 * property="subscriber_employer_city",
6498 * description="The subscriber employer city of insurance.",
6499 * type="string"
6500 * ),
6501 * @OA\Property(
6502 * property="copay",
6503 * description="The copay of insurance.",
6504 * type="string"
6505 * ),
6506 * @OA\Property(
6507 * property="date",
6508 * description="The effective date of insurance in YYYY-MM-DD format. This value cannot be after the date_end property and cannot be the same date as any other insurance policy for the same insurance type ('primary, 'secondary', etc).",
6509 * type="string"
6510 * ),
6511 * @OA\Property(
6512 * property="date_end",
6513 * description="The effective end date of insurance in YYYY-MM-DD format. This value cannot be before the date property. If it is null then this policy is the current policy for this policy type for the patient. There can only be one current policy per type and the request will fail if there is already a current policy for this type.",
6514 * type="string"
6515 * ),
6516 * @OA\Property(
6517 * property="subscriber_sex",
6518 * description="The subscriber sex of insurance.",
6519 * type="string"
6520 * ),
6521 * @OA\Property(
6522 * property="accept_assignment",
6523 * description="The accept_assignment of insurance.",
6524 * type="string"
6525 * ),
6526 * @OA\Property(
6527 * property="policy_type",
6528 * description="The 837p list of policy types for an insurance. See src/Billing/InsurancePolicyType.php for the list of valid values.",
6529 * type="string"
6530 * ),
6531 * @OA\Property(
6532 * property="type",
6533 * description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'. If this field is missing it will default to 'primary'.",
6534 * type="string"
6535 * ),
6536 * required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_sex", "accept_assignment"},
6537 * example={
6538 * "provider": "33",
6539 * "plan_name": "Some Plan",
6540 * "policy_number": "12345",
6541 * "group_number": "252412",
6542 * "subscriber_lname": "Tester",
6543 * "subscriber_mname": "Xi",
6544 * "subscriber_fname": "Foo",
6545 * "subscriber_relationship": "other",
6546 * "subscriber_ss": "234231234",
6547 * "subscriber_DOB": "2018-10-03",
6548 * "subscriber_street": "183 Cool St",
6549 * "subscriber_postal_code": "23418",
6550 * "subscriber_city": "Cooltown",
6551 * "subscriber_state": "AZ",
6552 * "subscriber_country": "USA",
6553 * "subscriber_phone": "234-598-2123",
6554 * "subscriber_employer": "Some Employer",
6555 * "subscriber_employer_street": "123 Heather Lane",
6556 * "subscriber_employer_postal_code": "23415",
6557 * "subscriber_employer_state": "AZ",
6558 * "subscriber_employer_country": "USA",
6559 * "subscriber_employer_city": "Cooltown",
6560 * "copay": "35",
6561 * "date": "2018-10-15",
6562 * "subscriber_sex": "Female",
6563 * "accept_assignment": "TRUE",
6564 * "policy_type": "a",
6565 * "type": "primary"
6571 * @OA\Put(
6572 * path="/api/patient/{puuid}/insurance/{insuranceUuid}",
6573 * description="Edit a specific patient insurance policy. Requires the patients/demo/write ACL to call. This method is the preferred method for updating a patient insurance policy. The {insuranceId} can be found by querying /api/patient/{pid}/insurance",
6574 * tags={"standard"},
6575 * @OA\Parameter(
6576 * name="puuid",
6577 * in="path",
6578 * description="The uuid for the patient.",
6579 * required=true,
6580 * @OA\Schema(
6581 * type="string"
6583 * ),
6584 * @OA\Parameter(
6585 * name="insuranceUuid",
6586 * in="path",
6587 * description="The insurance policy uuid for the patient.",
6588 * required=true,
6589 * @OA\Schema(
6590 * type="string"
6592 * ),
6593 * @OA\RequestBody(
6594 * required=true,
6595 * @OA\MediaType(
6596 * mediaType="application/json",
6597 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6599 * ),
6600 * @OA\Response(
6601 * response="200",
6602 * ref="#/components/responses/standard"
6603 * ),
6604 * @OA\Response(
6605 * response="400",
6606 * ref="#/components/responses/badrequest"
6607 * ),
6608 * @OA\Response(
6609 * response="401",
6610 * ref="#/components/responses/unauthorized"
6611 * ),
6612 * security={{"openemr_auth":{}}}
6615 "PUT /api/patient/:puuid/insurance/:insuranceUuid" => function ($puuid, $insuranceUuid, HttpRestRequest $request) {
6616 RestConfig::authorization_check("patients", "demo", '', 'write');
6617 $data = (array) (json_decode(file_get_contents("php://input")));
6618 $return = (new InsuranceRestController())->put($puuid, $insuranceUuid, $data);
6619 RestConfig::apiLog($return, $data);
6620 return $return;
6624 * @OA\Post(
6625 * path="/api/patient/{puuid}/insurance",
6626 * description="Submits a new patient insurance.",
6627 * tags={"standard"},
6628 * @OA\Parameter(
6629 * name="puuid",
6630 * in="path",
6631 * description="The uuid for the patient.",
6632 * required=true,
6633 * @OA\Schema(
6634 * type="string"
6636 * ),
6637 * @OA\RequestBody(
6638 * required=true,
6639 * @OA\MediaType(
6640 * mediaType="application/json",
6641 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6643 * ),
6644 * @OA\Response(
6645 * response="200",
6646 * ref="#/components/responses/standard"
6647 * ),
6648 * @OA\Response(
6649 * response="400",
6650 * ref="#/components/responses/badrequest"
6651 * ),
6652 * @OA\Response(
6653 * response="401",
6654 * ref="#/components/responses/unauthorized"
6655 * ),
6656 * security={{"openemr_auth":{}}}
6659 "POST /api/patient/:puuid/insurance" => function ($puuid) {
6660 RestConfig::authorization_check("patients", "demo", '', ['write','addonly']);
6661 $data = (array) (json_decode(file_get_contents("php://input")));
6662 $return = (new InsuranceRestController())->post($puuid, $data);
6663 RestConfig::apiLog($return, $data);
6664 return $return;
6667 * Schema for the message request
6669 * @OA\Schema(
6670 * schema="api_message_request",
6671 * @OA\Property(
6672 * property="body",
6673 * description="The body of message.",
6674 * type="string"
6675 * ),
6676 * @OA\Property(
6677 * property="groupname",
6678 * description="The group name (usually is 'Default').",
6679 * type="string"
6680 * ),
6681 * @OA\Property(
6682 * property="from",
6683 * description="The sender of the message.",
6684 * type="string"
6685 * ),
6686 * @OA\Property(
6687 * property="to",
6688 * description="The recipient of the message.",
6689 * type="string"
6690 * ),
6691 * @OA\Property(
6692 * property="title",
6693 * description="use an option from resource=/api/list/note_type",
6694 * type="string"
6695 * ),
6696 * @OA\Property(
6697 * property="message_status",
6698 * description="use an option from resource=/api/list/message_status",
6699 * type="string"
6700 * ),
6701 * required={"body", "groupname", "from", "to", "title", "message_status"},
6702 * example={
6703 * "body": "Test 456",
6704 * "groupname": "Default",
6705 * "from": "Matthew",
6706 * "to": "admin",
6707 * "title": "Other",
6708 * "message_status": "New"
6713 * @OA\Post(
6714 * path="/api/patient/{pid}/message",
6715 * description="Submits a pnote message",
6716 * tags={"standard"},
6717 * @OA\Parameter(
6718 * name="pid",
6719 * in="path",
6720 * description="The id for the patient.",
6721 * required=true,
6722 * @OA\Schema(
6723 * type="string"
6725 * ),
6726 * @OA\RequestBody(
6727 * required=true,
6728 * @OA\MediaType(
6729 * mediaType="application/json",
6730 * @OA\Schema(ref="#/components/schemas/api_message_request")
6732 * ),
6733 * @OA\Response(
6734 * response="200",
6735 * ref="#/components/responses/standard"
6736 * ),
6737 * @OA\Response(
6738 * response="400",
6739 * ref="#/components/responses/badrequest"
6740 * ),
6741 * @OA\Response(
6742 * response="401",
6743 * ref="#/components/responses/unauthorized"
6744 * ),
6745 * security={{"openemr_auth":{}}}
6748 "POST /api/patient/:pid/message" => function ($pid) {
6749 RestConfig::authorization_check("patients", "notes");
6750 $data = (array) (json_decode(file_get_contents("php://input")));
6751 $return = (new MessageRestController())->post($pid, $data);
6752 RestConfig::apiLog($return, $data);
6753 return $return;
6757 * @OA\Get(
6758 * path="/api/patient/{pid}/transaction",
6759 * description="Get Transactions for a patient",
6760 * tags={"standard"},
6761 * @OA\Parameter(
6762 * name="pid",
6763 * in="path",
6764 * description="The pid for the patient",
6765 * required=true,
6766 * @OA\Schema(
6767 * type="string"
6769 * ),
6770 * @OA\Response(
6771 * response="200",
6772 * ref="#/components/responses/standard"
6773 * ),
6774 * @OA\Response(
6775 * response="400",
6776 * ref="#/components/responses/badrequest"
6777 * ),
6778 * @OA\Response(
6779 * response="401",
6780 * ref="#/components/responses/unauthorized"
6781 * ),
6782 * security={{"openemr_auth":{}}}
6786 "GET /api/patient/:pid/transaction" => function ($pid) {
6787 RestConfig::authorization_check("patients", "trans");
6788 $cont = new TransactionRestController();
6789 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6790 RestConfig::apiLog($return);
6791 return $return;
6795 * Schema for the transaction request
6797 * @OA\Schema(
6798 * schema="api_transaction_request",
6799 * @OA\Property(
6800 * property="message",
6801 * description="The message of the transaction.",
6802 * type="string"
6803 * ),
6804 * @OA\Property(
6805 * property="type",
6806 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6807 * type="string"
6808 * ),
6809 * @OA\Property(
6810 * property="groupname",
6811 * description="The group name (usually is 'Default').",
6812 * type="string"
6813 * ),
6814 * @OA\Property(
6815 * property="referByNpi",
6816 * description="NPI of the person creating the referral.",
6817 * type="string"
6818 * ),
6819 * @OA\Property(
6820 * property="referToNpi",
6821 * description="NPI of the person getting the referral.",
6822 * type="string"
6823 * ),
6824 * @OA\Property(
6825 * property="referDiagnosis",
6826 * description="The referral diagnosis.",
6827 * type="string"
6828 * ),
6829 * @OA\Property(
6830 * property="riskLevel",
6831 * description="The risk level. (Low, Medium, High)",
6832 * type="string"
6833 * ),
6834 * @OA\Property(
6835 * property="includeVitals",
6836 * description="Are vitals included (0,1)",
6837 * type="string"
6838 * ),
6839 * @OA\Property(
6840 * property="referralDate",
6841 * description="The date of the referral",
6842 * type="string"
6843 * ),
6844 * @OA\Property(
6845 * property="authorization",
6846 * description="The authorization for the referral",
6847 * type="string"
6848 * ),
6849 * @OA\Property(
6850 * property="visits",
6851 * description="The number of vists for the referral",
6852 * type="string"
6853 * ),
6854 * @OA\Property(
6855 * property="validFrom",
6856 * description="The date the referral is valid from",
6857 * type="string"
6858 * ),
6859 * @OA\Property(
6860 * property="validThrough",
6861 * description="The date the referral is valid through",
6862 * type="string"
6863 * ),
6864 * required={"message", "groupname", "title"},
6865 * example={
6866 * "message": "Message",
6867 * "type": "LBTref",
6868 * "groupname": "Default",
6869 * "referByNpi":"9999999999",
6870 * "referToNpi":"9999999999",
6871 * "referDiagnosis":"Diag 1",
6872 * "riskLevel":"Low",
6873 * "includeVitals":"1",
6874 * "referralDate":"2022-01-01",
6875 * "authorization":"Auth_123",
6876 * "visits": "1",
6877 * "validFrom": "2022-01-02",
6878 * "validThrough": "2022-01-03",
6879 * "body": "Reason 1"
6884 * @OA\Post(
6885 * path="/api/patient/{pid}/transaction",
6886 * description="Submits a transaction",
6887 * tags={"standard"},
6888 * @OA\Parameter(
6889 * name="pid",
6890 * in="path",
6891 * description="The pid for the patient.",
6892 * required=true,
6893 * @OA\Schema(
6894 * type="string"
6896 * ),
6897 * @OA\RequestBody(
6898 * required=true,
6899 * @OA\MediaType(
6900 * mediaType="application/json",
6901 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6903 * ),
6904 * @OA\Response(
6905 * response="200",
6906 * ref="#/components/responses/standard"
6907 * ),
6908 * @OA\Response(
6909 * response="400",
6910 * ref="#/components/responses/badrequest"
6911 * ),
6912 * @OA\Response(
6913 * response="401",
6914 * ref="#/components/responses/unauthorized"
6915 * ),
6916 * security={{"openemr_auth":{}}}
6919 "POST /api/patient/:pid/transaction" => function ($pid) {
6920 RestConfig::authorization_check("patients", "trans");
6921 $data = (array) (json_decode(file_get_contents("php://input")));
6922 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6923 RestConfig::apiLog($return, $data);
6924 return $return;
6928 * @OA\PUT(
6929 * path="/api/transaction/{tid}",
6930 * description="Updates a transaction",
6931 * tags={"standard"},
6932 * @OA\Parameter(
6933 * name="tid",
6934 * in="path",
6935 * description="The id for the transaction.",
6936 * required=true,
6937 * @OA\Schema(
6938 * type="string"
6940 * ),
6941 * @OA\RequestBody(
6942 * required=true,
6943 * @OA\MediaType(
6944 * mediaType="application/json",
6945 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6947 * ),
6948 * @OA\Response(
6949 * response="200",
6950 * ref="#/components/responses/standard"
6951 * ),
6952 * @OA\Response(
6953 * response="400",
6954 * ref="#/components/responses/badrequest"
6955 * ),
6956 * @OA\Response(
6957 * response="401",
6958 * ref="#/components/responses/unauthorized"
6959 * ),
6960 * security={{"openemr_auth":{}}}
6963 "PUT /api/transaction/:tid" => function ($tid) {
6964 RestConfig::authorization_check("patients", "trans");
6965 $data = (array) (json_decode(file_get_contents("php://input")));
6966 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6967 RestConfig::apiLog($return, $data);
6968 return $return;
6972 * @OA\Put(
6973 * path="/api/patient/{pid}/message/{mid}",
6974 * description="Edit a pnote message",
6975 * tags={"standard"},
6976 * @OA\Parameter(
6977 * name="pid",
6978 * in="path",
6979 * description="The id for the patient.",
6980 * required=true,
6981 * @OA\Schema(
6982 * type="string"
6984 * ),
6985 * @OA\Parameter(
6986 * name="mid",
6987 * in="path",
6988 * description="The id for the pnote message.",
6989 * required=true,
6990 * @OA\Schema(
6991 * type="string"
6993 * ),
6994 * @OA\RequestBody(
6995 * required=true,
6996 * @OA\MediaType(
6997 * mediaType="application/json",
6998 * @OA\Schema(ref="#/components/schemas/api_message_request")
7000 * ),
7001 * @OA\Response(
7002 * response="200",
7003 * ref="#/components/responses/standard"
7004 * ),
7005 * @OA\Response(
7006 * response="400",
7007 * ref="#/components/responses/badrequest"
7008 * ),
7009 * @OA\Response(
7010 * response="401",
7011 * ref="#/components/responses/unauthorized"
7012 * ),
7013 * security={{"openemr_auth":{}}}
7016 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
7017 RestConfig::authorization_check("patients", "notes");
7018 $data = (array) (json_decode(file_get_contents("php://input")));
7019 $return = (new MessageRestController())->put($pid, $mid, $data);
7020 RestConfig::apiLog($return, $data);
7021 return $return;
7025 * @OA\Delete(
7026 * path="/api/patient/{pid}/message/{mid}",
7027 * description="Delete a pnote message",
7028 * tags={"standard"},
7029 * @OA\Parameter(
7030 * name="pid",
7031 * in="path",
7032 * description="The id for the patient.",
7033 * required=true,
7034 * @OA\Schema(
7035 * type="string"
7037 * ),
7038 * @OA\Parameter(
7039 * name="mid",
7040 * in="path",
7041 * description="The id for the pnote message.",
7042 * required=true,
7043 * @OA\Schema(
7044 * type="string"
7046 * ),
7047 * @OA\Response(
7048 * response="200",
7049 * ref="#/components/responses/standard"
7050 * ),
7051 * @OA\Response(
7052 * response="400",
7053 * ref="#/components/responses/badrequest"
7054 * ),
7055 * @OA\Response(
7056 * response="401",
7057 * ref="#/components/responses/unauthorized"
7058 * ),
7059 * security={{"openemr_auth":{}}}
7062 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
7063 RestConfig::authorization_check("patients", "notes");
7064 $return = (new MessageRestController())->delete($pid, $mid);
7065 RestConfig::apiLog($return);
7066 return $return;
7070 * @OA\Get(
7071 * path="/api/immunization",
7072 * description="Retrieves a list of immunizations",
7073 * tags={"standard"},
7074 * @OA\Parameter(
7075 * name="patient_id",
7076 * in="query",
7077 * description="The pid for the patient.",
7078 * required=false,
7079 * @OA\Schema(
7080 * type="string"
7082 * ),
7083 * @OA\Parameter(
7084 * name="id",
7085 * in="query",
7086 * description="The id for the immunization.",
7087 * required=false,
7088 * @OA\Schema(
7089 * type="string"
7091 * ),
7092 * @OA\Parameter(
7093 * name="uuid",
7094 * in="query",
7095 * description="The uuid for the immunization.",
7096 * required=false,
7097 * @OA\Schema(
7098 * type="string"
7100 * ),
7101 * @OA\Parameter(
7102 * name="administered_date",
7103 * in="query",
7104 * description="The administered date for the immunization.",
7105 * required=false,
7106 * @OA\Schema(
7107 * type="string"
7109 * ),
7110 * @OA\Parameter(
7111 * name="immunization_id",
7112 * in="query",
7113 * description="The immunization list_id for the immunization.",
7114 * required=false,
7115 * @OA\Schema(
7116 * type="string"
7118 * ),
7119 * @OA\Parameter(
7120 * name="cvx_code",
7121 * in="query",
7122 * description="The cvx code for the immunization.",
7123 * required=false,
7124 * @OA\Schema(
7125 * type="string"
7127 * ),
7128 * @OA\Parameter(
7129 * name="manufacturer",
7130 * in="query",
7131 * description="The manufacturer for the immunization.",
7132 * required=false,
7133 * @OA\Schema(
7134 * type="string"
7136 * ),
7137 * @OA\Parameter(
7138 * name="lot_number",
7139 * in="query",
7140 * description="The lot number for the immunization.",
7141 * required=false,
7142 * @OA\Schema(
7143 * type="string"
7145 * ),
7146 * @OA\Parameter(
7147 * name="administered_by_id",
7148 * in="query",
7149 * description="The administered by id for the immunization.",
7150 * required=false,
7151 * @OA\Schema(
7152 * type="string"
7154 * ),
7155 * @OA\Parameter(
7156 * name="administered_by",
7157 * in="query",
7158 * description="The administered by for the immunization.",
7159 * required=false,
7160 * @OA\Schema(
7161 * type="string"
7163 * ),
7164 * @OA\Parameter(
7165 * name="education_date",
7166 * in="query",
7167 * description="The education date for the immunization.",
7168 * required=false,
7169 * @OA\Schema(
7170 * type="string"
7172 * ),
7173 * @OA\Parameter(
7174 * name="vis_date",
7175 * in="query",
7176 * description="The vis date for the immunization.",
7177 * required=false,
7178 * @OA\Schema(
7179 * type="string"
7181 * ),
7182 * @OA\Parameter(
7183 * name="note",
7184 * in="query",
7185 * description="The note for the immunization.",
7186 * required=false,
7187 * @OA\Schema(
7188 * type="string"
7190 * ),
7191 * @OA\Parameter(
7192 * name="create_date",
7193 * in="query",
7194 * description="The create date for the immunization.",
7195 * required=false,
7196 * @OA\Schema(
7197 * type="string"
7199 * ),
7200 * @OA\Parameter(
7201 * name="update_date",
7202 * in="query",
7203 * description="The update date for the immunization.",
7204 * required=false,
7205 * @OA\Schema(
7206 * type="string"
7208 * ),
7209 * @OA\Parameter(
7210 * name="created_by",
7211 * in="query",
7212 * description="The created_by for the immunization.",
7213 * required=false,
7214 * @OA\Schema(
7215 * type="string"
7217 * ),
7218 * @OA\Parameter(
7219 * name="updated_by",
7220 * in="query",
7221 * description="The updated_by for the immunization.",
7222 * required=false,
7223 * @OA\Schema(
7224 * type="string"
7226 * ),
7227 * @OA\Parameter(
7228 * name="amount_administered",
7229 * in="query",
7230 * description="The amount administered for the immunization.",
7231 * required=false,
7232 * @OA\Schema(
7233 * type="string"
7235 * ),
7236 * @OA\Parameter(
7237 * name="amount_administered_unit",
7238 * in="query",
7239 * description="The amount administered unit for the immunization.",
7240 * required=false,
7241 * @OA\Schema(
7242 * type="string"
7244 * ),
7245 * @OA\Parameter(
7246 * name="expiration_date",
7247 * in="query",
7248 * description="The expiration date for the immunization.",
7249 * required=false,
7250 * @OA\Schema(
7251 * type="string"
7253 * ),
7254 * @OA\Parameter(
7255 * name="route",
7256 * in="query",
7257 * description="The route for the immunization.",
7258 * required=false,
7259 * @OA\Schema(
7260 * type="string"
7262 * ),
7263 * @OA\Parameter(
7264 * name="administration_site",
7265 * in="query",
7266 * description="The administration site for the immunization.",
7267 * required=false,
7268 * @OA\Schema(
7269 * type="string"
7271 * ),
7272 * @OA\Parameter(
7273 * name="added_erroneously",
7274 * in="query",
7275 * description="The added_erroneously for the immunization.",
7276 * required=false,
7277 * @OA\Schema(
7278 * type="string"
7280 * ),
7281 * @OA\Parameter(
7282 * name="external_id",
7283 * in="query",
7284 * description="The external_id for the immunization.",
7285 * required=false,
7286 * @OA\Schema(
7287 * type="string"
7289 * ),
7290 * @OA\Parameter(
7291 * name="completion_status",
7292 * in="query",
7293 * description="The completion status for the immunization.",
7294 * required=false,
7295 * @OA\Schema(
7296 * type="string"
7298 * ),
7299 * @OA\Parameter(
7300 * name="information_source",
7301 * in="query",
7302 * description="The information source for the immunization.",
7303 * required=false,
7304 * @OA\Schema(
7305 * type="string"
7307 * ),
7308 * @OA\Parameter(
7309 * name="refusal_reason",
7310 * in="query",
7311 * description="The refusal reason for the immunization.",
7312 * required=false,
7313 * @OA\Schema(
7314 * type="string"
7316 * ),
7317 * @OA\Parameter(
7318 * name="ordering_provider",
7319 * in="query",
7320 * description="The ordering provider for the immunization.",
7321 * required=false,
7322 * @OA\Schema(
7323 * type="string"
7325 * ),
7326 * @OA\Response(
7327 * response="200",
7328 * ref="#/components/responses/standard"
7329 * ),
7330 * @OA\Response(
7331 * response="400",
7332 * ref="#/components/responses/badrequest"
7333 * ),
7334 * @OA\Response(
7335 * response="401",
7336 * ref="#/components/responses/unauthorized"
7337 * ),
7338 * security={{"openemr_auth":{}}}
7341 "GET /api/immunization" => function () {
7342 RestConfig::authorization_check("patients", "med");
7343 $return = (new ImmunizationRestController())->getAll($_GET);
7344 RestConfig::apiLog($return);
7345 return $return;
7349 * @OA\Get(
7350 * path="/api/immunization/{uuid}",
7351 * description="Retrieves a immunization",
7352 * tags={"standard"},
7353 * @OA\Parameter(
7354 * name="uuid",
7355 * in="path",
7356 * description="The uuid for the immunization.",
7357 * required=true,
7358 * @OA\Schema(
7359 * type="string"
7361 * ),
7362 * @OA\Response(
7363 * response="200",
7364 * ref="#/components/responses/standard"
7365 * ),
7366 * @OA\Response(
7367 * response="400",
7368 * ref="#/components/responses/badrequest"
7369 * ),
7370 * @OA\Response(
7371 * response="401",
7372 * ref="#/components/responses/unauthorized"
7373 * ),
7374 * security={{"openemr_auth":{}}}
7377 "GET /api/immunization/:uuid" => function ($uuid) {
7378 RestConfig::authorization_check("patients", "med");
7379 $return = (new ImmunizationRestController())->getOne($uuid);
7380 RestConfig::apiLog($return);
7381 return $return;
7385 * @OA\Get(
7386 * path="/api/procedure",
7387 * description="Retrieves a list of all procedures",
7388 * tags={"standard"},
7389 * @OA\Response(
7390 * response="200",
7391 * ref="#/components/responses/standard"
7392 * ),
7393 * @OA\Response(
7394 * response="400",
7395 * ref="#/components/responses/badrequest"
7396 * ),
7397 * @OA\Response(
7398 * response="401",
7399 * ref="#/components/responses/unauthorized"
7400 * ),
7401 * security={{"openemr_auth":{}}}
7404 "GET /api/procedure" => function () {
7405 RestConfig::authorization_check("patients", "med");
7406 $return = (new ProcedureRestController())->getAll();
7407 RestConfig::apiLog($return);
7408 return $return;
7412 * @OA\Get(
7413 * path="/api/procedure/{uuid}",
7414 * description="Retrieves a procedure",
7415 * tags={"standard"},
7416 * @OA\Parameter(
7417 * name="uuid",
7418 * in="path",
7419 * description="The uuid for the procedure.",
7420 * required=true,
7421 * @OA\Schema(
7422 * type="string"
7424 * ),
7425 * @OA\Response(
7426 * response="200",
7427 * ref="#/components/responses/standard"
7428 * ),
7429 * @OA\Response(
7430 * response="400",
7431 * ref="#/components/responses/badrequest"
7432 * ),
7433 * @OA\Response(
7434 * response="401",
7435 * ref="#/components/responses/unauthorized"
7436 * ),
7437 * security={{"openemr_auth":{}}}
7440 "GET /api/procedure/:uuid" => function ($uuid) {
7441 RestConfig::authorization_check("patients", "med");
7442 $return = (new ProcedureRestController())->getOne($uuid);
7443 RestConfig::apiLog($return);
7444 return $return;
7448 * @OA\Get(
7449 * path="/api/drug",
7450 * description="Retrieves a list of all drugs",
7451 * tags={"standard"},
7452 * @OA\Response(
7453 * response="200",
7454 * ref="#/components/responses/standard"
7455 * ),
7456 * @OA\Response(
7457 * response="400",
7458 * ref="#/components/responses/badrequest"
7459 * ),
7460 * @OA\Response(
7461 * response="401",
7462 * ref="#/components/responses/unauthorized"
7463 * ),
7464 * security={{"openemr_auth":{}}}
7467 "GET /api/drug" => function () {
7468 RestConfig::authorization_check("patients", "med");
7469 $return = (new DrugRestController())->getAll();
7470 RestConfig::apiLog($return);
7471 return $return;
7475 * @OA\Get(
7476 * path="/api/drug/{uuid}",
7477 * description="Retrieves a drug",
7478 * tags={"standard"},
7479 * @OA\Parameter(
7480 * name="uuid",
7481 * in="path",
7482 * description="The uuid for the drug.",
7483 * required=true,
7484 * @OA\Schema(
7485 * type="string"
7487 * ),
7488 * @OA\Response(
7489 * response="200",
7490 * ref="#/components/responses/standard"
7491 * ),
7492 * @OA\Response(
7493 * response="400",
7494 * ref="#/components/responses/badrequest"
7495 * ),
7496 * @OA\Response(
7497 * response="401",
7498 * ref="#/components/responses/unauthorized"
7499 * ),
7500 * security={{"openemr_auth":{}}}
7503 "GET /api/drug/:uuid" => function ($uuid) {
7504 RestConfig::authorization_check("patients", "med");
7505 $return = (new DrugRestController())->getOne($uuid);
7506 RestConfig::apiLog($return);
7507 return $return;
7511 * @OA\Get(
7512 * path="/api/prescription",
7513 * description="Retrieves a list of all prescriptions",
7514 * tags={"standard"},
7515 * @OA\Response(
7516 * response="200",
7517 * ref="#/components/responses/standard"
7518 * ),
7519 * @OA\Response(
7520 * response="400",
7521 * ref="#/components/responses/badrequest"
7522 * ),
7523 * @OA\Response(
7524 * response="401",
7525 * ref="#/components/responses/unauthorized"
7526 * ),
7527 * security={{"openemr_auth":{}}}
7530 "GET /api/prescription" => function () {
7531 RestConfig::authorization_check("patients", "med");
7532 $return = (new PrescriptionRestController())->getAll();
7533 RestConfig::apiLog($return);
7534 return $return;
7538 * @OA\Get(
7539 * path="/api/prescription/{uuid}",
7540 * description="Retrieves a prescription",
7541 * tags={"standard"},
7542 * @OA\Parameter(
7543 * name="uuid",
7544 * in="path",
7545 * description="The uuid for the prescription.",
7546 * required=true,
7547 * @OA\Schema(
7548 * type="string"
7550 * ),
7551 * @OA\Response(
7552 * response="200",
7553 * ref="#/components/responses/standard"
7554 * ),
7555 * @OA\Response(
7556 * response="400",
7557 * ref="#/components/responses/badrequest"
7558 * ),
7559 * @OA\Response(
7560 * response="401",
7561 * ref="#/components/responses/unauthorized"
7562 * ),
7563 * security={{"openemr_auth":{}}}
7566 "GET /api/prescription/:uuid" => function ($uuid) {
7567 RestConfig::authorization_check("patients", "med");
7568 $return = (new PrescriptionRestController())->getOne($uuid);
7569 RestConfig::apiLog($return);
7570 return $return;
7574 use OpenEMR\Common\Http\StatusCode;
7575 use OpenEMR\Common\Http\Psr17Factory;
7576 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7577 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController;
7578 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7579 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7580 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7581 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7582 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7583 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7584 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7585 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7586 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7587 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7588 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7589 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7590 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7591 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7592 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7593 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7594 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7595 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7596 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7597 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7598 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7599 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7600 use OpenEMR\RestControllers\FHIR\FhirValueSetRestController;
7601 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7602 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7603 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7604 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController;
7606 // Note that the fhir route includes both user role and patient role
7607 // (there is a mechanism in place to ensure patient role is binded
7608 // to only see the data of the one patient)
7609 RestConfig::$FHIR_ROUTE_MAP = array(
7611 * @OA\Get(
7612 * path="/fhir/AllergyIntolerance",
7613 * description="Returns a list of AllergyIntolerance resources.",
7614 * tags={"fhir"},
7615 * @OA\Parameter(
7616 * name="_id",
7617 * in="query",
7618 * description="The uuid for the AllergyIntolerance resource.",
7619 * required=false,
7620 * @OA\Schema(
7621 * type="string"
7623 * ),
7624 * @OA\Parameter(
7625 * name="patient",
7626 * in="query",
7627 * description="The uuid for the patient.",
7628 * required=false,
7629 * @OA\Schema(
7630 * type="string"
7632 * ),
7633 * @OA\Response(
7634 * response="200",
7635 * description="Standard Response",
7636 * @OA\MediaType(
7637 * mediaType="application/json",
7638 * @OA\Schema(
7639 * @OA\Property(
7640 * property="json object",
7641 * description="FHIR Json object.",
7642 * type="object"
7643 * ),
7644 * example={
7645 * "meta": {
7646 * "lastUpdated": "2021-09-14T09:13:51"
7647 * },
7648 * "resourceType": "Bundle",
7649 * "type": "collection",
7650 * "total": 0,
7651 * "link": {
7653 * "relation": "self",
7654 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7660 * ),
7661 * @OA\Response(
7662 * response="400",
7663 * ref="#/components/responses/badrequest"
7664 * ),
7665 * @OA\Response(
7666 * response="401",
7667 * ref="#/components/responses/unauthorized"
7668 * ),
7669 * security={{"openemr_auth":{}}}
7672 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7673 $getParams = $request->getQueryParams();
7674 if ($request->isPatientRequest()) {
7675 // only allow access to data of binded patient
7676 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7677 } else {
7678 RestConfig::authorization_check("patients", "med");
7679 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7681 RestConfig::apiLog($return);
7682 return $return;
7686 * @OA\Get(
7687 * path="/fhir/AllergyIntolerance/{uuid}",
7688 * description="Returns a single AllergyIntolerance resource.",
7689 * tags={"fhir"},
7690 * @OA\Parameter(
7691 * name="uuid",
7692 * in="path",
7693 * description="The uuid for the AllergyIntolerance resource.",
7694 * required=true,
7695 * @OA\Schema(
7696 * type="string"
7698 * ),
7699 * @OA\Response(
7700 * response="200",
7701 * description="Standard Response",
7702 * @OA\MediaType(
7703 * mediaType="application/json",
7704 * @OA\Schema(
7705 * @OA\Property(
7706 * property="json object",
7707 * description="FHIR Json object.",
7708 * type="object"
7709 * ),
7710 * example={
7711 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7712 * "meta": {
7713 * "versionId": "1",
7714 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7715 * },
7716 * "resourceType": "AllergyIntolerance",
7717 * "text": {
7718 * "status": "additional",
7719 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7720 * },
7721 * "clinicalStatus": {
7722 * "coding": {
7724 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7725 * "code": "active",
7726 * "display": "Active"
7729 * },
7730 * "verificationStatus": {
7731 * "coding": {
7733 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7734 * "code": "confirmed",
7735 * "display": "Confirmed"
7738 * },
7739 * "category": {
7740 * "medication"
7741 * },
7742 * "criticality": "low",
7743 * "code": {
7744 * "coding": {
7746 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7747 * "code": "unknown",
7748 * "display": "Unknown"
7751 * },
7752 * "patient": {
7753 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7754 * },
7755 * "reaction": {
7757 * "manifestation": {
7759 * "coding": {
7761 * "system": "http://snomed.info/sct",
7762 * "code": "422587007",
7763 * "display": "Nausea"
7765 * },
7766 * "text": "Nausea"
7774 * ),
7775 * @OA\Response(
7776 * response="400",
7777 * ref="#/components/responses/badrequest"
7778 * ),
7779 * @OA\Response(
7780 * response="401",
7781 * ref="#/components/responses/unauthorized"
7782 * ),
7783 * @OA\Response(
7784 * response="404",
7785 * ref="#/components/responses/uuidnotfound"
7786 * ),
7787 * security={{"openemr_auth":{}}}
7790 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7791 if ($request->isPatientRequest()) {
7792 // only allow access to data of binded patient
7793 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7794 } else {
7795 RestConfig::authorization_check("patients", "med");
7796 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7798 RestConfig::apiLog($return);
7799 return $return;
7803 * @OA\Get(
7804 * path="/fhir/Appointment",
7805 * description="Returns a list of Appointment resources.",
7806 * tags={"fhir"},
7807 * @OA\Parameter(
7808 * name="_id",
7809 * in="query",
7810 * description="The uuid for the Appointment resource.",
7811 * required=false,
7812 * @OA\Schema(
7813 * type="string"
7815 * ),
7816 * @OA\Parameter(
7817 * name="patient",
7818 * in="query",
7819 * description="The uuid for the patient.",
7820 * required=false,
7821 * @OA\Schema(
7822 * type="string"
7824 * ),
7825 * @OA\Response(
7826 * response="200",
7827 * description="Standard Response",
7828 * @OA\MediaType(
7829 * mediaType="application/json",
7830 * @OA\Schema(
7831 * @OA\Property(
7832 * property="json object",
7833 * description="FHIR Json object.",
7834 * type="object"
7835 * ),
7836 * example={
7837 * "meta": {
7838 * "lastUpdated": "2021-09-14T09:13:51"
7839 * },
7840 * "resourceType": "Bundle",
7841 * "type": "collection",
7842 * "total": 0,
7843 * "link": {
7845 * "relation": "self",
7846 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7852 * ),
7853 * @OA\Response(
7854 * response="400",
7855 * ref="#/components/responses/badrequest"
7856 * ),
7857 * @OA\Response(
7858 * response="401",
7859 * ref="#/components/responses/unauthorized"
7860 * ),
7861 * security={{"openemr_auth":{}}}
7864 "GET /fhir/Appointment" => function (HttpRestRequest $request) {
7865 $getParams = $request->getQueryParams();
7866 if ($request->isPatientRequest()) {
7867 // only allow access to data of binded patient
7868 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7869 } else {
7870 RestConfig::authorization_check("patients", "appt");
7871 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7873 RestConfig::apiLog($return);
7874 return $return;
7878 * @OA\Get(
7879 * path="/fhir/Appointment/{uuid}",
7880 * description="Returns a single Appointment resource.",
7881 * tags={"fhir"},
7882 * @OA\Parameter(
7883 * name="uuid",
7884 * in="path",
7885 * description="The uuid for the Appointment resource.",
7886 * required=true,
7887 * @OA\Schema(
7888 * type="string"
7890 * ),
7891 * @OA\Response(
7892 * response="200",
7893 * description="Standard Response",
7894 * @OA\MediaType(
7895 * mediaType="application/json",
7896 * @OA\Schema(
7897 * @OA\Property(
7898 * property="json object",
7899 * description="FHIR Json object.",
7900 * type="object"
7901 * ),
7902 * example={}
7905 * ),
7906 * @OA\Response(
7907 * response="400",
7908 * ref="#/components/responses/badrequest"
7909 * ),
7910 * @OA\Response(
7911 * response="401",
7912 * ref="#/components/responses/unauthorized"
7913 * ),
7914 * @OA\Response(
7915 * response="404",
7916 * ref="#/components/responses/uuidnotfound"
7917 * ),
7918 * security={{"openemr_auth":{}}}
7921 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest $request) {
7922 if ($request->isPatientRequest()) {
7923 // only allow access to data of binded patient
7924 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7925 } else {
7926 RestConfig::authorization_check("patients", "appt");
7927 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7929 RestConfig::apiLog($return);
7930 return $return;
7934 * @OA\Get(
7935 * path="/fhir/CarePlan",
7936 * description="Returns a list of CarePlan resources.",
7937 * tags={"fhir"},
7938 * @OA\Parameter(
7939 * name="_id",
7940 * in="query",
7941 * description="The uuid for the CarePlan resource.",
7942 * required=false,
7943 * @OA\Schema(
7944 * type="string"
7946 * ),
7947 * @OA\Parameter(
7948 * name="patient",
7949 * in="query",
7950 * description="The uuid for the patient.",
7951 * required=false,
7952 * @OA\Schema(
7953 * type="string"
7955 * ),
7956 * @OA\Parameter(
7957 * name="category",
7958 * in="query",
7959 * description="The category of the CarePlan resource.",
7960 * required=false,
7961 * @OA\Schema(
7962 * type="string"
7964 * ),
7965 * @OA\Response(
7966 * response="200",
7967 * description="Standard Response",
7968 * @OA\MediaType(
7969 * mediaType="application/json",
7970 * @OA\Schema(
7971 * @OA\Property(
7972 * property="json object",
7973 * description="FHIR Json object.",
7974 * type="object"
7975 * ),
7976 * example={
7977 * "meta": {
7978 * "lastUpdated": "2021-09-14T09:13:51"
7979 * },
7980 * "resourceType": "Bundle",
7981 * "type": "collection",
7982 * "total": 0,
7983 * "link": {
7985 * "relation": "self",
7986 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7992 * ),
7993 * @OA\Response(
7994 * response="400",
7995 * ref="#/components/responses/badrequest"
7996 * ),
7997 * @OA\Response(
7998 * response="401",
7999 * ref="#/components/responses/unauthorized"
8000 * ),
8001 * security={{"openemr_auth":{}}}
8004 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
8005 $getParams = $request->getQueryParams();
8006 if ($request->isPatientRequest()) {
8007 // only allow access to data of binded patient
8008 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
8009 } else {
8010 RestConfig::authorization_check("patients", "med");
8011 $return = (new FhirCarePlanRestController())->getAll($getParams);
8013 RestConfig::apiLog($return);
8014 return $return;
8018 * @OA\Get(
8019 * path="/fhir/CarePlan/{uuid}",
8020 * description="Returns a single CarePlan resource.",
8021 * tags={"fhir"},
8022 * @OA\Parameter(
8023 * name="uuid",
8024 * in="path",
8025 * description="The uuid for the CarePlan resource.",
8026 * required=true,
8027 * @OA\Schema(
8028 * type="string"
8030 * ),
8031 * @OA\Response(
8032 * response="200",
8033 * description="Standard Response",
8034 * @OA\MediaType(
8035 * mediaType="application/json",
8036 * @OA\Schema(
8037 * @OA\Property(
8038 * property="json object",
8039 * description="FHIR Json object.",
8040 * type="object"
8041 * ),
8042 * example={
8043 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
8044 * "meta": {
8045 * "versionId": "1",
8046 * "lastUpdated": "2021-09-16T00:54:18+00:00"
8047 * },
8048 * "resourceType": "CarePlan",
8049 * "text": {
8050 * "status": "generated",
8051 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
8052 * },
8053 * "status": "active",
8054 * "intent": "plan",
8055 * "category": {
8057 * "coding": {
8059 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
8060 * "code": "assess-plan"
8064 * },
8065 * "description": "Treat flu.",
8066 * "subject": {
8067 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8068 * "type": "Patient"
8073 * ),
8074 * @OA\Response(
8075 * response="400",
8076 * ref="#/components/responses/badrequest"
8077 * ),
8078 * @OA\Response(
8079 * response="401",
8080 * ref="#/components/responses/unauthorized"
8081 * ),
8082 * @OA\Response(
8083 * response="404",
8084 * ref="#/components/responses/uuidnotfound"
8085 * ),
8086 * security={{"openemr_auth":{}}}
8089 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
8090 if ($request->isPatientRequest()) {
8091 // only allow access to data of binded patient
8092 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
8093 } else {
8094 RestConfig::authorization_check("patients", "med");
8095 $return = (new FhirCarePlanRestController())->getOne($uuid);
8097 RestConfig::apiLog($return);
8098 return $return;
8102 * @OA\Get(
8103 * path="/fhir/CareTeam",
8104 * description="Returns a list of CareTeam resources.",
8105 * tags={"fhir"},
8106 * @OA\Parameter(
8107 * name="_id",
8108 * in="query",
8109 * description="The uuid for the CareTeam resource.",
8110 * required=false,
8111 * @OA\Schema(
8112 * type="string"
8114 * ),
8115 * @OA\Parameter(
8116 * name="patient",
8117 * in="query",
8118 * description="The uuid for the patient.",
8119 * required=false,
8120 * @OA\Schema(
8121 * type="string"
8123 * ),
8124 * @OA\Parameter(
8125 * name="status",
8126 * in="query",
8127 * description="The status of the CarePlan resource.",
8128 * required=false,
8129 * @OA\Schema(
8130 * type="string"
8132 * ),
8133 * @OA\Response(
8134 * response="200",
8135 * description="Standard Response",
8136 * @OA\MediaType(
8137 * mediaType="application/json",
8138 * @OA\Schema(
8139 * @OA\Property(
8140 * property="json object",
8141 * description="FHIR Json object.",
8142 * type="object"
8143 * ),
8144 * example={
8145 * "meta": {
8146 * "lastUpdated": "2021-09-14T09:13:51"
8147 * },
8148 * "resourceType": "Bundle",
8149 * "type": "collection",
8150 * "total": 0,
8151 * "link": {
8153 * "relation": "self",
8154 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
8160 * ),
8161 * @OA\Response(
8162 * response="400",
8163 * ref="#/components/responses/badrequest"
8164 * ),
8165 * @OA\Response(
8166 * response="401",
8167 * ref="#/components/responses/unauthorized"
8168 * ),
8169 * security={{"openemr_auth":{}}}
8172 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
8173 $getParams = $request->getQueryParams();
8174 if ($request->isPatientRequest()) {
8175 // only allow access to data of binded patient
8176 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8177 } else {
8178 RestConfig::authorization_check("patients", "med");
8179 $return = (new FhirCareTeamRestController())->getAll($getParams);
8181 RestConfig::apiLog($return);
8182 return $return;
8186 * @OA\Get(
8187 * path="/fhir/CareTeam/{uuid}",
8188 * description="Returns a single CareTeam resource.",
8189 * tags={"fhir"},
8190 * @OA\Parameter(
8191 * name="uuid",
8192 * in="path",
8193 * description="The uuid for the CareTeam resource.",
8194 * required=true,
8195 * @OA\Schema(
8196 * type="string"
8198 * ),
8199 * @OA\Response(
8200 * response="200",
8201 * description="Standard Response",
8202 * @OA\MediaType(
8203 * mediaType="application/json",
8204 * @OA\Schema(
8205 * @OA\Property(
8206 * property="json object",
8207 * description="FHIR Json object.",
8208 * type="object"
8209 * ),
8210 * example={
8211 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8212 * "meta": {
8213 * "versionId": "1",
8214 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8215 * },
8216 * "resourceType": "CareTeam",
8217 * "status": "active",
8218 * "subject": {
8219 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8220 * "type": "Patient"
8221 * },
8222 * "participant": {
8224 * "role": {
8226 * "coding": {
8228 * "system": "http://nucc.org/provider-taxonomy",
8229 * "code": "102L00000X",
8230 * "display": "Psychoanalyst"
8234 * },
8235 * "member": {
8236 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8237 * "type": "Practitioner"
8238 * },
8239 * "onBehalfOf": {
8240 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8241 * "type": "Organization"
8243 * },
8245 * "role": {
8247 * "coding": {
8249 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8250 * "code": "unknown",
8251 * "display": "Unknown"
8255 * },
8256 * "member": {
8257 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8258 * "type": "Organization"
8265 * ),
8266 * @OA\Response(
8267 * response="400",
8268 * ref="#/components/responses/badrequest"
8269 * ),
8270 * @OA\Response(
8271 * response="401",
8272 * ref="#/components/responses/unauthorized"
8273 * ),
8274 * @OA\Response(
8275 * response="404",
8276 * ref="#/components/responses/uuidnotfound"
8277 * ),
8278 * security={{"openemr_auth":{}}}
8281 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
8282 if ($request->isPatientRequest()) {
8283 // only allow access to data of binded patient
8284 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8285 } else {
8286 RestConfig::authorization_check("patients", "med");
8287 $return = (new FhirCareTeamRestController())->getOne($uuid);
8289 RestConfig::apiLog($return);
8290 return $return;
8294 * @OA\Get(
8295 * path="/fhir/Condition",
8296 * description="Returns a list of Condition resources.",
8297 * tags={"fhir"},
8298 * @OA\Parameter(
8299 * name="_id",
8300 * in="query",
8301 * description="The uuid for the Condition resource.",
8302 * required=false,
8303 * @OA\Schema(
8304 * type="string"
8306 * ),
8307 * @OA\Parameter(
8308 * name="patient",
8309 * in="query",
8310 * description="The uuid for the patient.",
8311 * required=false,
8312 * @OA\Schema(
8313 * type="string"
8315 * ),
8316 * @OA\Response(
8317 * response="200",
8318 * description="Standard Response",
8319 * @OA\MediaType(
8320 * mediaType="application/json",
8321 * @OA\Schema(
8322 * @OA\Property(
8323 * property="json object",
8324 * description="FHIR Json object.",
8325 * type="object"
8326 * ),
8327 * example={
8328 * "meta": {
8329 * "lastUpdated": "2021-09-14T09:13:51"
8330 * },
8331 * "resourceType": "Bundle",
8332 * "type": "collection",
8333 * "total": 0,
8334 * "link": {
8336 * "relation": "self",
8337 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8343 * ),
8344 * @OA\Response(
8345 * response="400",
8346 * ref="#/components/responses/badrequest"
8347 * ),
8348 * @OA\Response(
8349 * response="401",
8350 * ref="#/components/responses/unauthorized"
8351 * ),
8352 * security={{"openemr_auth":{}}}
8355 "GET /fhir/Condition" => function (HttpRestRequest $request) {
8356 $getParams = $request->getQueryParams();
8357 if ($request->isPatientRequest()) {
8358 // only allow access to data of binded patient
8359 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8360 } else {
8361 RestConfig::authorization_check("patients", "med");
8362 $return = (new FhirConditionRestController())->getAll($getParams);
8364 RestConfig::apiLog($return);
8365 return $return;
8369 * @OA\Get(
8370 * path="/fhir/Condition/{uuid}",
8371 * description="Returns a single Condition resource.",
8372 * tags={"fhir"},
8373 * @OA\Parameter(
8374 * name="uuid",
8375 * in="path",
8376 * description="The uuid for the Condition resource.",
8377 * required=true,
8378 * @OA\Schema(
8379 * type="string"
8381 * ),
8382 * @OA\Response(
8383 * response="200",
8384 * description="Standard Response",
8385 * @OA\MediaType(
8386 * mediaType="application/json",
8387 * @OA\Schema(
8388 * @OA\Property(
8389 * property="json object",
8390 * description="FHIR Json object.",
8391 * type="object"
8392 * ),
8393 * example={
8394 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8395 * "meta": {
8396 * "versionId": "1",
8397 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8398 * },
8399 * "resourceType": "Condition",
8400 * "clinicalStatus": {
8401 * "coding": {
8403 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8404 * "code": "inactive",
8405 * "display": "Inactive"
8408 * },
8409 * "verificationStatus": {
8410 * "coding": {
8412 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8413 * "code": "unconfirmed",
8414 * "display": "Unconfirmed"
8417 * },
8418 * "category": {
8420 * "coding": {
8422 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8423 * "code": "problem-list-item",
8424 * "display": "Problem List Item"
8428 * },
8429 * "code": {
8430 * "coding": {
8432 * "system": "http://snomed.info/sct",
8433 * "code": "444814009",
8434 * "display": ""
8437 * },
8438 * "subject": {
8439 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8444 * ),
8445 * @OA\Response(
8446 * response="400",
8447 * ref="#/components/responses/badrequest"
8448 * ),
8449 * @OA\Response(
8450 * response="401",
8451 * ref="#/components/responses/unauthorized"
8452 * ),
8453 * @OA\Response(
8454 * response="404",
8455 * ref="#/components/responses/uuidnotfound"
8456 * ),
8457 * security={{"openemr_auth":{}}}
8460 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
8461 if ($request->isPatientRequest()) {
8462 // only allow access to data of binded patient
8463 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8464 } else {
8465 RestConfig::authorization_check("patients", "med");
8466 $return = (new FhirConditionRestController())->getOne($uuid);
8468 RestConfig::apiLog($return);
8469 return $return;
8473 * @OA\Get(
8474 * path="/fhir/Coverage",
8475 * description="Returns a list of Coverage resources.",
8476 * tags={"fhir"},
8477 * @OA\Parameter(
8478 * name="_id",
8479 * in="query",
8480 * description="The uuid for the Coverage resource.",
8481 * required=false,
8482 * @OA\Schema(
8483 * type="string"
8485 * ),
8486 * @OA\Parameter(
8487 * name="patient",
8488 * in="query",
8489 * description="The uuid for the patient.",
8490 * required=false,
8491 * @OA\Schema(
8492 * type="string"
8494 * ),
8495 * @OA\Parameter(
8496 * name="payor",
8497 * in="query",
8498 * description="The payor of the Coverage resource.",
8499 * required=false,
8500 * @OA\Schema(
8501 * type="string"
8503 * ),
8504 * @OA\Response(
8505 * response="200",
8506 * description="Standard Response",
8507 * @OA\MediaType(
8508 * mediaType="application/json",
8509 * @OA\Schema(
8510 * @OA\Property(
8511 * property="json object",
8512 * description="FHIR Json object.",
8513 * type="object"
8514 * ),
8515 * example={
8516 * "meta": {
8517 * "lastUpdated": "2021-09-14T09:13:51"
8518 * },
8519 * "resourceType": "Bundle",
8520 * "type": "collection",
8521 * "total": 0,
8522 * "link": {
8524 * "relation": "self",
8525 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8531 * ),
8532 * @OA\Response(
8533 * response="400",
8534 * ref="#/components/responses/badrequest"
8535 * ),
8536 * @OA\Response(
8537 * response="401",
8538 * ref="#/components/responses/unauthorized"
8539 * ),
8540 * security={{"openemr_auth":{}}}
8543 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
8544 if ($request->isPatientRequest()) {
8545 // only allow access to data of binded patient
8546 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8547 } else {
8548 RestConfig::authorization_check("admin", "super");
8549 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8551 RestConfig::apiLog($return);
8552 return $return;
8556 * @OA\Get(
8557 * path="/fhir/Coverage/{uuid}",
8558 * description="Returns a single Coverage resource.",
8559 * tags={"fhir"},
8560 * @OA\Parameter(
8561 * name="uuid",
8562 * in="path",
8563 * description="The uuid for the Coverage resource.",
8564 * required=true,
8565 * @OA\Schema(
8566 * type="string"
8568 * ),
8569 * @OA\Response(
8570 * response="200",
8571 * description="Standard Response",
8572 * @OA\MediaType(
8573 * mediaType="application/json",
8574 * @OA\Schema(
8575 * @OA\Property(
8576 * property="json object",
8577 * description="FHIR Json object.",
8578 * type="object"
8579 * ),
8580 * example={
8581 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8582 * "meta": {
8583 * "versionId": "1",
8584 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8585 * },
8586 * "resourceType": "Coverage",
8587 * "status": "active",
8588 * "beneficiary": {
8589 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8590 * },
8591 * "relationship": {
8592 * "coding": {
8594 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8595 * "code": ""
8602 * ),
8603 * @OA\Response(
8604 * response="400",
8605 * ref="#/components/responses/badrequest"
8606 * ),
8607 * @OA\Response(
8608 * response="401",
8609 * ref="#/components/responses/unauthorized"
8610 * ),
8611 * @OA\Response(
8612 * response="404",
8613 * ref="#/components/responses/uuidnotfound"
8614 * ),
8615 * security={{"openemr_auth":{}}}
8618 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
8619 if ($request->isPatientRequest()) {
8620 // only allow access to data of binded patient
8621 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8622 } else {
8623 RestConfig::authorization_check("admin", "super");
8624 $return = (new FhirCoverageRestController())->getOne($uuid);
8626 RestConfig::apiLog($return);
8627 return $return;
8631 * @OA\Get(
8632 * path="/fhir/Device",
8633 * description="Returns a list of Device resources.",
8634 * tags={"fhir"},
8635 * @OA\Parameter(
8636 * name="_id",
8637 * in="query",
8638 * description="The uuid for the Device resource.",
8639 * required=false,
8640 * @OA\Schema(
8641 * type="string"
8643 * ),
8644 * @OA\Parameter(
8645 * name="patient",
8646 * in="query",
8647 * description="The uuid for the patient.",
8648 * required=false,
8649 * @OA\Schema(
8650 * type="string"
8652 * ),
8653 * @OA\Response(
8654 * response="200",
8655 * description="Standard Response",
8656 * @OA\MediaType(
8657 * mediaType="application/json",
8658 * @OA\Schema(
8659 * @OA\Property(
8660 * property="json object",
8661 * description="FHIR Json object.",
8662 * type="object"
8663 * ),
8664 * example={
8665 * "meta": {
8666 * "lastUpdated": "2021-09-14T09:13:51"
8667 * },
8668 * "resourceType": "Bundle",
8669 * "type": "collection",
8670 * "total": 0,
8671 * "link": {
8673 * "relation": "self",
8674 * "url": "https://localhost:9300/apis/default/fhir/Device"
8680 * ),
8681 * @OA\Response(
8682 * response="400",
8683 * ref="#/components/responses/badrequest"
8684 * ),
8685 * @OA\Response(
8686 * response="401",
8687 * ref="#/components/responses/unauthorized"
8688 * ),
8689 * security={{"openemr_auth":{}}}
8692 "GET /fhir/Device" => function (HttpRestRequest $request) {
8693 if ($request->isPatientRequest()) {
8694 // only allow access to data of binded patient
8695 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8696 } else {
8697 RestConfig::authorization_check("admin", "super");
8698 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8700 RestConfig::apiLog($return);
8701 return $return;
8705 * @OA\Get(
8706 * path="/fhir/Device/{uuid}",
8707 * description="Returns a single Device resource.",
8708 * tags={"fhir"},
8709 * @OA\Parameter(
8710 * name="uuid",
8711 * in="path",
8712 * description="The uuid for the Device resource.",
8713 * required=true,
8714 * @OA\Schema(
8715 * type="string"
8717 * ),
8718 * @OA\Response(
8719 * response="200",
8720 * description="Standard Response",
8721 * @OA\MediaType(
8722 * mediaType="application/json",
8723 * @OA\Schema(
8724 * @OA\Property(
8725 * property="json object",
8726 * description="FHIR Json object.",
8727 * type="object"
8728 * ),
8729 * example={
8730 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8731 * "meta": {
8732 * "versionId": "1",
8733 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8734 * },
8735 * "resourceType": "Device",
8736 * "udiCarrier": {
8738 * "deviceIdentifier": "08717648200274",
8739 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8741 * },
8742 * "distinctIdentifier": "A99971312345600",
8743 * "manufactureDate": "2013-02-01",
8744 * "expirationDate": "2014-02-01",
8745 * "lotNumber": "000000000000XYZ123",
8746 * "serialNumber": "000025",
8747 * "type": {
8748 * "extension": {
8750 * "valueCode": "unknown",
8751 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8754 * },
8755 * "patient": {
8756 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8757 * "type": "Patient"
8762 * ),
8763 * @OA\Response(
8764 * response="400",
8765 * ref="#/components/responses/badrequest"
8766 * ),
8767 * @OA\Response(
8768 * response="401",
8769 * ref="#/components/responses/unauthorized"
8770 * ),
8771 * @OA\Response(
8772 * response="404",
8773 * ref="#/components/responses/uuidnotfound"
8774 * ),
8775 * security={{"openemr_auth":{}}}
8778 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8779 if ($request->isPatientRequest()) {
8780 // only allow access to data of binded patient
8781 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8782 } else {
8783 RestConfig::authorization_check("admin", "super");
8784 $return = (new FhirDeviceRestController())->getOne($uuid);
8786 RestConfig::apiLog($return);
8787 return $return;
8791 * @OA\Get(
8792 * path="/fhir/DiagnosticReport",
8793 * description="Returns a list of DiagnosticReport resources.",
8794 * tags={"fhir"},
8795 * @OA\Parameter(
8796 * name="_id",
8797 * in="query",
8798 * description="The uuid for the DiagnosticReport resource.",
8799 * required=false,
8800 * @OA\Schema(
8801 * type="string"
8803 * ),
8804 * @OA\Parameter(
8805 * name="patient",
8806 * in="query",
8807 * description="The uuid for the patient.",
8808 * required=false,
8809 * @OA\Schema(
8810 * type="string"
8812 * ),
8813 * @OA\Parameter(
8814 * name="code",
8815 * in="query",
8816 * description="The code of the DiagnosticReport resource.",
8817 * required=false,
8818 * @OA\Schema(
8819 * type="string"
8821 * ),
8822 * @OA\Parameter(
8823 * name="category",
8824 * in="query",
8825 * description="The category of the DiagnosticReport resource.",
8826 * required=false,
8827 * @OA\Schema(
8828 * type="string"
8830 * ),
8831 * @OA\Parameter(
8832 * name="date",
8833 * in="query",
8834 * description="The datetime of the DiagnosticReport resource.",
8835 * required=false,
8836 * @OA\Schema(
8837 * type="string"
8839 * ),
8840 * @OA\Response(
8841 * response="200",
8842 * description="Standard Response",
8843 * @OA\MediaType(
8844 * mediaType="application/json",
8845 * @OA\Schema(
8846 * @OA\Property(
8847 * property="json object",
8848 * description="FHIR Json object.",
8849 * type="object"
8850 * ),
8851 * example={
8852 * "meta": {
8853 * "lastUpdated": "2021-09-14T09:13:51"
8854 * },
8855 * "resourceType": "Bundle",
8856 * "type": "collection",
8857 * "total": 0,
8858 * "link": {
8860 * "relation": "self",
8861 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8867 * ),
8868 * @OA\Response(
8869 * response="400",
8870 * ref="#/components/responses/badrequest"
8871 * ),
8872 * @OA\Response(
8873 * response="401",
8874 * ref="#/components/responses/unauthorized"
8875 * ),
8876 * security={{"openemr_auth":{}}}
8879 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8880 $getParams = $request->getQueryParams();
8881 if ($request->isPatientRequest()) {
8882 // only allow access to data of binded patient
8883 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8884 } else {
8885 RestConfig::authorization_check("admin", "super");
8886 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8888 RestConfig::apiLog($return);
8889 return $return;
8893 * @OA\Get(
8894 * path="/fhir/DiagnosticReport/{uuid}",
8895 * description="Returns a single DiagnosticReport resource.",
8896 * tags={"fhir"},
8897 * @OA\Parameter(
8898 * name="uuid",
8899 * in="path",
8900 * description="The uuid for the DiagnosticReport resource.",
8901 * required=true,
8902 * @OA\Schema(
8903 * type="string"
8905 * ),
8906 * @OA\Response(
8907 * response="200",
8908 * description="Standard Response",
8909 * @OA\MediaType(
8910 * mediaType="application/json",
8911 * @OA\Schema(
8912 * @OA\Property(
8913 * property="json object",
8914 * description="FHIR Json object.",
8915 * type="object"
8916 * ),
8917 * example={
8918 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8919 * "meta": {
8920 * "versionId": "1",
8921 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8922 * },
8923 * "resourceType": "DiagnosticReport",
8924 * "status": "final",
8925 * "category": {
8927 * "coding": {
8929 * "system": "http://loinc.org",
8930 * "code": "LP7839-6",
8931 * "display": "Pathology"
8935 * },
8936 * "code": {
8937 * "coding": {
8939 * "system": "http://loinc.org",
8940 * "code": "11502-2",
8941 * "display": "Laboratory report"
8944 * },
8945 * "subject": {
8946 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8947 * "type": "Patient"
8948 * },
8949 * "encounter": {
8950 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8951 * "type": "Encounter"
8952 * },
8953 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8954 * "issued": "2015-06-22T00:00:00+00:00",
8955 * "performer": {
8957 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8958 * "type": "Organization"
8960 * },
8961 * "presentedForm": {
8963 * "contentType": "text/plain",
8964 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8970 * ),
8971 * @OA\Response(
8972 * response="400",
8973 * ref="#/components/responses/badrequest"
8974 * ),
8975 * @OA\Response(
8976 * response="401",
8977 * ref="#/components/responses/unauthorized"
8978 * ),
8979 * @OA\Response(
8980 * response="404",
8981 * ref="#/components/responses/uuidnotfound"
8982 * ),
8983 * security={{"openemr_auth":{}}}
8986 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8987 $getParams = $request->getQueryParams();
8988 if ($request->isPatientRequest()) {
8989 // only allow access to data of binded patient
8990 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8991 } else {
8992 RestConfig::authorization_check("admin", "super");
8993 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8995 RestConfig::apiLog($return);
8996 return $return;
9000 * @OA\Get(
9001 * path="/fhir/DocumentReference",
9002 * description="Returns a list of DocumentReference resources.",
9003 * tags={"fhir"},
9004 * @OA\Parameter(
9005 * name="_id",
9006 * in="query",
9007 * description="The uuid for the DocumentReference resource.",
9008 * required=false,
9009 * @OA\Schema(
9010 * type="string"
9012 * ),
9013 * @OA\Parameter(
9014 * name="patient",
9015 * in="query",
9016 * description="The uuid for the patient.",
9017 * required=false,
9018 * @OA\Schema(
9019 * type="string"
9021 * ),
9022 * @OA\Parameter(
9023 * name="type",
9024 * in="query",
9025 * description="The type of the DocumentReference resource.",
9026 * required=false,
9027 * @OA\Schema(
9028 * type="string"
9030 * ),
9031 * @OA\Parameter(
9032 * name="category",
9033 * in="query",
9034 * description="The category of the DocumentReference resource.",
9035 * required=false,
9036 * @OA\Schema(
9037 * type="string"
9039 * ),
9040 * @OA\Parameter(
9041 * name="date",
9042 * in="query",
9043 * description="The datetime of the DocumentReference resource.",
9044 * required=false,
9045 * @OA\Schema(
9046 * type="string"
9048 * ),
9049 * @OA\Response(
9050 * response="200",
9051 * description="Standard Response",
9052 * @OA\MediaType(
9053 * mediaType="application/json",
9054 * @OA\Schema(
9055 * @OA\Property(
9056 * property="json object",
9057 * description="FHIR Json object.",
9058 * type="object"
9059 * ),
9060 * example={
9061 * "meta": {
9062 * "lastUpdated": "2021-09-14T09:13:51"
9063 * },
9064 * "resourceType": "Bundle",
9065 * "type": "collection",
9066 * "total": 0,
9067 * "link": {
9069 * "relation": "self",
9070 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
9076 * ),
9077 * @OA\Response(
9078 * response="400",
9079 * ref="#/components/responses/badrequest"
9080 * ),
9081 * @OA\Response(
9082 * response="401",
9083 * ref="#/components/responses/unauthorized"
9084 * ),
9085 * security={{"openemr_auth":{}}}
9088 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
9089 $getParams = $request->getQueryParams();
9090 if ($request->isPatientRequest()) {
9091 // only allow access to data of binded patient
9092 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
9093 } else {
9094 RestConfig::authorization_check("admin", "super");
9095 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
9097 RestConfig::apiLog($return);
9098 return $return;
9102 * @OA\POST(
9103 * path="/fhir/DocumentReference/$docref",
9104 * 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.",
9105 * tags={"fhir"},
9106 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
9107 * @OA\Parameter(
9108 * name="patient",
9109 * in="query",
9110 * description="The uuid for the patient.",
9111 * required=true,
9112 * @OA\Schema(
9113 * type="string"
9115 * ),
9116 * @OA\Parameter(
9117 * name="start",
9118 * in="query",
9119 * 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.",
9120 * required=false,
9121 * @OA\Schema(
9122 * type="string"
9124 * ),
9125 * @OA\Parameter(
9126 * name="end",
9127 * in="query",
9128 * 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.",
9129 * required=false,
9130 * @OA\Schema(
9131 * type="string"
9133 * ),
9134 * @OA\Parameter(
9135 * name="type",
9136 * in="query",
9137 * 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).",
9138 * required=false,
9139 * @OA\Schema(
9140 * type="string"
9142 * ),
9143 * @OA\Response(
9144 * response="200",
9145 * description="A search bundle of DocumentReferences is returned"
9146 * ),
9147 * @OA\Response(
9148 * response="400",
9149 * ref="#/components/responses/badrequest"
9150 * ),
9151 * @OA\Response(
9152 * response="401",
9153 * ref="#/components/responses/unauthorized"
9154 * ),
9155 * security={{"openemr_auth":{}}}
9158 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
9160 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
9161 if ($request->isPatientRequest()) {
9162 // only allow access to data of binded patient
9163 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9164 } else {
9165 // TODO: it seems like regular users should be able to grab authorship / provenance information
9166 RestConfig::authorization_check("patients", "demo");
9167 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
9169 RestConfig::apiLog($return);
9170 return $return;
9174 * @OA\Get(
9175 * path="/fhir/DocumentReference/{uuid}",
9176 * description="Returns a single DocumentReference resource.",
9177 * tags={"fhir"},
9178 * @OA\Parameter(
9179 * name="uuid",
9180 * in="path",
9181 * description="The uuid for the DocumentReference resource.",
9182 * required=true,
9183 * @OA\Schema(
9184 * type="string"
9186 * ),
9187 * @OA\Response(
9188 * response="200",
9189 * description="Standard Response",
9190 * @OA\MediaType(
9191 * mediaType="application/json",
9192 * @OA\Schema(
9193 * @OA\Property(
9194 * property="json object",
9195 * description="FHIR Json object.",
9196 * type="object"
9197 * ),
9198 * example={
9199 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9200 * "meta": {
9201 * "versionId": "1",
9202 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9203 * },
9204 * "resourceType": "DocumentReference",
9205 * "identifier": {
9207 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9209 * },
9210 * "status": "current",
9211 * "type": {
9212 * "coding": {
9214 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9215 * "code": "UNK",
9216 * "display": "unknown"
9219 * },
9220 * "category": {
9222 * "coding": {
9224 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9225 * "code": "openemr-document",
9226 * "display": "OpenEMR Document"
9230 * },
9231 * "subject": {
9232 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9233 * "type": "Patient"
9234 * },
9235 * "date": "2021-09-19T03:15:56+00:00",
9236 * "author": {
9237 * null
9238 * },
9239 * "content": {
9241 * "attachment": {
9242 * "contentType": "image/gif",
9243 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9244 * },
9245 * "format": {
9246 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9247 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9248 * "display": "mimeType Sufficient"
9255 * ),
9256 * @OA\Response(
9257 * response="400",
9258 * ref="#/components/responses/badrequest"
9259 * ),
9260 * @OA\Response(
9261 * response="401",
9262 * ref="#/components/responses/unauthorized"
9263 * ),
9264 * @OA\Response(
9265 * response="404",
9266 * ref="#/components/responses/uuidnotfound"
9267 * ),
9268 * security={{"openemr_auth":{}}}
9271 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
9272 $getParams = $request->getQueryParams();
9273 if ($request->isPatientRequest()) {
9274 // only allow access to data of binded patient
9275 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9276 } else {
9277 RestConfig::authorization_check("admin", "super");
9278 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9280 RestConfig::apiLog($return);
9281 return $return;
9285 * @OA\Get(
9286 * path="/fhir/Binary/{id}",
9287 * 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>",
9288 * tags={"fhir"},
9289 * @OA\Parameter(
9290 * name="id",
9291 * in="path",
9292 * description="The id for the Document.",
9293 * required=true,
9294 * @OA\Schema(
9295 * type="string"
9297 * ),
9298 * @OA\Response(
9299 * response="200",
9300 * 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>"
9301 * ),
9302 * @OA\Response(
9303 * response="400",
9304 * ref="#/components/responses/badrequest"
9305 * ),
9306 * @OA\Response(
9307 * response="401",
9308 * ref="#/components/responses/unauthorized"
9309 * ),
9310 * security={{"openemr_auth":{}}}
9313 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest $request) {
9314 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
9316 if ($request->isPatientRequest()) {
9317 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9318 } else {
9319 RestConfig::authorization_check("admin", "users");
9320 $response = $docController->downloadDocument($documentId);
9323 return $response;
9327 * @OA\Get(
9328 * path="/fhir/Encounter",
9329 * description="Returns a list of Encounter resources.",
9330 * tags={"fhir"},
9331 * @OA\Parameter(
9332 * name="_id",
9333 * in="query",
9334 * description="The uuid for the Encounter resource.",
9335 * required=false,
9336 * @OA\Schema(
9337 * type="string"
9339 * ),
9340 * @OA\Parameter(
9341 * name="patient",
9342 * in="query",
9343 * description="The uuid for the patient.",
9344 * required=false,
9345 * @OA\Schema(
9346 * type="string"
9348 * ),
9349 * @OA\Parameter(
9350 * name="date",
9351 * in="query",
9352 * description="The datetime of the Encounter resource.",
9353 * required=false,
9354 * @OA\Schema(
9355 * type="string"
9357 * ),
9358 * @OA\Response(
9359 * response="200",
9360 * description="Standard Response",
9361 * @OA\MediaType(
9362 * mediaType="application/json",
9363 * @OA\Schema(
9364 * @OA\Property(
9365 * property="json object",
9366 * description="FHIR Json object.",
9367 * type="object"
9368 * ),
9369 * example={
9370 * "meta": {
9371 * "lastUpdated": "2021-09-14T09:13:51"
9372 * },
9373 * "resourceType": "Bundle",
9374 * "type": "collection",
9375 * "total": 0,
9376 * "link": {
9378 * "relation": "self",
9379 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9385 * ),
9386 * @OA\Response(
9387 * response="400",
9388 * ref="#/components/responses/badrequest"
9389 * ),
9390 * @OA\Response(
9391 * response="401",
9392 * ref="#/components/responses/unauthorized"
9393 * ),
9394 * security={{"openemr_auth":{}}}
9397 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
9398 $getParams = $request->getQueryParams();
9399 if ($request->isPatientRequest()) {
9400 // only allow access to data of binded patient
9401 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9402 } else {
9403 RestConfig::authorization_check("encounters", "auth_a");
9404 $return = (new FhirEncounterRestController())->getAll($getParams);
9406 RestConfig::apiLog($return);
9407 return $return;
9411 * @OA\Get(
9412 * path="/fhir/Encounter/{uuid}",
9413 * description="Returns a single Encounter resource.",
9414 * tags={"fhir"},
9415 * @OA\Parameter(
9416 * name="uuid",
9417 * in="path",
9418 * description="The uuid for the Encounter resource.",
9419 * required=true,
9420 * @OA\Schema(
9421 * type="string"
9423 * ),
9424 * @OA\Response(
9425 * response="200",
9426 * description="Standard Response",
9427 * @OA\MediaType(
9428 * mediaType="application/json",
9429 * @OA\Schema(
9430 * @OA\Property(
9431 * property="json object",
9432 * description="FHIR Json object.",
9433 * type="object"
9434 * ),
9435 * example={
9436 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9437 * "meta": {
9438 * "versionId": "1",
9439 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9440 * },
9441 * "resourceType": "Encounter",
9442 * "identifier": {
9444 * "system": "urn:ietf:rfc:3986",
9445 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9447 * },
9448 * "status": "finished",
9449 * "class": {
9450 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9451 * "code": "AMB",
9452 * "display": "ambulatory"
9453 * },
9454 * "type": {
9456 * "coding": {
9458 * "system": "http://snomed.info/sct",
9459 * "code": "185349003",
9460 * "display": "Encounter for check up (procedure)"
9464 * },
9465 * "subject": {
9466 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9467 * "type": "Patient"
9468 * },
9469 * "participant": {
9471 * "type": {
9473 * "coding": {
9475 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9476 * "code": "PPRF",
9477 * "display": "Primary Performer"
9481 * },
9482 * "period": {
9483 * "start": "2012-08-13T00:00:00+00:00"
9484 * },
9485 * "individual": {
9486 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9487 * "type": "Practitioner"
9490 * },
9491 * "period": {
9492 * "start": "2012-08-13T00:00:00+00:00"
9497 * ),
9498 * @OA\Response(
9499 * response="400",
9500 * ref="#/components/responses/badrequest"
9501 * ),
9502 * @OA\Response(
9503 * response="401",
9504 * ref="#/components/responses/unauthorized"
9505 * ),
9506 * @OA\Response(
9507 * response="404",
9508 * ref="#/components/responses/uuidnotfound"
9509 * ),
9510 * security={{"openemr_auth":{}}}
9513 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
9514 if ($request->isPatientRequest()) {
9515 // only allow access to data of binded patient
9516 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9517 } else {
9518 RestConfig::authorization_check("admin", "super");
9519 $return = (new FhirEncounterRestController())->getOne($uuid);
9521 RestConfig::apiLog($return);
9522 return $return;
9526 * @OA\Get(
9527 * path="/fhir/Goal",
9528 * description="Returns a list of Condition resources.",
9529 * tags={"fhir"},
9530 * @OA\Parameter(
9531 * name="_id",
9532 * in="query",
9533 * description="The uuid for the Goal resource.",
9534 * required=false,
9535 * @OA\Schema(
9536 * type="string"
9538 * ),
9539 * @OA\Parameter(
9540 * name="patient",
9541 * in="query",
9542 * description="The uuid for the patient.",
9543 * required=false,
9544 * @OA\Schema(
9545 * type="string"
9547 * ),
9548 * @OA\Response(
9549 * response="200",
9550 * description="Standard Response",
9551 * @OA\MediaType(
9552 * mediaType="application/json",
9553 * @OA\Schema(
9554 * @OA\Property(
9555 * property="json object",
9556 * description="FHIR Json object.",
9557 * type="object"
9558 * ),
9559 * example={
9560 * "meta": {
9561 * "lastUpdated": "2021-09-14T09:13:51"
9562 * },
9563 * "resourceType": "Bundle",
9564 * "type": "collection",
9565 * "total": 0,
9566 * "link": {
9568 * "relation": "self",
9569 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9575 * ),
9576 * @OA\Response(
9577 * response="400",
9578 * ref="#/components/responses/badrequest"
9579 * ),
9580 * @OA\Response(
9581 * response="401",
9582 * ref="#/components/responses/unauthorized"
9583 * ),
9584 * security={{"openemr_auth":{}}}
9587 "GET /fhir/Goal" => function (HttpRestRequest $request) {
9588 $getParams = $request->getQueryParams();
9589 if ($request->isPatientRequest()) {
9590 // only allow access to data of binded patient
9591 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9592 } else {
9593 RestConfig::authorization_check("admin", "super");
9594 $return = (new FhirGoalRestController())->getAll($getParams);
9596 RestConfig::apiLog($return);
9597 return $return;
9601 * @OA\Get(
9602 * path="/fhir/Goal/{uuid}",
9603 * description="Returns a single Goal resource.",
9604 * tags={"fhir"},
9605 * @OA\Parameter(
9606 * name="uuid",
9607 * in="path",
9608 * description="The uuid for the Goal resource.",
9609 * required=true,
9610 * @OA\Schema(
9611 * type="string"
9613 * ),
9614 * @OA\Response(
9615 * response="200",
9616 * description="Standard Response",
9617 * @OA\MediaType(
9618 * mediaType="application/json",
9619 * @OA\Schema(
9620 * @OA\Property(
9621 * property="json object",
9622 * description="FHIR Json object.",
9623 * type="object"
9624 * ),
9625 * example={
9626 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9627 * "meta": {
9628 * "versionId": "1",
9629 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9630 * },
9631 * "resourceType": "Goal",
9632 * "lifecycleStatus": "active",
9633 * "description": {
9634 * "text": "Eating more vegetables."
9635 * },
9636 * "subject": {
9637 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9638 * "type": "Patient"
9639 * },
9640 * "target": {
9642 * "measure": {
9643 * "extension": {
9645 * "valueCode": "unknown",
9646 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9649 * },
9650 * "detailString": "Eating more vegetables.",
9651 * "dueDate": "2021-09-09"
9657 * ),
9658 * @OA\Response(
9659 * response="400",
9660 * ref="#/components/responses/badrequest"
9661 * ),
9662 * @OA\Response(
9663 * response="401",
9664 * ref="#/components/responses/unauthorized"
9665 * ),
9666 * @OA\Response(
9667 * response="404",
9668 * ref="#/components/responses/uuidnotfound"
9669 * ),
9670 * security={{"openemr_auth":{}}}
9673 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9674 if ($request->isPatientRequest()) {
9675 // only allow access to data of binded patient
9676 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9677 } else {
9678 RestConfig::authorization_check("admin", "super");
9679 $return = (new FhirGoalRestController())->getOne($uuid);
9681 RestConfig::apiLog($return);
9682 return $return;
9686 * @OA\Get(
9687 * path="/fhir/Group",
9688 * 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>",
9689 * tags={"fhir"},
9690 * @OA\Parameter(
9691 * name="_id",
9692 * in="query",
9693 * description="The uuid for the Group resource.",
9694 * required=false,
9695 * @OA\Schema(
9696 * type="string"
9698 * ),
9699 * @OA\Parameter(
9700 * name="patient",
9701 * in="query",
9702 * description="The uuid for the patient.",
9703 * required=false,
9704 * @OA\Schema(
9705 * type="string"
9707 * ),
9708 * @OA\Response(
9709 * response="200",
9710 * description="Standard Response",
9711 * @OA\MediaType(
9712 * mediaType="application/json",
9713 * @OA\Schema(
9714 * @OA\Property(
9715 * property="json object",
9716 * description="FHIR Json object.",
9717 * type="object"
9718 * ),
9719 * example={
9720 * "meta": {
9721 * "lastUpdated": "2021-09-14T09:13:51"
9722 * },
9723 * "resourceType": "Bundle",
9724 * "type": "collection",
9725 * "total": 0,
9726 * "link": {
9728 * "relation": "self",
9729 * "url": "https://localhost:9300/apis/default/fhir/Group"
9735 * ),
9736 * @OA\Response(
9737 * response="400",
9738 * ref="#/components/responses/badrequest"
9739 * ),
9740 * @OA\Response(
9741 * response="401",
9742 * ref="#/components/responses/unauthorized"
9743 * ),
9744 * security={{"openemr_auth":{}}}
9747 'GET /fhir/Group' => function (HttpRestRequest $request) {
9748 RestConfig::authorization_check("admin", "users");
9749 $getParams = $request->getQueryParams();
9750 if ($request->isPatientRequest()) {
9751 // only allow access to data of binded patient
9752 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9753 } else {
9754 $return = (new FhirGroupRestController())->getAll($getParams);
9756 RestConfig::apiLog($return);
9757 return $return;
9761 * @OA\Get(
9762 * path="/fhir/Group/{uuid}",
9763 * 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>",
9764 * tags={"fhir"},
9765 * @OA\Parameter(
9766 * name="uuid",
9767 * in="path",
9768 * description="The uuid for the Group resource.",
9769 * required=true,
9770 * @OA\Schema(
9771 * type="string"
9773 * ),
9774 * @OA\Response(
9775 * response="200",
9776 * 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>"
9777 * ),
9778 * @OA\Response(
9779 * response="400",
9780 * ref="#/components/responses/badrequest"
9781 * ),
9782 * @OA\Response(
9783 * response="401",
9784 * ref="#/components/responses/unauthorized"
9785 * ),
9786 * @OA\Response(
9787 * response="404",
9788 * ref="#/components/responses/uuidnotfound"
9789 * ),
9790 * security={{"openemr_auth":{}}}
9793 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9794 RestConfig::authorization_check("admin", "users");
9795 if ($request->isPatientRequest()) {
9796 // only allow access to data of binded patient
9797 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9798 } else {
9799 $return = (new FhirGroupRestController())->getOne($uuid);
9801 RestConfig::apiLog($return);
9802 return $return;
9806 * @OA\Get(
9807 * path="/fhir/Group/{id}/$export",
9808 * 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>",
9809 * tags={"fhir"},
9810 * @OA\Parameter(
9811 * name="id",
9812 * in="path",
9813 * description="The id for the Group resource.",
9814 * required=true,
9815 * @OA\Schema(
9816 * type="string"
9818 * ),
9819 * @OA\Response(
9820 * response="200",
9821 * 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>"
9822 * ),
9823 * @OA\Response(
9824 * response="400",
9825 * ref="#/components/responses/badrequest"
9826 * ),
9827 * @OA\Response(
9828 * response="401",
9829 * ref="#/components/responses/unauthorized"
9830 * ),
9831 * security={{"openemr_auth":{}}}
9834 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9835 RestConfig::authorization_check("admin", "users");
9836 $fhirExportService = new FhirOperationExportRestController($request);
9837 $exportParams = $request->getQueryParams();
9838 $exportParams['groupId'] = $groupId;
9839 $return = $fhirExportService->processExport(
9840 $exportParams,
9841 'Group',
9842 $request->getHeader('Accept')[0] ?? '',
9843 $request->getHeader('Prefer')[0] ?? ''
9845 RestConfig::apiLog($return);
9846 return $return;
9850 * @OA\Get(
9851 * path="/fhir/Immunization",
9852 * description="Returns a list of Immunization resources.",
9853 * tags={"fhir"},
9854 * @OA\Parameter(
9855 * name="_id",
9856 * in="query",
9857 * description="The uuid for the Immunization resource.",
9858 * required=false,
9859 * @OA\Schema(
9860 * type="string"
9862 * ),
9863 * @OA\Parameter(
9864 * name="patient",
9865 * in="query",
9866 * description="The uuid for the patient.",
9867 * required=false,
9868 * @OA\Schema(
9869 * type="string"
9871 * ),
9872 * @OA\Response(
9873 * response="200",
9874 * description="Standard Response",
9875 * @OA\MediaType(
9876 * mediaType="application/json",
9877 * @OA\Schema(
9878 * @OA\Property(
9879 * property="json object",
9880 * description="FHIR Json object.",
9881 * type="object"
9882 * ),
9883 * example={
9884 * "meta": {
9885 * "lastUpdated": "2021-09-14T09:13:51"
9886 * },
9887 * "resourceType": "Bundle",
9888 * "type": "collection",
9889 * "total": 0,
9890 * "link": {
9892 * "relation": "self",
9893 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9899 * ),
9900 * @OA\Response(
9901 * response="400",
9902 * ref="#/components/responses/badrequest"
9903 * ),
9904 * @OA\Response(
9905 * response="401",
9906 * ref="#/components/responses/unauthorized"
9907 * ),
9908 * security={{"openemr_auth":{}}}
9911 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9912 $getParams = $request->getQueryParams();
9913 if ($request->isPatientRequest()) {
9914 // only allow access to data of binded patient
9915 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9916 } else {
9917 RestConfig::authorization_check("patients", "med");
9918 $return = (new FhirImmunizationRestController())->getAll($getParams);
9920 RestConfig::apiLog($return);
9921 return $return;
9925 * @OA\Get(
9926 * path="/fhir/Immunization/{uuid}",
9927 * description="Returns a single Immunization resource.",
9928 * tags={"fhir"},
9929 * @OA\Parameter(
9930 * name="uuid",
9931 * in="path",
9932 * description="The uuid for the Immunization resource.",
9933 * required=true,
9934 * @OA\Schema(
9935 * type="string"
9937 * ),
9938 * @OA\Response(
9939 * response="200",
9940 * description="Standard Response",
9941 * @OA\MediaType(
9942 * mediaType="application/json",
9943 * @OA\Schema(
9944 * @OA\Property(
9945 * property="json object",
9946 * description="FHIR Json object.",
9947 * type="object"
9948 * ),
9949 * example={
9950 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9951 * "meta": {
9952 * "versionId": "1",
9953 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9954 * },
9955 * "resourceType": "Immunization",
9956 * "status": "completed",
9957 * "vaccineCode": {
9958 * "coding": {
9960 * "system": "http://hl7.org/fhir/sid/cvx",
9961 * "code": "207",
9962 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9965 * },
9966 * "patient": {
9967 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9968 * },
9969 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9970 * "recorded": "2022-03-26T05:42:26+00:00",
9971 * "primarySource": false
9975 * ),
9976 * @OA\Response(
9977 * response="400",
9978 * ref="#/components/responses/badrequest"
9979 * ),
9980 * @OA\Response(
9981 * response="401",
9982 * ref="#/components/responses/unauthorized"
9983 * ),
9984 * @OA\Response(
9985 * response="404",
9986 * ref="#/components/responses/uuidnotfound"
9987 * ),
9988 * security={{"openemr_auth":{}}}
9991 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9992 if ($request->isPatientRequest()) {
9993 // only allow access to data of binded patient
9994 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9995 } else {
9996 RestConfig::authorization_check("patients", "med");
9997 $return = (new FhirImmunizationRestController())->getOne($uuid);
9999 RestConfig::apiLog($return);
10000 return $return;
10004 * @OA\Get(
10005 * path="/fhir/Location",
10006 * description="Returns a list of Location resources.",
10007 * tags={"fhir"},
10008 * @OA\Parameter(
10009 * name="_id",
10010 * in="query",
10011 * description="The uuid for the Location resource.",
10012 * required=false,
10013 * @OA\Schema(
10014 * type="string"
10016 * ),
10017 * @OA\Response(
10018 * response="200",
10019 * description="Standard Response",
10020 * @OA\MediaType(
10021 * mediaType="application/json",
10022 * @OA\Schema(
10023 * @OA\Property(
10024 * property="json object",
10025 * description="FHIR Json object.",
10026 * type="object"
10027 * ),
10028 * example={
10029 * "meta": {
10030 * "lastUpdated": "2021-09-14T09:13:51"
10031 * },
10032 * "resourceType": "Bundle",
10033 * "type": "collection",
10034 * "total": 0,
10035 * "link": {
10037 * "relation": "self",
10038 * "url": "https://localhost:9300/apis/default/fhir/Location"
10044 * ),
10045 * @OA\Response(
10046 * response="400",
10047 * ref="#/components/responses/badrequest"
10048 * ),
10049 * @OA\Response(
10050 * response="401",
10051 * ref="#/components/responses/unauthorized"
10052 * ),
10053 * security={{"openemr_auth":{}}}
10056 "GET /fhir/Location" => function (HttpRestRequest $request) {
10057 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
10058 RestConfig::apiLog($return);
10059 return $return;
10063 * @OA\Get(
10064 * path="/fhir/Location/{uuid}",
10065 * description="Returns a single Location resource.",
10066 * tags={"fhir"},
10067 * @OA\Parameter(
10068 * name="uuid",
10069 * in="path",
10070 * description="The uuid for the Location resource.",
10071 * required=true,
10072 * @OA\Schema(
10073 * type="string"
10075 * ),
10076 * @OA\Response(
10077 * response="200",
10078 * description="Standard Response",
10079 * @OA\MediaType(
10080 * mediaType="application/json",
10081 * @OA\Schema(
10082 * @OA\Property(
10083 * property="json object",
10084 * description="FHIR Json object.",
10085 * type="object"
10086 * ),
10087 * example={
10088 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
10089 * "meta": {
10090 * "versionId": "1",
10091 * "lastUpdated": "2021-09-19T08:14:58+00:00"
10092 * },
10093 * "resourceType": "Location",
10094 * "status": "active",
10095 * "name": "Your Clinic Name Here",
10096 * "telecom": {
10098 * "system": "phone",
10099 * "value": "000-000-0000"
10100 * },
10102 * "system": "fax",
10103 * "value": "000-000-0000"
10109 * ),
10110 * @OA\Response(
10111 * response="400",
10112 * ref="#/components/responses/badrequest"
10113 * ),
10114 * @OA\Response(
10115 * response="401",
10116 * ref="#/components/responses/unauthorized"
10117 * ),
10118 * @OA\Response(
10119 * response="404",
10120 * ref="#/components/responses/uuidnotfound"
10121 * ),
10122 * security={{"openemr_auth":{}}}
10125 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
10126 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10127 RestConfig::apiLog($return);
10128 return $return;
10132 * @OA\Get(
10133 * path="/fhir/Medication",
10134 * description="Returns a list of Medication resources.",
10135 * tags={"fhir"},
10136 * @OA\Response(
10137 * response="200",
10138 * description="Standard Response",
10139 * @OA\MediaType(
10140 * mediaType="application/json",
10141 * @OA\Schema(
10142 * @OA\Property(
10143 * property="json object",
10144 * description="FHIR Json object.",
10145 * type="object"
10146 * ),
10147 * example={
10148 * "meta": {
10149 * "lastUpdated": "2021-09-14T09:13:51"
10150 * },
10151 * "resourceType": "Bundle",
10152 * "type": "collection",
10153 * "total": 0,
10154 * "link": {
10156 * "relation": "self",
10157 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10163 * ),
10164 * @OA\Response(
10165 * response="400",
10166 * ref="#/components/responses/badrequest"
10167 * ),
10168 * @OA\Response(
10169 * response="401",
10170 * ref="#/components/responses/unauthorized"
10171 * ),
10172 * security={{"openemr_auth":{}}}
10175 "GET /fhir/Medication" => function (HttpRestRequest $request) {
10176 RestConfig::authorization_check("patients", "med");
10177 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10178 RestConfig::apiLog($return);
10179 return $return;
10183 * @OA\Get(
10184 * path="/fhir/Medication/{uuid}",
10185 * description="Returns a single Medication resource.",
10186 * tags={"fhir"},
10187 * @OA\Parameter(
10188 * name="uuid",
10189 * in="path",
10190 * description="The uuid for the Medication resource.",
10191 * required=true,
10192 * @OA\Schema(
10193 * type="string"
10195 * ),
10196 * @OA\Response(
10197 * response="200",
10198 * description="Standard Response",
10199 * @OA\MediaType(
10200 * mediaType="application/json",
10201 * @OA\Schema(
10202 * @OA\Property(
10203 * property="json object",
10204 * description="FHIR Json object.",
10205 * type="object"
10206 * ),
10207 * example={
10208 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10209 * "meta": {
10210 * "versionId": "1",
10211 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10212 * },
10213 * "resourceType": "Medication",
10214 * "code": {
10215 * "coding": {
10217 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10218 * "code": 153165
10221 * },
10222 * "status": "active",
10223 * "batch": {
10224 * "lotNumber": "132",
10225 * "expirationDate": "0000-00-00"
10230 * ),
10231 * @OA\Response(
10232 * response="400",
10233 * ref="#/components/responses/badrequest"
10234 * ),
10235 * @OA\Response(
10236 * response="401",
10237 * ref="#/components/responses/unauthorized"
10238 * ),
10239 * @OA\Response(
10240 * response="404",
10241 * ref="#/components/responses/uuidnotfound"
10242 * ),
10243 * security={{"openemr_auth":{}}}
10246 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
10247 if ($request->isPatientRequest()) {
10248 // only allow access to data of binded patient
10249 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10250 } else {
10251 RestConfig::authorization_check("patients", "med");
10252 $return = (new FhirMedicationRestController())->getOne($uuid);
10254 RestConfig::apiLog($return);
10255 return $return;
10259 * @OA\Get(
10260 * path="/fhir/MedicationRequest",
10261 * description="Returns a list of MedicationRequest resources.",
10262 * tags={"fhir"},
10263 * @OA\Parameter(
10264 * name="_id",
10265 * in="query",
10266 * description="The uuid for the MedicationRequest resource.",
10267 * required=false,
10268 * @OA\Schema(
10269 * type="string"
10271 * ),
10272 * @OA\Parameter(
10273 * name="patient",
10274 * in="query",
10275 * description="The uuid for the patient.",
10276 * required=false,
10277 * @OA\Schema(
10278 * type="string"
10280 * ),
10281 * @OA\Parameter(
10282 * name="intent",
10283 * in="query",
10284 * description="The intent of the MedicationRequest resource.",
10285 * required=false,
10286 * @OA\Schema(
10287 * type="string"
10289 * ),
10290 * @OA\Parameter(
10291 * name="status",
10292 * in="query",
10293 * description="The status of the MedicationRequest resource.",
10294 * required=false,
10295 * @OA\Schema(
10296 * type="string"
10298 * ),
10299 * @OA\Response(
10300 * response="200",
10301 * description="Standard Response",
10302 * @OA\MediaType(
10303 * mediaType="application/json",
10304 * @OA\Schema(
10305 * @OA\Property(
10306 * property="json object",
10307 * description="FHIR Json object.",
10308 * type="object"
10309 * ),
10310 * example={
10311 * "meta": {
10312 * "lastUpdated": "2021-09-14T09:13:51"
10313 * },
10314 * "resourceType": "Bundle",
10315 * "type": "collection",
10316 * "total": 0,
10317 * "link": {
10319 * "relation": "self",
10320 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10326 * ),
10327 * @OA\Response(
10328 * response="400",
10329 * ref="#/components/responses/badrequest"
10330 * ),
10331 * @OA\Response(
10332 * response="401",
10333 * ref="#/components/responses/unauthorized"
10334 * ),
10335 * security={{"openemr_auth":{}}}
10338 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
10339 $getParams = $request->getQueryParams();
10340 if ($request->isPatientRequest()) {
10341 // only allow access to data of binded patient
10342 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10343 } else {
10344 RestConfig::authorization_check("patients", "med");
10345 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10347 RestConfig::apiLog($return);
10348 return $return;
10352 * @OA\Get(
10353 * path="/fhir/MedicationRequest/{uuid}",
10354 * description="Returns a single MedicationRequest resource.",
10355 * tags={"fhir"},
10356 * @OA\Parameter(
10357 * name="uuid",
10358 * in="path",
10359 * description="The uuid for the MedicationRequest resource.",
10360 * required=true,
10361 * @OA\Schema(
10362 * type="string"
10364 * ),
10365 * @OA\Response(
10366 * response="200",
10367 * description="Standard Response",
10368 * @OA\MediaType(
10369 * mediaType="application/json",
10370 * @OA\Schema(
10371 * @OA\Property(
10372 * property="json object",
10373 * description="FHIR Json object.",
10374 * type="object"
10375 * ),
10376 * example={
10377 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10378 * "meta": {
10379 * "versionId": "1",
10380 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10381 * },
10382 * "resourceType": "MedicationRequest",
10383 * "status": "active",
10384 * "intent": "order",
10385 * "category": {
10387 * "coding": {
10389 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10390 * "code": "community",
10391 * "display": "Home/Community"
10395 * },
10396 * "reportedBoolean": false,
10397 * "medicationCodeableConcept": {
10398 * "coding": {
10400 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10401 * "code": "1738139",
10402 * "display": "Acetaminophen 325 MG Oral Tablet"
10405 * },
10406 * "subject": {
10407 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10408 * "type": "Patient"
10409 * },
10410 * "authoredOn": "2021-09-18T00:00:00+00:00",
10411 * "requester": {
10412 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10413 * "type": "Practitioner"
10418 * ),
10419 * @OA\Response(
10420 * response="400",
10421 * ref="#/components/responses/badrequest"
10422 * ),
10423 * @OA\Response(
10424 * response="401",
10425 * ref="#/components/responses/unauthorized"
10426 * ),
10427 * @OA\Response(
10428 * response="404",
10429 * ref="#/components/responses/uuidnotfound"
10430 * ),
10431 * security={{"openemr_auth":{}}}
10434 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
10435 if ($request->isPatientRequest()) {
10436 // only allow access to data of binded patient
10437 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10438 } else {
10439 RestConfig::authorization_check("patients", "med");
10440 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10442 RestConfig::apiLog($return);
10443 return $return;
10447 * @OA\Get(
10448 * path="/fhir/Observation",
10449 * description="Returns a list of Observation resources.",
10450 * tags={"fhir"},
10451 * @OA\Parameter(
10452 * name="_id",
10453 * in="query",
10454 * description="The uuid for the Observation resource.",
10455 * required=false,
10456 * @OA\Schema(
10457 * type="string"
10459 * ),
10460 * @OA\Parameter(
10461 * name="patient",
10462 * in="query",
10463 * description="The uuid for the patient.",
10464 * required=false,
10465 * @OA\Schema(
10466 * type="string"
10468 * ),
10469 * @OA\Parameter(
10470 * name="code",
10471 * in="query",
10472 * description="The code of the Observation resource.",
10473 * required=false,
10474 * @OA\Schema(
10475 * type="string"
10477 * ),
10478 * @OA\Parameter(
10479 * name="category",
10480 * in="query",
10481 * description="The category of the Observation resource.",
10482 * required=false,
10483 * @OA\Schema(
10484 * type="string"
10486 * ),
10487 * @OA\Parameter(
10488 * name="date",
10489 * in="query",
10490 * description="The datetime of the Observation resource.",
10491 * required=false,
10492 * @OA\Schema(
10493 * type="string"
10495 * ),
10496 * @OA\Response(
10497 * response="200",
10498 * description="Standard Response",
10499 * @OA\MediaType(
10500 * mediaType="application/json",
10501 * @OA\Schema(
10502 * @OA\Property(
10503 * property="json object",
10504 * description="FHIR Json object.",
10505 * type="object"
10506 * ),
10507 * example={
10508 * "meta": {
10509 * "lastUpdated": "2021-09-14T09:13:51"
10510 * },
10511 * "resourceType": "Bundle",
10512 * "type": "collection",
10513 * "total": 0,
10514 * "link": {
10516 * "relation": "self",
10517 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10523 * ),
10524 * @OA\Response(
10525 * response="400",
10526 * ref="#/components/responses/badrequest"
10527 * ),
10528 * @OA\Response(
10529 * response="401",
10530 * ref="#/components/responses/unauthorized"
10531 * ),
10532 * security={{"openemr_auth":{}}}
10535 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10536 $getParams = $request->getQueryParams();
10537 if ($request->isPatientRequest()) {
10538 // only allow access to data of binded patient
10539 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10540 } else {
10541 RestConfig::authorization_check("patients", "med");
10542 $return = (new FhirObservationRestController())->getAll($getParams);
10544 RestConfig::apiLog($return);
10545 return $return;
10549 * @OA\Get(
10550 * path="/fhir/Observation/{uuid}",
10551 * description="Returns a single Observation resource.",
10552 * tags={"fhir"},
10553 * @OA\Parameter(
10554 * name="uuid",
10555 * in="path",
10556 * description="The uuid for the Observation resource.",
10557 * required=true,
10558 * @OA\Schema(
10559 * type="string"
10561 * ),
10562 * @OA\Response(
10563 * response="200",
10564 * description="Standard Response",
10565 * @OA\MediaType(
10566 * mediaType="application/json",
10567 * @OA\Schema(
10568 * @OA\Property(
10569 * property="json object",
10570 * description="FHIR Json object.",
10571 * type="object"
10572 * ),
10573 * example={
10574 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10575 * "meta": {
10576 * "versionId": "1",
10577 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10578 * },
10579 * "resourceType": "Observation",
10580 * "status": "final",
10581 * "category": {
10583 * "coding": {
10585 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10586 * "code": "vital-signs"
10590 * },
10591 * "code": {
10592 * "coding": {
10594 * "system": "http://loinc.org",
10595 * "code": "85354-9",
10596 * "display": "Blood pressure systolic and diastolic"
10599 * },
10600 * "subject": {
10601 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10602 * "type": "Patient"
10603 * },
10604 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10605 * "component": {
10607 * "code": {
10608 * "coding": {
10610 * "system": "http://loinc.org",
10611 * "code": "8480-6",
10612 * "display": "Systolic blood pressure"
10615 * },
10616 * "valueQuantity": {
10617 * "value": 122,
10618 * "unit": "mm[Hg]",
10619 * "system": "http://unitsofmeasure.org",
10620 * "code": "mm[Hg]"
10622 * },
10624 * "code": {
10625 * "coding": {
10627 * "system": "http://loinc.org",
10628 * "code": "8462-4",
10629 * "display": "Diastolic blood pressure"
10632 * },
10633 * "valueQuantity": {
10634 * "value": 77,
10635 * "unit": "mm[Hg]",
10636 * "system": "http://unitsofmeasure.org",
10637 * "code": "mm[Hg]"
10644 * ),
10645 * @OA\Response(
10646 * response="400",
10647 * ref="#/components/responses/badrequest"
10648 * ),
10649 * @OA\Response(
10650 * response="401",
10651 * ref="#/components/responses/unauthorized"
10652 * ),
10653 * @OA\Response(
10654 * response="404",
10655 * ref="#/components/responses/uuidnotfound"
10656 * ),
10657 * security={{"openemr_auth":{}}}
10660 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10661 if ($request->isPatientRequest()) {
10662 // only allow access to data of binded patient
10663 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10664 } else {
10665 RestConfig::authorization_check("patients", "med");
10666 $return = (new FhirObservationRestController())->getOne($uuid);
10668 RestConfig::apiLog($return);
10669 return $return;
10673 * @OA\Get(
10674 * path="/fhir/Organization",
10675 * description="Returns a list of Organization resources.",
10676 * tags={"fhir"},
10677 * @OA\Parameter(
10678 * name="_id",
10679 * in="query",
10680 * description="The uuid for the Organization resource.",
10681 * required=false,
10682 * @OA\Schema(
10683 * type="string"
10685 * ),
10686 * @OA\Parameter(
10687 * name="name",
10688 * in="query",
10689 * description="The name of the Organization resource.",
10690 * required=false,
10691 * @OA\Schema(
10692 * type="string"
10694 * ),
10695 * @OA\Parameter(
10696 * name="email",
10697 * in="query",
10698 * description="The email of the Organization resource.",
10699 * required=false,
10700 * @OA\Schema(
10701 * type="string"
10703 * ),
10704 * @OA\Parameter(
10705 * name="phone",
10706 * in="query",
10707 * description="The phone of the Organization resource.",
10708 * required=false,
10709 * @OA\Schema(
10710 * type="string"
10712 * ),
10713 * @OA\Parameter(
10714 * name="telecom",
10715 * in="query",
10716 * description="The telecom of the Organization resource.",
10717 * required=false,
10718 * @OA\Schema(
10719 * type="string"
10721 * ),
10722 * @OA\Parameter(
10723 * name="address",
10724 * in="query",
10725 * description="The address of the Organization resource.",
10726 * required=false,
10727 * @OA\Schema(
10728 * type="string"
10730 * ),
10731 * @OA\Parameter(
10732 * name="address-city",
10733 * in="query",
10734 * description="The address-city of the Organization resource.",
10735 * required=false,
10736 * @OA\Schema(
10737 * type="string"
10739 * ),
10740 * @OA\Parameter(
10741 * name="address-postalcode",
10742 * in="query",
10743 * description="The address-postalcode of the Organization resource.",
10744 * required=false,
10745 * @OA\Schema(
10746 * type="string"
10748 * ),
10749 * @OA\Parameter(
10750 * name="address-state",
10751 * in="query",
10752 * description="The address-state of the Organization resource.",
10753 * required=false,
10754 * @OA\Schema(
10755 * type="string"
10757 * ),
10758 * @OA\Response(
10759 * response="200",
10760 * description="Standard Response",
10761 * @OA\MediaType(
10762 * mediaType="application/json",
10763 * @OA\Schema(
10764 * @OA\Property(
10765 * property="json object",
10766 * description="FHIR Json object.",
10767 * type="object"
10768 * ),
10769 * example={
10770 * "meta": {
10771 * "lastUpdated": "2021-09-14T09:13:51"
10772 * },
10773 * "resourceType": "Bundle",
10774 * "type": "collection",
10775 * "total": 0,
10776 * "link": {
10778 * "relation": "self",
10779 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10785 * ),
10786 * @OA\Response(
10787 * response="400",
10788 * ref="#/components/responses/badrequest"
10789 * ),
10790 * @OA\Response(
10791 * response="401",
10792 * ref="#/components/responses/unauthorized"
10793 * ),
10794 * security={{"openemr_auth":{}}}
10797 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10798 if (!$request->isPatientRequest()) {
10799 RestConfig::authorization_check("admin", "users");
10801 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10802 RestConfig::apiLog($return);
10803 return $return;
10807 * @OA\Get(
10808 * path="/fhir/Organization/{uuid}",
10809 * description="Returns a single Organization resource.",
10810 * tags={"fhir"},
10811 * @OA\Parameter(
10812 * name="uuid",
10813 * in="path",
10814 * description="The uuid for the Organization resource.",
10815 * required=true,
10816 * @OA\Schema(
10817 * type="string"
10819 * ),
10820 * @OA\Response(
10821 * response="200",
10822 * description="Standard Response",
10823 * @OA\MediaType(
10824 * mediaType="application/json",
10825 * @OA\Schema(
10826 * @OA\Property(
10827 * property="json object",
10828 * description="FHIR Json object.",
10829 * type="object"
10830 * ),
10831 * example={
10832 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10833 * "meta": {
10834 * "versionId": "1",
10835 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10836 * },
10837 * "resourceType": "Organization",
10838 * "text": {
10839 * "status": "generated",
10840 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10841 * },
10842 * "identifier": {
10844 * "system": "http://hl7.org/fhir/sid/us-npi",
10845 * "value": "1234567890"
10847 * },
10848 * "active": true,
10849 * "type": {
10851 * "coding": {
10853 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10854 * "code": "prov",
10855 * "display": "Healthcare Provider"
10859 * },
10860 * "name": "Your Clinic Name Here",
10861 * "telecom": {
10863 * "system": "phone",
10864 * "value": "000-000-0000",
10865 * "use": "work"
10866 * },
10868 * "system": "fax",
10869 * "value": "000-000-0000",
10870 * "use": "work"
10872 * },
10873 * "address": {
10874 * null
10879 * ),
10880 * @OA\Response(
10881 * response="400",
10882 * ref="#/components/responses/badrequest"
10883 * ),
10884 * @OA\Response(
10885 * response="401",
10886 * ref="#/components/responses/unauthorized"
10887 * ),
10888 * @OA\Response(
10889 * response="404",
10890 * ref="#/components/responses/uuidnotfound"
10891 * ),
10892 * security={{"openemr_auth":{}}}
10895 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10896 $patientUUID = null;
10897 if (!$request->isPatientRequest()) {
10898 RestConfig::authorization_check("admin", "users");
10899 } else {
10900 $patientUUID = $request->getPatientUUIDString();
10902 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10904 RestConfig::apiLog($return);
10905 return $return;
10909 * @OA\Post(
10910 * path="/fhir/Organization",
10911 * description="Adds a Organization resource.",
10912 * tags={"fhir"},
10913 * @OA\RequestBody(
10914 * required=true,
10915 * @OA\MediaType(
10916 * mediaType="application/json",
10917 * @OA\Schema(
10918 * description="The json object for the Organization resource.",
10919 * type="object"
10920 * ),
10921 * example={
10922 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10923 * "meta": {
10924 * "versionId": "1",
10925 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10926 * },
10927 * "resourceType": "Organization",
10928 * "text": {
10929 * "status": "generated",
10930 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10931 * },
10932 * "identifier": {
10934 * "system": "http://hl7.org/fhir/sid/us-npi",
10935 * "value": "1234567890"
10937 * },
10938 * "active": true,
10939 * "type": {
10941 * "coding": {
10943 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10944 * "code": "prov",
10945 * "display": "Healthcare Provider"
10949 * },
10950 * "name": "Your Clinic Name Here Hey",
10951 * "telecom": {
10953 * "system": "phone",
10954 * "value": "000-000-0000",
10955 * "use": "work"
10956 * },
10958 * "system": "fax",
10959 * "value": "000-000-0000",
10960 * "use": "work"
10962 * },
10963 * "address": {
10964 * null
10968 * ),
10969 * @OA\Response(
10970 * response="200",
10971 * description="Standard Response",
10972 * @OA\MediaType(
10973 * mediaType="application/json",
10974 * @OA\Schema(
10975 * @OA\Property(
10976 * property="json object",
10977 * description="FHIR Json object.",
10978 * type="object"
10979 * ),
10980 * example={
10981 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10982 * "meta": {
10983 * "versionId": "1",
10984 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10985 * },
10986 * "resourceType": "Organization",
10987 * "text": {
10988 * "status": "generated",
10989 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10990 * },
10991 * "identifier": {
10993 * "system": "http://hl7.org/fhir/sid/us-npi",
10994 * "value": "1234567890"
10996 * },
10997 * "active": true,
10998 * "type": {
11000 * "coding": {
11002 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11003 * "code": "prov",
11004 * "display": "Healthcare Provider"
11008 * },
11009 * "name": "Your Clinic Name Here Now",
11010 * "telecom": {
11012 * "system": "phone",
11013 * "value": "000-000-0000",
11014 * "use": "work"
11015 * },
11017 * "system": "fax",
11018 * "value": "000-000-0000",
11019 * "use": "work"
11021 * },
11022 * "address": {
11023 * null
11028 * ),
11029 * @OA\Response(
11030 * response="400",
11031 * ref="#/components/responses/badrequest"
11032 * ),
11033 * @OA\Response(
11034 * response="401",
11035 * ref="#/components/responses/unauthorized"
11036 * ),
11037 * security={{"openemr_auth":{}}}
11040 "POST /fhir/Organization" => function (HttpRestRequest $request) {
11041 RestConfig::authorization_check("admin", "super");
11042 $data = (array) (json_decode(file_get_contents("php://input"), true));
11043 $return = (new FhirOrganizationRestController())->post($data);
11044 RestConfig::apiLog($return, $data);
11045 return $return;
11049 * @OA\Put(
11050 * path="/fhir/Organization/{uuid}",
11051 * description="Modifies a Organization resource.",
11052 * tags={"fhir"},
11053 * @OA\Parameter(
11054 * name="uuid",
11055 * in="path",
11056 * description="The uuid for the organization.",
11057 * required=true,
11058 * @OA\Schema(
11059 * type="string"
11061 * ),
11062 * @OA\RequestBody(
11063 * required=true,
11064 * @OA\MediaType(
11065 * mediaType="application/json",
11066 * @OA\Schema(
11067 * description="The json object for the Organization resource.",
11068 * type="object"
11069 * ),
11070 * example={
11071 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
11072 * "meta": {
11073 * "versionId": "1",
11074 * "lastUpdated": "2022-03-30T07:43:23+00:00"
11075 * },
11076 * "resourceType": "Organization",
11077 * "text": {
11078 * "status": "generated",
11079 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
11080 * },
11081 * "identifier": {
11083 * "system": "http://hl7.org/fhir/sid/us-npi",
11084 * "value": "1234567890"
11086 * },
11087 * "active": true,
11088 * "type": {
11090 * "coding": {
11092 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11093 * "code": "prov",
11094 * "display": "Healthcare Provider"
11098 * },
11099 * "name": "Your Clinic Name Here",
11100 * "telecom": {
11102 * "system": "phone",
11103 * "value": "000-000-0000",
11104 * "use": "work"
11105 * },
11107 * "system": "fax",
11108 * "value": "000-000-0000",
11109 * "use": "work"
11111 * },
11112 * "address": {
11113 * null
11117 * ),
11118 * @OA\Response(
11119 * response="201",
11120 * description="Standard Response",
11121 * @OA\MediaType(
11122 * mediaType="application/json",
11123 * @OA\Schema(
11124 * example={
11125 * "id": 14,
11126 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11130 * ),
11131 * @OA\Response(
11132 * response="400",
11133 * ref="#/components/responses/badrequest"
11134 * ),
11135 * @OA\Response(
11136 * response="401",
11137 * ref="#/components/responses/unauthorized"
11138 * ),
11139 * security={{"openemr_auth":{}}}
11142 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
11143 RestConfig::authorization_check("admin", "super");
11144 $data = (array) (json_decode(file_get_contents("php://input"), true));
11145 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11146 RestConfig::apiLog($return, $data);
11147 return $return;
11151 * @OA\Post(
11152 * path="/fhir/Patient",
11153 * description="Adds a Patient resource.",
11154 * tags={"fhir"},
11155 * @OA\RequestBody(
11156 * required=true,
11157 * @OA\MediaType(
11158 * mediaType="application/json",
11159 * @OA\Schema(
11160 * description="The json object for the Patient resource.",
11161 * type="object"
11162 * ),
11163 * example={
11164 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11165 * "meta": {
11166 * "versionId": "1",
11167 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11168 * },
11169 * "resourceType": "Patient",
11170 * "text": {
11171 * "status": "generated",
11172 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11173 * },
11174 * "extension": {
11176 * "valueCode": "F",
11177 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11178 * },
11180 * "extension": {
11182 * "valueCoding": {
11183 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11184 * "code": "UNK",
11185 * "display": "Unknown"
11186 * },
11187 * "url": "ombCategory"
11188 * },
11190 * "valueString": "Unknown",
11191 * "url": "text"
11193 * },
11194 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11196 * },
11197 * "identifier": {
11199 * "use": "official",
11200 * "type": {
11201 * "coding": {
11203 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11204 * "code": "PT"
11207 * },
11208 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11209 * "value": "1"
11211 * },
11212 * "active": true,
11213 * "name": {
11215 * "use": "official",
11216 * "family": "Smith",
11217 * "given": {
11218 * "Brenda"
11221 * },
11222 * "gender": "female",
11223 * "birthDate": "2017-03-10",
11224 * "communication": {
11226 * "language": {
11227 * "coding": {
11229 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11230 * "code": "unknown",
11231 * "display": "Unknown"
11239 * ),
11240 * @OA\Response(
11241 * response="200",
11242 * description="Standard Response",
11243 * @OA\MediaType(
11244 * mediaType="application/json",
11245 * @OA\Schema(
11246 * @OA\Property(
11247 * property="json object",
11248 * description="FHIR Json object.",
11249 * type="object"
11250 * ),
11251 * example={
11252 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11253 * "meta": {
11254 * "versionId": "1",
11255 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11256 * },
11257 * "resourceType": "Patient",
11258 * "text": {
11259 * "status": "generated",
11260 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11261 * },
11262 * "extension": {
11264 * "valueCode": "F",
11265 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11266 * },
11268 * "extension": {
11270 * "valueCoding": {
11271 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11272 * "code": "UNK",
11273 * "display": "Unknown"
11274 * },
11275 * "url": "ombCategory"
11276 * },
11278 * "valueString": "Unknown",
11279 * "url": "text"
11281 * },
11282 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11284 * },
11285 * "identifier": {
11287 * "use": "official",
11288 * "type": {
11289 * "coding": {
11291 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11292 * "code": "PT"
11295 * },
11296 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11297 * "value": "1"
11299 * },
11300 * "active": true,
11301 * "name": {
11303 * "use": "official",
11304 * "family": "Smith",
11305 * "given": {
11306 * "Brenda"
11309 * },
11310 * "gender": "female",
11311 * "birthDate": "2017-03-10",
11312 * "communication": {
11314 * "language": {
11315 * "coding": {
11317 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11318 * "code": "unknown",
11319 * "display": "Unknown"
11328 * ),
11329 * @OA\Response(
11330 * response="400",
11331 * ref="#/components/responses/badrequest"
11332 * ),
11333 * @OA\Response(
11334 * response="401",
11335 * ref="#/components/responses/unauthorized"
11336 * ),
11337 * security={{"openemr_auth":{}}}
11340 "POST /fhir/Patient" => function (HttpRestRequest $request) {
11341 RestConfig::authorization_check("patients", "demo");
11342 $data = (array) (json_decode(file_get_contents("php://input"), true));
11343 $return = (new FhirPatientRestController())->post($data);
11344 RestConfig::apiLog($return, $data);
11345 return $return;
11349 * @OA\Put(
11350 * path="/fhir/Patient/{uuid}",
11351 * description="Modifies a Patient resource.",
11352 * tags={"fhir"},
11353 * @OA\Parameter(
11354 * name="uuid",
11355 * in="path",
11356 * description="The uuid for the Patient resource.",
11357 * required=true,
11358 * @OA\Schema(
11359 * type="string"
11361 * ),
11362 * @OA\RequestBody(
11363 * required=true,
11364 * @OA\MediaType(
11365 * mediaType="application/json",
11366 * @OA\Schema(
11367 * description="The json object for the Patient resource.",
11368 * type="object"
11369 * ),
11370 * example={
11371 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11372 * "meta": {
11373 * "versionId": "1",
11374 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11375 * },
11376 * "resourceType": "Patient",
11377 * "text": {
11378 * "status": "generated",
11379 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11380 * },
11381 * "extension": {
11383 * "valueCode": "F",
11384 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11385 * },
11387 * "extension": {
11389 * "valueCoding": {
11390 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11391 * "code": "UNK",
11392 * "display": "Unknown"
11393 * },
11394 * "url": "ombCategory"
11395 * },
11397 * "valueString": "Unknown",
11398 * "url": "text"
11400 * },
11401 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11403 * },
11404 * "identifier": {
11406 * "use": "official",
11407 * "type": {
11408 * "coding": {
11410 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11411 * "code": "PT"
11414 * },
11415 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11416 * "value": "1"
11418 * },
11419 * "active": true,
11420 * "name": {
11422 * "use": "official",
11423 * "family": "Smith",
11424 * "given": {
11425 * "Brenda"
11428 * },
11429 * "gender": "female",
11430 * "birthDate": "2017-03-10",
11431 * "communication": {
11433 * "language": {
11434 * "coding": {
11436 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11437 * "code": "unknown",
11438 * "display": "Unknown"
11446 * ),
11447 * @OA\Response(
11448 * response="201",
11449 * description="Standard Response",
11450 * @OA\MediaType(
11451 * mediaType="application/json",
11452 * @OA\Schema(
11453 * example={
11454 * "id": 2,
11455 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11459 * ),
11460 * @OA\Response(
11461 * response="400",
11462 * ref="#/components/responses/badrequest"
11463 * ),
11464 * @OA\Response(
11465 * response="401",
11466 * ref="#/components/responses/unauthorized"
11467 * ),
11468 * security={{"openemr_auth":{}}}
11471 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11472 RestConfig::authorization_check("patients", "demo");
11473 $data = (array) (json_decode(file_get_contents("php://input"), true));
11474 $return = (new FhirPatientRestController())->put($uuid, $data);
11475 RestConfig::apiLog($return, $data);
11476 return $return;
11480 * @OA\Get(
11481 * path="/fhir/Patient",
11482 * description="Returns a list of Patient resources.",
11483 * tags={"fhir"},
11484 * @OA\Parameter(
11485 * name="_id",
11486 * in="query",
11487 * description="The uuid for the Patient resource.",
11488 * required=false,
11489 * @OA\Schema(
11490 * type="string"
11492 * ),
11493 * @OA\Parameter(
11494 * name="identifier",
11495 * in="query",
11496 * description="The identifier of the Patient resource.",
11497 * required=false,
11498 * @OA\Schema(
11499 * type="string"
11501 * ),
11502 * @OA\Parameter(
11503 * name="name",
11504 * in="query",
11505 * description="The name of the Patient resource.",
11506 * required=false,
11507 * @OA\Schema(
11508 * type="string"
11510 * ),
11511 * @OA\Parameter(
11512 * name="birthdate",
11513 * in="query",
11514 * description="The birthdate of the Patient resource.",
11515 * required=false,
11516 * @OA\Schema(
11517 * type="string"
11519 * ),
11520 * @OA\Parameter(
11521 * name="gender",
11522 * in="query",
11523 * description="The gender of the Patient resource.",
11524 * required=false,
11525 * @OA\Schema(
11526 * type="string"
11528 * ),
11529 * @OA\Parameter(
11530 * name="address",
11531 * in="query",
11532 * description="The address of the Patient resource.",
11533 * required=false,
11534 * @OA\Schema(
11535 * type="string"
11537 * ),
11538 * @OA\Parameter(
11539 * name="address-city",
11540 * in="query",
11541 * description="The address-city of the Patient resource.",
11542 * required=false,
11543 * @OA\Schema(
11544 * type="string"
11546 * ),
11547 * @OA\Parameter(
11548 * name="address-postalcode",
11549 * in="query",
11550 * description="The address-postalcode of the Patient resource.",
11551 * required=false,
11552 * @OA\Schema(
11553 * type="string"
11555 * ),
11556 * @OA\Parameter(
11557 * name="address-state",
11558 * in="query",
11559 * description="The address-state of the Patient resource.",
11560 * required=false,
11561 * @OA\Schema(
11562 * type="string"
11564 * ),
11565 * @OA\Parameter(
11566 * name="email",
11567 * in="query",
11568 * description="The email of the Patient resource.",
11569 * required=false,
11570 * @OA\Schema(
11571 * type="string"
11573 * ),
11574 * @OA\Parameter(
11575 * name="family",
11576 * in="query",
11577 * description="The family name of the Patient resource.",
11578 * required=false,
11579 * @OA\Schema(
11580 * type="string"
11582 * ),
11583 * @OA\Parameter(
11584 * name="given",
11585 * in="query",
11586 * description="The given name of the Patient resource.",
11587 * required=false,
11588 * @OA\Schema(
11589 * type="string"
11591 * ),
11592 * @OA\Parameter(
11593 * name="phone",
11594 * in="query",
11595 * description="The phone number of the Patient resource.",
11596 * required=false,
11597 * @OA\Schema(
11598 * type="string"
11600 * ),
11601 * @OA\Parameter(
11602 * name="telecom",
11603 * in="query",
11604 * description="The fax number of the Patient resource.",
11605 * required=false,
11606 * @OA\Schema(
11607 * type="string"
11609 * ),
11610 * @OA\Parameter(
11611 * ref="#/components/parameters/_lastUpdated"
11612 * ),
11613 * @OA\Response(
11614 * response="200",
11615 * description="Standard Response",
11616 * @OA\MediaType(
11617 * mediaType="application/json",
11618 * @OA\Schema(
11619 * @OA\Property(
11620 * property="json object",
11621 * description="FHIR Json object.",
11622 * type="object"
11623 * ),
11624 * example={
11625 * "meta": {
11626 * "lastUpdated": "2021-09-14T09:13:51"
11627 * },
11628 * "resourceType": "Bundle",
11629 * "type": "collection",
11630 * "total": 0,
11631 * "link": {
11633 * "relation": "self",
11634 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11640 * ),
11641 * @OA\Response(
11642 * response="400",
11643 * ref="#/components/responses/badrequest"
11644 * ),
11645 * @OA\Response(
11646 * response="401",
11647 * ref="#/components/responses/unauthorized"
11648 * ),
11649 * security={{"openemr_auth":{}}}
11652 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11653 $params = $request->getQueryParams();
11654 if ($request->isPatientRequest()) {
11655 // only allow access to data of binded patient
11656 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11657 // need to use getAll rather than getOne)
11658 $params['_id'] = $request->getPatientUUIDString();
11659 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11660 } else {
11661 RestConfig::authorization_check("patients", "demo");
11662 $return = (new FhirPatientRestController())->getAll($params);
11664 RestConfig::apiLog($return);
11665 return $return;
11669 * @OA\Get(
11670 * path="/fhir/Patient/$export",
11671 * 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>",
11672 * tags={"fhir"},
11673 * @OA\Response(
11674 * response="200",
11675 * 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>"
11676 * ),
11677 * @OA\Response(
11678 * response="400",
11679 * ref="#/components/responses/badrequest"
11680 * ),
11681 * @OA\Response(
11682 * response="401",
11683 * ref="#/components/responses/unauthorized"
11684 * ),
11685 * security={{"openemr_auth":{}}}
11688 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11689 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11690 RestConfig::authorization_check("admin", "users");
11691 $fhirExportService = new FhirOperationExportRestController($request);
11692 $return = $fhirExportService->processExport(
11693 $request->getQueryParams(),
11694 'Patient',
11695 $request->getHeader('Accept')[0] ?? '',
11696 $request->getHeader('Prefer')[0] ?? ''
11698 RestConfig::apiLog($return);
11699 return $return;
11703 * @OA\Get(
11704 * path="/fhir/Patient/{uuid}",
11705 * description="Returns a single Patient resource.",
11706 * tags={"fhir"},
11707 * @OA\Parameter(
11708 * name="uuid",
11709 * in="path",
11710 * description="The uuid for the Patient resource.",
11711 * required=true,
11712 * @OA\Schema(
11713 * type="string"
11715 * ),
11716 * @OA\Response(
11717 * response="200",
11718 * description="Standard Response",
11719 * @OA\MediaType(
11720 * mediaType="application/json",
11721 * @OA\Schema(
11722 * @OA\Property(
11723 * property="json object",
11724 * description="FHIR Json object.",
11725 * type="object"
11726 * ),
11727 * example={
11728 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11729 * "meta": {
11730 * "versionId": "1",
11731 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11732 * },
11733 * "resourceType": "Patient",
11734 * "text": {
11735 * "status": "generated",
11736 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11737 * },
11738 * "extension": {
11740 * "valueCode": "F",
11741 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11742 * },
11744 * "extension": {
11746 * "valueCoding": {
11747 * "system": "urn:oid:2.16.840.1.113883.6.238",
11748 * "code": "1006-6",
11749 * "display": "Abenaki"
11750 * },
11751 * "url": "ombCategory"
11752 * },
11754 * "valueString": "Abenaki",
11755 * "url": "text"
11757 * },
11758 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11759 * },
11761 * "extension": {
11763 * "valueString": "Declined To Specify",
11764 * "url": "text"
11766 * },
11767 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11769 * },
11770 * "identifier": {
11772 * "use": "official",
11773 * "type": {
11774 * "coding": {
11776 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11777 * "code": "PT"
11780 * },
11781 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11782 * "value": "1"
11784 * },
11785 * "active": true,
11786 * "name": {
11788 * "use": "official",
11789 * "family": "Von197",
11790 * "given": {
11791 * "Aurore252"
11794 * },
11795 * "gender": "female",
11796 * "birthDate": "1970-07-03",
11797 * "address": {
11799 * "line": {
11800 * "245 Crona Wall"
11801 * },
11802 * "city": "Boston",
11803 * "state": "Massachusetts",
11804 * "postalCode": "02215",
11805 * "period": {
11806 * "start": "2020-09-21T17:08:03.532+00:00"
11809 * },
11810 * "communication": {
11812 * "language": {
11813 * "coding": {
11815 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11816 * "code": "unknown",
11817 * "display": "Unknown"
11826 * ),
11827 * @OA\Response(
11828 * response="400",
11829 * ref="#/components/responses/badrequest"
11830 * ),
11831 * @OA\Response(
11832 * response="401",
11833 * ref="#/components/responses/unauthorized"
11834 * ),
11835 * @OA\Response(
11836 * response="404",
11837 * ref="#/components/responses/uuidnotfound"
11838 * ),
11839 * security={{"openemr_auth":{}}}
11842 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11843 if ($request->isPatientRequest()) {
11844 // only allow access to data of binded patient
11845 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11846 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11848 $uuid = $request->getPatientUUIDString();
11849 } else {
11850 RestConfig::authorization_check("patients", "demo");
11852 $return = (new FhirPatientRestController())->getOne($uuid);
11853 RestConfig::apiLog($return);
11854 return $return;
11858 * @OA\Get(
11859 * path="/fhir/Person",
11860 * description="Returns a list of Person resources.",
11861 * tags={"fhir"},
11862 * @OA\Parameter(
11863 * name="name",
11864 * in="query",
11865 * description="The name of the Person resource.",
11866 * required=false,
11867 * @OA\Schema(
11868 * type="string"
11870 * ),
11871 * @OA\Parameter(
11872 * name="active",
11873 * in="query",
11874 * description="The active status of the Person resource.",
11875 * required=false,
11876 * @OA\Schema(
11877 * type="string"
11879 * ),
11880 * @OA\Parameter(
11881 * name="address",
11882 * in="query",
11883 * description="The address of the Person resource.",
11884 * required=false,
11885 * @OA\Schema(
11886 * type="string"
11888 * ),
11889 * @OA\Parameter(
11890 * name="address-city",
11891 * in="query",
11892 * description="The address-city of the Person resource.",
11893 * required=false,
11894 * @OA\Schema(
11895 * type="string"
11897 * ),
11898 * @OA\Parameter(
11899 * name="address-postalcode",
11900 * in="query",
11901 * description="The address-postalcode of the Person resource.",
11902 * required=false,
11903 * @OA\Schema(
11904 * type="string"
11906 * ),
11907 * @OA\Parameter(
11908 * name="address-state",
11909 * in="query",
11910 * description="The address-state of the Person resource.",
11911 * required=false,
11912 * @OA\Schema(
11913 * type="string"
11915 * ),
11916 * @OA\Parameter(
11917 * name="email",
11918 * in="query",
11919 * description="The email of the Person resource.",
11920 * required=false,
11921 * @OA\Schema(
11922 * type="string"
11924 * ),
11925 * @OA\Parameter(
11926 * name="family",
11927 * in="query",
11928 * description="The family name of the Person resource.",
11929 * required=false,
11930 * @OA\Schema(
11931 * type="string"
11933 * ),
11934 * @OA\Parameter(
11935 * name="given",
11936 * in="query",
11937 * description="The given name of the Person resource.",
11938 * required=false,
11939 * @OA\Schema(
11940 * type="string"
11942 * ),
11943 * @OA\Parameter(
11944 * name="phone",
11945 * in="query",
11946 * description="The phone number of the Person resource.",
11947 * required=false,
11948 * @OA\Schema(
11949 * type="string"
11951 * ),
11952 * @OA\Parameter(
11953 * name="telecom",
11954 * in="query",
11955 * description="The fax number of the Person resource.",
11956 * required=false,
11957 * @OA\Schema(
11958 * type="string"
11960 * ),
11961 * @OA\Response(
11962 * response="200",
11963 * description="Standard Response",
11964 * @OA\MediaType(
11965 * mediaType="application/json",
11966 * @OA\Schema(
11967 * @OA\Property(
11968 * property="json object",
11969 * description="FHIR Json object.",
11970 * type="object"
11971 * ),
11972 * example={
11973 * "meta": {
11974 * "lastUpdated": "2021-09-14T09:13:51"
11975 * },
11976 * "resourceType": "Bundle",
11977 * "type": "collection",
11978 * "total": 0,
11979 * "link": {
11981 * "relation": "self",
11982 * "url": "https://localhost:9300/apis/default/fhir/Person"
11988 * ),
11989 * @OA\Response(
11990 * response="400",
11991 * ref="#/components/responses/badrequest"
11992 * ),
11993 * @OA\Response(
11994 * response="401",
11995 * ref="#/components/responses/unauthorized"
11996 * ),
11997 * security={{"openemr_auth":{}}}
12000 "GET /fhir/Person" => function (HttpRestRequest $request) {
12001 RestConfig::authorization_check("admin", "users");
12002 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
12003 RestConfig::apiLog($return);
12004 return $return;
12008 * @OA\Get(
12009 * path="/fhir/Person/{uuid}",
12010 * description="Returns a single Person resource.",
12011 * tags={"fhir"},
12012 * @OA\Parameter(
12013 * name="uuid",
12014 * in="path",
12015 * description="The uuid for the Person resource.",
12016 * required=true,
12017 * @OA\Schema(
12018 * type="string"
12020 * ),
12021 * @OA\Response(
12022 * response="200",
12023 * description="Standard Response",
12024 * @OA\MediaType(
12025 * mediaType="application/json",
12026 * @OA\Schema(
12027 * @OA\Property(
12028 * property="json object",
12029 * description="FHIR Json object.",
12030 * type="object"
12031 * ),
12032 * example={
12033 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
12034 * "meta": {
12035 * "versionId": "1",
12036 * "lastUpdated": "2022-04-13T08:57:32+00:00"
12037 * },
12038 * "resourceType": "Person",
12039 * "text": {
12040 * "status": "generated",
12041 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
12042 * },
12043 * "name": {
12045 * "use": "official",
12046 * "family": "Administrator",
12047 * "given": {
12048 * "Administrator",
12049 * "Larry"
12052 * },
12053 * "telecom": {
12055 * "system": "phone",
12056 * "value": "1234567890",
12057 * "use": "home"
12058 * },
12060 * "system": "phone",
12061 * "value": "1234567890",
12062 * "use": "work"
12063 * },
12065 * "system": "phone",
12066 * "value": "1234567890",
12067 * "use": "mobile"
12068 * },
12070 * "system": "email",
12071 * "value": "hey@hey.com",
12072 * "use": "home"
12074 * },
12075 * "address": {
12077 * "line": {
12078 * "123 Lane Street"
12079 * },
12080 * "city": "Bellevue",
12081 * "state": "WA",
12082 * "period": {
12083 * "start": "2021-04-13T08:57:32.146+00:00"
12086 * },
12087 * "active": true
12091 * ),
12092 * @OA\Response(
12093 * response="400",
12094 * ref="#/components/responses/badrequest"
12095 * ),
12096 * @OA\Response(
12097 * response="401",
12098 * ref="#/components/responses/unauthorized"
12099 * ),
12100 * @OA\Response(
12101 * response="404",
12102 * ref="#/components/responses/uuidnotfound"
12103 * ),
12104 * security={{"openemr_auth":{}}}
12107 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
12108 // if the api user is requesting their own user we need to let it through
12109 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
12110 // for the currently logged in user
12111 if ($request->getRequestUserUUIDString() == $uuid) {
12112 $return = (new FhirPersonRestController())->getOne($uuid);
12113 } elseif (!$request->isPatientRequest()) {
12114 // not a patient ,make sure we have access to the users ACL
12115 RestConfig::authorization_check("admin", "users");
12116 $return = (new FhirPersonRestController())->getOne($uuid);
12117 } else {
12118 // if we are a patient bound request we need to make sure we are only bound to the patient
12119 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
12122 RestConfig::apiLog($return);
12123 return $return;
12127 * @OA\Get(
12128 * path="/fhir/Practitioner",
12129 * description="Returns a list of Practitioner resources.",
12130 * tags={"fhir"},
12131 * @OA\Parameter(
12132 * name="_id",
12133 * in="query",
12134 * description="The uuid for the Practitioner resource.",
12135 * required=false,
12136 * @OA\Schema(
12137 * type="string"
12139 * ),
12140 * @OA\Parameter(
12141 * name="name",
12142 * in="query",
12143 * description="The name of the Practitioner resource.",
12144 * required=false,
12145 * @OA\Schema(
12146 * type="string"
12148 * ),
12149 * @OA\Parameter(
12150 * name="active",
12151 * in="query",
12152 * description="The active status of the Practitioner resource.",
12153 * required=false,
12154 * @OA\Schema(
12155 * type="string"
12157 * ),
12158 * @OA\Parameter(
12159 * name="address",
12160 * in="query",
12161 * description="The address of the Practitioner resource.",
12162 * required=false,
12163 * @OA\Schema(
12164 * type="string"
12166 * ),
12167 * @OA\Parameter(
12168 * name="address-city",
12169 * in="query",
12170 * description="The address-city of the Practitioner resource.",
12171 * required=false,
12172 * @OA\Schema(
12173 * type="string"
12175 * ),
12176 * @OA\Parameter(
12177 * name="address-postalcode",
12178 * in="query",
12179 * description="The address-postalcode of the Practitioner resource.",
12180 * required=false,
12181 * @OA\Schema(
12182 * type="string"
12184 * ),
12185 * @OA\Parameter(
12186 * name="address-state",
12187 * in="query",
12188 * description="The address-state of the Practitioner resource.",
12189 * required=false,
12190 * @OA\Schema(
12191 * type="string"
12193 * ),
12194 * @OA\Parameter(
12195 * name="email",
12196 * in="query",
12197 * description="The email of the Practitioner resource.",
12198 * required=false,
12199 * @OA\Schema(
12200 * type="string"
12202 * ),
12203 * @OA\Parameter(
12204 * name="family",
12205 * in="query",
12206 * description="The family name of the Practitioner resource.",
12207 * required=false,
12208 * @OA\Schema(
12209 * type="string"
12211 * ),
12212 * @OA\Parameter(
12213 * name="given",
12214 * in="query",
12215 * description="The given name of the Practitioner resource.",
12216 * required=false,
12217 * @OA\Schema(
12218 * type="string"
12220 * ),
12221 * @OA\Parameter(
12222 * name="phone",
12223 * in="query",
12224 * description="The phone number of the Practitioner resource.",
12225 * required=false,
12226 * @OA\Schema(
12227 * type="string"
12229 * ),
12230 * @OA\Parameter(
12231 * name="telecom",
12232 * in="query",
12233 * description="The fax number of the Practitioner resource.",
12234 * required=false,
12235 * @OA\Schema(
12236 * type="string"
12238 * ),
12239 * @OA\Response(
12240 * response="200",
12241 * description="Standard Response",
12242 * @OA\MediaType(
12243 * mediaType="application/json",
12244 * @OA\Schema(
12245 * @OA\Property(
12246 * property="json object",
12247 * description="FHIR Json object.",
12248 * type="object"
12249 * ),
12250 * example={
12251 * "meta": {
12252 * "lastUpdated": "2021-09-14T09:13:51"
12253 * },
12254 * "resourceType": "Bundle",
12255 * "type": "collection",
12256 * "total": 0,
12257 * "link": {
12259 * "relation": "self",
12260 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12266 * ),
12267 * @OA\Response(
12268 * response="400",
12269 * ref="#/components/responses/badrequest"
12270 * ),
12271 * @OA\Response(
12272 * response="401",
12273 * ref="#/components/responses/unauthorized"
12274 * ),
12275 * security={{"openemr_auth":{}}}
12278 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
12280 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12281 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12282 // I don't believe patients are assigned to a particular practitioner
12283 // should we allow just open api access to admin information? Should we restrict particular pieces
12284 // of data in the practitioner side (phone number, address information) based on a permission set?
12285 if (!$request->isPatientRequest()) {
12286 RestConfig::authorization_check("admin", "users");
12288 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12289 RestConfig::apiLog($return);
12290 return $return;
12294 * @OA\Get(
12295 * path="/fhir/Practitioner/{uuid}",
12296 * description="Returns a single Practitioner resource.",
12297 * tags={"fhir"},
12298 * @OA\Parameter(
12299 * name="uuid",
12300 * in="path",
12301 * description="The uuid for the Practitioner resource.",
12302 * required=true,
12303 * @OA\Schema(
12304 * type="string"
12306 * ),
12307 * @OA\Response(
12308 * response="200",
12309 * description="Standard Response",
12310 * @OA\MediaType(
12311 * mediaType="application/json",
12312 * @OA\Schema(
12313 * @OA\Property(
12314 * property="json object",
12315 * description="FHIR Json object.",
12316 * type="object"
12317 * ),
12318 * example={
12319 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12320 * "meta": {
12321 * "versionId": "1",
12322 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12323 * },
12324 * "resourceType": "Practitioner",
12325 * "text": {
12326 * "status": "generated",
12327 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12328 * },
12329 * "identifier": {
12331 * "system": "http://hl7.org/fhir/sid/us-npi",
12332 * "value": "11223344554543"
12334 * },
12335 * "active": true,
12336 * "name": {
12338 * "use": "official",
12339 * "family": "Smith",
12340 * "given": {
12341 * "Billy"
12348 * ),
12349 * @OA\Response(
12350 * response="400",
12351 * ref="#/components/responses/badrequest"
12352 * ),
12353 * @OA\Response(
12354 * response="401",
12355 * ref="#/components/responses/unauthorized"
12356 * ),
12357 * @OA\Response(
12358 * response="404",
12359 * ref="#/components/responses/uuidnotfound"
12360 * ),
12361 * security={{"openemr_auth":{}}}
12364 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12365 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12366 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12367 // I don't believe patients are assigned to a particular practitioner
12368 // should we allow just open api access to admin information? Should we restrict particular pieces
12369 // of data in the practitioner side (phone number, address information) based on a permission set?
12370 if (!$request->isPatientRequest()) {
12371 RestConfig::authorization_check("admin", "users");
12373 $return = (new FhirPractitionerRestController())->getOne($uuid);
12374 RestConfig::apiLog($return);
12375 return $return;
12379 * @OA\Post(
12380 * path="/fhir/Practitioner",
12381 * description="Adds a Practitioner resources.",
12382 * tags={"fhir"},
12383 * @OA\RequestBody(
12384 * required=true,
12385 * @OA\MediaType(
12386 * mediaType="application/json",
12387 * @OA\Schema(
12388 * description="The json object for the Practitioner resource.",
12389 * type="object"
12390 * ),
12391 * example={
12392 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12393 * "meta": {
12394 * "versionId": "1",
12395 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12396 * },
12397 * "resourceType": "Practitioner",
12398 * "text": {
12399 * "status": "generated",
12400 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12401 * },
12402 * "identifier": {
12404 * "system": "http://hl7.org/fhir/sid/us-npi",
12405 * "value": "11223344554543"
12407 * },
12408 * "active": true,
12409 * "name": {
12411 * "use": "official",
12412 * "family": "Smith",
12413 * "given": {
12414 * "Danny"
12420 * ),
12421 * @OA\Response(
12422 * response="200",
12423 * description="Standard Response",
12424 * @OA\MediaType(
12425 * mediaType="application/json",
12426 * @OA\Schema(
12427 * @OA\Property(
12428 * property="json object",
12429 * description="FHIR Json object.",
12430 * type="object"
12431 * ),
12432 * example={
12433 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12434 * "meta": {
12435 * "versionId": "1",
12436 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12437 * },
12438 * "resourceType": "Practitioner",
12439 * "text": {
12440 * "status": "generated",
12441 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12442 * },
12443 * "identifier": {
12445 * "system": "http://hl7.org/fhir/sid/us-npi",
12446 * "value": "11223344554543"
12448 * },
12449 * "active": true,
12450 * "name": {
12452 * "use": "official",
12453 * "family": "Smith",
12454 * "given": {
12455 * "Danny"
12462 * ),
12463 * @OA\Response(
12464 * response="400",
12465 * ref="#/components/responses/badrequest"
12466 * ),
12467 * @OA\Response(
12468 * response="401",
12469 * ref="#/components/responses/unauthorized"
12470 * ),
12471 * security={{"openemr_auth":{}}}
12474 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
12475 RestConfig::authorization_check("admin", "users");
12476 $data = (array) (json_decode(file_get_contents("php://input"), true));
12477 $return = (new FhirPractitionerRestController())->post($data);
12478 RestConfig::apiLog($return, $data);
12479 return $return;
12483 * @OA\Put(
12484 * path="/fhir/Practitioner/{uuid}",
12485 * description="Modify a Practitioner resource.",
12486 * tags={"fhir"},
12487 * @OA\Parameter(
12488 * name="uuid",
12489 * in="path",
12490 * description="The uuid for the Practitioner resource.",
12491 * required=true,
12492 * @OA\Schema(
12493 * type="string"
12495 * ),
12496 * @OA\RequestBody(
12497 * required=true,
12498 * @OA\MediaType(
12499 * mediaType="application/json",
12500 * @OA\Schema(
12501 * description="The json object for the Practitioner resource.",
12502 * type="object"
12503 * ),
12504 * example={
12505 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12506 * "meta": {
12507 * "versionId": "1",
12508 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12509 * },
12510 * "resourceType": "Practitioner",
12511 * "text": {
12512 * "status": "generated",
12513 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12514 * },
12515 * "identifier": {
12517 * "system": "http://hl7.org/fhir/sid/us-npi",
12518 * "value": "11223344554543"
12520 * },
12521 * "active": true,
12522 * "name": {
12524 * "use": "official",
12525 * "family": "Smith",
12526 * "given": {
12527 * "Billy"
12533 * ),
12534 * @OA\Response(
12535 * response="201",
12536 * description="Standard Response",
12537 * @OA\MediaType(
12538 * mediaType="application/json",
12539 * @OA\Schema(
12540 * example={
12541 * "id": 5,
12542 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12546 * ),
12547 * @OA\Response(
12548 * response="400",
12549 * ref="#/components/responses/badrequest"
12550 * ),
12551 * @OA\Response(
12552 * response="401",
12553 * ref="#/components/responses/unauthorized"
12554 * ),
12555 * security={{"openemr_auth":{}}}
12558 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12559 RestConfig::authorization_check("admin", "users");
12560 $data = (array) (json_decode(file_get_contents("php://input"), true));
12561 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12562 RestConfig::apiLog($return, $data);
12563 return $return;
12567 * @OA\Get(
12568 * path="/fhir/PractitionerRole",
12569 * description="Returns a list of PractitionerRole resources.",
12570 * tags={"fhir"},
12571 * @OA\Parameter(
12572 * name="specialty",
12573 * in="query",
12574 * description="The specialty of the PractitionerRole resource.",
12575 * required=false,
12576 * @OA\Schema(
12577 * type="string"
12579 * ),
12580 * @OA\Parameter(
12581 * name="practitioner",
12582 * in="query",
12583 * description="The practitioner of the PractitionerRole resource.",
12584 * required=false,
12585 * @OA\Schema(
12586 * type="string"
12588 * ),
12589 * @OA\Response(
12590 * response="200",
12591 * description="Standard Response",
12592 * @OA\MediaType(
12593 * mediaType="application/json",
12594 * @OA\Schema(
12595 * @OA\Property(
12596 * property="json object",
12597 * description="FHIR Json object.",
12598 * type="object"
12599 * ),
12600 * example={
12601 * "meta": {
12602 * "lastUpdated": "2021-09-14T09:13:51"
12603 * },
12604 * "resourceType": "Bundle",
12605 * "type": "collection",
12606 * "total": 0,
12607 * "link": {
12609 * "relation": "self",
12610 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12616 * ),
12617 * @OA\Response(
12618 * response="400",
12619 * ref="#/components/responses/badrequest"
12620 * ),
12621 * @OA\Response(
12622 * response="401",
12623 * ref="#/components/responses/unauthorized"
12624 * ),
12625 * security={{"openemr_auth":{}}}
12628 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12629 RestConfig::authorization_check("admin", "users");
12630 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12631 RestConfig::apiLog($return);
12632 return $return;
12636 * @OA\Get(
12637 * path="/fhir/PractitionerRole/{uuid}",
12638 * description="Returns a single PractitionerRole resource.",
12639 * tags={"fhir"},
12640 * @OA\Parameter(
12641 * name="uuid",
12642 * in="path",
12643 * description="The uuid for the PractitionerRole resource.",
12644 * required=true,
12645 * @OA\Schema(
12646 * type="string"
12648 * ),
12649 * @OA\Response(
12650 * response="200",
12651 * description="Standard Response",
12652 * @OA\MediaType(
12653 * mediaType="application/json",
12654 * @OA\Schema(
12655 * @OA\Property(
12656 * property="json object",
12657 * description="FHIR Json object.",
12658 * type="object"
12659 * ),
12660 * example={
12661 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12662 * "meta": {
12663 * "versionId": "1",
12664 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12665 * },
12666 * "resourceType": "PractitionerRole",
12667 * "practitioner": {
12668 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12669 * "display": "Administrator Administrator"
12670 * },
12671 * "organization": {
12672 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12673 * "display": "Your Clinic Name Here"
12674 * },
12675 * "code": {
12677 * "coding": {
12678 * "102L00000X"
12679 * },
12680 * "text": "Psychoanalyst"
12681 * },
12683 * "coding": {
12684 * "101Y00000X"
12685 * },
12686 * "text": "Counselor"
12692 * ),
12693 * @OA\Response(
12694 * response="400",
12695 * ref="#/components/responses/badrequest"
12696 * ),
12697 * @OA\Response(
12698 * response="401",
12699 * ref="#/components/responses/unauthorized"
12700 * ),
12701 * @OA\Response(
12702 * response="404",
12703 * ref="#/components/responses/uuidnotfound"
12704 * ),
12705 * security={{"openemr_auth":{}}}
12708 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12709 RestConfig::authorization_check("admin", "users");
12710 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12711 RestConfig::apiLog($return);
12712 return $return;
12716 * @OA\Get(
12717 * path="/fhir/Procedure",
12718 * description="Returns a list of Procedure resources.",
12719 * tags={"fhir"},
12720 * @OA\Parameter(
12721 * name="_id",
12722 * in="query",
12723 * description="The uuid for the Procedure resource.",
12724 * required=false,
12725 * @OA\Schema(
12726 * type="string"
12728 * ),
12729 * @OA\Parameter(
12730 * name="patient",
12731 * in="query",
12732 * description="The uuid for the patient.",
12733 * required=false,
12734 * @OA\Schema(
12735 * type="string"
12737 * ),
12738 * @OA\Parameter(
12739 * name="date",
12740 * in="query",
12741 * description="The datetime of the Procedure resource.",
12742 * required=false,
12743 * @OA\Schema(
12744 * type="string"
12746 * ),
12747 * @OA\Response(
12748 * response="200",
12749 * description="Standard Response",
12750 * @OA\MediaType(
12751 * mediaType="application/json",
12752 * @OA\Schema(
12753 * @OA\Property(
12754 * property="json object",
12755 * description="FHIR Json object.",
12756 * type="object"
12757 * ),
12758 * example={
12759 * "meta": {
12760 * "lastUpdated": "2021-09-14T09:13:51"
12761 * },
12762 * "resourceType": "Bundle",
12763 * "type": "collection",
12764 * "total": 0,
12765 * "link": {
12767 * "relation": "self",
12768 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12774 * ),
12775 * @OA\Response(
12776 * response="400",
12777 * ref="#/components/responses/badrequest"
12778 * ),
12779 * @OA\Response(
12780 * response="401",
12781 * ref="#/components/responses/unauthorized"
12782 * ),
12783 * security={{"openemr_auth":{}}}
12786 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12787 if ($request->isPatientRequest()) {
12788 // only allow access to data of binded patient
12789 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12790 } else {
12791 RestConfig::authorization_check("patients", "med");
12792 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12794 RestConfig::apiLog($return);
12795 return $return;
12799 * @OA\Get(
12800 * path="/fhir/Procedure/{uuid}",
12801 * description="Returns a single Procedure resource.",
12802 * tags={"fhir"},
12803 * @OA\Parameter(
12804 * name="uuid",
12805 * in="path",
12806 * description="The uuid for the Procedure resource.",
12807 * required=true,
12808 * @OA\Schema(
12809 * type="string"
12811 * ),
12812 * @OA\Response(
12813 * response="200",
12814 * description="Standard Response",
12815 * @OA\MediaType(
12816 * mediaType="application/json",
12817 * @OA\Schema(
12818 * @OA\Property(
12819 * property="json object",
12820 * description="FHIR Json object.",
12821 * type="object"
12822 * ),
12823 * example={
12824 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12825 * "meta": {
12826 * "versionId": "1",
12827 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12828 * },
12829 * "resourceType": "Procedure",
12830 * "status": "in-progress",
12831 * "subject": {
12832 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12833 * "type": "Patient"
12838 * ),
12839 * @OA\Response(
12840 * response="400",
12841 * ref="#/components/responses/badrequest"
12842 * ),
12843 * @OA\Response(
12844 * response="401",
12845 * ref="#/components/responses/unauthorized"
12846 * ),
12847 * @OA\Response(
12848 * response="404",
12849 * ref="#/components/responses/uuidnotfound"
12850 * ),
12851 * security={{"openemr_auth":{}}}
12854 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12855 if ($request->isPatientRequest()) {
12856 // only allow access to data of binded patient
12857 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12858 } else {
12859 RestConfig::authorization_check("patients", "med");
12860 $return = (new FhirProcedureRestController())->getOne($uuid);
12862 RestConfig::apiLog($return);
12863 return $return;
12867 * @OA\Get(
12868 * path="/fhir/Provenance/{uuid}",
12869 * description="Returns a single Provenance resource.",
12870 * tags={"fhir"},
12871 * @OA\Parameter(
12872 * name="uuid",
12873 * in="path",
12874 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12875 * required=true,
12876 * @OA\Schema(
12877 * type="string"
12879 * ),
12880 * @OA\Response(
12881 * response="200",
12882 * description="Standard Response",
12883 * @OA\MediaType(
12884 * mediaType="application/json",
12885 * @OA\Schema(
12886 * @OA\Property(
12887 * property="json object",
12888 * description="FHIR Json object.",
12889 * type="object"
12890 * ),
12891 * example={
12892 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12893 * "resourceType": "Provenance",
12894 * "target": {
12896 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12897 * "type": "AllergyIntolerance"
12899 * },
12900 * "recorded": "2022-03-26T22:43:30+00:00",
12901 * "agent": {
12903 * "type": {
12904 * "coding": {
12906 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12907 * "code": "author",
12908 * "display": "Author"
12911 * },
12912 * "who": {
12913 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12914 * "type": "Organization"
12915 * },
12916 * "onBehalfOf": {
12917 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12918 * "type": "Organization"
12920 * },
12922 * "type": {
12923 * "coding": {
12925 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12926 * "code": "transmitter",
12927 * "display": "Transmitter"
12931 * },
12932 * "who": {
12933 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12934 * "type": "Organization"
12935 * },
12936 * "onBehalfOf": {
12937 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12938 * "type": "Organization"
12944 * ),
12945 * @OA\Response(
12946 * response="400",
12947 * ref="#/components/responses/badrequest"
12948 * ),
12949 * @OA\Response(
12950 * response="401",
12951 * ref="#/components/responses/unauthorized"
12952 * ),
12953 * @OA\Response(
12954 * response="404",
12955 * ref="#/components/responses/uuidnotfound"
12956 * ),
12957 * security={{"openemr_auth":{}}}
12960 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12961 if ($request->isPatientRequest()) {
12962 // only allow access to data of binded patient
12963 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12964 } else {
12965 RestConfig::authorization_check("admin", "super");
12966 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12968 RestConfig::apiLog($return);
12969 return $return;
12973 * @OA\Get(
12974 * path="/fhir/Provenance",
12975 * description="Returns a list of Provenance resources.",
12976 * tags={"fhir"},
12977 * @OA\Parameter(
12978 * name="_id",
12979 * in="query",
12980 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12981 * required=false,
12982 * @OA\Schema(
12983 * type="string"
12985 * ),
12986 * @OA\Response(
12987 * response="200",
12988 * description="Standard Response",
12989 * @OA\MediaType(
12990 * mediaType="application/json",
12991 * @OA\Schema(
12992 * @OA\Property(
12993 * property="json object",
12994 * description="FHIR Json object.",
12995 * type="object"
12996 * ),
12997 * example={
12998 * "meta": {
12999 * "lastUpdated": "2021-09-14T09:13:51"
13000 * },
13001 * "resourceType": "Bundle",
13002 * "type": "collection",
13003 * "total": 0,
13004 * "link": {
13006 * "relation": "self",
13007 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
13013 * ),
13014 * @OA\Response(
13015 * response="400",
13016 * ref="#/components/responses/badrequest"
13017 * ),
13018 * @OA\Response(
13019 * response="401",
13020 * ref="#/components/responses/unauthorized"
13021 * ),
13022 * security={{"openemr_auth":{}}}
13025 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
13026 // property to support which is why this endpoint exists.
13027 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
13028 if ($request->isPatientRequest()) {
13029 // only allow access to data of binded patient
13030 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
13031 } else {
13032 // TODO: it seems like regular users should be able to grab authorship / provenance information
13033 RestConfig::authorization_check("admin", "super");
13034 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
13036 RestConfig::apiLog($return);
13037 return $return;
13041 * @OA\Get(
13042 * path="/fhir/ValueSet",
13043 * description="Returns a list of ValueSet resources.",
13044 * tags={"fhir"},
13045 * @OA\Parameter(
13046 * name="_id",
13047 * in="query",
13048 * description="The uuid for the ValueSet resource.",
13049 * required=false,
13050 * @OA\Schema(
13051 * type="string"
13053 * ),
13054 * @OA\Response(
13055 * response="200",
13056 * description="Standard Response",
13057 * @OA\MediaType(
13058 * mediaType="application/json",
13059 * @OA\Schema(
13060 * @OA\Property(
13061 * property="json object",
13062 * description="FHIR Json object.",
13063 * type="object"
13064 * ),
13065 * example={
13066 * "meta": {
13067 * "lastUpdated": "2021-09-14T09:13:51"
13068 * },
13069 * "resourceType": "Bundle",
13070 * "type": "collection",
13071 * "total": 0,
13072 * "link": {
13074 * "relation": "self",
13075 * "url": "https://localhost:9300/apis/default/fhir/ValueSet"
13081 * ),
13082 * @OA\Response(
13083 * response="400",
13084 * ref="#/components/responses/badrequest"
13085 * ),
13086 * @OA\Response(
13087 * response="401",
13088 * ref="#/components/responses/unauthorized"
13089 * ),
13090 * security={{"openemr_auth":{}}}
13093 "GET /fhir/ValueSet" => function (HttpRestRequest $request) {
13094 RestConfig::authorization_check("admin", "super");
13095 $return = (new FhirValueSetRestController())->getAll($request->getQueryParams());
13096 RestConfig::apiLog($return);
13097 return $return;
13101 * @OA\Get(
13102 * path="/fhir/ValueSet/{uuid}",
13103 * description="Returns a single ValueSet resource.",
13104 * tags={"fhir"},
13105 * @OA\Parameter(
13106 * name="uuid",
13107 * in="path",
13108 * description="The uuid for the ValueSet resource.",
13109 * required=true,
13110 * @OA\Schema(
13111 * type="string"
13113 * ),
13114 * @OA\Response(
13115 * response="200",
13116 * description="Standard Response",
13117 * @OA\MediaType(
13118 * mediaType="application/json",
13119 * @OA\Schema(
13120 * @OA\Property(
13121 * property="json object",
13122 * description="FHIR Json object.",
13123 * type="object"
13124 * ),
13125 * example={
13126 * "resourceType": "ValueSet",
13127 * "id": "appointment-type",
13128 * "compose": {
13129 * "include": {
13131 * "concept": {
13133 * "code": "no_show",
13134 * "display": "No Show"
13135 * },
13137 * "code": "office_visit",
13138 * "display": "Office Visit"
13139 * },
13141 * "code": "established_patient",
13142 * "display": "Established Patient"
13143 * },
13145 * "code": "new_patient",
13146 * "display": "New Patient"
13147 * },
13149 * "code": "health_and_behavioral_assessment",
13150 * "display": "Health and Behavioral Assessment"
13151 * },
13153 * "code": "preventive_care_services",
13154 * "display": "Preventive Care Services"
13155 * },
13157 * "code": "ophthalmological_services",
13158 * "display": "Ophthalmological Services"
13167 * ),
13168 * @OA\Response(
13169 * response="400",
13170 * ref="#/components/responses/badrequest"
13171 * ),
13172 * @OA\Response(
13173 * response="401",
13174 * ref="#/components/responses/unauthorized"
13175 * ),
13176 * @OA\Response(
13177 * response="404",
13178 * ref="#/components/responses/uuidnotfound"
13179 * ),
13180 * security={{"openemr_auth":{}}}
13183 "GET /fhir/ValueSet/:uuid" => function ($uuid, HttpRestRequest $request) {
13184 RestConfig::authorization_check("admin", "super");
13185 $return = (new FhirValueSetRestController())->getOne($uuid);
13186 RestConfig::apiLog($return);
13187 return $return;
13190 // other endpoints
13193 * @OA\Get(
13194 * path="/fhir/metadata",
13195 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
13196 * tags={"fhir"},
13197 * @OA\Response(
13198 * response="200",
13199 * description="Return CapabilityStatement resource of the fhir server"
13203 "GET /fhir/metadata" => function () {
13204 $return = (new FhirMetaDataRestController())->getMetaData();
13205 RestConfig::apiLog($return);
13206 return $return;
13210 * @OA\Get(
13211 * path="/fhir/.well-known/smart-configuration",
13212 * description="Returns smart configuration of the fhir server.",
13213 * tags={"fhir"},
13214 * @OA\Response(
13215 * response="200",
13216 * description="Return smart configuration of the fhir server"
13220 "GET /fhir/.well-known/smart-configuration" => function () {
13221 $authController = new \OpenEMR\RestControllers\AuthorizationController();
13222 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
13223 RestConfig::apiLog($return);
13224 return $return;
13228 * @OA\Get(
13229 * path="/fhir/OperationDefinition",
13230 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
13231 * tags={"fhir"},
13232 * @OA\Response(
13233 * response="200",
13234 * description="Return list of OperationDefinition resources"
13238 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
13239 // for now we will just hard code the custom resources
13240 $operationDefinitionController = new FhirOperationDefinitionRestController();
13241 $return = $operationDefinitionController->getAll($request->getQueryParams());
13242 RestConfig::apiLog($return);
13243 return $return;
13247 * @OA\Get(
13248 * path="/fhir/OperationDefinition/{operation}",
13249 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
13250 * tags={"fhir"},
13251 * @OA\Parameter(
13252 * name="operation",
13253 * in="path",
13254 * description="The name of the operation to query. For example $bulkdata-status",
13255 * required=true,
13256 * @OA\Schema(
13257 * type="string"
13259 * ),
13260 * @OA\Response(
13261 * response="200",
13262 * description="Standard Response",
13263 * @OA\MediaType(
13264 * mediaType="application/json",
13265 * @OA\Schema(
13266 * @OA\Property(
13267 * property="json object",
13268 * description="FHIR Json object.",
13269 * type="object"
13270 * ),
13271 * example={
13272 * "resourceType": "OperationDefinition",
13273 * "name": "$bulkdata-status",
13274 * "status": "active",
13275 * "kind": "operation",
13276 * "parameter": {
13278 * "name": "job",
13279 * "use": "in",
13280 * "min": 1,
13281 * "max": 1,
13282 * "type": {
13283 * "system": "http://hl7.org/fhir/data-types",
13284 * "code": "string",
13285 * "display": "string"
13286 * },
13287 * "searchType": {
13288 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13289 * "code": "string",
13290 * "display": "string"
13297 * ),
13300 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
13301 // for now we will just hard code the custom resources
13302 $operationDefinitionController = new FhirOperationDefinitionRestController();
13303 $return = $operationDefinitionController->getOne($operation);
13304 RestConfig::apiLog($return);
13305 return $return;
13308 // FHIR root level operations
13311 * @OA\Get(
13312 * path="/fhir/$export",
13313 * 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>",
13314 * tags={"fhir"},
13315 * @OA\Response(
13316 * response="200",
13317 * 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>"
13318 * ),
13319 * @OA\Response(
13320 * response="400",
13321 * ref="#/components/responses/badrequest"
13322 * ),
13323 * @OA\Response(
13324 * response="401",
13325 * ref="#/components/responses/unauthorized"
13326 * ),
13327 * security={{"openemr_auth":{}}}
13330 'GET /fhir/$export' => function (HttpRestRequest $request) {
13331 RestConfig::authorization_check("admin", "users");
13332 $fhirExportService = new FhirOperationExportRestController($request);
13333 $return = $fhirExportService->processExport(
13334 $request->getQueryParams(),
13335 'System',
13336 $request->getHeader('Accept')[0] ?? '',
13337 $request->getHeader('Prefer')[0] ?? ''
13339 RestConfig::apiLog($return);
13340 return $return;
13343 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13344 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13345 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13348 * @OA\Get(
13349 * path="/fhir/$bulkdata-status",
13350 * 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>",
13351 * tags={"fhir"},
13352 * @OA\Response(
13353 * response="200",
13354 * 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>"
13355 * ),
13356 * @OA\Response(
13357 * response="400",
13358 * ref="#/components/responses/badrequest"
13359 * ),
13360 * @OA\Response(
13361 * response="401",
13362 * ref="#/components/responses/unauthorized"
13363 * ),
13364 * security={{"openemr_auth":{}}}
13367 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13368 RestConfig::authorization_check("admin", "users");
13369 $jobUuidString = $request->getQueryParam('job');
13370 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13371 // since OpenEMR data is so small we just return the JSON from the database
13372 $fhirExportService = new FhirOperationExportRestController($request);
13373 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13374 RestConfig::apiLog($return);
13375 return $return;
13379 * @OA\Delete(
13380 * path="/fhir/$bulkdata-status",
13381 * 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>",
13382 * tags={"fhir"},
13383 * @OA\Response(
13384 * response="200",
13385 * 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>"
13386 * ),
13387 * @OA\Response(
13388 * response="400",
13389 * ref="#/components/responses/badrequest"
13390 * ),
13391 * @OA\Response(
13392 * response="401",
13393 * ref="#/components/responses/unauthorized"
13394 * ),
13395 * security={{"openemr_auth":{}}}
13398 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13399 RestConfig::authorization_check("admin", "users");
13400 $job = $request->getQueryParam('job');
13401 $fhirExportService = new FhirOperationExportRestController($request);
13402 $return = $fhirExportService->processDeleteExportForJob($job);
13403 RestConfig::apiLog($return);
13404 return $return;
13408 // Note that the portal (api) route is only for patient role
13409 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13410 RestConfig::$PORTAL_ROUTE_MAP = array(
13412 * @OA\Get(
13413 * path="/portal/patient",
13414 * description="Returns the patient.",
13415 * tags={"standard-patient"},
13416 * @OA\Response(
13417 * response="200",
13418 * description="Standard response",
13419 * @OA\MediaType(
13420 * mediaType="application/json",
13421 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13423 * ),
13424 * @OA\Response(
13425 * response="401",
13426 * ref="#/components/responses/unauthorized"
13427 * ),
13428 * security={{"openemr_auth":{}}}
13431 "GET /portal/patient" => function (HttpRestRequest $request) {
13432 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13433 RestConfig::apiLog($return);
13434 return $return;
13438 * @OA\Get(
13439 * path="/portal/patient/encounter",
13440 * description="Returns encounters for the patient.",
13441 * tags={"standard-patient"},
13442 * @OA\Response(
13443 * response="200",
13444 * ref="#/components/responses/standard"
13445 * ),
13446 * @OA\Response(
13447 * response="400",
13448 * ref="#/components/responses/badrequest"
13449 * ),
13450 * @OA\Response(
13451 * response="401",
13452 * ref="#/components/responses/unauthorized"
13453 * ),
13454 * security={{"openemr_auth":{}}}
13457 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
13458 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13459 RestConfig::apiLog($return);
13460 return $return;
13464 * @OA\Get(
13465 * path="/portal/patient/encounter/{euuid}",
13466 * description="Returns a selected encounter by its uuid.",
13467 * tags={"standard-patient"},
13468 * @OA\Parameter(
13469 * name="euuid",
13470 * in="path",
13471 * description="The uuid for the encounter.",
13472 * required=true,
13473 * @OA\Schema(
13474 * type="string"
13476 * ),
13477 * @OA\Response(
13478 * response="200",
13479 * ref="#/components/responses/standard"
13480 * ),
13481 * @OA\Response(
13482 * response="400",
13483 * ref="#/components/responses/badrequest"
13484 * ),
13485 * @OA\Response(
13486 * response="401",
13487 * ref="#/components/responses/unauthorized"
13488 * ),
13489 * security={{"openemr_auth":{}}}
13492 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
13493 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13494 RestConfig::apiLog($return);
13495 return $return;
13499 * @OA\Get(
13500 * path="/portal/patient/appointment",
13501 * description="Retrieves all appointments for a patient",
13502 * tags={"standard-patient"},
13503 * @OA\Response(
13504 * response="200",
13505 * ref="#/components/responses/standard"
13506 * ),
13507 * @OA\Response(
13508 * response="400",
13509 * ref="#/components/responses/badrequest"
13510 * ),
13511 * @OA\Response(
13512 * response="401",
13513 * ref="#/components/responses/unauthorized"
13514 * ),
13515 * security={{"openemr_auth":{}}}
13518 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
13519 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13520 RestConfig::apiLog($return);
13521 return $return;
13526 * @OA\Get(
13527 * path="/portal/patient/appointment/{auuid}",
13528 * description="Returns a selected appointment by its uuid.",
13529 * tags={"standard-patient"},
13530 * @OA\Parameter(
13531 * name="auuid",
13532 * in="path",
13533 * description="The uuid for the appointment.",
13534 * required=true,
13535 * @OA\Schema(
13536 * type="string"
13538 * ),
13539 * @OA\Response(
13540 * response="200",
13541 * ref="#/components/responses/standard"
13542 * ),
13543 * @OA\Response(
13544 * response="400",
13545 * ref="#/components/responses/badrequest"
13546 * ),
13547 * @OA\Response(
13548 * response="401",
13549 * ref="#/components/responses/unauthorized"
13550 * ),
13551 * security={{"openemr_auth":{}}}
13554 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
13555 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13556 RestConfig::apiLog($return);
13557 return $return;