fix: Uninitialised zip and missing file size error in Native Data Loads (#7081)
[openemr.git] / _rest_routes.inc.php
blobe39c594abb021382578ee6f52b8e7e376b60c60e
1 <?php
3 /**
4 * Routes
5 * (All REST routes)
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Matthew Vita <matthewvita48@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @author Yash Raj Bothra <yashrajbothra786@gmail.com>
13 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
14 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
15 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 /**
21 * @OA\Info(title="OpenEMR API", version="7.0.3")
22 * @OA\Server(url="/apis/default/")
23 * @OA\SecurityScheme(
24 * securityScheme="openemr_auth",
25 * type="oauth2",
26 * @OA\Flow(
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
31 * scopes={
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
35 * "api:fhir": "FHIR R4 API",
36 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
37 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
38 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
39 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
40 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
41 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
42 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
43 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
44 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
46 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
47 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
48 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
49 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
50 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
51 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
52 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
53 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
54 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
55 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
56 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
57 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
58 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
59 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
60 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
61 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
62 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
63 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
64 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
65 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
66 * "system/Device.read": "Read all device resources in the system (api:fhir)",
67 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
68 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
69 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
70 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
71 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
72 * "system/Group.read": "Read all group resources in the system (api:fhir)",
73 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
74 * "system/Location.read": "Read all location resources in the system (api:fhir)",
75 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
76 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
77 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
78 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
79 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
80 * "system/Person.read": "Read all person resources in the system (api:fhir)",
81 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
82 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
83 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
84 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
85 * "system/ValueSet.read": "Read all valueSet resources in the system (api:fhir)",
86 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
87 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
88 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
89 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
90 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
91 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
92 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
93 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
94 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
95 * "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)",
96 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
97 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
98 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
99 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
100 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
101 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
102 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
103 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
104 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
105 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
106 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
107 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
108 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
109 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
110 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
111 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
112 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
113 * "user/ValueSet.read": "Read all valueSet resources the user has access to (api:fhir)",
114 * "api:oemr": "Standard OpenEMR API",
115 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
116 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
117 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
118 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
119 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
120 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
121 * "user/document.read": "Read documents the user has access to (api:oemr)",
122 * "user/document.write": "Write documents the user has access to (api:oemr)",
123 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
124 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
125 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
126 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
127 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
128 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
129 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
130 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
131 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
132 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
133 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
134 * "user/list.read": "Read lists the user has access to (api:oemr)",
135 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
136 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
137 * "user/medication.read": "Read medications the user has access to (api:oemr)",
138 * "user/medication.write": "Write medications the user has access to (api:oemr)",
139 * "user/message.write": "Read messages the user has access to (api:oemr)",
140 * "user/patient.read": "Read patients the user has access to (api:oemr)",
141 * "user/patient.write": "Write patients the user has access to (api:oemr)",
142 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
143 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
144 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
145 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
146 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
147 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
148 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
149 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
150 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
151 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
152 * "user/user.read": "Read users the current user has access to (api:oemr)",
153 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
154 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
155 * "api:port": "Standard Patient Portal OpenEMR API",
156 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
157 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
158 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
162 * @OA\Tag(
163 * name="fhir",
164 * description="FHIR R4 API"
166 * @OA\Tag(
167 * name="standard",
168 * description="Standard OpenEMR API"
170 * @OA\Tag(
171 * name="standard-patient",
172 * description="Standard Patient Portal OpenEMR API"
174 * @OA\Parameter(
175 * name="_sort",
176 * in="query",
177 * parameter="_sort",
178 * 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)",
179 * required=false,
180 * @OA\Schema(
181 * type="string"
184 * @OA\Parameter(
185 * name="_lastUpdated",
186 * in="query",
187 * parameter="_lastUpdated",
188 * description="The date the resource was last updated.",
189 * required=false,
190 * @OA\Schema(
191 * type="string"
194 * @OA\Response(
195 * response="standard",
196 * description="Standard Response",
197 * @OA\MediaType(
198 * mediaType="application/json",
199 * @OA\Schema(
200 * @OA\Property(
201 * property="validationErrors",
202 * description="Validation errors.",
203 * type="array",
204 * @OA\Items(
205 * type="object",
206 * ),
207 * ),
208 * @OA\Property(
209 * property="internalErrors",
210 * description="Internal errors.",
211 * type="array",
212 * @OA\Items(
213 * type="object",
214 * ),
215 * ),
216 * @OA\Property(
217 * property="data",
218 * description="Returned data.",
219 * type="array",
220 * @OA\Items(
221 * type="object",
222 * ),
223 * ),
224 * example={
225 * "validationErrors": {},
226 * "error_description": {},
227 * "data": {}
232 * @OA\Response(
233 * response="badrequest",
234 * description="Bad Request",
235 * @OA\MediaType(
236 * mediaType="application/json",
237 * @OA\Schema(
238 * @OA\Property(
239 * property="validationErrors",
240 * description="Validation errors.",
241 * type="object"
242 * ),
243 * example={
244 * "validationErrors":
246 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
252 * @OA\Response(
253 * response="unauthorized",
254 * description="Unauthorized",
255 * @OA\MediaType(
256 * mediaType="application/json",
257 * @OA\Schema(
258 * @OA\Property(
259 * property="error",
260 * description="The error.",
261 * type="string"
262 * ),
263 * @OA\Property(
264 * property="error_description",
265 * description="The description of the error.",
266 * type="string"
267 * ),
268 * @OA\Property(
269 * property="hint",
270 * description="More specific information on the error.",
271 * type="string"
272 * ),
273 * @OA\Property(
274 * property="message",
275 * description="Message regarding the error.",
276 * type="string"
277 * ),
278 * example={
279 * "error": "access_denied",
280 * "error_description": "The resource owner or authorization server denied the request.",
281 * "hint": "Missing ""Authorization"" header",
282 * "message": "The resource owner or authorization server denied the request."
287 * @OA\Response(
288 * response="uuidnotfound",
289 * description="Not Found",
290 * @OA\MediaType(
291 * mediaType="application/json",
292 * @OA\Schema(
293 * @OA\Property(
294 * property="empty",
295 * description="empty",
296 * type="object"
297 * ),
298 * example={}
304 // Lets keep our controller classes with the routes.
306 use OpenEMR\Common\Acl\AccessDeniedException;
307 use OpenEMR\Common\Http\HttpRestRequest;
308 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
309 use OpenEMR\RestControllers\FacilityRestController;
310 use OpenEMR\RestControllers\VersionRestController;
311 use OpenEMR\RestControllers\ProductRegistrationRestController;
312 use OpenEMR\RestControllers\PatientRestController;
313 use OpenEMR\RestControllers\EncounterRestController;
314 use OpenEMR\RestControllers\PractitionerRestController;
315 use OpenEMR\RestControllers\ListRestController;
316 use OpenEMR\RestControllers\InsuranceCompanyRestController;
317 use OpenEMR\RestControllers\AppointmentRestController;
318 use OpenEMR\RestControllers\ConditionRestController;
319 use OpenEMR\RestControllers\ONoteRestController;
320 use OpenEMR\RestControllers\DocumentRestController;
321 use OpenEMR\RestControllers\DrugRestController;
322 use OpenEMR\RestControllers\ImmunizationRestController;
323 use OpenEMR\RestControllers\InsuranceRestController;
324 use OpenEMR\RestControllers\MessageRestController;
325 use OpenEMR\RestControllers\PrescriptionRestController;
326 use OpenEMR\RestControllers\ProcedureRestController;
327 use OpenEMR\RestControllers\TransactionRestController;
328 use OpenEMR\RestControllers\UserRestController;
329 use OpenEMR\Services\Search\SearchQueryConfig;
331 // Note some Http clients may not send auth as json so a function
332 // is implemented to determine and parse encoding on auth route's.
334 // Note that the api route is only for users role
335 // (there is a mechanism in place to ensure only user role can access the api route)
336 RestConfig::$ROUTE_MAP = array(
338 * @OA\Get(
339 * path="/api/facility",
340 * description="Returns a single facility.",
341 * tags={"standard"},
342 * @OA\Parameter(
343 * name="name",
344 * in="query",
345 * description="The name for the facility.",
346 * required=false,
347 * @OA\Schema(
348 * type="string"
350 * ),
351 * @OA\Parameter(
352 * name="facility_npi",
353 * in="query",
354 * description="The facility_npi for the facility.",
355 * required=false,
356 * @OA\Schema(
357 * type="string"
359 * ),
360 * @OA\Parameter(
361 * name="phone",
362 * in="query",
363 * description="The phone for the facility.",
364 * required=false,
365 * @OA\Schema(
366 * type="string"
368 * ),
369 * @OA\Parameter(
370 * name="fax",
371 * in="query",
372 * description="The fax for the facility.",
373 * required=false,
374 * @OA\Schema(
375 * type="string"
377 * ),
378 * @OA\Parameter(
379 * name="street",
380 * in="query",
381 * description="The street for the facility.",
382 * required=false,
383 * @OA\Schema(
384 * type="string"
386 * ),
387 * @OA\Parameter(
388 * name="city",
389 * in="query",
390 * description="The city for the facility.",
391 * required=false,
392 * @OA\Schema(
393 * type="string"
395 * ),
396 * @OA\Parameter(
397 * name="state",
398 * in="query",
399 * description="The state for the facility.",
400 * required=false,
401 * @OA\Schema(
402 * type="string"
404 * ),
405 * @OA\Parameter(
406 * name="postal_code",
407 * in="query",
408 * description="The postal_code for the facility.",
409 * required=false,
410 * @OA\Schema(
411 * type="string"
413 * ),
414 * @OA\Parameter(
415 * name="country_code",
416 * in="query",
417 * description="The country_code for the facility.",
418 * required=false,
419 * @OA\Schema(
420 * type="string"
422 * ),
423 * @OA\Parameter(
424 * name="federal_ein",
425 * in="query",
426 * description="The federal_ein for the facility.",
427 * required=false,
428 * @OA\Schema(
429 * type="string"
431 * ),
432 * @OA\Parameter(
433 * name="website",
434 * in="query",
435 * description="The website for the facility.",
436 * required=false,
437 * @OA\Schema(
438 * type="string"
440 * ),
441 * @OA\Parameter(
442 * name="email",
443 * in="query",
444 * description="The email for the facility.",
445 * required=false,
446 * @OA\Schema(
447 * type="string"
449 * ),
450 * @OA\Parameter(
451 * name="domain_identifier",
452 * in="query",
453 * description="The domain_identifier for the facility.",
454 * required=false,
455 * @OA\Schema(
456 * type="string"
458 * ),
459 * @OA\Parameter(
460 * name="facility_taxonomy",
461 * in="query",
462 * description="The facility_taxonomy for the facility.",
463 * required=false,
464 * @OA\Schema(
465 * type="string"
467 * ),
468 * @OA\Parameter(
469 * name="facility_code",
470 * in="query",
471 * description="The facility_code for the facility.",
472 * required=false,
473 * @OA\Schema(
474 * type="string"
476 * ),
477 * @OA\Parameter(
478 * name="billing_location",
479 * in="query",
480 * description="The billing_location setting for the facility.",
481 * required=false,
482 * @OA\Schema(
483 * type="string"
485 * ),
486 * @OA\Parameter(
487 * name="accepts_assignment",
488 * in="query",
489 * description="The accepts_assignment setting for the facility.",
490 * required=false,
491 * @OA\Schema(
492 * type="string"
494 * ),
495 * @OA\Parameter(
496 * name="oid",
497 * in="query",
498 * description="The oid for the facility.",
499 * required=false,
500 * @OA\Schema(
501 * type="string"
503 * ),
504 * @OA\Parameter(
505 * name="service_location",
506 * in="query",
507 * description="The service_location setting for the facility.",
508 * required=false,
509 * @OA\Schema(
510 * type="string"
512 * ),
513 * @OA\Response(
514 * response="200",
515 * ref="#/components/responses/standard"
516 * ),
517 * @OA\Response(
518 * response="400",
519 * ref="#/components/responses/badrequest"
520 * ),
521 * @OA\Response(
522 * response="401",
523 * ref="#/components/responses/unauthorized"
524 * ),
525 * security={{"openemr_auth":{}}}
528 "GET /api/facility" => function () {
529 RestConfig::authorization_check("admin", "users");
530 $return = (new FacilityRestController())->getAll($_GET);
531 RestConfig::apiLog($return);
532 return $return;
536 * @OA\Get(
537 * path="/api/facility/{fuuid}",
538 * description="Returns a single facility.",
539 * tags={"standard"},
540 * @OA\Parameter(
541 * name="fuuid",
542 * in="path",
543 * description="The uuid for the facility.",
544 * required=true,
545 * @OA\Schema(
546 * type="string"
548 * ),
549 * @OA\Response(
550 * response="200",
551 * ref="#/components/responses/standard"
552 * ),
553 * @OA\Response(
554 * response="400",
555 * ref="#/components/responses/badrequest"
556 * ),
557 * @OA\Response(
558 * response="401",
559 * ref="#/components/responses/unauthorized"
560 * ),
561 * security={{"openemr_auth":{}}}
564 "GET /api/facility/:fuuid" => function ($fuuid) {
565 RestConfig::authorization_check("admin", "users");
566 $return = (new FacilityRestController())->getOne($fuuid);
567 RestConfig::apiLog($return);
568 return $return;
572 * @OA\Post(
573 * path="/api/facility",
574 * description="Creates a facility in the system",
575 * tags={"standard"},
576 * @OA\RequestBody(
577 * required=true,
578 * @OA\MediaType(
579 * mediaType="application/json",
580 * @OA\Schema(
581 * @OA\Property(
582 * property="name",
583 * description="The name for the facility.",
584 * type="string"
585 * ),
586 * @OA\Property(
587 * property="facility_npi",
588 * description="The facility_npi for the facility.",
589 * type="string"
590 * ),
591 * @OA\Property(
592 * property="phone",
593 * description="The phone for the facility.",
594 * type="string"
595 * ),
596 * @OA\Property(
597 * property="fax",
598 * description="The fax for the facility.",
599 * type="string"
600 * ),
601 * @OA\Property(
602 * property="street",
603 * description="The street for the facility.",
604 * type="string"
605 * ),
606 * @OA\Property(
607 * property="city",
608 * description="The city for the facility.",
609 * type="string"
610 * ),
611 * @OA\Property(
612 * property="state",
613 * description="The state for the facility.",
614 * type="string"
615 * ),
616 * @OA\Property(
617 * property="postal_code",
618 * description="The postal_code for the facility.",
619 * type="string"
620 * ),
621 * @OA\Property(
622 * property="country_code",
623 * description="The country_code for the facility.",
624 * type="string"
625 * ),
626 * @OA\Property(
627 * property="federal_ein",
628 * description="The federal_ein for the facility.",
629 * type="string"
630 * ),
631 * @OA\Property(
632 * property="website",
633 * description="The website for the facility.",
634 * type="string"
635 * ),
636 * @OA\Property(
637 * property="email",
638 * description="The email for the facility.",
639 * type="string"
640 * ),
641 * @OA\Property(
642 * property="domain_identifier",
643 * description="The domain_identifier for the facility.",
644 * type="string"
645 * ),
646 * @OA\Property(
647 * property="facility_taxonomy",
648 * description="The facility_taxonomy for the facility.",
649 * type="string"
650 * ),
651 * @OA\Property(
652 * property="facility_code",
653 * description="The facility_code for the facility.",
654 * type="string"
655 * ),
656 * @OA\Property(
657 * property="billing_location",
658 * description="The billing_location setting for the facility.",
659 * type="string"
660 * ),
661 * @OA\Property(
662 * property="accepts_assignment",
663 * description="The accepts_assignment setting for the facility.",
664 * type="string"
665 * ),
666 * @OA\Property(
667 * property="oid",
668 * description="The oid for the facility.",
669 * type="string"
670 * ),
671 * @OA\Property(
672 * property="service_location",
673 * description="The service_location setting for the facility.",
674 * type="string"
675 * ),
676 * required={"name", "facility_npi"},
677 * example={
678 * "name": "Aquaria",
679 * "facility_npi": "123456789123",
680 * "phone": "808-606-3030",
681 * "fax": "808-606-3031",
682 * "street": "1337 Bit Shifter Ln",
683 * "city": "San Lorenzo",
684 * "state": "ZZ",
685 * "postal_code": "54321",
686 * "country_code": "US",
687 * "federal_ein": "4343434",
688 * "website": "https://example.com",
689 * "email": "foo@bar.com",
690 * "domain_identifier": "",
691 * "facility_taxonomy": "",
692 * "facility_code": "",
693 * "billing_location": "1",
694 * "accepts_assignment": "1",
695 * "oid": "",
696 * "service_location": "1"
700 * ),
701 * @OA\Response(
702 * response="200",
703 * ref="#/components/responses/standard"
704 * ),
705 * @OA\Response(
706 * response="400",
707 * ref="#/components/responses/badrequest"
708 * ),
709 * @OA\Response(
710 * response="401",
711 * ref="#/components/responses/unauthorized"
712 * ),
713 * security={{"openemr_auth":{}}}
716 "POST /api/facility" => function () {
717 RestConfig::authorization_check("admin", "super");
718 $data = (array) (json_decode(file_get_contents("php://input")));
719 $return = (new FacilityRestController())->post($data);
720 RestConfig::apiLog($return, $data);
721 return $return;
725 * @OA\Put(
726 * path="/api/facility/{fuuid}",
727 * description="Updates a facility in the system",
728 * tags={"standard"},
729 * @OA\Parameter(
730 * name="fuuid",
731 * in="path",
732 * description="The uuid for the facility.",
733 * required=true,
734 * @OA\Schema(
735 * type="string"
737 * ),
738 * @OA\RequestBody(
739 * required=true,
740 * @OA\MediaType(
741 * mediaType="application/json",
742 * @OA\Schema(
743 * @OA\Property(
744 * property="name",
745 * description="The name for the facility.",
746 * type="string"
747 * ),
748 * @OA\Property(
749 * property="facility_npi",
750 * description="The facility_npi for the facility.",
751 * type="string"
752 * ),
753 * @OA\Property(
754 * property="phone",
755 * description="The phone for the facility.",
756 * type="string"
757 * ),
758 * @OA\Property(
759 * property="fax",
760 * description="The fax for the facility.",
761 * type="string"
762 * ),
763 * @OA\Property(
764 * property="street",
765 * description="The street for the facility.",
766 * type="string"
767 * ),
768 * @OA\Property(
769 * property="city",
770 * description="The city for the facility.",
771 * type="string"
772 * ),
773 * @OA\Property(
774 * property="state",
775 * description="The state for the facility.",
776 * type="string"
777 * ),
778 * @OA\Property(
779 * property="postal_code",
780 * description="The postal_code for the facility.",
781 * type="string"
782 * ),
783 * @OA\Property(
784 * property="country_code",
785 * description="The country_code for the facility.",
786 * type="string"
787 * ),
788 * @OA\Property(
789 * property="federal_ein",
790 * description="The federal_ein for the facility.",
791 * type="string"
792 * ),
793 * @OA\Property(
794 * property="website",
795 * description="The website for the facility.",
796 * type="string"
797 * ),
798 * @OA\Property(
799 * property="email",
800 * description="The email for the facility.",
801 * type="string"
802 * ),
803 * @OA\Property(
804 * property="domain_identifier",
805 * description="The domain_identifier for the facility.",
806 * type="string"
807 * ),
808 * @OA\Property(
809 * property="facility_taxonomy",
810 * description="The facility_taxonomy for the facility.",
811 * type="string"
812 * ),
813 * @OA\Property(
814 * property="facility_code",
815 * description="The facility_code for the facility.",
816 * type="string"
817 * ),
818 * @OA\Property(
819 * property="billing_location",
820 * description="The billing_location setting for the facility.",
821 * type="string"
822 * ),
823 * @OA\Property(
824 * property="accepts_assignment",
825 * description="The accepts_assignment setting for the facility.",
826 * type="string"
827 * ),
828 * @OA\Property(
829 * property="oid",
830 * description="The oid for the facility.",
831 * type="string"
832 * ),
833 * @OA\Property(
834 * property="service_location",
835 * description="The service_location setting for the facility.",
836 * type="string"
837 * ),
838 * example={
839 * "name": "Aquaria",
840 * "facility_npi": "123456789123",
841 * "phone": "808-606-3030",
842 * "fax": "808-606-3031",
843 * "street": "1337 Bit Shifter Ln",
844 * "city": "San Lorenzo",
845 * "state": "ZZ",
846 * "postal_code": "54321",
847 * "country_code": "US",
848 * "federal_ein": "4343434",
849 * "website": "https://example.com",
850 * "email": "foo@bar.com",
851 * "domain_identifier": "",
852 * "facility_taxonomy": "",
853 * "facility_code": "",
854 * "billing_location": "1",
855 * "accepts_assignment": "1",
856 * "oid": "",
857 * "service_location": "1"
861 * ),
862 * @OA\Response(
863 * response="200",
864 * ref="#/components/responses/standard"
865 * ),
866 * @OA\Response(
867 * response="400",
868 * ref="#/components/responses/badrequest"
869 * ),
870 * @OA\Response(
871 * response="401",
872 * ref="#/components/responses/unauthorized"
873 * ),
874 * security={{"openemr_auth":{}}}
877 "PUT /api/facility/:fuuid" => function ($fuuid) {
878 RestConfig::authorization_check("admin", "super");
879 $data = (array) (json_decode(file_get_contents("php://input")));
880 $return = (new FacilityRestController())->patch($fuuid, $data);
881 RestConfig::apiLog($return, $data);
882 return $return;
886 * @OA\Get(
887 * path="/api/patient",
888 * description="Retrieves a list of patients",
889 * tags={"standard"},
890 * @OA\Parameter(
891 * ref="#/components/parameters/_sort"
892 * ),
893 * @OA\Parameter(
894 * name="fname",
895 * in="query",
896 * description="The first name for the patient.",
897 * required=false,
898 * @OA\Schema(
899 * type="string"
901 * ),
902 * @OA\Parameter(
903 * name="lname",
904 * in="query",
905 * description="The last name for the patient.",
906 * required=false,
907 * @OA\Schema(
908 * type="string"
910 * ),
911 * @OA\Parameter(
912 * name="ss",
913 * in="query",
914 * description="The social security number for the patient.",
915 * required=false,
916 * @OA\Schema(
917 * type="string"
919 * ),
920 * @OA\Parameter(
921 * name="street",
922 * in="query",
923 * description="The street for the patient.",
924 * required=false,
925 * @OA\Schema(
926 * type="string"
928 * ),
929 * @OA\Parameter(
930 * name="postal_code",
931 * in="query",
932 * description="The postal code for the patient.",
933 * required=false,
934 * @OA\Schema(
935 * type="string"
937 * ),
938 * @OA\Parameter(
939 * name="city",
940 * in="query",
941 * description="The city for the patient.",
942 * required=false,
943 * @OA\Schema(
944 * type="string"
946 * ),
947 * @OA\Parameter(
948 * name="state",
949 * in="query",
950 * description="The state for the patient.",
951 * required=false,
952 * @OA\Schema(
953 * type="string"
955 * ),
956 * @OA\Parameter(
957 * name="phone_home",
958 * in="query",
959 * description="The home phone for the patient.",
960 * required=false,
961 * @OA\Schema(
962 * type="string"
964 * ),
965 * @OA\Parameter(
966 * name="phone_biz",
967 * in="query",
968 * description="The business phone for the patient.",
969 * required=false,
970 * @OA\Schema(
971 * type="string"
973 * ),
974 * @OA\Parameter(
975 * name="phone_cell",
976 * in="query",
977 * description="The cell phone for the patient.",
978 * required=false,
979 * @OA\Schema(
980 * type="string"
982 * ),
983 * @OA\Parameter(
984 * name="postal_contact",
985 * in="query",
986 * description="The postal_contact for the patient.",
987 * required=false,
988 * @OA\Schema(
989 * type="string"
991 * ),
992 * @OA\Parameter(
993 * name="sex",
994 * in="query",
995 * description="The gender for the patient.",
996 * required=false,
997 * @OA\Schema(
998 * type="string"
1000 * ),
1001 * @OA\Parameter(
1002 * name="country_code",
1003 * in="query",
1004 * description="The country code for the patient.",
1005 * required=false,
1006 * @OA\Schema(
1007 * type="string"
1009 * ),
1010 * @OA\Parameter(
1011 * name="email",
1012 * in="query",
1013 * description="The email for the patient.",
1014 * required=false,
1015 * @OA\Schema(
1016 * type="string"
1018 * ),
1019 * @OA\Parameter(
1020 * name="DOB",
1021 * in="query",
1022 * description="The DOB for the patient.",
1023 * required=false,
1024 * @OA\Schema(
1025 * type="string"
1027 * ),
1028 * @OA\Parameter(
1029 * name="date",
1030 * in="query",
1031 * description="The date this patient resource was last modified.",
1032 * required=false,
1033 * @OA\Schema(
1034 * type="string"
1036 * ),
1037 * @OA\Parameter(
1038 * name="_offset",
1039 * in="query",
1040 * description="The number of records to offset from this index in the search result.",
1041 * required=false,
1042 * @OA\Schema(
1043 * type="integer"
1045 * ),
1046 * @OA\Parameter(
1047 * name="_limit",
1048 * in="query",
1049 * description="The maximum number of resources to return in the result set. 0 means unlimited.",
1050 * required=false,
1051 * @OA\Schema(
1052 * type="integer"
1053 * ,minimum=0
1054 * ,maximum=200
1056 * ),
1057 * @OA\Response(
1058 * response="200",
1059 * ref="#/components/responses/standard"
1060 * ),
1061 * @OA\Response(
1062 * response="400",
1063 * ref="#/components/responses/badrequest"
1064 * ),
1065 * @OA\Response(
1066 * response="401",
1067 * ref="#/components/responses/unauthorized"
1068 * ),
1069 * security={{"openemr_auth":{}}}
1072 "GET /api/patient" => function () {
1073 RestConfig::authorization_check("patients", "demo");
1074 $config = SearchQueryConfig::createConfigFromQueryParams($_GET);
1075 $return = (new PatientRestController())->getAll($_GET, $config);
1076 RestConfig::apiLog($return);
1077 return $return;
1081 * Schema for the patient request
1083 * @OA\Schema(
1084 * schema="api_patient_request",
1085 * @OA\Property(
1086 * property="title",
1087 * description="The title of patient.",
1088 * type="string"
1089 * ),
1090 * @OA\Property(
1091 * property="fname",
1092 * description="The fname of patient.",
1093 * type="string"
1094 * ),
1095 * @OA\Property(
1096 * property="mname",
1097 * description="The mname of patient.",
1098 * type="string"
1099 * ),
1100 * @OA\Property(
1101 * property="lname",
1102 * description="The lname of patient.",
1103 * type="string"
1104 * ),
1105 * @OA\Property(
1106 * property="street",
1107 * description="The street address of patient.",
1108 * type="string"
1109 * ),
1110 * @OA\Property(
1111 * property="postal_code",
1112 * description="The postal code of patient.",
1113 * type="string"
1114 * ),
1115 * @OA\Property(
1116 * property="city",
1117 * description="The city of patient.",
1118 * type="string"
1119 * ),
1120 * @OA\Property(
1121 * property="state",
1122 * description="The state of patient.",
1123 * type="string"
1124 * ),
1125 * @OA\Property(
1126 * property="country_code",
1127 * description="The country code of patient.",
1128 * type="string"
1129 * ),
1130 * @OA\Property(
1131 * property="phone_contact",
1132 * description="The phone contact of patient.",
1133 * type="string"
1134 * ),
1135 * @OA\Property(
1136 * property="DOB",
1137 * description="The DOB of patient.",
1138 * type="string"
1139 * ),
1140 * @OA\Property(
1141 * property="sex",
1142 * description="The lname of patient.",
1143 * type="string"
1144 * ),
1145 * @OA\Property(
1146 * property="race",
1147 * description="The race of patient.",
1148 * type="string"
1149 * ),
1150 * @OA\Property(
1151 * property="ethnicity",
1152 * description="The ethnicity of patient.",
1153 * type="string"
1154 * ),
1155 * required={"fname", "lname", "DOB", "sex"},
1156 * example={
1157 * "title": "Mr",
1158 * "fname": "Foo",
1159 * "mname": "",
1160 * "lname": "Bar",
1161 * "street": "456 Tree Lane",
1162 * "postal_code": "08642",
1163 * "city": "FooTown",
1164 * "state": "FL",
1165 * "country_code": "US",
1166 * "phone_contact": "123-456-7890",
1167 * "DOB": "1992-02-02",
1168 * "sex": "Male",
1169 * "race": "",
1170 * "ethnicity": ""
1175 * @OA\Post(
1176 * path="/api/patient",
1177 * description="Creates a new patient",
1178 * tags={"standard"},
1179 * @OA\RequestBody(
1180 * required=true,
1181 * @OA\MediaType(
1182 * mediaType="application/json",
1183 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1185 * ),
1186 * @OA\Response(
1187 * response="200",
1188 * description="Standard response",
1189 * @OA\MediaType(
1190 * mediaType="application/json",
1191 * @OA\Schema(
1192 * @OA\Property(
1193 * property="validationErrors",
1194 * description="Validation errors.",
1195 * type="array",
1196 * @OA\Items(
1197 * type="object",
1198 * ),
1199 * ),
1200 * @OA\Property(
1201 * property="internalErrors",
1202 * description="Internal errors.",
1203 * type="array",
1204 * @OA\Items(
1205 * type="object",
1206 * ),
1207 * ),
1208 * @OA\Property(
1209 * property="data",
1210 * description="Returned data.",
1211 * type="array",
1212 * @OA\Items(
1213 * @OA\Property(
1214 * property="pid",
1215 * description="patient pid",
1216 * type="integer",
1218 * ),
1219 * ),
1220 * example={
1221 * "validationErrors": {},
1222 * "error_description": {},
1223 * "data": {
1224 * "pid": 1
1229 * ),
1230 * @OA\Response(
1231 * response="401",
1232 * ref="#/components/responses/unauthorized"
1233 * ),
1234 * security={{"openemr_auth":{}}}
1237 "POST /api/patient" => function () {
1238 RestConfig::authorization_check("patients", "demo");
1239 $data = (array) (json_decode(file_get_contents("php://input")));
1240 $return = (new PatientRestController())->post($data);
1241 RestConfig::apiLog($return, $data);
1242 return $return;
1246 * Schema for the patient response
1248 * @OA\Schema(
1249 * schema="api_patient_response",
1250 * @OA\Property(
1251 * property="validationErrors",
1252 * description="Validation errors.",
1253 * type="array",
1254 * @OA\Items(
1255 * type="object",
1256 * ),
1257 * ),
1258 * @OA\Property(
1259 * property="internalErrors",
1260 * description="Internal errors.",
1261 * type="array",
1262 * @OA\Items(
1263 * type="object",
1264 * ),
1265 * ),
1266 * @OA\Property(
1267 * property="data",
1268 * description="Returned data.",
1269 * type="array",
1270 * @OA\Items(
1271 * @OA\Property(
1272 * property="id",
1273 * description="patient id",
1274 * type="string",
1275 * ),
1276 * @OA\Property(
1277 * property="pid",
1278 * description="patient pid",
1279 * type="string",
1280 * ),
1281 * @OA\Property(
1282 * property="pubpid",
1283 * description="patient public id",
1284 * type="string",
1285 * ),
1286 * @OA\Property(
1287 * property="title",
1288 * description="patient title",
1289 * type="string",
1290 * ),
1291 * @OA\Property(
1292 * property="fname",
1293 * description="patient first name",
1294 * type="string",
1295 * ),
1296 * @OA\Property(
1297 * property="mname",
1298 * description="patient middle name",
1299 * type="string",
1300 * ),
1301 * @OA\Property(
1302 * property="lname",
1303 * description="patient last name",
1304 * type="string",
1305 * ),
1306 * @OA\Property(
1307 * property="ss",
1308 * description="patient social security number",
1309 * type="string",
1310 * ),
1311 * @OA\Property(
1312 * property="street",
1313 * description="patient street address",
1314 * type="string",
1315 * ),
1316 * @OA\Property(
1317 * property="postal_code",
1318 * description="patient postal code",
1319 * type="string",
1320 * ),
1321 * @OA\Property(
1322 * property="city",
1323 * description="patient city",
1324 * type="string",
1325 * ),
1326 * @OA\Property(
1327 * property="state",
1328 * description="patient state",
1329 * type="string",
1330 * ),
1331 * @OA\Property(
1332 * property="county",
1333 * description="patient county",
1334 * type="string",
1335 * ),
1336 * @OA\Property(
1337 * property="country_code",
1338 * description="patient country code",
1339 * type="string",
1340 * ),
1341 * @OA\Property(
1342 * property="drivers_license",
1343 * description="patient drivers license id",
1344 * type="string",
1345 * ),
1346 * @OA\Property(
1347 * property="contact_relationship",
1348 * description="patient contact relationship",
1349 * type="string",
1350 * ),
1351 * @OA\Property(
1352 * property="phone_contact",
1353 * description="patient phone contact",
1354 * type="string",
1355 * ),
1356 * @OA\Property(
1357 * property="phone_home",
1358 * description="patient home phone",
1359 * type="string",
1360 * ),
1361 * @OA\Property(
1362 * property="phone_biz",
1363 * description="patient work phone",
1364 * type="string",
1365 * ),
1366 * @OA\Property(
1367 * property="phone_cell",
1368 * description="patient mobile phone",
1369 * type="string",
1370 * ),
1371 * @OA\Property(
1372 * property="email",
1373 * description="patient email",
1374 * type="string",
1375 * ),
1376 * @OA\Property(
1377 * property="DOB",
1378 * description="patient DOB",
1379 * type="string",
1380 * ),
1381 * @OA\Property(
1382 * property="sex",
1383 * description="patient sex (gender)",
1384 * type="string",
1385 * ),
1386 * @OA\Property(
1387 * property="race",
1388 * description="patient race",
1389 * type="string",
1390 * ),
1391 * @OA\Property(
1392 * property="ethnicity",
1393 * description="patient ethnicity",
1394 * type="string",
1395 * ),
1396 * @OA\Property(
1397 * property="status",
1398 * description="patient status",
1399 * type="string",
1400 * ),
1401 * ),
1402 * ),
1403 * example={
1404 * "validationErrors": {},
1405 * "error_description": {},
1406 * "data": {
1407 * "id": "193",
1408 * "pid": "1",
1409 * "pubpid": "",
1410 * "title": "Mr",
1411 * "fname": "Baz",
1412 * "mname": "",
1413 * "lname": "Bop",
1414 * "ss": "",
1415 * "street": "456 Tree Lane",
1416 * "postal_code": "08642",
1417 * "city": "FooTown",
1418 * "state": "FL",
1419 * "county": "",
1420 * "country_code": "US",
1421 * "drivers_license": "",
1422 * "contact_relationship": "",
1423 * "phone_contact": "123-456-7890",
1424 * "phone_home": "",
1425 * "phone_biz": "",
1426 * "phone_cell": "",
1427 * "email": "",
1428 * "DOB": "1992-02-03",
1429 * "sex": "Male",
1430 * "race": "",
1431 * "ethnicity": "",
1432 * "status": ""
1438 * @OA\Put(
1439 * path="/api/patient/{puuid}",
1440 * description="Updates a patient",
1441 * tags={"standard"},
1442 * @OA\Parameter(
1443 * name="puuid",
1444 * in="path",
1445 * description="The uuid for the patient.",
1446 * required=true,
1447 * @OA\Schema(
1448 * type="string"
1450 * ),
1451 * @OA\RequestBody(
1452 * required=true,
1453 * @OA\MediaType(
1454 * mediaType="application/json",
1455 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1457 * ),
1458 * @OA\Response(
1459 * response="200",
1460 * description="Standard response",
1461 * @OA\MediaType(
1462 * mediaType="application/json",
1463 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1465 * ),
1466 * @OA\Response(
1467 * response="401",
1468 * ref="#/components/responses/unauthorized"
1469 * ),
1470 * security={{"openemr_auth":{}}}
1473 "PUT /api/patient/:puuid" => function ($puuid) {
1474 RestConfig::authorization_check("patients", "demo");
1475 $data = (array) (json_decode(file_get_contents("php://input")));
1476 $return = (new PatientRestController())->put($puuid, $data);
1477 RestConfig::apiLog($return, $data);
1478 return $return;
1482 * @OA\Get(
1483 * path="/api/patient/{puuid}",
1484 * description="Retrieves a single patient by their uuid",
1485 * tags={"standard"},
1486 * @OA\Parameter(
1487 * name="puuid",
1488 * in="path",
1489 * description="The uuid for the patient.",
1490 * required=true,
1491 * @OA\Schema(
1492 * type="string"
1494 * ),
1495 * @OA\Response(
1496 * response="200",
1497 * description="Standard response",
1498 * @OA\MediaType(
1499 * mediaType="application/json",
1500 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1502 * ),
1503 * @OA\Response(
1504 * response="401",
1505 * ref="#/components/responses/unauthorized"
1506 * ),
1507 * security={{"openemr_auth":{}}}
1510 "GET /api/patient/:puuid" => function ($puuid) {
1511 RestConfig::authorization_check("patients", "demo");
1512 $return = (new PatientRestController())->getOne($puuid);
1513 RestConfig::apiLog($return);
1514 return $return;
1518 * @OA\Get(
1519 * path="/api/patient/{puuid}/encounter",
1520 * description="Retrieves a list of encounters for a single patient",
1521 * tags={"standard"},
1522 * @OA\Parameter(
1523 * name="puuid",
1524 * in="path",
1525 * description="The uuid for the patient.",
1526 * required=true,
1527 * @OA\Schema(
1528 * type="string"
1530 * ),
1531 * @OA\Response(
1532 * response="200",
1533 * ref="#/components/responses/standard"
1534 * ),
1535 * @OA\Response(
1536 * response="400",
1537 * ref="#/components/responses/badrequest"
1538 * ),
1539 * @OA\Response(
1540 * response="401",
1541 * ref="#/components/responses/unauthorized"
1542 * ),
1543 * security={{"openemr_auth":{}}}
1546 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1547 RestConfig::authorization_check("encounters", "auth_a");
1548 $return = (new EncounterRestController())->getAll($puuid);
1549 RestConfig::apiLog($return);
1550 return $return;
1554 * Schema for the encounter request
1556 * @OA\Schema(
1557 * schema="api_encounter_request",
1558 * @OA\Property(
1559 * property="date",
1560 * description="The date of encounter.",
1561 * type="string"
1562 * ),
1563 * @OA\Property(
1564 * property="onset_date",
1565 * description="The onset date of encounter.",
1566 * type="string"
1567 * ),
1568 * @OA\Property(
1569 * property="reason",
1570 * description="The reason of encounter.",
1571 * type="string"
1572 * ),
1573 * @OA\Property(
1574 * property="facility",
1575 * description="The facility of encounter.",
1576 * type="string"
1577 * ),
1578 * @OA\Property(
1579 * property="pc_catid",
1580 * description="The pc_catid of encounter.",
1581 * type="string"
1582 * ),
1583 * @OA\Property(
1584 * property="facility_id",
1585 * description="The facility id of encounter.",
1586 * type="string"
1587 * ),
1588 * @OA\Property(
1589 * property="billing_facility",
1590 * description="The billing facility id of encounter.",
1591 * type="string"
1592 * ),
1593 * @OA\Property(
1594 * property="sensitivity",
1595 * description="The sensitivity of encounter.",
1596 * type="string"
1597 * ),
1598 * @OA\Property(
1599 * property="referral_source",
1600 * description="The referral source of encounter.",
1601 * type="string"
1602 * ),
1603 * @OA\Property(
1604 * property="pos_code",
1605 * description="The pos_code of encounter.",
1606 * type="string"
1607 * ),
1608 * @OA\Property(
1609 * property="external_id",
1610 * description="The external id of encounter.",
1611 * type="string"
1612 * ),
1613 * @OA\Property(
1614 * property="provider_id",
1615 * description="The provider id of encounter.",
1616 * type="string"
1617 * ),
1618 * @OA\Property(
1619 * property="class_code",
1620 * description="The class_code of encounter.",
1621 * type="string"
1622 * ),
1623 * required={"pc_catid", "class_code"},
1624 * example={
1625 * "date":"2020-11-10",
1626 * "onset_date": "",
1627 * "reason": "Pregnancy Test",
1628 * "facility": "Owerri General Hospital",
1629 * "pc_catid": "5",
1630 * "facility_id": "3",
1631 * "billing_facility": "3",
1632 * "sensitivity": "normal",
1633 * "referral_source": "",
1634 * "pos_code": "0",
1635 * "external_id": "",
1636 * "provider_id": "1",
1637 * "class_code" : "AMB"
1642 * @OA\Post(
1643 * path="/api/patient/{puuid}/encounter",
1644 * description="Creates a new encounter",
1645 * tags={"standard"},
1646 * @OA\Parameter(
1647 * name="puuid",
1648 * in="path",
1649 * description="The uuid for the patient.",
1650 * required=true,
1651 * @OA\Schema(
1652 * type="string"
1654 * ),
1655 * @OA\RequestBody(
1656 * required=true,
1657 * @OA\MediaType(
1658 * mediaType="application/json",
1659 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1661 * ),
1662 * @OA\Response(
1663 * response="200",
1664 * description="Standard response",
1665 * @OA\MediaType(
1666 * mediaType="application/json",
1667 * @OA\Schema(
1668 * @OA\Property(
1669 * property="validationErrors",
1670 * description="Validation errors.",
1671 * type="array",
1672 * @OA\Items(
1673 * type="object",
1674 * ),
1675 * ),
1676 * @OA\Property(
1677 * property="internalErrors",
1678 * description="Internal errors.",
1679 * type="array",
1680 * @OA\Items(
1681 * type="object",
1682 * ),
1683 * ),
1684 * @OA\Property(
1685 * property="data",
1686 * description="Returned data.",
1687 * type="array",
1688 * @OA\Items(
1689 * @OA\Property(
1690 * property="encounter",
1691 * description="encounter id",
1692 * type="integer",
1693 * ),
1694 * @OA\Property(
1695 * property="uuid",
1696 * description="encounter uuid",
1697 * type="string",
1699 * ),
1700 * ),
1701 * example={
1702 * "validationErrors": {},
1703 * "error_description": {},
1704 * "data": {
1705 * "encounter": 1,
1706 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1711 * ),
1712 * @OA\Response(
1713 * response="401",
1714 * ref="#/components/responses/unauthorized"
1715 * ),
1716 * security={{"openemr_auth":{}}}
1719 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1720 RestConfig::authorization_check("encounters", "auth_a");
1721 $data = (array) (json_decode(file_get_contents("php://input")));
1722 $return = (new EncounterRestController())->post($puuid, $data);
1723 RestConfig::apiLog($return, $data);
1724 return $return;
1728 * Schema for the encounter response
1730 * @OA\Schema(
1731 * schema="api_encounter_response",
1732 * @OA\Property(
1733 * property="validationErrors",
1734 * description="Validation errors.",
1735 * type="array",
1736 * @OA\Items(
1737 * type="object",
1738 * ),
1739 * ),
1740 * @OA\Property(
1741 * property="internalErrors",
1742 * description="Internal errors.",
1743 * type="array",
1744 * @OA\Items(
1745 * type="object",
1746 * ),
1747 * ),
1748 * @OA\Property(
1749 * property="data",
1750 * description="Returned data.",
1751 * type="array",
1752 * @OA\Items(
1753 * @OA\Property(
1754 * property="id",
1755 * description="encounter id",
1756 * type="string",
1757 * ),
1758 * @OA\Property(
1759 * property="uuid",
1760 * description="encounter uuid",
1761 * type="string",
1762 * ),
1763 * @OA\Property(
1764 * property="date",
1765 * description="encounter date",
1766 * type="string",
1767 * ),
1768 * @OA\Property(
1769 * property="reason",
1770 * description="encounter reason",
1771 * type="string",
1772 * ),
1773 * @OA\Property(
1774 * property="facility",
1775 * description="encounter facility name",
1776 * type="string",
1777 * ),
1778 * @OA\Property(
1779 * property="facility_id",
1780 * description="encounter facility id name",
1781 * type="string",
1782 * ),
1783 * @OA\Property(
1784 * property="pid",
1785 * description="encounter for patient pid",
1786 * type="string",
1787 * ),
1788 * @OA\Property(
1789 * property="onset_date",
1790 * description="encounter onset date",
1791 * type="string",
1792 * ),
1793 * @OA\Property(
1794 * property="sensitivity",
1795 * description="encounter sensitivity",
1796 * type="string",
1797 * ),
1798 * @OA\Property(
1799 * property="billing_note",
1800 * description="encounter billing note",
1801 * type="string",
1802 * ),
1803 * @OA\Property(
1804 * property="pc_catid",
1805 * description="encounter pc_catid",
1806 * type="string",
1807 * ),
1808 * @OA\Property(
1809 * property="last_level_billed",
1810 * description="encounter last_level_billed",
1811 * type="string",
1812 * ),
1813 * @OA\Property(
1814 * property="last_level_closed",
1815 * description="encounter last_level_closed",
1816 * type="string",
1817 * ),
1818 * @OA\Property(
1819 * property="last_stmt_date",
1820 * description="encounter last_stmt_date",
1821 * type="string",
1822 * ),
1823 * @OA\Property(
1824 * property="stmt_count",
1825 * description="encounter stmt_count",
1826 * type="string",
1827 * ),
1828 * @OA\Property(
1829 * property="provider_id",
1830 * description="provider id",
1831 * type="string",
1832 * ),
1833 * @OA\Property(
1834 * property="supervisor_id",
1835 * description="encounter supervisor id",
1836 * type="string",
1837 * ),
1838 * @OA\Property(
1839 * property="invoice_refno",
1840 * description="encounter invoice_refno",
1841 * type="string",
1842 * ),
1843 * @OA\Property(
1844 * property="referral_source",
1845 * description="encounter referral source",
1846 * type="string",
1847 * ),
1848 * @OA\Property(
1849 * property="billing_facility",
1850 * description="encounter billing facility id",
1851 * type="string",
1852 * ),
1853 * @OA\Property(
1854 * property="external_id",
1855 * description="encounter external id",
1856 * type="string",
1857 * ),
1858 * @OA\Property(
1859 * property="pos_code",
1860 * description="encounter pos_code",
1861 * type="string",
1862 * ),
1863 * @OA\Property(
1864 * property="class_code",
1865 * description="encounter class_code",
1866 * type="string",
1867 * ),
1868 * @OA\Property(
1869 * property="class_title",
1870 * description="encounter class_title",
1871 * type="string",
1872 * ),
1873 * @OA\Property(
1874 * property="pc_catname",
1875 * description="encounter pc_catname",
1876 * type="string",
1877 * ),
1878 * @OA\Property(
1879 * property="billing_facility_name",
1880 * description="encounter billing facility name",
1881 * type="string",
1882 * ),
1883 * ),
1884 * ),
1885 * example={
1886 * "validationErrors": {},
1887 * "error_description": {},
1888 * "data": {
1889 * "id": "1",
1890 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1891 * "date": "2019-09-14 00:00:00",
1892 * "reason": "Pregnancy Test",
1893 * "facility": "Owerri General Hospital",
1894 * "facility_id": "3",
1895 * "pid": "1",
1896 * "onset_date": "2019-04-20 00:00:00",
1897 * "sensitivity": "normal",
1898 * "billing_note": null,
1899 * "pc_catid": "5",
1900 * "last_level_billed": "0",
1901 * "last_level_closed": "0",
1902 * "last_stmt_date": null,
1903 * "stmt_count": "0",
1904 * "provider_id": "1",
1905 * "supervisor_id": "0",
1906 * "invoice_refno": "",
1907 * "referral_source": "",
1908 * "billing_facility": "3",
1909 * "external_id": "",
1910 * "pos_code": "0",
1911 * "class_code": "AMB",
1912 * "class_title": "ambulatory",
1913 * "pc_catname": "Office Visit",
1914 * "billing_facility_name": "Owerri General Hospital"
1920 * @OA\Put(
1921 * path="/api/patient/{puuid}/encounter/{euuid}",
1922 * description="Modify a encounter",
1923 * tags={"standard"},
1924 * @OA\Parameter(
1925 * name="puuid",
1926 * in="path",
1927 * description="The uuid for the patient.",
1928 * required=true,
1929 * @OA\Schema(
1930 * type="string"
1932 * ),
1933 * @OA\Parameter(
1934 * name="euuid",
1935 * in="path",
1936 * description="The uuid for the encounter.",
1937 * required=true,
1938 * @OA\Schema(
1939 * type="string"
1941 * ),
1942 * @OA\RequestBody(
1943 * required=true,
1944 * @OA\MediaType(
1945 * mediaType="application/json",
1946 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1948 * ),
1949 * @OA\Response(
1950 * response="200",
1951 * description="Standard response",
1952 * @OA\MediaType(
1953 * mediaType="application/json",
1954 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1956 * ),
1957 * @OA\Response(
1958 * response="401",
1959 * ref="#/components/responses/unauthorized"
1960 * ),
1961 * security={{"openemr_auth":{}}}
1964 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1965 RestConfig::authorization_check("encounters", "auth_a");
1966 $data = (array) (json_decode(file_get_contents("php://input")));
1967 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1968 RestConfig::apiLog($return, $data);
1969 return $return;
1973 * @OA\Get(
1974 * path="/api/patient/{puuid}/encounter/{euuid}",
1975 * description="Retrieves a single encounter for a patient",
1976 * tags={"standard"},
1977 * @OA\Parameter(
1978 * name="puuid",
1979 * in="path",
1980 * description="The uuid for the patient.",
1981 * required=true,
1982 * @OA\Schema(
1983 * type="string"
1985 * ),
1986 * @OA\Parameter(
1987 * name="euuid",
1988 * in="path",
1989 * description="The uuid for the encounter.",
1990 * required=true,
1991 * @OA\Schema(
1992 * type="string"
1994 * ),
1995 * @OA\Response(
1996 * response="200",
1997 * description="Standard response",
1998 * @OA\MediaType(
1999 * mediaType="application/json",
2000 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
2002 * ),
2003 * @OA\Response(
2004 * response="401",
2005 * ref="#/components/responses/unauthorized"
2006 * ),
2007 * security={{"openemr_auth":{}}}
2010 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
2011 RestConfig::authorization_check("encounters", "auth_a");
2012 $return = (new EncounterRestController())->getOne($puuid, $euuid);
2013 RestConfig::apiLog($return);
2014 return $return;
2018 * @OA\Get(
2019 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2020 * description="Retrieves soap notes from an encounter for a patient",
2021 * tags={"standard"},
2022 * @OA\Parameter(
2023 * name="pid",
2024 * in="path",
2025 * description="The pid for the patient.",
2026 * required=true,
2027 * @OA\Schema(
2028 * type="string"
2030 * ),
2031 * @OA\Parameter(
2032 * name="eid",
2033 * in="path",
2034 * description="The id for the encounter.",
2035 * required=true,
2036 * @OA\Schema(
2037 * type="string"
2039 * ),
2040 * @OA\Response(
2041 * response="200",
2042 * ref="#/components/responses/standard"
2043 * ),
2044 * @OA\Response(
2045 * response="400",
2046 * ref="#/components/responses/badrequest"
2047 * ),
2048 * @OA\Response(
2049 * response="401",
2050 * ref="#/components/responses/unauthorized"
2051 * ),
2052 * security={{"openemr_auth":{}}}
2055 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2056 RestConfig::authorization_check("encounters", "notes");
2057 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2058 RestConfig::apiLog($return);
2059 return $return;
2063 * Schema for the vital request
2065 * @OA\Schema(
2066 * schema="api_vital_request",
2067 * @OA\Property(
2068 * property="bps",
2069 * description="The bps of vitals.",
2070 * type="string"
2071 * ),
2072 * @OA\Property(
2073 * property="bpd",
2074 * description="The bpd of vitals.",
2075 * type="string"
2076 * ),
2077 * @OA\Property(
2078 * property="weight",
2079 * description="The weight of vitals. (unit is lb)",
2080 * type="string"
2081 * ),
2082 * @OA\Property(
2083 * property="height",
2084 * description="The height of vitals. (unit is inches)",
2085 * type="string"
2086 * ),
2087 * @OA\Property(
2088 * property="temperature",
2089 * description="The temperature of temperature. (unit is F)",
2090 * type="string"
2091 * ),
2092 * @OA\Property(
2093 * property="temp_method",
2094 * description="The temp_method of vitals.",
2095 * type="string"
2096 * ),
2097 * @OA\Property(
2098 * property="pulse",
2099 * description="The pulse of vitals.",
2100 * type="string"
2101 * ),
2102 * @OA\Property(
2103 * property="respiration",
2104 * description="The respiration of vitals.",
2105 * type="string"
2106 * ),
2107 * @OA\Property(
2108 * property="note",
2109 * description="The note (ie. comments) of vitals.",
2110 * type="string"
2111 * ),
2112 * @OA\Property(
2113 * property="waist_circ",
2114 * description="The waist circumference of vitals. (unit is inches)",
2115 * type="string"
2116 * ),
2117 * @OA\Property(
2118 * property="head_circ",
2119 * description="The head circumference of vitals. (unit is inches)",
2120 * type="string"
2121 * ),
2122 * @OA\Property(
2123 * property="oxygen_saturation",
2124 * description="The oxygen_saturation of vitals.",
2125 * type="string"
2126 * ),
2127 * example={
2128 * "bps": "130",
2129 * "bpd": "80",
2130 * "weight": "220",
2131 * "height": "70",
2132 * "temperature": "98",
2133 * "temp_method": "Oral",
2134 * "pulse": "60",
2135 * "respiration": "20",
2136 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2137 * "waist_circ": "37",
2138 * "head_circ": "22.2",
2139 * "oxygen_saturation": "96"
2144 * @OA\Post(
2145 * path="/api/patient/{pid}/encounter/{eid}/vital",
2146 * description="Submits a new vitals form",
2147 * tags={"standard"},
2148 * @OA\Parameter(
2149 * name="pid",
2150 * in="path",
2151 * description="The id for the patient.",
2152 * required=true,
2153 * @OA\Schema(
2154 * type="string"
2156 * ),
2157 * @OA\Parameter(
2158 * name="eid",
2159 * in="path",
2160 * description="The id for the encounter.",
2161 * required=true,
2162 * @OA\Schema(
2163 * type="string"
2165 * ),
2166 * @OA\RequestBody(
2167 * required=true,
2168 * @OA\MediaType(
2169 * mediaType="application/json",
2170 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2172 * ),
2173 * @OA\Response(
2174 * response="200",
2175 * ref="#/components/responses/standard"
2176 * ),
2177 * @OA\Response(
2178 * response="400",
2179 * ref="#/components/responses/badrequest"
2180 * ),
2181 * @OA\Response(
2182 * response="401",
2183 * ref="#/components/responses/unauthorized"
2184 * ),
2185 * security={{"openemr_auth":{}}}
2188 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2189 RestConfig::authorization_check("encounters", "notes");
2190 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2191 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2192 RestConfig::apiLog($return, $data);
2193 return $return;
2197 * @OA\Put(
2198 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2199 * description="Edit a vitals form",
2200 * tags={"standard"},
2201 * @OA\Parameter(
2202 * name="pid",
2203 * in="path",
2204 * description="The id for the patient.",
2205 * required=true,
2206 * @OA\Schema(
2207 * type="string"
2209 * ),
2210 * @OA\Parameter(
2211 * name="eid",
2212 * in="path",
2213 * description="The id for the encounter.",
2214 * required=true,
2215 * @OA\Schema(
2216 * type="string"
2218 * ),
2219 * @OA\Parameter(
2220 * name="vid",
2221 * in="path",
2222 * description="The id for the vitalss form.",
2223 * required=true,
2224 * @OA\Schema(
2225 * type="string"
2227 * ),
2228 * @OA\RequestBody(
2229 * required=true,
2230 * @OA\MediaType(
2231 * mediaType="application/json",
2232 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2234 * ),
2235 * @OA\Response(
2236 * response="200",
2237 * ref="#/components/responses/standard"
2238 * ),
2239 * @OA\Response(
2240 * response="400",
2241 * ref="#/components/responses/badrequest"
2242 * ),
2243 * @OA\Response(
2244 * response="401",
2245 * ref="#/components/responses/unauthorized"
2246 * ),
2247 * security={{"openemr_auth":{}}}
2250 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2251 RestConfig::authorization_check("encounters", "notes");
2252 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2253 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2254 RestConfig::apiLog($return, $data);
2255 return $return;
2259 * @OA\Get(
2260 * path="/api/patient/{pid}/encounter/{eid}/vital",
2261 * description="Retrieves all vitals from an encounter for a patient",
2262 * tags={"standard"},
2263 * @OA\Parameter(
2264 * name="pid",
2265 * in="path",
2266 * description="The pid for the patient.",
2267 * required=true,
2268 * @OA\Schema(
2269 * type="string"
2271 * ),
2272 * @OA\Parameter(
2273 * name="eid",
2274 * in="path",
2275 * description="The id for the encounter.",
2276 * required=true,
2277 * @OA\Schema(
2278 * type="string"
2280 * ),
2281 * @OA\Response(
2282 * response="200",
2283 * ref="#/components/responses/standard"
2284 * ),
2285 * @OA\Response(
2286 * response="400",
2287 * ref="#/components/responses/badrequest"
2288 * ),
2289 * @OA\Response(
2290 * response="401",
2291 * ref="#/components/responses/unauthorized"
2292 * ),
2293 * security={{"openemr_auth":{}}}
2296 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2297 RestConfig::authorization_check("encounters", "notes");
2298 $return = (new EncounterRestController())->getVitals($pid, $eid);
2299 RestConfig::apiLog($return);
2300 return $return;
2304 * @OA\Get(
2305 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2306 * description="Retrieves a vitals form from an encounter for a patient",
2307 * tags={"standard"},
2308 * @OA\Parameter(
2309 * name="pid",
2310 * in="path",
2311 * description="The pid for the patient.",
2312 * required=true,
2313 * @OA\Schema(
2314 * type="string"
2316 * ),
2317 * @OA\Parameter(
2318 * name="eid",
2319 * in="path",
2320 * description="The id for the encounter.",
2321 * required=true,
2322 * @OA\Schema(
2323 * type="string"
2325 * ),
2326 * @OA\Parameter(
2327 * name="vid",
2328 * in="path",
2329 * description="The id for the vitals form.",
2330 * required=true,
2331 * @OA\Schema(
2332 * type="string"
2334 * ),
2335 * @OA\Response(
2336 * response="200",
2337 * ref="#/components/responses/standard"
2338 * ),
2339 * @OA\Response(
2340 * response="400",
2341 * ref="#/components/responses/badrequest"
2342 * ),
2343 * @OA\Response(
2344 * response="401",
2345 * ref="#/components/responses/unauthorized"
2346 * ),
2347 * security={{"openemr_auth":{}}}
2350 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2351 RestConfig::authorization_check("encounters", "notes");
2352 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2353 RestConfig::apiLog($return);
2354 return $return;
2358 * @OA\Get(
2359 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2360 * description="Retrieves a soap note from an encounter for a patient",
2361 * tags={"standard"},
2362 * @OA\Parameter(
2363 * name="pid",
2364 * in="path",
2365 * description="The pid for the patient.",
2366 * required=true,
2367 * @OA\Schema(
2368 * type="string"
2370 * ),
2371 * @OA\Parameter(
2372 * name="eid",
2373 * in="path",
2374 * description="The id for the encounter.",
2375 * required=true,
2376 * @OA\Schema(
2377 * type="string"
2379 * ),
2380 * @OA\Parameter(
2381 * name="sid",
2382 * in="path",
2383 * description="The id for the soap note.",
2384 * required=true,
2385 * @OA\Schema(
2386 * type="string"
2388 * ),
2389 * @OA\Response(
2390 * response="200",
2391 * ref="#/components/responses/standard"
2392 * ),
2393 * @OA\Response(
2394 * response="400",
2395 * ref="#/components/responses/badrequest"
2396 * ),
2397 * @OA\Response(
2398 * response="401",
2399 * ref="#/components/responses/unauthorized"
2400 * ),
2401 * security={{"openemr_auth":{}}}
2404 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2405 RestConfig::authorization_check("encounters", "notes");
2406 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2407 RestConfig::apiLog($return);
2408 return $return;
2412 * Schema for the soap_note request
2414 * @OA\Schema(
2415 * schema="api_soap_note_request",
2416 * @OA\Property(
2417 * property="subjective",
2418 * description="The subjective of soap note.",
2419 * type="string"
2420 * ),
2421 * @OA\Property(
2422 * property="objective",
2423 * description="The objective of soap note.",
2424 * type="string"
2425 * ),
2426 * @OA\Property(
2427 * property="assessment",
2428 * description="The assessment of soap note.",
2429 * type="string"
2430 * ),
2431 * @OA\Property(
2432 * property="plan",
2433 * description="The plan of soap note.",
2434 * type="string"
2435 * ),
2436 * example={
2437 * "subjective": "The patient with mechanical fall and cut finger.",
2438 * "objective": "The patient with finger laceration on exam.",
2439 * "assessment": "The patient with finger laceration requiring sutures.",
2440 * "plan": "Sutured finger laceration."
2445 * @OA\Post(
2446 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2447 * description="Submits a new soap note",
2448 * tags={"standard"},
2449 * @OA\Parameter(
2450 * name="pid",
2451 * in="path",
2452 * description="The id for the patient.",
2453 * required=true,
2454 * @OA\Schema(
2455 * type="string"
2457 * ),
2458 * @OA\Parameter(
2459 * name="eid",
2460 * in="path",
2461 * description="The id for the encounter.",
2462 * required=true,
2463 * @OA\Schema(
2464 * type="string"
2466 * ),
2467 * @OA\RequestBody(
2468 * required=true,
2469 * @OA\MediaType(
2470 * mediaType="application/json",
2471 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2473 * ),
2474 * @OA\Response(
2475 * response="200",
2476 * ref="#/components/responses/standard"
2477 * ),
2478 * @OA\Response(
2479 * response="400",
2480 * ref="#/components/responses/badrequest"
2481 * ),
2482 * @OA\Response(
2483 * response="401",
2484 * ref="#/components/responses/unauthorized"
2485 * ),
2486 * security={{"openemr_auth":{}}}
2489 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2490 RestConfig::authorization_check("encounters", "notes");
2491 $data = (array) (json_decode(file_get_contents("php://input")));
2492 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2493 RestConfig::apiLog($return, $data);
2494 return $return;
2498 * @OA\Put(
2499 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2500 * description="Edit a soap note",
2501 * tags={"standard"},
2502 * @OA\Parameter(
2503 * name="pid",
2504 * in="path",
2505 * description="The id for the patient.",
2506 * required=true,
2507 * @OA\Schema(
2508 * type="string"
2510 * ),
2511 * @OA\Parameter(
2512 * name="eid",
2513 * in="path",
2514 * description="The id for the encounter.",
2515 * required=true,
2516 * @OA\Schema(
2517 * type="string"
2519 * ),
2520 * @OA\Parameter(
2521 * name="sid",
2522 * in="path",
2523 * description="The id for the soap noted.",
2524 * required=true,
2525 * @OA\Schema(
2526 * type="string"
2528 * ),
2529 * @OA\RequestBody(
2530 * required=true,
2531 * @OA\MediaType(
2532 * mediaType="application/json",
2533 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2535 * ),
2536 * @OA\Response(
2537 * response="200",
2538 * ref="#/components/responses/standard"
2539 * ),
2540 * @OA\Response(
2541 * response="400",
2542 * ref="#/components/responses/badrequest"
2543 * ),
2544 * @OA\Response(
2545 * response="401",
2546 * ref="#/components/responses/unauthorized"
2547 * ),
2548 * security={{"openemr_auth":{}}}
2551 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2552 RestConfig::authorization_check("encounters", "notes");
2553 $data = (array) (json_decode(file_get_contents("php://input")));
2554 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2555 RestConfig::apiLog($return, $data);
2556 return $return;
2561 * @OA\Get(
2562 * path="/api/practitioner",
2563 * description="Retrieves a list of practitioners",
2564 * tags={"standard"},
2565 * @OA\Parameter(
2566 * name="title",
2567 * in="query",
2568 * description="The title for the practitioner.",
2569 * required=false,
2570 * @OA\Schema(
2571 * type="string"
2573 * ),
2574 * @OA\Parameter(
2575 * name="fname",
2576 * in="query",
2577 * description="The first name for the practitioner.",
2578 * required=false,
2579 * @OA\Schema(
2580 * type="string"
2582 * ),
2583 * @OA\Parameter(
2584 * name="lname",
2585 * in="query",
2586 * description="The last name for the practitioner.",
2587 * required=false,
2588 * @OA\Schema(
2589 * type="string"
2591 * ),
2592 * @OA\Parameter(
2593 * name="mname",
2594 * in="query",
2595 * description="The middle name for the practitioner.",
2596 * required=false,
2597 * @OA\Schema(
2598 * type="string"
2600 * ),
2601 * @OA\Parameter(
2602 * name="federaltaxid",
2603 * in="query",
2604 * description="The federal tax id for the practitioner.",
2605 * required=false,
2606 * @OA\Schema(
2607 * type="string"
2609 * ),
2610 * @OA\Parameter(
2611 * name="federaldrugid",
2612 * in="query",
2613 * description="The federal drug id for the practitioner.",
2614 * required=false,
2615 * @OA\Schema(
2616 * type="string"
2618 * ),
2619 * @OA\Parameter(
2620 * name="upin",
2621 * in="query",
2622 * description="The upin for the practitioner.",
2623 * required=false,
2624 * @OA\Schema(
2625 * type="string"
2627 * ),
2628 * @OA\Parameter(
2629 * name="facility_id",
2630 * in="query",
2631 * description="The facility id for the practitioner.",
2632 * required=false,
2633 * @OA\Schema(
2634 * type="string"
2636 * ),
2637 * @OA\Parameter(
2638 * name="facility",
2639 * in="query",
2640 * description="The facility for the practitioner.",
2641 * required=false,
2642 * @OA\Schema(
2643 * type="string"
2645 * ),
2646 * @OA\Parameter(
2647 * name="npi",
2648 * in="query",
2649 * description="The npi for the practitioner.",
2650 * required=false,
2651 * @OA\Schema(
2652 * type="string"
2654 * ),
2655 * @OA\Parameter(
2656 * name="email",
2657 * in="query",
2658 * description="The email for the practitioner.",
2659 * required=false,
2660 * @OA\Schema(
2661 * type="string"
2663 * ),
2664 * @OA\Parameter(
2665 * name="specialty",
2666 * in="query",
2667 * description="The specialty for the practitioner.",
2668 * required=false,
2669 * @OA\Schema(
2670 * type="string"
2672 * ),
2673 * @OA\Parameter(
2674 * name="billname",
2675 * in="query",
2676 * description="The billname for the practitioner.",
2677 * required=false,
2678 * @OA\Schema(
2679 * type="string"
2681 * ),
2682 * @OA\Parameter(
2683 * name="url",
2684 * in="query",
2685 * description="The url for the practitioner.",
2686 * required=false,
2687 * @OA\Schema(
2688 * type="string"
2690 * ),
2691 * @OA\Parameter(
2692 * name="assistant",
2693 * in="query",
2694 * description="The assistant for the practitioner.",
2695 * required=false,
2696 * @OA\Schema(
2697 * type="string"
2699 * ),
2700 * @OA\Parameter(
2701 * name="organization",
2702 * in="query",
2703 * description="The organization for the practitioner.",
2704 * required=false,
2705 * @OA\Schema(
2706 * type="string"
2708 * ),
2709 * @OA\Parameter(
2710 * name="valedictory",
2711 * in="query",
2712 * description="The valedictory for the practitioner.",
2713 * required=false,
2714 * @OA\Schema(
2715 * type="string"
2717 * ),
2718 * @OA\Parameter(
2719 * name="street",
2720 * in="query",
2721 * description="The street for the practitioner.",
2722 * required=false,
2723 * @OA\Schema(
2724 * type="string"
2726 * ),
2727 * @OA\Parameter(
2728 * name="streetb",
2729 * in="query",
2730 * description="The street (line 2) for the practitioner.",
2731 * required=false,
2732 * @OA\Schema(
2733 * type="string"
2735 * ),
2736 * @OA\Parameter(
2737 * name="city",
2738 * in="query",
2739 * description="The city for the practitioner.",
2740 * required=false,
2741 * @OA\Schema(
2742 * type="string"
2744 * ),
2745 * @OA\Parameter(
2746 * name="state",
2747 * in="query",
2748 * description="The state for the practitioner.",
2749 * required=false,
2750 * @OA\Schema(
2751 * type="string"
2753 * ),
2754 * @OA\Parameter(
2755 * name="zip",
2756 * in="query",
2757 * description="The zip for the practitioner.",
2758 * required=false,
2759 * @OA\Schema(
2760 * type="string"
2762 * ),
2763 * @OA\Parameter(
2764 * name="phone",
2765 * in="query",
2766 * description="The phone for the practitioner.",
2767 * required=false,
2768 * @OA\Schema(
2769 * type="string"
2771 * ),
2772 * @OA\Parameter(
2773 * name="fax",
2774 * in="query",
2775 * description="The fax for the practitioner.",
2776 * required=false,
2777 * @OA\Schema(
2778 * type="string"
2780 * ),
2781 * @OA\Parameter(
2782 * name="phonew1",
2783 * in="query",
2784 * description="The phonew1 for the practitioner.",
2785 * required=false,
2786 * @OA\Schema(
2787 * type="string"
2789 * ),
2790 * @OA\Parameter(
2791 * name="phonecell",
2792 * in="query",
2793 * description="The phonecell for the practitioner.",
2794 * required=false,
2795 * @OA\Schema(
2796 * type="string"
2798 * ),
2799 * @OA\Parameter(
2800 * name="notes",
2801 * in="query",
2802 * description="The notes for the practitioner.",
2803 * required=false,
2804 * @OA\Schema(
2805 * type="string"
2807 * ),
2808 * @OA\Parameter(
2809 * name="state_license_number2",
2810 * in="query",
2811 * description="The state license number for the practitioner.",
2812 * required=false,
2813 * @OA\Schema(
2814 * type="string"
2816 * ),
2817 * @OA\Parameter(
2818 * name="username",
2819 * in="query",
2820 * description="The username for the practitioner.",
2821 * required=false,
2822 * @OA\Schema(
2823 * type="string"
2825 * ),
2826 * @OA\Response(
2827 * response="200",
2828 * ref="#/components/responses/standard"
2829 * ),
2830 * @OA\Response(
2831 * response="400",
2832 * ref="#/components/responses/badrequest"
2833 * ),
2834 * @OA\Response(
2835 * response="401",
2836 * ref="#/components/responses/unauthorized"
2837 * ),
2838 * security={{"openemr_auth":{}}}
2841 "GET /api/practitioner" => function () {
2842 RestConfig::authorization_check("admin", "users");
2843 $return = (new PractitionerRestController())->getAll($_GET);
2844 RestConfig::apiLog($return);
2845 return $return;
2849 * @OA\Get(
2850 * path="/api/practitioner/{pruuid}",
2851 * description="Retrieves a single practitioner by their uuid",
2852 * tags={"standard"},
2853 * @OA\Parameter(
2854 * name="pruuid",
2855 * in="path",
2856 * description="The uuid for the practitioner.",
2857 * required=true,
2858 * @OA\Schema(
2859 * type="string"
2861 * ),
2862 * @OA\Response(
2863 * response="200",
2864 * ref="#/components/responses/standard"
2865 * ),
2866 * @OA\Response(
2867 * response="400",
2868 * ref="#/components/responses/badrequest"
2869 * ),
2870 * @OA\Response(
2871 * response="401",
2872 * ref="#/components/responses/unauthorized"
2873 * ),
2874 * security={{"openemr_auth":{}}}
2877 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2878 RestConfig::authorization_check("admin", "users");
2879 $return = (new PractitionerRestController())->getOne($pruuid);
2880 RestConfig::apiLog($return);
2881 return $return;
2885 * @OA\Post(
2886 * path="/api/practitioner",
2887 * description="Submits a new practitioner",
2888 * tags={"standard"},
2889 * @OA\RequestBody(
2890 * required=true,
2891 * @OA\MediaType(
2892 * mediaType="application/json",
2893 * @OA\Schema(
2894 * @OA\Property(
2895 * property="title",
2896 * description="The title for the practitioner.",
2897 * type="string"
2898 * ),
2899 * @OA\Property(
2900 * property="fname",
2901 * description="The first name for the practitioner.",
2902 * type="string"
2903 * ),
2904 * @OA\Property(
2905 * property="mname",
2906 * description="The middle name for the practitioner.",
2907 * type="string"
2908 * ),
2909 * @OA\Property(
2910 * property="lname",
2911 * description="The last name for the practitioner.",
2912 * type="string"
2913 * ),
2914 * @OA\Property(
2915 * property="federaltaxid",
2916 * description="The federal tax id for the practitioner.",
2917 * type="string"
2918 * ),
2919 * @OA\Property(
2920 * property="federaldrugid",
2921 * description="The federal drug id for the practitioner.",
2922 * type="string"
2923 * ),
2924 * @OA\Property(
2925 * property="upin",
2926 * description="The upin for the practitioner.",
2927 * type="string"
2928 * ),
2929 * @OA\Property(
2930 * property="facility_id",
2931 * description="The facility_id for the practitioner.",
2932 * type="string"
2933 * ),
2934 * @OA\Property(
2935 * property="facility",
2936 * description="The facility name for the practitioner.",
2937 * type="string"
2938 * ),
2939 * @OA\Property(
2940 * property="npi",
2941 * description="The npi for the practitioner.",
2942 * type="string"
2943 * ),
2944 * @OA\Property(
2945 * property="email",
2946 * description="The email for the practitioner.",
2947 * type="string"
2948 * ),
2949 * @OA\Property(
2950 * property="specialty",
2951 * description="The specialty for the practitioner.",
2952 * type="string"
2953 * ),
2954 * @OA\Property(
2955 * property="billname",
2956 * description="The billname for the practitioner.",
2957 * type="string"
2958 * ),
2959 * @OA\Property(
2960 * property="url",
2961 * description="The url for the practitioner.",
2962 * type="string"
2963 * ),
2964 * @OA\Property(
2965 * property="assistant",
2966 * description="The assistant for the practitioner.",
2967 * type="string"
2968 * ),
2969 * @OA\Property(
2970 * property="valedictory",
2971 * description="The valedictory for the practitioner.",
2972 * type="string"
2973 * ),
2974 * @OA\Property(
2975 * property="street",
2976 * description="The street address for the practitioner.",
2977 * type="string"
2978 * ),
2979 * @OA\Property(
2980 * property="streetb",
2981 * description="The streetb address for the practitioner.",
2982 * type="string"
2983 * ),
2984 * @OA\Property(
2985 * property="city",
2986 * description="The city for the practitioner.",
2987 * type="string"
2988 * ),
2989 * @OA\Property(
2990 * property="state",
2991 * description="The state for the practitioner.",
2992 * type="string"
2993 * ),
2994 * @OA\Property(
2995 * property="zip",
2996 * description="The zip for the practitioner.",
2997 * type="string"
2998 * ),
2999 * @OA\Property(
3000 * property="phone",
3001 * description="The phone for the practitioner.",
3002 * type="string"
3003 * ),
3004 * @OA\Property(
3005 * property="fax",
3006 * description="The fax for the practitioner.",
3007 * type="string"
3008 * ),
3009 * @OA\Property(
3010 * property="phonew1",
3011 * description="The phonew1 for the practitioner.",
3012 * type="string"
3013 * ),
3014 * @OA\Property(
3015 * property="phonecell",
3016 * description="The phonecell for the practitioner.",
3017 * type="string"
3018 * ),
3019 * @OA\Property(
3020 * property="notes",
3021 * description="The notes for the practitioner.",
3022 * type="string"
3023 * ),
3024 * @OA\Property(
3025 * property="state_license_number",
3026 * description="The state license number for the practitioner.",
3027 * type="string"
3028 * ),
3029 * @OA\Property(
3030 * property="username",
3031 * description="The username for the practitioner.",
3032 * type="string"
3033 * ),
3034 * required={"fname", "lname", "npi"},
3035 * example={
3036 * "title": "Mrs.",
3037 * "fname": "Eduardo",
3038 * "mname": "Kathy",
3039 * "lname": "Perez",
3040 * "federaltaxid": "",
3041 * "federaldrugid": "",
3042 * "upin": "",
3043 * "facility_id": "3",
3044 * "facility": "Your Clinic Name Here",
3045 * "npi": "12345678901",
3046 * "email": "info@pennfirm.com",
3047 * "specialty": "",
3048 * "billname": null,
3049 * "url": null,
3050 * "assistant": null,
3051 * "organization": null,
3052 * "valedictory": null,
3053 * "street": "789 Third Avenue",
3054 * "streetb": "123 Cannaut Street",
3055 * "city": "San Diego",
3056 * "state": "CA",
3057 * "zip": "90210",
3058 * "phone": "(619) 555-9827",
3059 * "fax": null,
3060 * "phonew1": "(619) 555-7822",
3061 * "phonecell": "(619) 555-7821",
3062 * "notes": null,
3063 * "state_license_number": "123456",
3064 * "username": "eduardoperez"
3068 * ),
3069 * @OA\Response(
3070 * response="200",
3071 * description="Standard response",
3072 * @OA\MediaType(
3073 * mediaType="application/json",
3074 * @OA\Schema(
3075 * @OA\Property(
3076 * property="validationErrors",
3077 * description="Validation errors.",
3078 * type="array",
3079 * @OA\Items(
3080 * type="object",
3081 * ),
3082 * ),
3083 * @OA\Property(
3084 * property="internalErrors",
3085 * description="Internal errors.",
3086 * type="array",
3087 * @OA\Items(
3088 * type="object",
3089 * ),
3090 * ),
3091 * @OA\Property(
3092 * property="data",
3093 * description="Returned data.",
3094 * type="array",
3095 * @OA\Items(
3096 * @OA\Property(
3097 * property="id",
3098 * description="practitioner id",
3099 * type="integer",
3100 * ),
3101 * @OA\Property(
3102 * property="uuid",
3103 * description="practitioner uuid",
3104 * type="string",
3105 * ),
3106 * ),
3107 * ),
3108 * example={
3109 * "validationErrors": {},
3110 * "error_description": {},
3111 * "data": {
3112 * "id": 7,
3113 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3118 * ),
3119 * @OA\Response(
3120 * response="401",
3121 * ref="#/components/responses/unauthorized"
3122 * ),
3123 * security={{"openemr_auth":{}}}
3126 "POST /api/practitioner" => function () {
3127 RestConfig::authorization_check("admin", "users");
3128 $data = (array) (json_decode(file_get_contents("php://input")));
3129 $return = (new PractitionerRestController())->post($data);
3130 RestConfig::apiLog($return, $data);
3131 return $return;
3135 * @OA\Put(
3136 * path="/api/practitioner/{pruuid}",
3137 * description="Edit a practitioner",
3138 * tags={"standard"},
3139 * @OA\Parameter(
3140 * name="pruuid",
3141 * in="path",
3142 * description="The uuid for the practitioner.",
3143 * required=true,
3144 * @OA\Schema(
3145 * type="string"
3147 * ),
3148 * @OA\RequestBody(
3149 * required=true,
3150 * @OA\MediaType(
3151 * mediaType="application/json",
3152 * @OA\Schema(
3153 * @OA\Property(
3154 * property="title",
3155 * description="The title for the practitioner.",
3156 * type="string"
3157 * ),
3158 * @OA\Property(
3159 * property="fname",
3160 * description="The first name for the practitioner.",
3161 * type="string"
3162 * ),
3163 * @OA\Property(
3164 * property="mname",
3165 * description="The middle name for the practitioner.",
3166 * type="string"
3167 * ),
3168 * @OA\Property(
3169 * property="lname",
3170 * description="The last name for the practitioner.",
3171 * type="string"
3172 * ),
3173 * @OA\Property(
3174 * property="federaltaxid",
3175 * description="The federal tax id for the practitioner.",
3176 * type="string"
3177 * ),
3178 * @OA\Property(
3179 * property="federaldrugid",
3180 * description="The federal drug id for the practitioner.",
3181 * type="string"
3182 * ),
3183 * @OA\Property(
3184 * property="upin",
3185 * description="The upin for the practitioner.",
3186 * type="string"
3187 * ),
3188 * @OA\Property(
3189 * property="facility_id",
3190 * description="The facility_id for the practitioner.",
3191 * type="string"
3192 * ),
3193 * @OA\Property(
3194 * property="facility",
3195 * description="The facility name for the practitioner.",
3196 * type="string"
3197 * ),
3198 * @OA\Property(
3199 * property="npi",
3200 * description="The npi for the practitioner.",
3201 * type="string"
3202 * ),
3203 * @OA\Property(
3204 * property="email",
3205 * description="The email for the practitioner.",
3206 * type="string"
3207 * ),
3208 * @OA\Property(
3209 * property="specialty",
3210 * description="The specialty for the practitioner.",
3211 * type="string"
3212 * ),
3213 * @OA\Property(
3214 * property="billname",
3215 * description="The billname for the practitioner.",
3216 * type="string"
3217 * ),
3218 * @OA\Property(
3219 * property="url",
3220 * description="The url for the practitioner.",
3221 * type="string"
3222 * ),
3223 * @OA\Property(
3224 * property="assistant",
3225 * description="The assistant for the practitioner.",
3226 * type="string"
3227 * ),
3228 * @OA\Property(
3229 * property="valedictory",
3230 * description="The valedictory for the practitioner.",
3231 * type="string"
3232 * ),
3233 * @OA\Property(
3234 * property="street",
3235 * description="The street address for the practitioner.",
3236 * type="string"
3237 * ),
3238 * @OA\Property(
3239 * property="streetb",
3240 * description="The streetb address for the practitioner.",
3241 * type="string"
3242 * ),
3243 * @OA\Property(
3244 * property="city",
3245 * description="The city for the practitioner.",
3246 * type="string"
3247 * ),
3248 * @OA\Property(
3249 * property="state",
3250 * description="The state for the practitioner.",
3251 * type="string"
3252 * ),
3253 * @OA\Property(
3254 * property="zip",
3255 * description="The zip for the practitioner.",
3256 * type="string"
3257 * ),
3258 * @OA\Property(
3259 * property="phone",
3260 * description="The phone for the practitioner.",
3261 * type="string"
3262 * ),
3263 * @OA\Property(
3264 * property="fax",
3265 * description="The fax for the practitioner.",
3266 * type="string"
3267 * ),
3268 * @OA\Property(
3269 * property="phonew1",
3270 * description="The phonew1 for the practitioner.",
3271 * type="string"
3272 * ),
3273 * @OA\Property(
3274 * property="phonecell",
3275 * description="The phonecell for the practitioner.",
3276 * type="string"
3277 * ),
3278 * @OA\Property(
3279 * property="notes",
3280 * description="The notes for the practitioner.",
3281 * type="string"
3282 * ),
3283 * @OA\Property(
3284 * property="state_license_number",
3285 * description="The state license number for the practitioner.",
3286 * type="string"
3287 * ),
3288 * @OA\Property(
3289 * property="username",
3290 * description="The username for the practitioner.",
3291 * type="string"
3292 * ),
3293 * example={
3294 * "title": "Mr",
3295 * "fname": "Baz",
3296 * "mname": "",
3297 * "lname": "Bop",
3298 * "street": "456 Tree Lane",
3299 * "zip": "08642",
3300 * "city": "FooTown",
3301 * "state": "FL",
3302 * "phone": "123-456-7890"
3306 * ),
3307 * @OA\Response(
3308 * response="200",
3309 * description="Standard response",
3310 * @OA\MediaType(
3311 * mediaType="application/json",
3312 * @OA\Schema(
3313 * @OA\Property(
3314 * property="validationErrors",
3315 * description="Validation errors.",
3316 * type="array",
3317 * @OA\Items(
3318 * type="object",
3319 * ),
3320 * ),
3321 * @OA\Property(
3322 * property="internalErrors",
3323 * description="Internal errors.",
3324 * type="array",
3325 * @OA\Items(
3326 * type="object",
3327 * ),
3328 * ),
3329 * @OA\Property(
3330 * property="data",
3331 * description="Returned data.",
3332 * type="array",
3333 * @OA\Items(
3334 * @OA\Property(
3335 * property="id",
3336 * description="practitioner id",
3337 * type="string",
3338 * ),
3339 * @OA\Property(
3340 * property="uuid",
3341 * description="practitioner uuid",
3342 * type="string",
3343 * ),
3344 * @OA\Property(
3345 * property="title",
3346 * description="practitioner title",
3347 * type="string",
3348 * ),
3349 * @OA\Property(
3350 * property="fname",
3351 * description="practitioner fname",
3352 * type="string",
3353 * ),
3354 * @OA\Property(
3355 * property="lname",
3356 * description="practitioner lname",
3357 * type="string",
3358 * ),
3359 * @OA\Property(
3360 * property="mname",
3361 * description="practitioner mname",
3362 * type="string",
3363 * ),
3364 * @OA\Property(
3365 * property="federaltaxid",
3366 * description="practitioner federaltaxid",
3367 * type="string",
3368 * ),
3369 * @OA\Property(
3370 * property="federaldrugid",
3371 * description="practitioner federaldrugid",
3372 * type="string",
3373 * ),
3374 * @OA\Property(
3375 * property="upin",
3376 * description="practitioner upin",
3377 * type="string",
3378 * ),
3379 * @OA\Property(
3380 * property="facility_id",
3381 * description="practitioner facility_id",
3382 * type="string",
3383 * ),
3384 * @OA\Property(
3385 * property="facility",
3386 * description="practitioner facility",
3387 * type="string",
3388 * ),
3389 * @OA\Property(
3390 * property="npi",
3391 * description="practitioner npi",
3392 * type="string",
3393 * ),
3394 * @OA\Property(
3395 * property="email",
3396 * description="practitioner email",
3397 * type="string",
3398 * ),
3399 * @OA\Property(
3400 * property="active",
3401 * description="practitioner active setting",
3402 * type="string",
3403 * ),
3404 * @OA\Property(
3405 * property="specialty",
3406 * description="practitioner specialty",
3407 * type="string",
3408 * ),
3409 * @OA\Property(
3410 * property="billname",
3411 * description="practitioner billname",
3412 * type="string",
3413 * ),
3414 * @OA\Property(
3415 * property="url",
3416 * description="practitioner url",
3417 * type="string",
3418 * ),
3419 * @OA\Property(
3420 * property="assistant",
3421 * description="practitioner assistant",
3422 * type="string",
3423 * ),
3424 * @OA\Property(
3425 * property="organization",
3426 * description="practitioner organization",
3427 * type="string",
3428 * ),
3429 * @OA\Property(
3430 * property="valedictory",
3431 * description="practitioner valedictory",
3432 * type="string",
3433 * ),
3434 * @OA\Property(
3435 * property="street",
3436 * description="practitioner street",
3437 * type="string",
3438 * ),
3439 * @OA\Property(
3440 * property="streetb",
3441 * description="practitioner streetb",
3442 * type="string",
3443 * ),
3444 * @OA\Property(
3445 * property="city",
3446 * description="practitioner city",
3447 * type="string",
3448 * ),
3449 * @OA\Property(
3450 * property="state",
3451 * description="practitioner state",
3452 * type="string",
3453 * ),
3454 * @OA\Property(
3455 * property="zip",
3456 * description="practitioner zip",
3457 * type="string",
3458 * ),
3459 * @OA\Property(
3460 * property="phone",
3461 * description="practitioner phone",
3462 * type="string",
3463 * ),
3464 * @OA\Property(
3465 * property="fax",
3466 * description="fax",
3467 * type="string",
3468 * ),
3469 * @OA\Property(
3470 * property="phonew1",
3471 * description="practitioner phonew1",
3472 * type="string",
3473 * ),
3474 * @OA\Property(
3475 * property="phonecell",
3476 * description="practitioner phonecell",
3477 * type="string",
3478 * ),
3479 * @OA\Property(
3480 * property="notes",
3481 * description="practitioner notes",
3482 * type="string",
3483 * ),
3484 * @OA\Property(
3485 * property="state_license_number",
3486 * description="practitioner state license number",
3487 * type="string",
3488 * ),
3489 * @OA\Property(
3490 * property="abook_title",
3491 * description="practitioner abook title",
3492 * type="string",
3493 * ),
3494 * @OA\Property(
3495 * property="physician_title",
3496 * description="practitioner physician title",
3497 * type="string",
3498 * ),
3499 * @OA\Property(
3500 * property="physician_code",
3501 * description="practitioner physician code",
3502 * type="string",
3504 * ),
3505 * ),
3506 * example={
3507 * "validationErrors": {},
3508 * "error_description": {},
3509 * "data": {
3510 * "id": 7,
3511 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3512 * "title": "Mr",
3513 * "fname": "Baz",
3514 * "lname": "Bop",
3515 * "mname": "",
3516 * "federaltaxid": "",
3517 * "federaldrugid": "",
3518 * "upin": "",
3519 * "facility_id": "3",
3520 * "facility": "Your Clinic Name Here",
3521 * "npi": "0123456789",
3522 * "email": "info@pennfirm.com",
3523 * "active": "1",
3524 * "specialty": "",
3525 * "billname": "",
3526 * "url": "",
3527 * "assistant": "",
3528 * "organization": "",
3529 * "valedictory": "",
3530 * "street": "456 Tree Lane",
3531 * "streetb": "123 Cannaut Street",
3532 * "city": "FooTown",
3533 * "state": "FL",
3534 * "zip": "08642",
3535 * "phone": "123-456-7890",
3536 * "fax": "",
3537 * "phonew1": "(619) 555-7822",
3538 * "phonecell": "(619) 555-7821",
3539 * "notes": "",
3540 * "state_license_number": "123456",
3541 * "abook_title": null,
3542 * "physician_title": null,
3543 * "physician_code": null
3548 * ),
3549 * @OA\Response(
3550 * response="401",
3551 * ref="#/components/responses/unauthorized"
3552 * ),
3553 * security={{"openemr_auth":{}}}
3556 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3557 RestConfig::authorization_check("admin", "users");
3558 $data = (array) (json_decode(file_get_contents("php://input")));
3559 $return = (new PractitionerRestController())->patch($pruuid, $data);
3560 RestConfig::apiLog($return, $data);
3561 return $return;
3565 * @OA\Get(
3566 * path="/api/medical_problem",
3567 * description="Retrieves a list of medical problems",
3568 * tags={"standard"},
3569 * @OA\Parameter(
3570 * name="puuid",
3571 * in="query",
3572 * description="The uuid for the patient.",
3573 * required=false,
3574 * @OA\Schema(
3575 * type="string"
3577 * ),
3578 * @OA\Parameter(
3579 * name="condition_uuid",
3580 * in="query",
3581 * description="The uuid for the medical problem.",
3582 * required=false,
3583 * @OA\Schema(
3584 * type="string"
3586 * ),
3587 * @OA\Parameter(
3588 * name="title",
3589 * in="query",
3590 * description="The title for the medical problem.",
3591 * required=false,
3592 * @OA\Schema(
3593 * type="string"
3595 * ),
3596 * @OA\Parameter(
3597 * name="begdate",
3598 * in="query",
3599 * description="The start date for the medical problem.",
3600 * required=false,
3601 * @OA\Schema(
3602 * type="string"
3604 * ),
3605 * @OA\Parameter(
3606 * name="enddate",
3607 * in="query",
3608 * description="The end date for the medical problem.",
3609 * required=false,
3610 * @OA\Schema(
3611 * type="string"
3613 * ),
3614 * @OA\Parameter(
3615 * name="diagnosis",
3616 * in="query",
3617 * description="The diagnosis for the medical problem.",
3618 * required=false,
3619 * @OA\Schema(
3620 * type="string"
3622 * ),
3623 * @OA\Response(
3624 * response="200",
3625 * ref="#/components/responses/standard"
3626 * ),
3627 * @OA\Response(
3628 * response="400",
3629 * ref="#/components/responses/badrequest"
3630 * ),
3631 * @OA\Response(
3632 * response="401",
3633 * ref="#/components/responses/unauthorized"
3634 * ),
3635 * security={{"openemr_auth":{}}}
3638 "GET /api/medical_problem" => function () {
3639 RestConfig::authorization_check("encounters", "notes");
3640 $return = (new ConditionRestController())->getAll();
3641 RestConfig::apiLog($return);
3642 return $return;
3646 * @OA\Get(
3647 * path="/api/medical_problem/{muuid}",
3648 * description="Retrieves a single medical problem by their uuid",
3649 * tags={"standard"},
3650 * @OA\Parameter(
3651 * name="muuid",
3652 * in="path",
3653 * description="The uuid for the medical problem.",
3654 * required=true,
3655 * @OA\Schema(
3656 * type="string"
3658 * ),
3659 * @OA\Response(
3660 * response="200",
3661 * ref="#/components/responses/standard"
3662 * ),
3663 * @OA\Response(
3664 * response="400",
3665 * ref="#/components/responses/badrequest"
3666 * ),
3667 * @OA\Response(
3668 * response="401",
3669 * ref="#/components/responses/unauthorized"
3670 * ),
3671 * security={{"openemr_auth":{}}}
3674 "GET /api/medical_problem/:muuid" => function ($muuid) {
3675 RestConfig::authorization_check("encounters", "notes");
3676 $return = (new ConditionRestController())->getOne($muuid);
3677 RestConfig::apiLog($return);
3678 return $return;
3682 * @OA\Get(
3683 * path="/api/patient/{puuid}/medical_problem",
3684 * description="Retrieves all medical problems for a patient",
3685 * tags={"standard"},
3686 * @OA\Parameter(
3687 * name="puuid",
3688 * in="path",
3689 * description="The uuid for the patient.",
3690 * required=true,
3691 * @OA\Schema(
3692 * type="string"
3694 * ),
3695 * @OA\Response(
3696 * response="200",
3697 * ref="#/components/responses/standard"
3698 * ),
3699 * @OA\Response(
3700 * response="400",
3701 * ref="#/components/responses/badrequest"
3702 * ),
3703 * @OA\Response(
3704 * response="401",
3705 * ref="#/components/responses/unauthorized"
3706 * ),
3707 * security={{"openemr_auth":{}}}
3710 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3711 RestConfig::authorization_check("encounters", "notes");
3712 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3713 RestConfig::apiLog($return);
3714 return $return;
3718 * @OA\Get(
3719 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3720 * description="Retrieves a medical problem for a patient",
3721 * tags={"standard"},
3722 * @OA\Parameter(
3723 * name="puuid",
3724 * in="path",
3725 * description="The uuid for the patient.",
3726 * required=true,
3727 * @OA\Schema(
3728 * type="string"
3730 * ),
3731 * @OA\Parameter(
3732 * name="muuid",
3733 * in="path",
3734 * description="The uuid for the medical problem.",
3735 * required=true,
3736 * @OA\Schema(
3737 * type="string"
3739 * ),
3740 * @OA\Response(
3741 * response="200",
3742 * ref="#/components/responses/standard"
3743 * ),
3744 * @OA\Response(
3745 * response="400",
3746 * ref="#/components/responses/badrequest"
3747 * ),
3748 * @OA\Response(
3749 * response="401",
3750 * ref="#/components/responses/unauthorized"
3751 * ),
3752 * security={{"openemr_auth":{}}}
3755 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3756 RestConfig::authorization_check("patients", "med");
3757 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3758 RestConfig::apiLog($return);
3759 return $return;
3763 * Schema for the medical_problem request
3765 * @OA\Schema(
3766 * schema="api_medical_problem_request",
3767 * @OA\Property(
3768 * property="title",
3769 * description="The title of medical problem.",
3770 * type="string"
3771 * ),
3772 * @OA\Property(
3773 * property="begdate",
3774 * description="The beginning date of medical problem.",
3775 * type="string"
3776 * ),
3777 * @OA\Property(
3778 * property="enddate",
3779 * description="The end date of medical problem.",
3780 * type="string"
3781 * ),
3782 * @OA\Property(
3783 * property="diagnosis",
3784 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3785 * type="string"
3786 * ),
3787 * required={"title", "begdate"},
3788 * example={
3789 * "title": "Dermatochalasis",
3790 * "begdate": "2010-10-13",
3791 * "enddate": null,
3792 * "diagnosis": "ICD10:H02.839"
3797 * @OA\Post(
3798 * path="/api/patient/{puuid}/medical_problem",
3799 * description="Submits a new medical problem",
3800 * tags={"standard"},
3801 * @OA\Parameter(
3802 * name="puuid",
3803 * in="path",
3804 * description="The uuid for the patient.",
3805 * required=true,
3806 * @OA\Schema(
3807 * type="string"
3809 * ),
3810 * @OA\RequestBody(
3811 * required=true,
3812 * @OA\MediaType(
3813 * mediaType="application/json",
3814 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3816 * ),
3817 * @OA\Response(
3818 * response="200",
3819 * ref="#/components/responses/standard"
3820 * ),
3821 * @OA\Response(
3822 * response="400",
3823 * ref="#/components/responses/badrequest"
3824 * ),
3825 * @OA\Response(
3826 * response="401",
3827 * ref="#/components/responses/unauthorized"
3828 * ),
3829 * security={{"openemr_auth":{}}}
3832 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3833 RestConfig::authorization_check("patients", "med");
3834 $data = (array) (json_decode(file_get_contents("php://input")));
3835 $return = (new ConditionRestController())->post($puuid, $data);
3836 RestConfig::apiLog($return, $data);
3837 return $return;
3841 * @OA\Put(
3842 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3843 * description="Edit a medical problem",
3844 * tags={"standard"},
3845 * @OA\Parameter(
3846 * name="puuid",
3847 * in="path",
3848 * description="The uuid for the patient.",
3849 * required=true,
3850 * @OA\Schema(
3851 * type="string"
3853 * ),
3854 * @OA\Parameter(
3855 * name="muuid",
3856 * in="path",
3857 * description="The uuid for the medical problem.",
3858 * required=true,
3859 * @OA\Schema(
3860 * type="string"
3862 * ),
3863 * @OA\RequestBody(
3864 * required=true,
3865 * @OA\MediaType(
3866 * mediaType="application/json",
3867 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3869 * ),
3870 * @OA\Response(
3871 * response="200",
3872 * ref="#/components/responses/standard"
3873 * ),
3874 * @OA\Response(
3875 * response="400",
3876 * ref="#/components/responses/badrequest"
3877 * ),
3878 * @OA\Response(
3879 * response="401",
3880 * ref="#/components/responses/unauthorized"
3881 * ),
3882 * security={{"openemr_auth":{}}}
3885 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3886 RestConfig::authorization_check("patients", "med");
3887 $data = (array) (json_decode(file_get_contents("php://input")));
3888 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3889 RestConfig::apiLog($return, $data);
3890 return $return;
3894 * @OA\Delete(
3895 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3896 * description="Delete a medical problem",
3897 * tags={"standard"},
3898 * @OA\Parameter(
3899 * name="puuid",
3900 * in="path",
3901 * description="The uuid for the patient.",
3902 * required=true,
3903 * @OA\Schema(
3904 * type="string"
3906 * ),
3907 * @OA\Parameter(
3908 * name="muuid",
3909 * in="path",
3910 * description="The uuid for the medical problem.",
3911 * required=true,
3912 * @OA\Schema(
3913 * type="string"
3915 * ),
3916 * @OA\Response(
3917 * response="200",
3918 * ref="#/components/responses/standard"
3919 * ),
3920 * @OA\Response(
3921 * response="400",
3922 * ref="#/components/responses/badrequest"
3923 * ),
3924 * @OA\Response(
3925 * response="401",
3926 * ref="#/components/responses/unauthorized"
3927 * ),
3928 * security={{"openemr_auth":{}}}
3931 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3932 RestConfig::authorization_check("patients", "med");
3933 $return = (new ConditionRestController())->delete($puuid, $muuid);
3934 RestConfig::apiLog($return);
3935 return $return;
3939 * @OA\Get(
3940 * path="/api/allergy",
3941 * description="Retrieves a list of allergies",
3942 * tags={"standard"},
3943 * @OA\Parameter(
3944 * name="lists.pid",
3945 * in="query",
3946 * description="The uuid for the patient.",
3947 * required=false,
3948 * @OA\Schema(
3949 * type="string"
3951 * ),
3952 * @OA\Parameter(
3953 * name="lists.id",
3954 * in="query",
3955 * description="The uuid for the allergy.",
3956 * required=false,
3957 * @OA\Schema(
3958 * type="string"
3960 * ),
3961 * @OA\Parameter(
3962 * name="title",
3963 * in="query",
3964 * description="The title for the allergy.",
3965 * required=false,
3966 * @OA\Schema(
3967 * type="string"
3969 * ),
3970 * @OA\Parameter(
3971 * name="begdate",
3972 * in="query",
3973 * description="The start date for the allergy.",
3974 * required=false,
3975 * @OA\Schema(
3976 * type="string"
3978 * ),
3979 * @OA\Parameter(
3980 * name="enddate",
3981 * in="query",
3982 * description="The end date for the allergy.",
3983 * required=false,
3984 * @OA\Schema(
3985 * type="string"
3987 * ),
3988 * @OA\Parameter(
3989 * name="diagnosis",
3990 * in="query",
3991 * description="The diagnosis for the allergy.",
3992 * required=false,
3993 * @OA\Schema(
3994 * type="string"
3996 * ),
3997 * @OA\Response(
3998 * response="200",
3999 * ref="#/components/responses/standard"
4000 * ),
4001 * @OA\Response(
4002 * response="400",
4003 * ref="#/components/responses/badrequest"
4004 * ),
4005 * @OA\Response(
4006 * response="401",
4007 * ref="#/components/responses/unauthorized"
4008 * ),
4009 * security={{"openemr_auth":{}}}
4012 "GET /api/allergy" => function () {
4013 RestConfig::authorization_check("patients", "med");
4014 $return = (new AllergyIntoleranceRestController())->getAll();
4015 RestConfig::apiLog($return);
4016 return $return;
4020 * @OA\Get(
4021 * path="/api/allergy/{auuid}",
4022 * description="Retrieves a single allergy by their uuid",
4023 * tags={"standard"},
4024 * @OA\Parameter(
4025 * name="auuid",
4026 * in="path",
4027 * description="The uuid for the allergy.",
4028 * required=true,
4029 * @OA\Schema(
4030 * type="string"
4032 * ),
4033 * @OA\Response(
4034 * response="200",
4035 * ref="#/components/responses/standard"
4036 * ),
4037 * @OA\Response(
4038 * response="400",
4039 * ref="#/components/responses/badrequest"
4040 * ),
4041 * @OA\Response(
4042 * response="401",
4043 * ref="#/components/responses/unauthorized"
4044 * ),
4045 * security={{"openemr_auth":{}}}
4048 "GET /api/allergy/:auuid" => function ($auuid) {
4049 RestConfig::authorization_check("patients", "med");
4050 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
4051 RestConfig::apiLog($return);
4052 return $return;
4056 * @OA\Get(
4057 * path="/api/patient/{puuid}/allergy",
4058 * description="Retrieves all allergies for a patient",
4059 * tags={"standard"},
4060 * @OA\Parameter(
4061 * name="puuid",
4062 * in="path",
4063 * description="The uuid for the patient.",
4064 * required=true,
4065 * @OA\Schema(
4066 * type="string"
4068 * ),
4069 * @OA\Response(
4070 * response="200",
4071 * ref="#/components/responses/standard"
4072 * ),
4073 * @OA\Response(
4074 * response="400",
4075 * ref="#/components/responses/badrequest"
4076 * ),
4077 * @OA\Response(
4078 * response="401",
4079 * ref="#/components/responses/unauthorized"
4080 * ),
4081 * security={{"openemr_auth":{}}}
4084 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4085 RestConfig::authorization_check("patients", "med");
4086 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4087 RestConfig::apiLog($return);
4088 return $return;
4092 * @OA\Get(
4093 * path="/api/patient/{puuid}/allergy/{auuid}",
4094 * description="Retrieves a allergy for a patient",
4095 * tags={"standard"},
4096 * @OA\Parameter(
4097 * name="puuid",
4098 * in="path",
4099 * description="The uuid for the patient.",
4100 * required=true,
4101 * @OA\Schema(
4102 * type="string"
4104 * ),
4105 * @OA\Parameter(
4106 * name="auuid",
4107 * in="path",
4108 * description="The uuid for the allergy.",
4109 * required=true,
4110 * @OA\Schema(
4111 * type="string"
4113 * ),
4114 * @OA\Response(
4115 * response="200",
4116 * ref="#/components/responses/standard"
4117 * ),
4118 * @OA\Response(
4119 * response="400",
4120 * ref="#/components/responses/badrequest"
4121 * ),
4122 * @OA\Response(
4123 * response="401",
4124 * ref="#/components/responses/unauthorized"
4125 * ),
4126 * security={{"openemr_auth":{}}}
4129 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4130 RestConfig::authorization_check("patients", "med");
4131 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4132 RestConfig::apiLog($return);
4133 return $return;
4137 * Schema for the allergy request
4139 * @OA\Schema(
4140 * schema="api_allergy_request",
4141 * @OA\Property(
4142 * property="title",
4143 * description="The title of allergy.",
4144 * type="string"
4145 * ),
4146 * @OA\Property(
4147 * property="begdate",
4148 * description="The beginning date of allergy.",
4149 * type="string"
4150 * ),
4151 * @OA\Property(
4152 * property="enddate",
4153 * description="The end date of allergy.",
4154 * type="string"
4155 * ),
4156 * @OA\Property(
4157 * property="diagnosis",
4158 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4159 * type="string"
4160 * ),
4161 * required={"title", "begdate"},
4162 * example={
4163 * "title": "Iodine",
4164 * "begdate": "2010-10-13",
4165 * "enddate": null
4170 * @OA\Post(
4171 * path="/api/patient/{puuid}/allergy",
4172 * description="Submits a new allergy",
4173 * tags={"standard"},
4174 * @OA\Parameter(
4175 * name="puuid",
4176 * in="path",
4177 * description="The uuid for the patient.",
4178 * required=true,
4179 * @OA\Schema(
4180 * type="string"
4182 * ),
4183 * @OA\RequestBody(
4184 * required=true,
4185 * @OA\MediaType(
4186 * mediaType="application/json",
4187 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4189 * ),
4190 * @OA\Response(
4191 * response="200",
4192 * ref="#/components/responses/standard"
4193 * ),
4194 * @OA\Response(
4195 * response="400",
4196 * ref="#/components/responses/badrequest"
4197 * ),
4198 * @OA\Response(
4199 * response="401",
4200 * ref="#/components/responses/unauthorized"
4201 * ),
4202 * security={{"openemr_auth":{}}}
4205 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4206 RestConfig::authorization_check("patients", "med");
4207 $data = (array) (json_decode(file_get_contents("php://input")));
4208 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4209 RestConfig::apiLog($return, $data);
4210 return $return;
4214 * @OA\Put(
4215 * path="/api/patient/{puuid}/allergy/{auuid}",
4216 * description="Edit a allergy",
4217 * tags={"standard"},
4218 * @OA\Parameter(
4219 * name="puuid",
4220 * in="path",
4221 * description="The uuid for the patient.",
4222 * required=true,
4223 * @OA\Schema(
4224 * type="string"
4226 * ),
4227 * @OA\Parameter(
4228 * name="auuid",
4229 * in="path",
4230 * description="The uuid for the allergy.",
4231 * required=true,
4232 * @OA\Schema(
4233 * type="string"
4235 * ),
4236 * @OA\RequestBody(
4237 * required=true,
4238 * @OA\MediaType(
4239 * mediaType="application/json",
4240 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4242 * ),
4243 * @OA\Response(
4244 * response="200",
4245 * ref="#/components/responses/standard"
4246 * ),
4247 * @OA\Response(
4248 * response="400",
4249 * ref="#/components/responses/badrequest"
4250 * ),
4251 * @OA\Response(
4252 * response="401",
4253 * ref="#/components/responses/unauthorized"
4254 * ),
4255 * security={{"openemr_auth":{}}}
4258 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4259 RestConfig::authorization_check("patients", "med");
4260 $data = (array) (json_decode(file_get_contents("php://input")));
4261 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4262 RestConfig::apiLog($return, $data);
4263 return $return;
4267 * @OA\Delete(
4268 * path="/api/patient/{puuid}/allergy/{auuid}",
4269 * description="Delete a medical problem",
4270 * tags={"standard"},
4271 * @OA\Parameter(
4272 * name="puuid",
4273 * in="path",
4274 * description="The uuid for the patient.",
4275 * required=true,
4276 * @OA\Schema(
4277 * type="string"
4279 * ),
4280 * @OA\Parameter(
4281 * name="auuid",
4282 * in="path",
4283 * description="The uuid for the allergy.",
4284 * required=true,
4285 * @OA\Schema(
4286 * type="string"
4288 * ),
4289 * @OA\Response(
4290 * response="200",
4291 * ref="#/components/responses/standard"
4292 * ),
4293 * @OA\Response(
4294 * response="400",
4295 * ref="#/components/responses/badrequest"
4296 * ),
4297 * @OA\Response(
4298 * response="401",
4299 * ref="#/components/responses/unauthorized"
4300 * ),
4301 * security={{"openemr_auth":{}}}
4304 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4305 RestConfig::authorization_check("patients", "med");
4306 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4307 RestConfig::apiLog($return);
4308 return $return;
4312 * @OA\Get(
4313 * path="/api/patient/{pid}/medication",
4314 * description="Retrieves all medications for a patient",
4315 * tags={"standard"},
4316 * @OA\Parameter(
4317 * name="pid",
4318 * in="path",
4319 * description="The pid for the patient.",
4320 * required=true,
4321 * @OA\Schema(
4322 * type="string"
4324 * ),
4325 * @OA\Response(
4326 * response="200",
4327 * ref="#/components/responses/standard"
4328 * ),
4329 * @OA\Response(
4330 * response="400",
4331 * ref="#/components/responses/badrequest"
4332 * ),
4333 * @OA\Response(
4334 * response="401",
4335 * ref="#/components/responses/unauthorized"
4336 * ),
4337 * security={{"openemr_auth":{}}}
4340 "GET /api/patient/:pid/medication" => function ($pid) {
4341 RestConfig::authorization_check("patients", "med");
4342 $return = (new ListRestController())->getAll($pid, "medication");
4343 RestConfig::apiLog($return);
4344 return $return;
4348 * Schema for the medication request
4350 * @OA\Schema(
4351 * schema="api_medication_request",
4352 * @OA\Property(
4353 * property="title",
4354 * description="The title of medication.",
4355 * type="string"
4356 * ),
4357 * @OA\Property(
4358 * property="begdate",
4359 * description="The beginning date of medication.",
4360 * type="string"
4361 * ),
4362 * @OA\Property(
4363 * property="enddate",
4364 * description="The end date of medication.",
4365 * type="string"
4366 * ),
4367 * @OA\Property(
4368 * property="diagnosis",
4369 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4370 * type="string"
4371 * ),
4372 * required={"title", "begdate"},
4373 * example={
4374 * "title": "Norvasc",
4375 * "begdate": "2013-04-13",
4376 * "enddate": null
4381 * @OA\Post(
4382 * path="/api/patient/{pid}/medication",
4383 * description="Submits a new medication",
4384 * tags={"standard"},
4385 * @OA\Parameter(
4386 * name="pid",
4387 * in="path",
4388 * description="The pid for the patient.",
4389 * required=true,
4390 * @OA\Schema(
4391 * type="string"
4393 * ),
4394 * @OA\RequestBody(
4395 * required=true,
4396 * @OA\MediaType(
4397 * mediaType="application/json",
4398 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4400 * ),
4401 * @OA\Response(
4402 * response="200",
4403 * ref="#/components/responses/standard"
4404 * ),
4405 * @OA\Response(
4406 * response="400",
4407 * ref="#/components/responses/badrequest"
4408 * ),
4409 * @OA\Response(
4410 * response="401",
4411 * ref="#/components/responses/unauthorized"
4412 * ),
4413 * security={{"openemr_auth":{}}}
4416 "POST /api/patient/:pid/medication" => function ($pid) {
4417 RestConfig::authorization_check("patients", "med");
4418 $data = (array) (json_decode(file_get_contents("php://input")));
4419 $return = (new ListRestController())->post($pid, "medication", $data);
4420 RestConfig::apiLog($return, $data);
4421 return $return;
4425 * @OA\Put(
4426 * path="/api/patient/{pid}/medication/{mid}",
4427 * description="Edit a medication",
4428 * tags={"standard"},
4429 * @OA\Parameter(
4430 * name="pid",
4431 * in="path",
4432 * description="The pid for the patient.",
4433 * required=true,
4434 * @OA\Schema(
4435 * type="string"
4437 * ),
4438 * @OA\Parameter(
4439 * name="mid",
4440 * in="path",
4441 * description="The id for the medication.",
4442 * required=true,
4443 * @OA\Schema(
4444 * type="string"
4446 * ),
4447 * @OA\RequestBody(
4448 * required=true,
4449 * @OA\MediaType(
4450 * mediaType="application/json",
4451 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4453 * ),
4454 * @OA\Response(
4455 * response="200",
4456 * ref="#/components/responses/standard"
4457 * ),
4458 * @OA\Response(
4459 * response="400",
4460 * ref="#/components/responses/badrequest"
4461 * ),
4462 * @OA\Response(
4463 * response="401",
4464 * ref="#/components/responses/unauthorized"
4465 * ),
4466 * security={{"openemr_auth":{}}}
4469 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4470 RestConfig::authorization_check("patients", "med");
4471 $data = (array) (json_decode(file_get_contents("php://input")));
4472 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4473 RestConfig::apiLog($return, $data);
4474 return $return;
4478 * @OA\Get(
4479 * path="/api/patient/{pid}/medication/{mid}",
4480 * description="Retrieves a medication for a patient",
4481 * tags={"standard"},
4482 * @OA\Parameter(
4483 * name="pid",
4484 * in="path",
4485 * description="The id for the patient.",
4486 * required=true,
4487 * @OA\Schema(
4488 * type="string"
4490 * ),
4491 * @OA\Parameter(
4492 * name="mid",
4493 * in="path",
4494 * description="The id for the medication.",
4495 * required=true,
4496 * @OA\Schema(
4497 * type="string"
4499 * ),
4500 * @OA\Response(
4501 * response="200",
4502 * ref="#/components/responses/standard"
4503 * ),
4504 * @OA\Response(
4505 * response="400",
4506 * ref="#/components/responses/badrequest"
4507 * ),
4508 * @OA\Response(
4509 * response="401",
4510 * ref="#/components/responses/unauthorized"
4511 * ),
4512 * security={{"openemr_auth":{}}}
4515 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4516 RestConfig::authorization_check("patients", "med");
4517 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4518 RestConfig::apiLog($return);
4519 return $return;
4523 * @OA\Delete(
4524 * path="/api/patient/{pid}/medication/{mid}",
4525 * description="Delete a medication",
4526 * tags={"standard"},
4527 * @OA\Parameter(
4528 * name="pid",
4529 * in="path",
4530 * description="The id for the patient.",
4531 * required=true,
4532 * @OA\Schema(
4533 * type="string"
4535 * ),
4536 * @OA\Parameter(
4537 * name="mid",
4538 * in="path",
4539 * description="The id for the medication.",
4540 * required=true,
4541 * @OA\Schema(
4542 * type="string"
4544 * ),
4545 * @OA\Response(
4546 * response="200",
4547 * ref="#/components/responses/standard"
4548 * ),
4549 * @OA\Response(
4550 * response="400",
4551 * ref="#/components/responses/badrequest"
4552 * ),
4553 * @OA\Response(
4554 * response="401",
4555 * ref="#/components/responses/unauthorized"
4556 * ),
4557 * security={{"openemr_auth":{}}}
4560 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4561 RestConfig::authorization_check("patients", "med");
4562 $return = (new ListRestController())->delete($pid, $mid, "medication");
4563 RestConfig::apiLog($return);
4564 return $return;
4568 * @OA\Get(
4569 * path="/api/patient/{pid}/surgery",
4570 * description="Retrieves all surgeries for a patient",
4571 * tags={"standard"},
4572 * @OA\Parameter(
4573 * name="pid",
4574 * in="path",
4575 * description="The pid for the patient.",
4576 * required=true,
4577 * @OA\Schema(
4578 * type="string"
4580 * ),
4581 * @OA\Response(
4582 * response="200",
4583 * ref="#/components/responses/standard"
4584 * ),
4585 * @OA\Response(
4586 * response="400",
4587 * ref="#/components/responses/badrequest"
4588 * ),
4589 * @OA\Response(
4590 * response="401",
4591 * ref="#/components/responses/unauthorized"
4592 * ),
4593 * security={{"openemr_auth":{}}}
4596 "GET /api/patient/:pid/surgery" => function ($pid) {
4597 RestConfig::authorization_check("patients", "med");
4598 $return = (new ListRestController())->getAll($pid, "surgery");
4599 RestConfig::apiLog($return);
4600 return $return;
4604 * @OA\Get(
4605 * path="/api/patient/{pid}/surgery/{sid}",
4606 * description="Retrieves a surgery for a patient",
4607 * tags={"standard"},
4608 * @OA\Parameter(
4609 * name="pid",
4610 * in="path",
4611 * description="The id for the patient.",
4612 * required=true,
4613 * @OA\Schema(
4614 * type="string"
4616 * ),
4617 * @OA\Parameter(
4618 * name="sid",
4619 * in="path",
4620 * description="The id for the surgery.",
4621 * required=true,
4622 * @OA\Schema(
4623 * type="string"
4625 * ),
4626 * @OA\Response(
4627 * response="200",
4628 * ref="#/components/responses/standard"
4629 * ),
4630 * @OA\Response(
4631 * response="400",
4632 * ref="#/components/responses/badrequest"
4633 * ),
4634 * @OA\Response(
4635 * response="401",
4636 * ref="#/components/responses/unauthorized"
4637 * ),
4638 * security={{"openemr_auth":{}}}
4641 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4642 RestConfig::authorization_check("patients", "med");
4643 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4644 RestConfig::apiLog($return);
4645 return $return;
4649 * @OA\Delete(
4650 * path="/api/patient/{pid}/surgery/{sid}",
4651 * description="Delete a surgery",
4652 * tags={"standard"},
4653 * @OA\Parameter(
4654 * name="pid",
4655 * in="path",
4656 * description="The id for the patient.",
4657 * required=true,
4658 * @OA\Schema(
4659 * type="string"
4661 * ),
4662 * @OA\Parameter(
4663 * name="sid",
4664 * in="path",
4665 * description="The id for the surgery.",
4666 * required=true,
4667 * @OA\Schema(
4668 * type="string"
4670 * ),
4671 * @OA\Response(
4672 * response="200",
4673 * ref="#/components/responses/standard"
4674 * ),
4675 * @OA\Response(
4676 * response="400",
4677 * ref="#/components/responses/badrequest"
4678 * ),
4679 * @OA\Response(
4680 * response="401",
4681 * ref="#/components/responses/unauthorized"
4682 * ),
4683 * security={{"openemr_auth":{}}}
4686 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4687 RestConfig::authorization_check("patients", "med");
4688 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4689 RestConfig::apiLog($return);
4690 return $return;
4694 * Schema for the surgery request
4696 * @OA\Schema(
4697 * schema="api_surgery_request",
4698 * @OA\Property(
4699 * property="title",
4700 * description="The title of surgery.",
4701 * type="string"
4702 * ),
4703 * @OA\Property(
4704 * property="begdate",
4705 * description="The beginning date of surgery.",
4706 * type="string"
4707 * ),
4708 * @OA\Property(
4709 * property="enddate",
4710 * description="The end date of surgery.",
4711 * type="string"
4712 * ),
4713 * @OA\Property(
4714 * property="diagnosis",
4715 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4716 * type="string"
4717 * ),
4718 * required={"title", "begdate"},
4719 * example={
4720 * "title": "Blepharoplasty",
4721 * "begdate": "2013-10-14",
4722 * "enddate": null,
4723 * "diagnosis": "CPT4:15823-50"
4728 * @OA\Post(
4729 * path="/api/patient/{pid}/surgery",
4730 * description="Submits a new surgery",
4731 * tags={"standard"},
4732 * @OA\Parameter(
4733 * name="pid",
4734 * in="path",
4735 * description="The pid for the patient.",
4736 * required=true,
4737 * @OA\Schema(
4738 * type="string"
4740 * ),
4741 * @OA\RequestBody(
4742 * required=true,
4743 * @OA\MediaType(
4744 * mediaType="application/json",
4745 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4747 * ),
4748 * @OA\Response(
4749 * response="200",
4750 * ref="#/components/responses/standard"
4751 * ),
4752 * @OA\Response(
4753 * response="400",
4754 * ref="#/components/responses/badrequest"
4755 * ),
4756 * @OA\Response(
4757 * response="401",
4758 * ref="#/components/responses/unauthorized"
4759 * ),
4760 * security={{"openemr_auth":{}}}
4763 "POST /api/patient/:pid/surgery" => function ($pid) {
4764 RestConfig::authorization_check("patients", "med");
4765 $data = (array) (json_decode(file_get_contents("php://input")));
4766 $return = (new ListRestController())->post($pid, "surgery", $data);
4767 RestConfig::apiLog($return, $data);
4768 return $return;
4772 * @OA\Put(
4773 * path="/api/patient/{pid}/surgery/{sid}",
4774 * description="Edit a surgery",
4775 * tags={"standard"},
4776 * @OA\Parameter(
4777 * name="pid",
4778 * in="path",
4779 * description="The pid for the patient.",
4780 * required=true,
4781 * @OA\Schema(
4782 * type="string"
4784 * ),
4785 * @OA\Parameter(
4786 * name="sid",
4787 * in="path",
4788 * description="The id for the surgery.",
4789 * required=true,
4790 * @OA\Schema(
4791 * type="string"
4793 * ),
4794 * @OA\RequestBody(
4795 * required=true,
4796 * @OA\MediaType(
4797 * mediaType="application/json",
4798 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4800 * ),
4801 * @OA\Response(
4802 * response="200",
4803 * ref="#/components/responses/standard"
4804 * ),
4805 * @OA\Response(
4806 * response="400",
4807 * ref="#/components/responses/badrequest"
4808 * ),
4809 * @OA\Response(
4810 * response="401",
4811 * ref="#/components/responses/unauthorized"
4812 * ),
4813 * security={{"openemr_auth":{}}}
4816 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4817 RestConfig::authorization_check("patients", "med");
4818 $data = (array) (json_decode(file_get_contents("php://input")));
4819 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4820 RestConfig::apiLog($return, $data);
4821 return $return;
4825 * @OA\Get(
4826 * path="/api/patient/{pid}/dental_issue",
4827 * description="Retrieves all dental issues for a patient",
4828 * tags={"standard"},
4829 * @OA\Parameter(
4830 * name="pid",
4831 * in="path",
4832 * description="The pid for the patient.",
4833 * required=true,
4834 * @OA\Schema(
4835 * type="string"
4837 * ),
4838 * @OA\Response(
4839 * response="200",
4840 * ref="#/components/responses/standard"
4841 * ),
4842 * @OA\Response(
4843 * response="400",
4844 * ref="#/components/responses/badrequest"
4845 * ),
4846 * @OA\Response(
4847 * response="401",
4848 * ref="#/components/responses/unauthorized"
4849 * ),
4850 * security={{"openemr_auth":{}}}
4853 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4854 RestConfig::authorization_check("patients", "med");
4855 $return = (new ListRestController())->getAll($pid, "dental");
4856 RestConfig::apiLog($return);
4857 return $return;
4861 * @OA\Get(
4862 * path="/api/patient/{pid}/dental_issue/{did}",
4863 * description="Retrieves a dental issue for a patient",
4864 * tags={"standard"},
4865 * @OA\Parameter(
4866 * name="pid",
4867 * in="path",
4868 * description="The id for the patient.",
4869 * required=true,
4870 * @OA\Schema(
4871 * type="string"
4873 * ),
4874 * @OA\Parameter(
4875 * name="did",
4876 * in="path",
4877 * description="The id for the dental issue.",
4878 * required=true,
4879 * @OA\Schema(
4880 * type="string"
4882 * ),
4883 * @OA\Response(
4884 * response="200",
4885 * ref="#/components/responses/standard"
4886 * ),
4887 * @OA\Response(
4888 * response="400",
4889 * ref="#/components/responses/badrequest"
4890 * ),
4891 * @OA\Response(
4892 * response="401",
4893 * ref="#/components/responses/unauthorized"
4894 * ),
4895 * security={{"openemr_auth":{}}}
4898 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4899 RestConfig::authorization_check("patients", "med");
4900 $return = (new ListRestController())->getOne($pid, "dental", $did);
4901 RestConfig::apiLog($return);
4902 return $return;
4906 * @OA\Delete(
4907 * path="/api/patient/{pid}/dental_issue/{did}",
4908 * description="Delete a dental issue",
4909 * tags={"standard"},
4910 * @OA\Parameter(
4911 * name="pid",
4912 * in="path",
4913 * description="The id for the patient.",
4914 * required=true,
4915 * @OA\Schema(
4916 * type="string"
4918 * ),
4919 * @OA\Parameter(
4920 * name="did",
4921 * in="path",
4922 * description="The id for the dental issue.",
4923 * required=true,
4924 * @OA\Schema(
4925 * type="string"
4927 * ),
4928 * @OA\Response(
4929 * response="200",
4930 * ref="#/components/responses/standard"
4931 * ),
4932 * @OA\Response(
4933 * response="400",
4934 * ref="#/components/responses/badrequest"
4935 * ),
4936 * @OA\Response(
4937 * response="401",
4938 * ref="#/components/responses/unauthorized"
4939 * ),
4940 * security={{"openemr_auth":{}}}
4943 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4944 RestConfig::authorization_check("patients", "med");
4945 $return = (new ListRestController())->delete($pid, $did, "dental");
4946 RestConfig::apiLog($return);
4947 return $return;
4951 * Schema for the dental_issue request
4953 * @OA\Schema(
4954 * schema="api_dental_issue_request",
4955 * @OA\Property(
4956 * property="title",
4957 * description="The title of dental issue.",
4958 * type="string"
4959 * ),
4960 * @OA\Property(
4961 * property="begdate",
4962 * description="The beginning date of dental issue.",
4963 * type="string"
4964 * ),
4965 * @OA\Property(
4966 * property="enddate",
4967 * description="The end date of dental issue.",
4968 * type="string"
4969 * ),
4970 * @OA\Property(
4971 * property="diagnosis",
4972 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4973 * type="string"
4974 * ),
4975 * required={"title", "begdate"},
4976 * example={
4977 * "title": "Halitosis",
4978 * "begdate": "2015-03-17",
4979 * "enddate": null,
4984 * @OA\Post(
4985 * path="/api/patient/{pid}/dental_issue",
4986 * description="Submits a new dental issue",
4987 * tags={"standard"},
4988 * @OA\Parameter(
4989 * name="pid",
4990 * in="path",
4991 * description="The pid for the patient.",
4992 * required=true,
4993 * @OA\Schema(
4994 * type="string"
4996 * ),
4997 * @OA\RequestBody(
4998 * required=true,
4999 * @OA\MediaType(
5000 * mediaType="application/json",
5001 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5003 * ),
5004 * @OA\Response(
5005 * response="200",
5006 * ref="#/components/responses/standard"
5007 * ),
5008 * @OA\Response(
5009 * response="400",
5010 * ref="#/components/responses/badrequest"
5011 * ),
5012 * @OA\Response(
5013 * response="401",
5014 * ref="#/components/responses/unauthorized"
5015 * ),
5016 * security={{"openemr_auth":{}}}
5019 "POST /api/patient/:pid/dental_issue" => function ($pid) {
5020 RestConfig::authorization_check("patients", "med");
5021 $data = (array) (json_decode(file_get_contents("php://input")));
5022 $return = (new ListRestController())->post($pid, "dental", $data);
5023 RestConfig::apiLog($return, $data);
5024 return $return;
5028 * @OA\Put(
5029 * path="/api/patient/{pid}/dental_issue/{did}",
5030 * description="Edit a dental issue",
5031 * tags={"standard"},
5032 * @OA\Parameter(
5033 * name="pid",
5034 * in="path",
5035 * description="The pid for the patient.",
5036 * required=true,
5037 * @OA\Schema(
5038 * type="string"
5040 * ),
5041 * @OA\Parameter(
5042 * name="did",
5043 * in="path",
5044 * description="The id for the dental issue.",
5045 * required=true,
5046 * @OA\Schema(
5047 * type="string"
5049 * ),
5050 * @OA\RequestBody(
5051 * required=true,
5052 * @OA\MediaType(
5053 * mediaType="application/json",
5054 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5056 * ),
5057 * @OA\Response(
5058 * response="200",
5059 * ref="#/components/responses/standard"
5060 * ),
5061 * @OA\Response(
5062 * response="400",
5063 * ref="#/components/responses/badrequest"
5064 * ),
5065 * @OA\Response(
5066 * response="401",
5067 * ref="#/components/responses/unauthorized"
5068 * ),
5069 * security={{"openemr_auth":{}}}
5072 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5073 RestConfig::authorization_check("patients", "med");
5074 $data = (array) (json_decode(file_get_contents("php://input")));
5075 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5076 RestConfig::apiLog($return, $data);
5077 return $return;
5081 * @OA\Get(
5082 * path="/api/patient/{pid}/appointment",
5083 * description="Retrieves all appointments for a patient",
5084 * tags={"standard"},
5085 * @OA\Parameter(
5086 * name="pid",
5087 * in="path",
5088 * description="The pid for the patient.",
5089 * required=true,
5090 * @OA\Schema(
5091 * type="string"
5093 * ),
5094 * @OA\Response(
5095 * response="200",
5096 * ref="#/components/responses/standard"
5097 * ),
5098 * @OA\Response(
5099 * response="400",
5100 * ref="#/components/responses/badrequest"
5101 * ),
5102 * @OA\Response(
5103 * response="401",
5104 * ref="#/components/responses/unauthorized"
5105 * ),
5106 * security={{"openemr_auth":{}}}
5109 "GET /api/patient/:pid/appointment" => function ($pid) {
5110 RestConfig::authorization_check("patients", "appt");
5111 $return = (new AppointmentRestController())->getAllForPatient($pid);
5112 RestConfig::apiLog($return);
5113 return $return;
5117 * @OA\Post(
5118 * path="/api/patient/{pid}/appointment",
5119 * description="Submits a new appointment",
5120 * tags={"standard"},
5121 * @OA\Parameter(
5122 * name="pid",
5123 * in="path",
5124 * description="The id for the patient.",
5125 * required=true,
5126 * @OA\Schema(
5127 * type="string"
5129 * ),
5130 * @OA\RequestBody(
5131 * required=true,
5132 * @OA\MediaType(
5133 * mediaType="application/json",
5134 * @OA\Schema(
5135 * @OA\Property(
5136 * property="pc_catid",
5137 * description="The category of the appointment.",
5138 * type="string"
5139 * ),
5140 * @OA\Property(
5141 * property="pc_title",
5142 * description="The title of the appointment.",
5143 * type="string"
5144 * ),
5145 * @OA\Property(
5146 * property="pc_duration",
5147 * description="The duration of the appointment.",
5148 * type="string"
5149 * ),
5150 * @OA\Property(
5151 * property="pc_hometext",
5152 * description="Comments for the appointment.",
5153 * type="string"
5154 * ),
5155 * @OA\Property(
5156 * property="pc_apptstatus",
5157 * description="use an option from resource=/api/list/apptstat",
5158 * type="string"
5159 * ),
5160 * @OA\Property(
5161 * property="pc_eventDate",
5162 * description="The date of the appointment.",
5163 * type="string"
5164 * ),
5165 * @OA\Property(
5166 * property="pc_startTime",
5167 * description="The time of the appointment.",
5168 * type="string"
5169 * ),
5170 * @OA\Property(
5171 * property="pc_facility",
5172 * description="The facility id of the appointment.",
5173 * type="string"
5174 * ),
5175 * @OA\Property(
5176 * property="pc_billing_location",
5177 * description="The billinag location id of the appointment.",
5178 * type="string"
5179 * ),
5180 * @OA\Property(
5181 * property="pc_aid",
5182 * description="The provider id for the appointment.",
5183 * type="string"
5184 * ),
5185 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5186 * example={
5187 * "pc_catid": "5",
5188 * "pc_title": "Office Visit",
5189 * "pc_duration": "900",
5190 * "pc_hometext": "Test",
5191 * "pc_apptstatus": "-",
5192 * "pc_eventDate": "2018-10-19",
5193 * "pc_startTime": "09:00",
5194 * "pc_facility": "9",
5195 * "pc_billing_location": "10",
5196 * "pc_aid": "1"
5200 * ),
5201 * @OA\Response(
5202 * response="200",
5203 * ref="#/components/responses/standard"
5204 * ),
5205 * @OA\Response(
5206 * response="400",
5207 * ref="#/components/responses/badrequest"
5208 * ),
5209 * @OA\Response(
5210 * response="401",
5211 * ref="#/components/responses/unauthorized"
5212 * ),
5213 * security={{"openemr_auth":{}}}
5216 "POST /api/patient/:pid/appointment" => function ($pid) {
5217 RestConfig::authorization_check("patients", "appt");
5218 $data = (array) (json_decode(file_get_contents("php://input")));
5219 $return = (new AppointmentRestController())->post($pid, $data);
5220 RestConfig::apiLog($return, $data);
5221 return $return;
5225 * @OA\Get(
5226 * path="/api/appointment",
5227 * description="Retrieves all appointments",
5228 * tags={"standard"},
5229 * @OA\Response(
5230 * response="200",
5231 * ref="#/components/responses/standard"
5232 * ),
5233 * @OA\Response(
5234 * response="400",
5235 * ref="#/components/responses/badrequest"
5236 * ),
5237 * @OA\Response(
5238 * response="401",
5239 * ref="#/components/responses/unauthorized"
5240 * ),
5241 * security={{"openemr_auth":{}}}
5244 "GET /api/appointment" => function () {
5245 RestConfig::authorization_check("patients", "appt");
5246 $return = (new AppointmentRestController())->getAll();
5247 RestConfig::apiLog($return);
5248 return $return;
5252 * @OA\Get(
5253 * path="/api/appointment/{eid}",
5254 * description="Retrieves an appointment",
5255 * tags={"standard"},
5256 * @OA\Parameter(
5257 * name="eid",
5258 * in="path",
5259 * description="The eid for the appointment.",
5260 * required=true,
5261 * @OA\Schema(
5262 * type="string"
5264 * ),
5265 * @OA\Response(
5266 * response="200",
5267 * ref="#/components/responses/standard"
5268 * ),
5269 * @OA\Response(
5270 * response="400",
5271 * ref="#/components/responses/badrequest"
5272 * ),
5273 * @OA\Response(
5274 * response="401",
5275 * ref="#/components/responses/unauthorized"
5276 * ),
5277 * security={{"openemr_auth":{}}}
5280 "GET /api/appointment/:eid" => function ($eid) {
5281 RestConfig::authorization_check("patients", "appt");
5282 $return = (new AppointmentRestController())->getOne($eid);
5283 RestConfig::apiLog($return);
5284 return $return;
5288 * @OA\Delete(
5289 * path="/api/patient/{pid}/appointment/{eid}",
5290 * description="Delete a appointment",
5291 * tags={"standard"},
5292 * @OA\Parameter(
5293 * name="pid",
5294 * in="path",
5295 * description="The id for the patient.",
5296 * required=true,
5297 * @OA\Schema(
5298 * type="string"
5300 * ),
5301 * @OA\Parameter(
5302 * name="eid",
5303 * in="path",
5304 * description="The eid for the appointment.",
5305 * required=true,
5306 * @OA\Schema(
5307 * type="string"
5309 * ),
5310 * @OA\Response(
5311 * response="200",
5312 * ref="#/components/responses/standard"
5313 * ),
5314 * @OA\Response(
5315 * response="400",
5316 * ref="#/components/responses/badrequest"
5317 * ),
5318 * @OA\Response(
5319 * response="401",
5320 * ref="#/components/responses/unauthorized"
5321 * ),
5322 * security={{"openemr_auth":{}}}
5325 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5326 RestConfig::authorization_check("patients", "appt");
5327 $return = (new AppointmentRestController())->delete($eid);
5328 RestConfig::apiLog($return);
5329 return $return;
5333 * @OA\Get(
5334 * path="/api/patient/{pid}/appointment/{eid}",
5335 * description="Retrieves a appointment for a patient",
5336 * tags={"standard"},
5337 * @OA\Parameter(
5338 * name="pid",
5339 * in="path",
5340 * description="The id for the patient.",
5341 * required=true,
5342 * @OA\Schema(
5343 * type="string"
5345 * ),
5346 * @OA\Parameter(
5347 * name="eid",
5348 * in="path",
5349 * description="The eid for the appointment.",
5350 * required=true,
5351 * @OA\Schema(
5352 * type="string"
5354 * ),
5355 * @OA\Response(
5356 * response="200",
5357 * ref="#/components/responses/standard"
5358 * ),
5359 * @OA\Response(
5360 * response="400",
5361 * ref="#/components/responses/badrequest"
5362 * ),
5363 * @OA\Response(
5364 * response="401",
5365 * ref="#/components/responses/unauthorized"
5366 * ),
5367 * security={{"openemr_auth":{}}}
5370 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5371 RestConfig::authorization_check("patients", "appt");
5372 $return = (new AppointmentRestController())->getOne($eid);
5373 RestConfig::apiLog($return);
5374 return $return;
5378 * @OA\Get(
5379 * path="/api/list/{list_name}",
5380 * description="Retrieves a list",
5381 * tags={"standard"},
5382 * @OA\Parameter(
5383 * name="list_name",
5384 * in="path",
5385 * description="The list_id of the list.",
5386 * required=true,
5387 * @OA\Schema(
5388 * type="string"
5390 * ),
5391 * @OA\Response(
5392 * response="200",
5393 * ref="#/components/responses/standard"
5394 * ),
5395 * @OA\Response(
5396 * response="400",
5397 * ref="#/components/responses/badrequest"
5398 * ),
5399 * @OA\Response(
5400 * response="401",
5401 * ref="#/components/responses/unauthorized"
5402 * ),
5403 * security={{"openemr_auth":{}}}
5406 "GET /api/list/:list_name" => function ($list_name) {
5407 RestConfig::authorization_check("lists", "default");
5408 $return = (new ListRestController())->getOptions($list_name);
5409 RestConfig::apiLog($return);
5410 return $return;
5414 * @OA\Get(
5415 * path="/api/user",
5416 * description="Retrieves a list of users",
5417 * tags={"standard"},
5418 * @OA\Parameter(
5419 * name="id",
5420 * in="query",
5421 * description="The id for the user.",
5422 * required=false,
5423 * @OA\Schema(
5424 * type="string"
5426 * ),
5427 * @OA\Parameter(
5428 * name="title",
5429 * in="query",
5430 * description="The title for the user.",
5431 * required=false,
5432 * @OA\Schema(
5433 * type="string"
5435 * ),
5436 * @OA\Parameter(
5437 * name="fname",
5438 * in="query",
5439 * description="The first name for the user.",
5440 * required=false,
5441 * @OA\Schema(
5442 * type="string"
5444 * ),
5445 * @OA\Parameter(
5446 * name="lname",
5447 * in="query",
5448 * description="The last name for the user.",
5449 * required=false,
5450 * @OA\Schema(
5451 * type="string"
5453 * ),
5454 * @OA\Parameter(
5455 * name="mname",
5456 * in="query",
5457 * description="The middle name for the user.",
5458 * required=false,
5459 * @OA\Schema(
5460 * type="string"
5462 * ),
5463 * @OA\Parameter(
5464 * name="federaltaxid",
5465 * in="query",
5466 * description="The federal tax id for the user.",
5467 * required=false,
5468 * @OA\Schema(
5469 * type="string"
5471 * ),
5472 * @OA\Parameter(
5473 * name="federaldrugid",
5474 * in="query",
5475 * description="The federal drug id for the user.",
5476 * required=false,
5477 * @OA\Schema(
5478 * type="string"
5480 * ),
5481 * @OA\Parameter(
5482 * name="upin",
5483 * in="query",
5484 * description="The upin for the user.",
5485 * required=false,
5486 * @OA\Schema(
5487 * type="string"
5489 * ),
5490 * @OA\Parameter(
5491 * name="facility_id",
5492 * in="query",
5493 * description="The facility id for the user.",
5494 * required=false,
5495 * @OA\Schema(
5496 * type="string"
5498 * ),
5499 * @OA\Parameter(
5500 * name="facility",
5501 * in="query",
5502 * description="The facility for the user.",
5503 * required=false,
5504 * @OA\Schema(
5505 * type="string"
5507 * ),
5508 * @OA\Parameter(
5509 * name="npi",
5510 * in="query",
5511 * description="The npi for the user.",
5512 * required=false,
5513 * @OA\Schema(
5514 * type="string"
5516 * ),
5517 * @OA\Parameter(
5518 * name="email",
5519 * in="query",
5520 * description="The email for the user.",
5521 * required=false,
5522 * @OA\Schema(
5523 * type="string"
5525 * ),
5526 * @OA\Parameter(
5527 * name="specialty",
5528 * in="query",
5529 * description="The specialty for the user.",
5530 * required=false,
5531 * @OA\Schema(
5532 * type="string"
5534 * ),
5535 * @OA\Parameter(
5536 * name="billname",
5537 * in="query",
5538 * description="The billname for the user.",
5539 * required=false,
5540 * @OA\Schema(
5541 * type="string"
5543 * ),
5544 * @OA\Parameter(
5545 * name="url",
5546 * in="query",
5547 * description="The url for the user.",
5548 * required=false,
5549 * @OA\Schema(
5550 * type="string"
5552 * ),
5553 * @OA\Parameter(
5554 * name="assistant",
5555 * in="query",
5556 * description="The assistant for the user.",
5557 * required=false,
5558 * @OA\Schema(
5559 * type="string"
5561 * ),
5562 * @OA\Parameter(
5563 * name="organization",
5564 * in="query",
5565 * description="The organization for the user.",
5566 * required=false,
5567 * @OA\Schema(
5568 * type="string"
5570 * ),
5571 * @OA\Parameter(
5572 * name="valedictory",
5573 * in="query",
5574 * description="The valedictory for the user.",
5575 * required=false,
5576 * @OA\Schema(
5577 * type="string"
5579 * ),
5580 * @OA\Parameter(
5581 * name="street",
5582 * in="query",
5583 * description="The street for the user.",
5584 * required=false,
5585 * @OA\Schema(
5586 * type="string"
5588 * ),
5589 * @OA\Parameter(
5590 * name="streetb",
5591 * in="query",
5592 * description="The street (line 2) for the user.",
5593 * required=false,
5594 * @OA\Schema(
5595 * type="string"
5597 * ),
5598 * @OA\Parameter(
5599 * name="city",
5600 * in="query",
5601 * description="The city for the user.",
5602 * required=false,
5603 * @OA\Schema(
5604 * type="string"
5606 * ),
5607 * @OA\Parameter(
5608 * name="state",
5609 * in="query",
5610 * description="The state for the user.",
5611 * required=false,
5612 * @OA\Schema(
5613 * type="string"
5615 * ),
5616 * @OA\Parameter(
5617 * name="zip",
5618 * in="query",
5619 * description="The zip for the user.",
5620 * required=false,
5621 * @OA\Schema(
5622 * type="string"
5624 * ),
5625 * @OA\Parameter(
5626 * name="phone",
5627 * in="query",
5628 * description="The phone for the user.",
5629 * required=false,
5630 * @OA\Schema(
5631 * type="string"
5633 * ),
5634 * @OA\Parameter(
5635 * name="fax",
5636 * in="query",
5637 * description="The fax for the user.",
5638 * required=false,
5639 * @OA\Schema(
5640 * type="string"
5642 * ),
5643 * @OA\Parameter(
5644 * name="phonew1",
5645 * in="query",
5646 * description="The phonew1 for the user.",
5647 * required=false,
5648 * @OA\Schema(
5649 * type="string"
5651 * ),
5652 * @OA\Parameter(
5653 * name="phonecell",
5654 * in="query",
5655 * description="The phonecell for the user.",
5656 * required=false,
5657 * @OA\Schema(
5658 * type="string"
5660 * ),
5661 * @OA\Parameter(
5662 * name="notes",
5663 * in="query",
5664 * description="The notes for the user.",
5665 * required=false,
5666 * @OA\Schema(
5667 * type="string"
5669 * ),
5670 * @OA\Parameter(
5671 * name="state_license_number2",
5672 * in="query",
5673 * description="The state license number for the user.",
5674 * required=false,
5675 * @OA\Schema(
5676 * type="string"
5678 * ),
5679 * @OA\Parameter(
5680 * name="username",
5681 * in="query",
5682 * description="The username for the user.",
5683 * required=false,
5684 * @OA\Schema(
5685 * type="string"
5687 * ),
5688 * @OA\Response(
5689 * response="200",
5690 * ref="#/components/responses/standard"
5691 * ),
5692 * @OA\Response(
5693 * response="400",
5694 * ref="#/components/responses/badrequest"
5695 * ),
5696 * @OA\Response(
5697 * response="401",
5698 * ref="#/components/responses/unauthorized"
5699 * ),
5700 * security={{"openemr_auth":{}}}
5703 "GET /api/user" => function () {
5704 RestConfig::authorization_check("admin", "users");
5705 $return = (new UserRestController())->getAll($_GET);
5706 RestConfig::apiLog($return);
5707 return $return;
5711 * @OA\Get(
5712 * path="/api/user/{uuid}",
5713 * description="Retrieves a single user by their uuid",
5714 * tags={"standard"},
5715 * @OA\Parameter(
5716 * name="uuid",
5717 * in="path",
5718 * description="The uuid for the user.",
5719 * required=true,
5720 * @OA\Schema(
5721 * type="string"
5723 * ),
5724 * @OA\Response(
5725 * response="200",
5726 * ref="#/components/responses/standard"
5727 * ),
5728 * @OA\Response(
5729 * response="400",
5730 * ref="#/components/responses/badrequest"
5731 * ),
5732 * @OA\Response(
5733 * response="401",
5734 * ref="#/components/responses/unauthorized"
5735 * ),
5736 * security={{"openemr_auth":{}}}
5739 "GET /api/user/:uuid" => function ($uuid) {
5740 RestConfig::authorization_check("admin", "users");
5741 $return = (new UserRestController())->getOne($uuid);
5742 RestConfig::apiLog($return);
5743 return $return;
5747 * @OA\Get(
5748 * path="/api/version",
5749 * description="Retrieves the OpenEMR version information",
5750 * tags={"standard"},
5751 * @OA\Response(
5752 * response="200",
5753 * ref="#/components/responses/standard"
5754 * ),
5755 * @OA\Response(
5756 * response="400",
5757 * ref="#/components/responses/badrequest"
5758 * ),
5759 * @OA\Response(
5760 * response="401",
5761 * ref="#/components/responses/unauthorized"
5762 * ),
5763 * security={{"openemr_auth":{}}}
5766 "GET /api/version" => function () {
5767 $return = (new VersionRestController())->getOne();
5768 RestConfig::apiLog($return);
5769 return $return;
5773 * @OA\Get(
5774 * path="/api/product",
5775 * description="Retrieves the OpenEMR product registration information",
5776 * tags={"standard"},
5777 * @OA\Response(
5778 * response="200",
5779 * ref="#/components/responses/standard"
5780 * ),
5781 * @OA\Response(
5782 * response="400",
5783 * ref="#/components/responses/badrequest"
5784 * ),
5785 * @OA\Response(
5786 * response="401",
5787 * ref="#/components/responses/unauthorized"
5788 * ),
5789 * security={{"openemr_auth":{}}}
5792 "GET /api/product" => function () {
5793 $return = (new ProductRegistrationRestController())->getOne();
5794 RestConfig::apiLog($return);
5795 return $return;
5799 * @OA\Get(
5800 * path="/api/insurance_company",
5801 * description="Retrieves all insurance companies",
5802 * tags={"standard"},
5803 * @OA\Response(
5804 * response="200",
5805 * ref="#/components/responses/standard"
5806 * ),
5807 * @OA\Response(
5808 * response="400",
5809 * ref="#/components/responses/badrequest"
5810 * ),
5811 * @OA\Response(
5812 * response="401",
5813 * ref="#/components/responses/unauthorized"
5814 * ),
5815 * security={{"openemr_auth":{}}}
5818 "GET /api/insurance_company" => function () {
5819 $return = (new InsuranceCompanyRestController())->getAll();
5820 RestConfig::apiLog($return);
5821 return $return;
5825 * @OA\Get(
5826 * path="/api/insurance_company/{iid}",
5827 * description="Retrieves insurance company",
5828 * tags={"standard"},
5829 * @OA\Parameter(
5830 * name="iid",
5831 * in="path",
5832 * description="The id of the insurance company.",
5833 * required=true,
5834 * @OA\Schema(
5835 * type="string"
5837 * ),
5838 * @OA\Response(
5839 * response="200",
5840 * ref="#/components/responses/standard"
5841 * ),
5842 * @OA\Response(
5843 * response="400",
5844 * ref="#/components/responses/badrequest"
5845 * ),
5846 * @OA\Response(
5847 * response="401",
5848 * ref="#/components/responses/unauthorized"
5849 * ),
5850 * security={{"openemr_auth":{}}}
5853 "GET /api/insurance_company/:iid" => function ($iid) {
5854 $return = (new InsuranceCompanyRestController())->getOne($iid);
5855 RestConfig::apiLog($return);
5856 return $return;
5860 * @OA\Get(
5861 * path="/api/insurance_type",
5862 * description="Retrieves all insurance types",
5863 * tags={"standard"},
5864 * @OA\Response(
5865 * response="200",
5866 * ref="#/components/responses/standard"
5867 * ),
5868 * @OA\Response(
5869 * response="400",
5870 * ref="#/components/responses/badrequest"
5871 * ),
5872 * @OA\Response(
5873 * response="401",
5874 * ref="#/components/responses/unauthorized"
5875 * ),
5876 * security={{"openemr_auth":{}}}
5879 "GET /api/insurance_type" => function () {
5880 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5881 RestConfig::apiLog($return);
5882 return $return;
5886 * Schema for the insurance_company request
5888 * @OA\Schema(
5889 * schema="api_insurance_company_request",
5890 * @OA\Property(
5891 * property="name",
5892 * description="The name of insurance company.",
5893 * type="string"
5894 * ),
5895 * @OA\Property(
5896 * property="attn",
5897 * description="The attn of insurance company.",
5898 * type="string"
5899 * ),
5900 * @OA\Property(
5901 * property="cms_id",
5902 * description="The cms id of insurance company.",
5903 * type="string"
5904 * ),
5905 * @OA\Property(
5906 * property="ins_type_code",
5907 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5908 * type="string"
5909 * ),
5910 * @OA\Property(
5911 * property="x12_receiver_id",
5912 * description="The x12 receiver id of insurance company.",
5913 * type="string"
5914 * ),
5915 * @OA\Property(
5916 * property="x12_default_partner_id",
5917 * description="The x12 default partner id of insurance company.",
5918 * type="string"
5919 * ),
5920 * @OA\Property(
5921 * property="alt_cms_id",
5922 * description="The alternate cms id of insurance company.",
5923 * type="string"
5924 * ),
5925 * @OA\Property(
5926 * property="line1",
5927 * description="The line1 address of insurance company.",
5928 * type="string"
5929 * ),
5930 * @OA\Property(
5931 * property="line2",
5932 * description="The line2 address of insurance company.",
5933 * type="string"
5934 * ),
5935 * @OA\Property(
5936 * property="city",
5937 * description="The city of insurance company.",
5938 * type="string"
5939 * ),
5940 * @OA\Property(
5941 * property="state",
5942 * description="The state of insurance company.",
5943 * type="string"
5944 * ),
5945 * @OA\Property(
5946 * property="zip",
5947 * description="The zip of insurance company.",
5948 * type="string"
5949 * ),
5950 * @OA\Property(
5951 * property="country",
5952 * description="The country of insurance company.",
5953 * type="string"
5954 * ),
5955 * required={"name"},
5956 * example={
5957 * "name": "Cool Insurance Company",
5958 * "attn": null,
5959 * "cms_id": null,
5960 * "ins_type_code": "2",
5961 * "x12_receiver_id": null,
5962 * "x12_default_partner_id": null,
5963 * "alt_cms_id": "",
5964 * "line1": "123 Cool Lane",
5965 * "line2": "Suite 123",
5966 * "city": "Cooltown",
5967 * "state": "CA",
5968 * "zip": "12245",
5969 * "country": "USA"
5974 * @OA\Post(
5975 * path="/api/insurance_company",
5976 * description="Submits a new insurance company",
5977 * tags={"standard"},
5978 * @OA\RequestBody(
5979 * required=true,
5980 * @OA\MediaType(
5981 * mediaType="application/json",
5982 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5984 * ),
5985 * @OA\Response(
5986 * response="200",
5987 * ref="#/components/responses/standard"
5988 * ),
5989 * @OA\Response(
5990 * response="400",
5991 * ref="#/components/responses/badrequest"
5992 * ),
5993 * @OA\Response(
5994 * response="401",
5995 * ref="#/components/responses/unauthorized"
5996 * ),
5997 * security={{"openemr_auth":{}}}
6000 "POST /api/insurance_company" => function () {
6001 $data = (array) (json_decode(file_get_contents("php://input")));
6002 $return = (new InsuranceCompanyRestController())->post($data);
6003 RestConfig::apiLog($return, $data);
6004 return $return;
6008 * @OA\Put(
6009 * path="/api/insurance_company/{iid}",
6010 * description="Edit a insurance company",
6011 * tags={"standard"},
6012 * @OA\Parameter(
6013 * name="iid",
6014 * in="path",
6015 * description="The id for the insurance company.",
6016 * required=true,
6017 * @OA\Schema(
6018 * type="string"
6020 * ),
6021 * @OA\RequestBody(
6022 * required=true,
6023 * @OA\MediaType(
6024 * mediaType="application/json",
6025 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
6027 * ),
6028 * @OA\Response(
6029 * response="200",
6030 * ref="#/components/responses/standard"
6031 * ),
6032 * @OA\Response(
6033 * response="400",
6034 * ref="#/components/responses/badrequest"
6035 * ),
6036 * @OA\Response(
6037 * response="401",
6038 * ref="#/components/responses/unauthorized"
6039 * ),
6040 * security={{"openemr_auth":{}}}
6043 "PUT /api/insurance_company/:iid" => function ($iid) {
6044 $data = (array) (json_decode(file_get_contents("php://input")));
6045 $return = (new InsuranceCompanyRestController())->put($iid, $data);
6046 RestConfig::apiLog($return, $data);
6047 return $return;
6051 * @OA\Post(
6052 * path="/api/patient/{pid}/document",
6053 * description="Submits a new patient document",
6054 * tags={"standard"},
6055 * @OA\Parameter(
6056 * name="pid",
6057 * in="path",
6058 * description="The pid for the patient.",
6059 * required=true,
6060 * @OA\Schema(
6061 * type="string"
6063 * ),
6064 * @OA\Parameter(
6065 * name="path",
6066 * in="query",
6067 * description="The category of the document.",
6068 * required=true,
6069 * @OA\Schema(
6070 * type="string"
6072 * ),
6073 * @OA\RequestBody(
6074 * required=true,
6075 * @OA\MediaType(
6076 * mediaType="multipart/form-data",
6077 * @OA\Schema(
6078 * @OA\Property(
6079 * property="document",
6080 * description="document",
6081 * type="string",
6082 * format="binary"
6083 * ),
6084 * ),
6085 * ),
6086 * ),
6087 * @OA\Response(
6088 * response="200",
6089 * ref="#/components/responses/standard"
6090 * ),
6091 * @OA\Response(
6092 * response="400",
6093 * ref="#/components/responses/badrequest"
6094 * ),
6095 * @OA\Response(
6096 * response="401",
6097 * ref="#/components/responses/unauthorized"
6098 * ),
6099 * security={{"openemr_auth":{}}}
6102 "POST /api/patient/:pid/document" => function ($pid) {
6103 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6104 RestConfig::apiLog($return);
6105 return $return;
6109 * @OA\Get(
6110 * path="/api/patient/{pid}/document",
6111 * description="Retrieves all file information of documents from a category for a patient",
6112 * tags={"standard"},
6113 * @OA\Parameter(
6114 * name="pid",
6115 * in="path",
6116 * description="The pid for the patient.",
6117 * required=true,
6118 * @OA\Schema(
6119 * type="string"
6121 * ),
6122 * @OA\Parameter(
6123 * name="path",
6124 * in="query",
6125 * description="The category of the documents.",
6126 * required=true,
6127 * @OA\Schema(
6128 * type="string"
6130 * ),
6131 * @OA\Response(
6132 * response="200",
6133 * ref="#/components/responses/standard"
6134 * ),
6135 * @OA\Response(
6136 * response="400",
6137 * ref="#/components/responses/badrequest"
6138 * ),
6139 * @OA\Response(
6140 * response="401",
6141 * ref="#/components/responses/unauthorized"
6142 * ),
6143 * security={{"openemr_auth":{}}}
6146 "GET /api/patient/:pid/document" => function ($pid) {
6147 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6148 RestConfig::apiLog($return);
6149 return $return;
6153 * @OA\Get(
6154 * path="/api/patient/{pid}/document/{did}",
6155 * description="Retrieves a document for a patient",
6156 * tags={"standard"},
6157 * @OA\Parameter(
6158 * name="pid",
6159 * in="path",
6160 * description="The pid for the patient.",
6161 * required=true,
6162 * @OA\Schema(
6163 * type="string"
6165 * ),
6166 * @OA\Parameter(
6167 * name="did",
6168 * in="path",
6169 * description="The id for the patient document.",
6170 * required=true,
6171 * @OA\Schema(
6172 * type="string"
6174 * ),
6175 * @OA\Response(
6176 * response="200",
6177 * ref="#/components/responses/standard"
6178 * ),
6179 * @OA\Response(
6180 * response="400",
6181 * ref="#/components/responses/badrequest"
6182 * ),
6183 * @OA\Response(
6184 * response="401",
6185 * ref="#/components/responses/unauthorized"
6186 * ),
6187 * security={{"openemr_auth":{}}}
6190 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6191 $return = (new DocumentRestController())->downloadFile($pid, $did);
6192 RestConfig::apiLog($return);
6193 return $return;
6197 * @OA\Get(
6198 * path="/api/patient/{pid}/insurance",
6199 * description="Retrieves all insurances for a patient",
6200 * tags={"standard"},
6201 * @OA\Parameter(
6202 * name="pid",
6203 * in="path",
6204 * description="The pid for the patient.",
6205 * required=true,
6206 * @OA\Schema(
6207 * type="string"
6209 * ),
6210 * @OA\Response(
6211 * response="200",
6212 * ref="#/components/responses/standard"
6213 * ),
6214 * @OA\Response(
6215 * response="400",
6216 * ref="#/components/responses/badrequest"
6217 * ),
6218 * @OA\Response(
6219 * response="401",
6220 * ref="#/components/responses/unauthorized"
6221 * ),
6222 * security={{"openemr_auth":{}}}
6225 "GET /api/patient/:pid/insurance" => function ($pid) {
6226 $return = (new InsuranceRestController())->getAll($pid);
6227 RestConfig::apiLog($return);
6228 return $return;
6232 * @OA\Get(
6233 * path="/api/patient/{pid}/insurance/{type}",
6234 * description="Retrieves a insurance (by type) for a patient",
6235 * tags={"standard"},
6236 * @OA\Parameter(
6237 * name="pid",
6238 * in="path",
6239 * description="The pid for the patient.",
6240 * required=true,
6241 * @OA\Schema(
6242 * type="string"
6244 * ),
6245 * @OA\Parameter(
6246 * name="type",
6247 * in="path",
6248 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6249 * required=true,
6250 * @OA\Schema(
6251 * type="string"
6253 * ),
6254 * @OA\Response(
6255 * response="200",
6256 * ref="#/components/responses/standard"
6257 * ),
6258 * @OA\Response(
6259 * response="400",
6260 * ref="#/components/responses/badrequest"
6261 * ),
6262 * @OA\Response(
6263 * response="401",
6264 * ref="#/components/responses/unauthorized"
6265 * ),
6266 * security={{"openemr_auth":{}}}
6269 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6270 $return = (new InsuranceRestController())->getOne($pid, $type);
6271 RestConfig::apiLog($return);
6272 return $return;
6276 * Schema for the insurance request
6278 * @OA\Schema(
6279 * schema="api_insurance_request",
6280 * @OA\Property(
6281 * property="provider",
6282 * description="The insurance company id.",
6283 * type="string"
6284 * ),
6285 * @OA\Property(
6286 * property="plan_name",
6287 * description="The plan name of insurance.",
6288 * type="string"
6289 * ),
6290 * @OA\Property(
6291 * property="policy_number",
6292 * description="The policy number of insurance.",
6293 * type="string"
6294 * ),
6295 * @OA\Property(
6296 * property="group_number",
6297 * description="The group number of insurance.",
6298 * type="string"
6299 * ),
6300 * @OA\Property(
6301 * property="subscriber_lname",
6302 * description="The subscriber last name of insurance.",
6303 * type="string"
6304 * ),
6305 * @OA\Property(
6306 * property="subscriber_mname",
6307 * description="The subscriber middle name of insurance.",
6308 * type="string"
6309 * ),
6310 * @OA\Property(
6311 * property="subscriber_fname",
6312 * description="The subscriber first name of insurance.",
6313 * type="string"
6314 * ),
6315 * @OA\Property(
6316 * property="subscriber_relationship",
6317 * description="The subscriber relationship of insurance.",
6318 * type="string"
6319 * ),
6320 * @OA\Property(
6321 * property="subscriber_ss",
6322 * description="The subscriber ss number of insurance.",
6323 * type="string"
6324 * ),
6325 * @OA\Property(
6326 * property="subscriber_DOB",
6327 * description="The subscriber DOB of insurance.",
6328 * type="string"
6329 * ),
6330 * @OA\Property(
6331 * property="subscriber_street",
6332 * description="The subscriber street address of insurance.",
6333 * type="string"
6334 * ),
6335 * @OA\Property(
6336 * property="subscriber_postal_code",
6337 * description="The subscriber postal code of insurance.",
6338 * type="string"
6339 * ),
6340 * @OA\Property(
6341 * property="subscriber_city",
6342 * description="The subscriber city of insurance.",
6343 * type="string"
6344 * ),
6345 * @OA\Property(
6346 * property="subscriber_state",
6347 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6348 * type="string"
6349 * ),
6350 * @OA\Property(
6351 * property="subscriber_country",
6352 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6353 * type="string"
6354 * ),
6355 * @OA\Property(
6356 * property="subscriber_phone",
6357 * description="The subscriber phone of insurance.",
6358 * type="string"
6359 * ),
6360 * @OA\Property(
6361 * property="subscriber_employer",
6362 * description="The subscriber employer of insurance.",
6363 * type="string"
6364 * ),
6365 * @OA\Property(
6366 * property="subscriber_employer_street",
6367 * description="The subscriber employer street of insurance.",
6368 * type="string"
6369 * ),
6370 * @OA\Property(
6371 * property="subscriber_employer_postal_code",
6372 * description="The subscriber employer postal code of insurance.",
6373 * type="string"
6374 * ),
6375 * @OA\Property(
6376 * property="subscriber_employer_state",
6377 * description="The subscriber employer state of insurance.",
6378 * type="string"
6379 * ),
6380 * @OA\Property(
6381 * property="subscriber_employer_country",
6382 * description="The subscriber employer country of insurance.",
6383 * type="string"
6384 * ),
6385 * @OA\Property(
6386 * property="subscriber_employer_city",
6387 * description="The subscriber employer city of insurance.",
6388 * type="string"
6389 * ),
6390 * @OA\Property(
6391 * property="copay",
6392 * description="The copay of insurance.",
6393 * type="string"
6394 * ),
6395 * @OA\Property(
6396 * property="date",
6397 * description="The date of insurance.",
6398 * type="string"
6399 * ),
6400 * @OA\Property(
6401 * property="subscriber_sex",
6402 * description="The subscriber sex of insurance.",
6403 * type="string"
6404 * ),
6405 * @OA\Property(
6406 * property="accept_assignment",
6407 * description="The accept_assignment of insurance.",
6408 * type="string"
6409 * ),
6410 * @OA\Property(
6411 * property="policy_type",
6412 * description="The policy_type of insurance.",
6413 * type="string"
6414 * ),
6415 * required={"provider", "plan_name", "policy_number", "group_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_country", "subscriber_phone", "subscriber_sex", "accept_assignment", "policy_type"},
6416 * example={
6417 * "provider": "33",
6418 * "plan_name": "Some Plan",
6419 * "policy_number": "12345",
6420 * "group_number": "252412",
6421 * "subscriber_lname": "Tester",
6422 * "subscriber_mname": "Xi",
6423 * "subscriber_fname": "Foo",
6424 * "subscriber_relationship": "other",
6425 * "subscriber_ss": "234231234",
6426 * "subscriber_DOB": "2018-10-03",
6427 * "subscriber_street": "183 Cool St",
6428 * "subscriber_postal_code": "23418",
6429 * "subscriber_city": "Cooltown",
6430 * "subscriber_state": "AZ",
6431 * "subscriber_country": "USA",
6432 * "subscriber_phone": "234-598-2123",
6433 * "subscriber_employer": "Some Employer",
6434 * "subscriber_employer_street": "123 Heather Lane",
6435 * "subscriber_employer_postal_code": "23415",
6436 * "subscriber_employer_state": "AZ",
6437 * "subscriber_employer_country": "USA",
6438 * "subscriber_employer_city": "Cooltown",
6439 * "copay": "35",
6440 * "date": "2018-10-15",
6441 * "subscriber_sex": "Female",
6442 * "accept_assignment": "TRUE",
6443 * "policy_type": "a"
6448 * @OA\Post(
6449 * path="/api/patient/{pid}/insurance/{type}",
6450 * description="Submits a new patient insurance (with type)",
6451 * tags={"standard"},
6452 * @OA\Parameter(
6453 * name="pid",
6454 * in="path",
6455 * description="The pid for the patient.",
6456 * required=true,
6457 * @OA\Schema(
6458 * type="string"
6460 * ),
6461 * @OA\Parameter(
6462 * name="type",
6463 * in="path",
6464 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6465 * required=true,
6466 * @OA\Schema(
6467 * type="string"
6469 * ),
6470 * @OA\RequestBody(
6471 * required=true,
6472 * @OA\MediaType(
6473 * mediaType="application/json",
6474 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6476 * ),
6477 * @OA\Response(
6478 * response="200",
6479 * ref="#/components/responses/standard"
6480 * ),
6481 * @OA\Response(
6482 * response="400",
6483 * ref="#/components/responses/badrequest"
6484 * ),
6485 * @OA\Response(
6486 * response="401",
6487 * ref="#/components/responses/unauthorized"
6488 * ),
6489 * security={{"openemr_auth":{}}}
6492 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6493 $data = (array) (json_decode(file_get_contents("php://input")));
6494 $return = (new InsuranceRestController())->post($pid, $type, $data);
6495 RestConfig::apiLog($return, $data);
6496 return $return;
6500 * @OA\Put(
6501 * path="/api/patient/{pid}/insurance/{type}",
6502 * description="Edit a patient insurance (by type)",
6503 * tags={"standard"},
6504 * @OA\Parameter(
6505 * name="pid",
6506 * in="path",
6507 * description="The pid for the patient.",
6508 * required=true,
6509 * @OA\Schema(
6510 * type="string"
6512 * ),
6513 * @OA\Parameter(
6514 * name="type",
6515 * in="path",
6516 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6517 * required=true,
6518 * @OA\Schema(
6519 * type="string"
6521 * ),
6522 * @OA\RequestBody(
6523 * required=true,
6524 * @OA\MediaType(
6525 * mediaType="application/json",
6526 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6528 * ),
6529 * @OA\Response(
6530 * response="200",
6531 * ref="#/components/responses/standard"
6532 * ),
6533 * @OA\Response(
6534 * response="400",
6535 * ref="#/components/responses/badrequest"
6536 * ),
6537 * @OA\Response(
6538 * response="401",
6539 * ref="#/components/responses/unauthorized"
6540 * ),
6541 * security={{"openemr_auth":{}}}
6544 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6545 $data = (array) (json_decode(file_get_contents("php://input")));
6546 $return = (new InsuranceRestController())->put($pid, $type, $data);
6547 RestConfig::apiLog($return, $data);
6548 return $return;
6552 * Schema for the message request
6554 * @OA\Schema(
6555 * schema="api_message_request",
6556 * @OA\Property(
6557 * property="body",
6558 * description="The body of message.",
6559 * type="string"
6560 * ),
6561 * @OA\Property(
6562 * property="groupname",
6563 * description="The group name (usually is 'Default').",
6564 * type="string"
6565 * ),
6566 * @OA\Property(
6567 * property="from",
6568 * description="The sender of the message.",
6569 * type="string"
6570 * ),
6571 * @OA\Property(
6572 * property="to",
6573 * description="The recipient of the message.",
6574 * type="string"
6575 * ),
6576 * @OA\Property(
6577 * property="title",
6578 * description="use an option from resource=/api/list/note_type",
6579 * type="string"
6580 * ),
6581 * @OA\Property(
6582 * property="message_status",
6583 * description="use an option from resource=/api/list/message_status",
6584 * type="string"
6585 * ),
6586 * required={"body", "groupname", "from", "to", "title", "message_status"},
6587 * example={
6588 * "body": "Test 456",
6589 * "groupname": "Default",
6590 * "from": "Matthew",
6591 * "to": "admin",
6592 * "title": "Other",
6593 * "message_status": "New"
6598 * @OA\Post(
6599 * path="/api/patient/{pid}/message",
6600 * description="Submits a pnote message",
6601 * tags={"standard"},
6602 * @OA\Parameter(
6603 * name="pid",
6604 * in="path",
6605 * description="The id for the patient.",
6606 * required=true,
6607 * @OA\Schema(
6608 * type="string"
6610 * ),
6611 * @OA\RequestBody(
6612 * required=true,
6613 * @OA\MediaType(
6614 * mediaType="application/json",
6615 * @OA\Schema(ref="#/components/schemas/api_message_request")
6617 * ),
6618 * @OA\Response(
6619 * response="200",
6620 * ref="#/components/responses/standard"
6621 * ),
6622 * @OA\Response(
6623 * response="400",
6624 * ref="#/components/responses/badrequest"
6625 * ),
6626 * @OA\Response(
6627 * response="401",
6628 * ref="#/components/responses/unauthorized"
6629 * ),
6630 * security={{"openemr_auth":{}}}
6633 "POST /api/patient/:pid/message" => function ($pid) {
6634 RestConfig::authorization_check("patients", "notes");
6635 $data = (array) (json_decode(file_get_contents("php://input")));
6636 $return = (new MessageRestController())->post($pid, $data);
6637 RestConfig::apiLog($return, $data);
6638 return $return;
6642 * @OA\Get(
6643 * path="/api/patient/{pid}/transaction",
6644 * description="Get Transactions for a patient",
6645 * tags={"standard"},
6646 * @OA\Parameter(
6647 * name="pid",
6648 * in="path",
6649 * description="The pid for the patient",
6650 * required=true,
6651 * @OA\Schema(
6652 * type="string"
6654 * ),
6655 * @OA\Response(
6656 * response="200",
6657 * ref="#/components/responses/standard"
6658 * ),
6659 * @OA\Response(
6660 * response="400",
6661 * ref="#/components/responses/badrequest"
6662 * ),
6663 * @OA\Response(
6664 * response="401",
6665 * ref="#/components/responses/unauthorized"
6666 * ),
6667 * security={{"openemr_auth":{}}}
6671 "GET /api/patient/:pid/transaction" => function ($pid) {
6672 RestConfig::authorization_check("patients", "trans");
6673 $cont = new TransactionRestController();
6674 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6675 RestConfig::apiLog($return);
6676 return $return;
6680 * Schema for the transaction request
6682 * @OA\Schema(
6683 * schema="api_transaction_request",
6684 * @OA\Property(
6685 * property="message",
6686 * description="The message of the transaction.",
6687 * type="string"
6688 * ),
6689 * @OA\Property(
6690 * property="type",
6691 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6692 * type="string"
6693 * ),
6694 * @OA\Property(
6695 * property="groupname",
6696 * description="The group name (usually is 'Default').",
6697 * type="string"
6698 * ),
6699 * @OA\Property(
6700 * property="referByNpi",
6701 * description="NPI of the person creating the referral.",
6702 * type="string"
6703 * ),
6704 * @OA\Property(
6705 * property="referToNpi",
6706 * description="NPI of the person getting the referral.",
6707 * type="string"
6708 * ),
6709 * @OA\Property(
6710 * property="referDiagnosis",
6711 * description="The referral diagnosis.",
6712 * type="string"
6713 * ),
6714 * @OA\Property(
6715 * property="riskLevel",
6716 * description="The risk level. (Low, Medium, High)",
6717 * type="string"
6718 * ),
6719 * @OA\Property(
6720 * property="includeVitals",
6721 * description="Are vitals included (0,1)",
6722 * type="string"
6723 * ),
6724 * @OA\Property(
6725 * property="referralDate",
6726 * description="The date of the referral",
6727 * type="string"
6728 * ),
6729 * @OA\Property(
6730 * property="authorization",
6731 * description="The authorization for the referral",
6732 * type="string"
6733 * ),
6734 * @OA\Property(
6735 * property="visits",
6736 * description="The number of vists for the referral",
6737 * type="string"
6738 * ),
6739 * @OA\Property(
6740 * property="validFrom",
6741 * description="The date the referral is valid from",
6742 * type="string"
6743 * ),
6744 * @OA\Property(
6745 * property="validThrough",
6746 * description="The date the referral is valid through",
6747 * type="string"
6748 * ),
6749 * required={"message", "groupname", "title"},
6750 * example={
6751 * "message": "Message",
6752 * "type": "LBTref",
6753 * "groupname": "Default",
6754 * "referByNpi":"9999999999",
6755 * "referToNpi":"9999999999",
6756 * "referDiagnosis":"Diag 1",
6757 * "riskLevel":"Low",
6758 * "includeVitals":"1",
6759 * "referralDate":"2022-01-01",
6760 * "authorization":"Auth_123",
6761 * "visits": "1",
6762 * "validFrom": "2022-01-02",
6763 * "validThrough": "2022-01-03",
6764 * "body": "Reason 1"
6769 * @OA\Post(
6770 * path="/api/patient/{pid}/transaction",
6771 * description="Submits a transaction",
6772 * tags={"standard"},
6773 * @OA\Parameter(
6774 * name="pid",
6775 * in="path",
6776 * description="The pid for the patient.",
6777 * required=true,
6778 * @OA\Schema(
6779 * type="string"
6781 * ),
6782 * @OA\RequestBody(
6783 * required=true,
6784 * @OA\MediaType(
6785 * mediaType="application/json",
6786 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6788 * ),
6789 * @OA\Response(
6790 * response="200",
6791 * ref="#/components/responses/standard"
6792 * ),
6793 * @OA\Response(
6794 * response="400",
6795 * ref="#/components/responses/badrequest"
6796 * ),
6797 * @OA\Response(
6798 * response="401",
6799 * ref="#/components/responses/unauthorized"
6800 * ),
6801 * security={{"openemr_auth":{}}}
6804 "POST /api/patient/:pid/transaction" => function ($pid) {
6805 RestConfig::authorization_check("patients", "trans");
6806 $data = (array) (json_decode(file_get_contents("php://input")));
6807 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6808 RestConfig::apiLog($return, $data);
6809 return $return;
6813 * @OA\PUT(
6814 * path="/api/transaction/{tid}",
6815 * description="Updates a transaction",
6816 * tags={"standard"},
6817 * @OA\Parameter(
6818 * name="tid",
6819 * in="path",
6820 * description="The id for the transaction.",
6821 * required=true,
6822 * @OA\Schema(
6823 * type="string"
6825 * ),
6826 * @OA\RequestBody(
6827 * required=true,
6828 * @OA\MediaType(
6829 * mediaType="application/json",
6830 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6832 * ),
6833 * @OA\Response(
6834 * response="200",
6835 * ref="#/components/responses/standard"
6836 * ),
6837 * @OA\Response(
6838 * response="400",
6839 * ref="#/components/responses/badrequest"
6840 * ),
6841 * @OA\Response(
6842 * response="401",
6843 * ref="#/components/responses/unauthorized"
6844 * ),
6845 * security={{"openemr_auth":{}}}
6848 "PUT /api/transaction/:tid" => function ($tid) {
6849 RestConfig::authorization_check("patients", "trans");
6850 $data = (array) (json_decode(file_get_contents("php://input")));
6851 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6852 RestConfig::apiLog($return, $data);
6853 return $return;
6857 * @OA\Put(
6858 * path="/api/patient/{pid}/message/{mid}",
6859 * description="Edit a pnote message",
6860 * tags={"standard"},
6861 * @OA\Parameter(
6862 * name="pid",
6863 * in="path",
6864 * description="The id for the patient.",
6865 * required=true,
6866 * @OA\Schema(
6867 * type="string"
6869 * ),
6870 * @OA\Parameter(
6871 * name="mid",
6872 * in="path",
6873 * description="The id for the pnote message.",
6874 * required=true,
6875 * @OA\Schema(
6876 * type="string"
6878 * ),
6879 * @OA\RequestBody(
6880 * required=true,
6881 * @OA\MediaType(
6882 * mediaType="application/json",
6883 * @OA\Schema(ref="#/components/schemas/api_message_request")
6885 * ),
6886 * @OA\Response(
6887 * response="200",
6888 * ref="#/components/responses/standard"
6889 * ),
6890 * @OA\Response(
6891 * response="400",
6892 * ref="#/components/responses/badrequest"
6893 * ),
6894 * @OA\Response(
6895 * response="401",
6896 * ref="#/components/responses/unauthorized"
6897 * ),
6898 * security={{"openemr_auth":{}}}
6901 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6902 RestConfig::authorization_check("patients", "notes");
6903 $data = (array) (json_decode(file_get_contents("php://input")));
6904 $return = (new MessageRestController())->put($pid, $mid, $data);
6905 RestConfig::apiLog($return, $data);
6906 return $return;
6910 * @OA\Delete(
6911 * path="/api/patient/{pid}/message/{mid}",
6912 * description="Delete a pnote message",
6913 * tags={"standard"},
6914 * @OA\Parameter(
6915 * name="pid",
6916 * in="path",
6917 * description="The id for the patient.",
6918 * required=true,
6919 * @OA\Schema(
6920 * type="string"
6922 * ),
6923 * @OA\Parameter(
6924 * name="mid",
6925 * in="path",
6926 * description="The id for the pnote message.",
6927 * required=true,
6928 * @OA\Schema(
6929 * type="string"
6931 * ),
6932 * @OA\Response(
6933 * response="200",
6934 * ref="#/components/responses/standard"
6935 * ),
6936 * @OA\Response(
6937 * response="400",
6938 * ref="#/components/responses/badrequest"
6939 * ),
6940 * @OA\Response(
6941 * response="401",
6942 * ref="#/components/responses/unauthorized"
6943 * ),
6944 * security={{"openemr_auth":{}}}
6947 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6948 RestConfig::authorization_check("patients", "notes");
6949 $return = (new MessageRestController())->delete($pid, $mid);
6950 RestConfig::apiLog($return);
6951 return $return;
6955 * @OA\Get(
6956 * path="/api/immunization",
6957 * description="Retrieves a list of immunizations",
6958 * tags={"standard"},
6959 * @OA\Parameter(
6960 * name="patient_id",
6961 * in="query",
6962 * description="The pid for the patient.",
6963 * required=false,
6964 * @OA\Schema(
6965 * type="string"
6967 * ),
6968 * @OA\Parameter(
6969 * name="id",
6970 * in="query",
6971 * description="The id for the immunization.",
6972 * required=false,
6973 * @OA\Schema(
6974 * type="string"
6976 * ),
6977 * @OA\Parameter(
6978 * name="uuid",
6979 * in="query",
6980 * description="The uuid for the immunization.",
6981 * required=false,
6982 * @OA\Schema(
6983 * type="string"
6985 * ),
6986 * @OA\Parameter(
6987 * name="administered_date",
6988 * in="query",
6989 * description="The administered date for the immunization.",
6990 * required=false,
6991 * @OA\Schema(
6992 * type="string"
6994 * ),
6995 * @OA\Parameter(
6996 * name="immunization_id",
6997 * in="query",
6998 * description="The immunization list_id for the immunization.",
6999 * required=false,
7000 * @OA\Schema(
7001 * type="string"
7003 * ),
7004 * @OA\Parameter(
7005 * name="cvx_code",
7006 * in="query",
7007 * description="The cvx code for the immunization.",
7008 * required=false,
7009 * @OA\Schema(
7010 * type="string"
7012 * ),
7013 * @OA\Parameter(
7014 * name="manufacturer",
7015 * in="query",
7016 * description="The manufacturer for the immunization.",
7017 * required=false,
7018 * @OA\Schema(
7019 * type="string"
7021 * ),
7022 * @OA\Parameter(
7023 * name="lot_number",
7024 * in="query",
7025 * description="The lot number for the immunization.",
7026 * required=false,
7027 * @OA\Schema(
7028 * type="string"
7030 * ),
7031 * @OA\Parameter(
7032 * name="administered_by_id",
7033 * in="query",
7034 * description="The administered by id for the immunization.",
7035 * required=false,
7036 * @OA\Schema(
7037 * type="string"
7039 * ),
7040 * @OA\Parameter(
7041 * name="administered_by",
7042 * in="query",
7043 * description="The administered by for the immunization.",
7044 * required=false,
7045 * @OA\Schema(
7046 * type="string"
7048 * ),
7049 * @OA\Parameter(
7050 * name="education_date",
7051 * in="query",
7052 * description="The education date for the immunization.",
7053 * required=false,
7054 * @OA\Schema(
7055 * type="string"
7057 * ),
7058 * @OA\Parameter(
7059 * name="vis_date",
7060 * in="query",
7061 * description="The vis date for the immunization.",
7062 * required=false,
7063 * @OA\Schema(
7064 * type="string"
7066 * ),
7067 * @OA\Parameter(
7068 * name="note",
7069 * in="query",
7070 * description="The note for the immunization.",
7071 * required=false,
7072 * @OA\Schema(
7073 * type="string"
7075 * ),
7076 * @OA\Parameter(
7077 * name="create_date",
7078 * in="query",
7079 * description="The create date for the immunization.",
7080 * required=false,
7081 * @OA\Schema(
7082 * type="string"
7084 * ),
7085 * @OA\Parameter(
7086 * name="update_date",
7087 * in="query",
7088 * description="The update date for the immunization.",
7089 * required=false,
7090 * @OA\Schema(
7091 * type="string"
7093 * ),
7094 * @OA\Parameter(
7095 * name="created_by",
7096 * in="query",
7097 * description="The created_by for the immunization.",
7098 * required=false,
7099 * @OA\Schema(
7100 * type="string"
7102 * ),
7103 * @OA\Parameter(
7104 * name="updated_by",
7105 * in="query",
7106 * description="The updated_by for the immunization.",
7107 * required=false,
7108 * @OA\Schema(
7109 * type="string"
7111 * ),
7112 * @OA\Parameter(
7113 * name="amount_administered",
7114 * in="query",
7115 * description="The amount administered for the immunization.",
7116 * required=false,
7117 * @OA\Schema(
7118 * type="string"
7120 * ),
7121 * @OA\Parameter(
7122 * name="amount_administered_unit",
7123 * in="query",
7124 * description="The amount administered unit for the immunization.",
7125 * required=false,
7126 * @OA\Schema(
7127 * type="string"
7129 * ),
7130 * @OA\Parameter(
7131 * name="expiration_date",
7132 * in="query",
7133 * description="The expiration date for the immunization.",
7134 * required=false,
7135 * @OA\Schema(
7136 * type="string"
7138 * ),
7139 * @OA\Parameter(
7140 * name="route",
7141 * in="query",
7142 * description="The route for the immunization.",
7143 * required=false,
7144 * @OA\Schema(
7145 * type="string"
7147 * ),
7148 * @OA\Parameter(
7149 * name="administration_site",
7150 * in="query",
7151 * description="The administration site for the immunization.",
7152 * required=false,
7153 * @OA\Schema(
7154 * type="string"
7156 * ),
7157 * @OA\Parameter(
7158 * name="added_erroneously",
7159 * in="query",
7160 * description="The added_erroneously for the immunization.",
7161 * required=false,
7162 * @OA\Schema(
7163 * type="string"
7165 * ),
7166 * @OA\Parameter(
7167 * name="external_id",
7168 * in="query",
7169 * description="The external_id for the immunization.",
7170 * required=false,
7171 * @OA\Schema(
7172 * type="string"
7174 * ),
7175 * @OA\Parameter(
7176 * name="completion_status",
7177 * in="query",
7178 * description="The completion status for the immunization.",
7179 * required=false,
7180 * @OA\Schema(
7181 * type="string"
7183 * ),
7184 * @OA\Parameter(
7185 * name="information_source",
7186 * in="query",
7187 * description="The information source for the immunization.",
7188 * required=false,
7189 * @OA\Schema(
7190 * type="string"
7192 * ),
7193 * @OA\Parameter(
7194 * name="refusal_reason",
7195 * in="query",
7196 * description="The refusal reason for the immunization.",
7197 * required=false,
7198 * @OA\Schema(
7199 * type="string"
7201 * ),
7202 * @OA\Parameter(
7203 * name="ordering_provider",
7204 * in="query",
7205 * description="The ordering provider for the immunization.",
7206 * required=false,
7207 * @OA\Schema(
7208 * type="string"
7210 * ),
7211 * @OA\Response(
7212 * response="200",
7213 * ref="#/components/responses/standard"
7214 * ),
7215 * @OA\Response(
7216 * response="400",
7217 * ref="#/components/responses/badrequest"
7218 * ),
7219 * @OA\Response(
7220 * response="401",
7221 * ref="#/components/responses/unauthorized"
7222 * ),
7223 * security={{"openemr_auth":{}}}
7226 "GET /api/immunization" => function () {
7227 RestConfig::authorization_check("patients", "med");
7228 $return = (new ImmunizationRestController())->getAll($_GET);
7229 RestConfig::apiLog($return);
7230 return $return;
7234 * @OA\Get(
7235 * path="/api/immunization/{uuid}",
7236 * description="Retrieves a immunization",
7237 * tags={"standard"},
7238 * @OA\Parameter(
7239 * name="uuid",
7240 * in="path",
7241 * description="The uuid for the immunization.",
7242 * required=true,
7243 * @OA\Schema(
7244 * type="string"
7246 * ),
7247 * @OA\Response(
7248 * response="200",
7249 * ref="#/components/responses/standard"
7250 * ),
7251 * @OA\Response(
7252 * response="400",
7253 * ref="#/components/responses/badrequest"
7254 * ),
7255 * @OA\Response(
7256 * response="401",
7257 * ref="#/components/responses/unauthorized"
7258 * ),
7259 * security={{"openemr_auth":{}}}
7262 "GET /api/immunization/:uuid" => function ($uuid) {
7263 RestConfig::authorization_check("patients", "med");
7264 $return = (new ImmunizationRestController())->getOne($uuid);
7265 RestConfig::apiLog($return);
7266 return $return;
7270 * @OA\Get(
7271 * path="/api/procedure",
7272 * description="Retrieves a list of all procedures",
7273 * tags={"standard"},
7274 * @OA\Response(
7275 * response="200",
7276 * ref="#/components/responses/standard"
7277 * ),
7278 * @OA\Response(
7279 * response="400",
7280 * ref="#/components/responses/badrequest"
7281 * ),
7282 * @OA\Response(
7283 * response="401",
7284 * ref="#/components/responses/unauthorized"
7285 * ),
7286 * security={{"openemr_auth":{}}}
7289 "GET /api/procedure" => function () {
7290 RestConfig::authorization_check("patients", "med");
7291 $return = (new ProcedureRestController())->getAll();
7292 RestConfig::apiLog($return);
7293 return $return;
7297 * @OA\Get(
7298 * path="/api/procedure/{uuid}",
7299 * description="Retrieves a procedure",
7300 * tags={"standard"},
7301 * @OA\Parameter(
7302 * name="uuid",
7303 * in="path",
7304 * description="The uuid for the procedure.",
7305 * required=true,
7306 * @OA\Schema(
7307 * type="string"
7309 * ),
7310 * @OA\Response(
7311 * response="200",
7312 * ref="#/components/responses/standard"
7313 * ),
7314 * @OA\Response(
7315 * response="400",
7316 * ref="#/components/responses/badrequest"
7317 * ),
7318 * @OA\Response(
7319 * response="401",
7320 * ref="#/components/responses/unauthorized"
7321 * ),
7322 * security={{"openemr_auth":{}}}
7325 "GET /api/procedure/:uuid" => function ($uuid) {
7326 RestConfig::authorization_check("patients", "med");
7327 $return = (new ProcedureRestController())->getOne($uuid);
7328 RestConfig::apiLog($return);
7329 return $return;
7333 * @OA\Get(
7334 * path="/api/drug",
7335 * description="Retrieves a list of all drugs",
7336 * tags={"standard"},
7337 * @OA\Response(
7338 * response="200",
7339 * ref="#/components/responses/standard"
7340 * ),
7341 * @OA\Response(
7342 * response="400",
7343 * ref="#/components/responses/badrequest"
7344 * ),
7345 * @OA\Response(
7346 * response="401",
7347 * ref="#/components/responses/unauthorized"
7348 * ),
7349 * security={{"openemr_auth":{}}}
7352 "GET /api/drug" => function () {
7353 RestConfig::authorization_check("patients", "med");
7354 $return = (new DrugRestController())->getAll();
7355 RestConfig::apiLog($return);
7356 return $return;
7360 * @OA\Get(
7361 * path="/api/drug/{uuid}",
7362 * description="Retrieves a drug",
7363 * tags={"standard"},
7364 * @OA\Parameter(
7365 * name="uuid",
7366 * in="path",
7367 * description="The uuid for the drug.",
7368 * required=true,
7369 * @OA\Schema(
7370 * type="string"
7372 * ),
7373 * @OA\Response(
7374 * response="200",
7375 * ref="#/components/responses/standard"
7376 * ),
7377 * @OA\Response(
7378 * response="400",
7379 * ref="#/components/responses/badrequest"
7380 * ),
7381 * @OA\Response(
7382 * response="401",
7383 * ref="#/components/responses/unauthorized"
7384 * ),
7385 * security={{"openemr_auth":{}}}
7388 "GET /api/drug/:uuid" => function ($uuid) {
7389 RestConfig::authorization_check("patients", "med");
7390 $return = (new DrugRestController())->getOne($uuid);
7391 RestConfig::apiLog($return);
7392 return $return;
7396 * @OA\Get(
7397 * path="/api/prescription",
7398 * description="Retrieves a list of all prescriptions",
7399 * tags={"standard"},
7400 * @OA\Response(
7401 * response="200",
7402 * ref="#/components/responses/standard"
7403 * ),
7404 * @OA\Response(
7405 * response="400",
7406 * ref="#/components/responses/badrequest"
7407 * ),
7408 * @OA\Response(
7409 * response="401",
7410 * ref="#/components/responses/unauthorized"
7411 * ),
7412 * security={{"openemr_auth":{}}}
7415 "GET /api/prescription" => function () {
7416 RestConfig::authorization_check("patients", "med");
7417 $return = (new PrescriptionRestController())->getAll();
7418 RestConfig::apiLog($return);
7419 return $return;
7423 * @OA\Get(
7424 * path="/api/prescription/{uuid}",
7425 * description="Retrieves a prescription",
7426 * tags={"standard"},
7427 * @OA\Parameter(
7428 * name="uuid",
7429 * in="path",
7430 * description="The uuid for the prescription.",
7431 * required=true,
7432 * @OA\Schema(
7433 * type="string"
7435 * ),
7436 * @OA\Response(
7437 * response="200",
7438 * ref="#/components/responses/standard"
7439 * ),
7440 * @OA\Response(
7441 * response="400",
7442 * ref="#/components/responses/badrequest"
7443 * ),
7444 * @OA\Response(
7445 * response="401",
7446 * ref="#/components/responses/unauthorized"
7447 * ),
7448 * security={{"openemr_auth":{}}}
7451 "GET /api/prescription/:uuid" => function ($uuid) {
7452 RestConfig::authorization_check("patients", "med");
7453 $return = (new PrescriptionRestController())->getOne($uuid);
7454 RestConfig::apiLog($return);
7455 return $return;
7459 use OpenEMR\Common\Http\StatusCode;
7460 use OpenEMR\Common\Http\Psr17Factory;
7461 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
7462 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController;
7463 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
7464 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
7465 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
7466 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
7467 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
7468 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
7469 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
7470 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
7471 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
7472 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
7473 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
7474 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
7475 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
7476 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
7477 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
7478 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
7479 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
7480 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
7481 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
7482 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
7483 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
7484 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
7485 use OpenEMR\RestControllers\FHIR\FhirValueSetRestController;
7486 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
7487 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController;
7488 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController;
7489 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController;
7491 // Note that the fhir route includes both user role and patient role
7492 // (there is a mechanism in place to ensure patient role is binded
7493 // to only see the data of the one patient)
7494 RestConfig::$FHIR_ROUTE_MAP = array(
7496 * @OA\Get(
7497 * path="/fhir/AllergyIntolerance",
7498 * description="Returns a list of AllergyIntolerance resources.",
7499 * tags={"fhir"},
7500 * @OA\Parameter(
7501 * name="_id",
7502 * in="query",
7503 * description="The uuid for the AllergyIntolerance resource.",
7504 * required=false,
7505 * @OA\Schema(
7506 * type="string"
7508 * ),
7509 * @OA\Parameter(
7510 * name="patient",
7511 * in="query",
7512 * description="The uuid for the patient.",
7513 * required=false,
7514 * @OA\Schema(
7515 * type="string"
7517 * ),
7518 * @OA\Response(
7519 * response="200",
7520 * description="Standard Response",
7521 * @OA\MediaType(
7522 * mediaType="application/json",
7523 * @OA\Schema(
7524 * @OA\Property(
7525 * property="json object",
7526 * description="FHIR Json object.",
7527 * type="object"
7528 * ),
7529 * example={
7530 * "meta": {
7531 * "lastUpdated": "2021-09-14T09:13:51"
7532 * },
7533 * "resourceType": "Bundle",
7534 * "type": "collection",
7535 * "total": 0,
7536 * "link": {
7538 * "relation": "self",
7539 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7545 * ),
7546 * @OA\Response(
7547 * response="400",
7548 * ref="#/components/responses/badrequest"
7549 * ),
7550 * @OA\Response(
7551 * response="401",
7552 * ref="#/components/responses/unauthorized"
7553 * ),
7554 * security={{"openemr_auth":{}}}
7557 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
7558 $getParams = $request->getQueryParams();
7559 if ($request->isPatientRequest()) {
7560 // only allow access to data of binded patient
7561 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7562 } else {
7563 RestConfig::authorization_check("patients", "med");
7564 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7566 RestConfig::apiLog($return);
7567 return $return;
7571 * @OA\Get(
7572 * path="/fhir/AllergyIntolerance/{uuid}",
7573 * description="Returns a single AllergyIntolerance resource.",
7574 * tags={"fhir"},
7575 * @OA\Parameter(
7576 * name="uuid",
7577 * in="path",
7578 * description="The uuid for the AllergyIntolerance resource.",
7579 * required=true,
7580 * @OA\Schema(
7581 * type="string"
7583 * ),
7584 * @OA\Response(
7585 * response="200",
7586 * description="Standard Response",
7587 * @OA\MediaType(
7588 * mediaType="application/json",
7589 * @OA\Schema(
7590 * @OA\Property(
7591 * property="json object",
7592 * description="FHIR Json object.",
7593 * type="object"
7594 * ),
7595 * example={
7596 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7597 * "meta": {
7598 * "versionId": "1",
7599 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7600 * },
7601 * "resourceType": "AllergyIntolerance",
7602 * "text": {
7603 * "status": "additional",
7604 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7605 * },
7606 * "clinicalStatus": {
7607 * "coding": {
7609 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7610 * "code": "active",
7611 * "display": "Active"
7614 * },
7615 * "verificationStatus": {
7616 * "coding": {
7618 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7619 * "code": "confirmed",
7620 * "display": "Confirmed"
7623 * },
7624 * "category": {
7625 * "medication"
7626 * },
7627 * "criticality": "low",
7628 * "code": {
7629 * "coding": {
7631 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7632 * "code": "unknown",
7633 * "display": "Unknown"
7636 * },
7637 * "patient": {
7638 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7639 * },
7640 * "reaction": {
7642 * "manifestation": {
7644 * "coding": {
7646 * "system": "http://snomed.info/sct",
7647 * "code": "422587007",
7648 * "display": "Nausea"
7650 * },
7651 * "text": "Nausea"
7659 * ),
7660 * @OA\Response(
7661 * response="400",
7662 * ref="#/components/responses/badrequest"
7663 * ),
7664 * @OA\Response(
7665 * response="401",
7666 * ref="#/components/responses/unauthorized"
7667 * ),
7668 * @OA\Response(
7669 * response="404",
7670 * ref="#/components/responses/uuidnotfound"
7671 * ),
7672 * security={{"openemr_auth":{}}}
7675 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7676 if ($request->isPatientRequest()) {
7677 // only allow access to data of binded patient
7678 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7679 } else {
7680 RestConfig::authorization_check("patients", "med");
7681 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7683 RestConfig::apiLog($return);
7684 return $return;
7688 * @OA\Get(
7689 * path="/fhir/Appointment",
7690 * description="Returns a list of Appointment resources.",
7691 * tags={"fhir"},
7692 * @OA\Parameter(
7693 * name="_id",
7694 * in="query",
7695 * description="The uuid for the Appointment resource.",
7696 * required=false,
7697 * @OA\Schema(
7698 * type="string"
7700 * ),
7701 * @OA\Parameter(
7702 * name="patient",
7703 * in="query",
7704 * description="The uuid for the patient.",
7705 * required=false,
7706 * @OA\Schema(
7707 * type="string"
7709 * ),
7710 * @OA\Response(
7711 * response="200",
7712 * description="Standard Response",
7713 * @OA\MediaType(
7714 * mediaType="application/json",
7715 * @OA\Schema(
7716 * @OA\Property(
7717 * property="json object",
7718 * description="FHIR Json object.",
7719 * type="object"
7720 * ),
7721 * example={
7722 * "meta": {
7723 * "lastUpdated": "2021-09-14T09:13:51"
7724 * },
7725 * "resourceType": "Bundle",
7726 * "type": "collection",
7727 * "total": 0,
7728 * "link": {
7730 * "relation": "self",
7731 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7737 * ),
7738 * @OA\Response(
7739 * response="400",
7740 * ref="#/components/responses/badrequest"
7741 * ),
7742 * @OA\Response(
7743 * response="401",
7744 * ref="#/components/responses/unauthorized"
7745 * ),
7746 * security={{"openemr_auth":{}}}
7749 "GET /fhir/Appointment" => function (HttpRestRequest $request) {
7750 $getParams = $request->getQueryParams();
7751 if ($request->isPatientRequest()) {
7752 // only allow access to data of binded patient
7753 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7754 } else {
7755 RestConfig::authorization_check("patients", "appt");
7756 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7758 RestConfig::apiLog($return);
7759 return $return;
7763 * @OA\Get(
7764 * path="/fhir/Appointment/{uuid}",
7765 * description="Returns a single Appointment resource.",
7766 * tags={"fhir"},
7767 * @OA\Parameter(
7768 * name="uuid",
7769 * in="path",
7770 * description="The uuid for the Appointment resource.",
7771 * required=true,
7772 * @OA\Schema(
7773 * type="string"
7775 * ),
7776 * @OA\Response(
7777 * response="200",
7778 * description="Standard Response",
7779 * @OA\MediaType(
7780 * mediaType="application/json",
7781 * @OA\Schema(
7782 * @OA\Property(
7783 * property="json object",
7784 * description="FHIR Json object.",
7785 * type="object"
7786 * ),
7787 * example={}
7790 * ),
7791 * @OA\Response(
7792 * response="400",
7793 * ref="#/components/responses/badrequest"
7794 * ),
7795 * @OA\Response(
7796 * response="401",
7797 * ref="#/components/responses/unauthorized"
7798 * ),
7799 * @OA\Response(
7800 * response="404",
7801 * ref="#/components/responses/uuidnotfound"
7802 * ),
7803 * security={{"openemr_auth":{}}}
7806 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest $request) {
7807 if ($request->isPatientRequest()) {
7808 // only allow access to data of binded patient
7809 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7810 } else {
7811 RestConfig::authorization_check("patients", "appt");
7812 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7814 RestConfig::apiLog($return);
7815 return $return;
7819 * @OA\Get(
7820 * path="/fhir/CarePlan",
7821 * description="Returns a list of CarePlan resources.",
7822 * tags={"fhir"},
7823 * @OA\Parameter(
7824 * name="_id",
7825 * in="query",
7826 * description="The uuid for the CarePlan resource.",
7827 * required=false,
7828 * @OA\Schema(
7829 * type="string"
7831 * ),
7832 * @OA\Parameter(
7833 * name="patient",
7834 * in="query",
7835 * description="The uuid for the patient.",
7836 * required=false,
7837 * @OA\Schema(
7838 * type="string"
7840 * ),
7841 * @OA\Parameter(
7842 * name="category",
7843 * in="query",
7844 * description="The category of the CarePlan resource.",
7845 * required=false,
7846 * @OA\Schema(
7847 * type="string"
7849 * ),
7850 * @OA\Response(
7851 * response="200",
7852 * description="Standard Response",
7853 * @OA\MediaType(
7854 * mediaType="application/json",
7855 * @OA\Schema(
7856 * @OA\Property(
7857 * property="json object",
7858 * description="FHIR Json object.",
7859 * type="object"
7860 * ),
7861 * example={
7862 * "meta": {
7863 * "lastUpdated": "2021-09-14T09:13:51"
7864 * },
7865 * "resourceType": "Bundle",
7866 * "type": "collection",
7867 * "total": 0,
7868 * "link": {
7870 * "relation": "self",
7871 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7877 * ),
7878 * @OA\Response(
7879 * response="400",
7880 * ref="#/components/responses/badrequest"
7881 * ),
7882 * @OA\Response(
7883 * response="401",
7884 * ref="#/components/responses/unauthorized"
7885 * ),
7886 * security={{"openemr_auth":{}}}
7889 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7890 $getParams = $request->getQueryParams();
7891 if ($request->isPatientRequest()) {
7892 // only allow access to data of binded patient
7893 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7894 } else {
7895 RestConfig::authorization_check("patients", "med");
7896 $return = (new FhirCarePlanRestController())->getAll($getParams);
7898 RestConfig::apiLog($return);
7899 return $return;
7903 * @OA\Get(
7904 * path="/fhir/CarePlan/{uuid}",
7905 * description="Returns a single CarePlan resource.",
7906 * tags={"fhir"},
7907 * @OA\Parameter(
7908 * name="uuid",
7909 * in="path",
7910 * description="The uuid for the CarePlan resource.",
7911 * required=true,
7912 * @OA\Schema(
7913 * type="string"
7915 * ),
7916 * @OA\Response(
7917 * response="200",
7918 * description="Standard Response",
7919 * @OA\MediaType(
7920 * mediaType="application/json",
7921 * @OA\Schema(
7922 * @OA\Property(
7923 * property="json object",
7924 * description="FHIR Json object.",
7925 * type="object"
7926 * ),
7927 * example={
7928 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7929 * "meta": {
7930 * "versionId": "1",
7931 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7932 * },
7933 * "resourceType": "CarePlan",
7934 * "text": {
7935 * "status": "generated",
7936 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7937 * },
7938 * "status": "active",
7939 * "intent": "plan",
7940 * "category": {
7942 * "coding": {
7944 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7945 * "code": "assess-plan"
7949 * },
7950 * "description": "Treat flu.",
7951 * "subject": {
7952 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7953 * "type": "Patient"
7958 * ),
7959 * @OA\Response(
7960 * response="400",
7961 * ref="#/components/responses/badrequest"
7962 * ),
7963 * @OA\Response(
7964 * response="401",
7965 * ref="#/components/responses/unauthorized"
7966 * ),
7967 * @OA\Response(
7968 * response="404",
7969 * ref="#/components/responses/uuidnotfound"
7970 * ),
7971 * security={{"openemr_auth":{}}}
7974 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7975 if ($request->isPatientRequest()) {
7976 // only allow access to data of binded patient
7977 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7978 } else {
7979 RestConfig::authorization_check("patients", "med");
7980 $return = (new FhirCarePlanRestController())->getOne($uuid);
7982 RestConfig::apiLog($return);
7983 return $return;
7987 * @OA\Get(
7988 * path="/fhir/CareTeam",
7989 * description="Returns a list of CareTeam resources.",
7990 * tags={"fhir"},
7991 * @OA\Parameter(
7992 * name="_id",
7993 * in="query",
7994 * description="The uuid for the CareTeam resource.",
7995 * required=false,
7996 * @OA\Schema(
7997 * type="string"
7999 * ),
8000 * @OA\Parameter(
8001 * name="patient",
8002 * in="query",
8003 * description="The uuid for the patient.",
8004 * required=false,
8005 * @OA\Schema(
8006 * type="string"
8008 * ),
8009 * @OA\Parameter(
8010 * name="status",
8011 * in="query",
8012 * description="The status of the CarePlan resource.",
8013 * required=false,
8014 * @OA\Schema(
8015 * type="string"
8017 * ),
8018 * @OA\Response(
8019 * response="200",
8020 * description="Standard Response",
8021 * @OA\MediaType(
8022 * mediaType="application/json",
8023 * @OA\Schema(
8024 * @OA\Property(
8025 * property="json object",
8026 * description="FHIR Json object.",
8027 * type="object"
8028 * ),
8029 * example={
8030 * "meta": {
8031 * "lastUpdated": "2021-09-14T09:13:51"
8032 * },
8033 * "resourceType": "Bundle",
8034 * "type": "collection",
8035 * "total": 0,
8036 * "link": {
8038 * "relation": "self",
8039 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
8045 * ),
8046 * @OA\Response(
8047 * response="400",
8048 * ref="#/components/responses/badrequest"
8049 * ),
8050 * @OA\Response(
8051 * response="401",
8052 * ref="#/components/responses/unauthorized"
8053 * ),
8054 * security={{"openemr_auth":{}}}
8057 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
8058 $getParams = $request->getQueryParams();
8059 if ($request->isPatientRequest()) {
8060 // only allow access to data of binded patient
8061 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8062 } else {
8063 RestConfig::authorization_check("patients", "med");
8064 $return = (new FhirCareTeamRestController())->getAll($getParams);
8066 RestConfig::apiLog($return);
8067 return $return;
8071 * @OA\Get(
8072 * path="/fhir/CareTeam/{uuid}",
8073 * description="Returns a single CareTeam resource.",
8074 * tags={"fhir"},
8075 * @OA\Parameter(
8076 * name="uuid",
8077 * in="path",
8078 * description="The uuid for the CareTeam resource.",
8079 * required=true,
8080 * @OA\Schema(
8081 * type="string"
8083 * ),
8084 * @OA\Response(
8085 * response="200",
8086 * description="Standard Response",
8087 * @OA\MediaType(
8088 * mediaType="application/json",
8089 * @OA\Schema(
8090 * @OA\Property(
8091 * property="json object",
8092 * description="FHIR Json object.",
8093 * type="object"
8094 * ),
8095 * example={
8096 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8097 * "meta": {
8098 * "versionId": "1",
8099 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8100 * },
8101 * "resourceType": "CareTeam",
8102 * "status": "active",
8103 * "subject": {
8104 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8105 * "type": "Patient"
8106 * },
8107 * "participant": {
8109 * "role": {
8111 * "coding": {
8113 * "system": "http://nucc.org/provider-taxonomy",
8114 * "code": "102L00000X",
8115 * "display": "Psychoanalyst"
8119 * },
8120 * "member": {
8121 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8122 * "type": "Practitioner"
8123 * },
8124 * "onBehalfOf": {
8125 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8126 * "type": "Organization"
8128 * },
8130 * "role": {
8132 * "coding": {
8134 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8135 * "code": "unknown",
8136 * "display": "Unknown"
8140 * },
8141 * "member": {
8142 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8143 * "type": "Organization"
8150 * ),
8151 * @OA\Response(
8152 * response="400",
8153 * ref="#/components/responses/badrequest"
8154 * ),
8155 * @OA\Response(
8156 * response="401",
8157 * ref="#/components/responses/unauthorized"
8158 * ),
8159 * @OA\Response(
8160 * response="404",
8161 * ref="#/components/responses/uuidnotfound"
8162 * ),
8163 * security={{"openemr_auth":{}}}
8166 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
8167 if ($request->isPatientRequest()) {
8168 // only allow access to data of binded patient
8169 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8170 } else {
8171 RestConfig::authorization_check("patients", "med");
8172 $return = (new FhirCareTeamRestController())->getOne($uuid);
8174 RestConfig::apiLog($return);
8175 return $return;
8179 * @OA\Get(
8180 * path="/fhir/Condition",
8181 * description="Returns a list of Condition resources.",
8182 * tags={"fhir"},
8183 * @OA\Parameter(
8184 * name="_id",
8185 * in="query",
8186 * description="The uuid for the Condition resource.",
8187 * required=false,
8188 * @OA\Schema(
8189 * type="string"
8191 * ),
8192 * @OA\Parameter(
8193 * name="patient",
8194 * in="query",
8195 * description="The uuid for the patient.",
8196 * required=false,
8197 * @OA\Schema(
8198 * type="string"
8200 * ),
8201 * @OA\Response(
8202 * response="200",
8203 * description="Standard Response",
8204 * @OA\MediaType(
8205 * mediaType="application/json",
8206 * @OA\Schema(
8207 * @OA\Property(
8208 * property="json object",
8209 * description="FHIR Json object.",
8210 * type="object"
8211 * ),
8212 * example={
8213 * "meta": {
8214 * "lastUpdated": "2021-09-14T09:13:51"
8215 * },
8216 * "resourceType": "Bundle",
8217 * "type": "collection",
8218 * "total": 0,
8219 * "link": {
8221 * "relation": "self",
8222 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8228 * ),
8229 * @OA\Response(
8230 * response="400",
8231 * ref="#/components/responses/badrequest"
8232 * ),
8233 * @OA\Response(
8234 * response="401",
8235 * ref="#/components/responses/unauthorized"
8236 * ),
8237 * security={{"openemr_auth":{}}}
8240 "GET /fhir/Condition" => function (HttpRestRequest $request) {
8241 $getParams = $request->getQueryParams();
8242 if ($request->isPatientRequest()) {
8243 // only allow access to data of binded patient
8244 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8245 } else {
8246 RestConfig::authorization_check("patients", "med");
8247 $return = (new FhirConditionRestController())->getAll($getParams);
8249 RestConfig::apiLog($return);
8250 return $return;
8254 * @OA\Get(
8255 * path="/fhir/Condition/{uuid}",
8256 * description="Returns a single Condition resource.",
8257 * tags={"fhir"},
8258 * @OA\Parameter(
8259 * name="uuid",
8260 * in="path",
8261 * description="The uuid for the Condition resource.",
8262 * required=true,
8263 * @OA\Schema(
8264 * type="string"
8266 * ),
8267 * @OA\Response(
8268 * response="200",
8269 * description="Standard Response",
8270 * @OA\MediaType(
8271 * mediaType="application/json",
8272 * @OA\Schema(
8273 * @OA\Property(
8274 * property="json object",
8275 * description="FHIR Json object.",
8276 * type="object"
8277 * ),
8278 * example={
8279 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8280 * "meta": {
8281 * "versionId": "1",
8282 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8283 * },
8284 * "resourceType": "Condition",
8285 * "clinicalStatus": {
8286 * "coding": {
8288 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8289 * "code": "inactive",
8290 * "display": "Inactive"
8293 * },
8294 * "verificationStatus": {
8295 * "coding": {
8297 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8298 * "code": "unconfirmed",
8299 * "display": "Unconfirmed"
8302 * },
8303 * "category": {
8305 * "coding": {
8307 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8308 * "code": "problem-list-item",
8309 * "display": "Problem List Item"
8313 * },
8314 * "code": {
8315 * "coding": {
8317 * "system": "http://snomed.info/sct",
8318 * "code": "444814009",
8319 * "display": ""
8322 * },
8323 * "subject": {
8324 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8329 * ),
8330 * @OA\Response(
8331 * response="400",
8332 * ref="#/components/responses/badrequest"
8333 * ),
8334 * @OA\Response(
8335 * response="401",
8336 * ref="#/components/responses/unauthorized"
8337 * ),
8338 * @OA\Response(
8339 * response="404",
8340 * ref="#/components/responses/uuidnotfound"
8341 * ),
8342 * security={{"openemr_auth":{}}}
8345 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
8346 if ($request->isPatientRequest()) {
8347 // only allow access to data of binded patient
8348 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8349 } else {
8350 RestConfig::authorization_check("patients", "med");
8351 $return = (new FhirConditionRestController())->getOne($uuid);
8353 RestConfig::apiLog($return);
8354 return $return;
8358 * @OA\Get(
8359 * path="/fhir/Coverage",
8360 * description="Returns a list of Coverage resources.",
8361 * tags={"fhir"},
8362 * @OA\Parameter(
8363 * name="_id",
8364 * in="query",
8365 * description="The uuid for the Coverage resource.",
8366 * required=false,
8367 * @OA\Schema(
8368 * type="string"
8370 * ),
8371 * @OA\Parameter(
8372 * name="patient",
8373 * in="query",
8374 * description="The uuid for the patient.",
8375 * required=false,
8376 * @OA\Schema(
8377 * type="string"
8379 * ),
8380 * @OA\Parameter(
8381 * name="payor",
8382 * in="query",
8383 * description="The payor of the Coverage resource.",
8384 * required=false,
8385 * @OA\Schema(
8386 * type="string"
8388 * ),
8389 * @OA\Response(
8390 * response="200",
8391 * description="Standard Response",
8392 * @OA\MediaType(
8393 * mediaType="application/json",
8394 * @OA\Schema(
8395 * @OA\Property(
8396 * property="json object",
8397 * description="FHIR Json object.",
8398 * type="object"
8399 * ),
8400 * example={
8401 * "meta": {
8402 * "lastUpdated": "2021-09-14T09:13:51"
8403 * },
8404 * "resourceType": "Bundle",
8405 * "type": "collection",
8406 * "total": 0,
8407 * "link": {
8409 * "relation": "self",
8410 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8416 * ),
8417 * @OA\Response(
8418 * response="400",
8419 * ref="#/components/responses/badrequest"
8420 * ),
8421 * @OA\Response(
8422 * response="401",
8423 * ref="#/components/responses/unauthorized"
8424 * ),
8425 * security={{"openemr_auth":{}}}
8428 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
8429 if ($request->isPatientRequest()) {
8430 // only allow access to data of binded patient
8431 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8432 } else {
8433 RestConfig::authorization_check("admin", "super");
8434 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8436 RestConfig::apiLog($return);
8437 return $return;
8441 * @OA\Get(
8442 * path="/fhir/Coverage/{uuid}",
8443 * description="Returns a single Coverage resource.",
8444 * tags={"fhir"},
8445 * @OA\Parameter(
8446 * name="uuid",
8447 * in="path",
8448 * description="The uuid for the Coverage resource.",
8449 * required=true,
8450 * @OA\Schema(
8451 * type="string"
8453 * ),
8454 * @OA\Response(
8455 * response="200",
8456 * description="Standard Response",
8457 * @OA\MediaType(
8458 * mediaType="application/json",
8459 * @OA\Schema(
8460 * @OA\Property(
8461 * property="json object",
8462 * description="FHIR Json object.",
8463 * type="object"
8464 * ),
8465 * example={
8466 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8467 * "meta": {
8468 * "versionId": "1",
8469 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8470 * },
8471 * "resourceType": "Coverage",
8472 * "status": "active",
8473 * "beneficiary": {
8474 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8475 * },
8476 * "relationship": {
8477 * "coding": {
8479 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8480 * "code": ""
8487 * ),
8488 * @OA\Response(
8489 * response="400",
8490 * ref="#/components/responses/badrequest"
8491 * ),
8492 * @OA\Response(
8493 * response="401",
8494 * ref="#/components/responses/unauthorized"
8495 * ),
8496 * @OA\Response(
8497 * response="404",
8498 * ref="#/components/responses/uuidnotfound"
8499 * ),
8500 * security={{"openemr_auth":{}}}
8503 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
8504 if ($request->isPatientRequest()) {
8505 // only allow access to data of binded patient
8506 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8507 } else {
8508 RestConfig::authorization_check("admin", "super");
8509 $return = (new FhirCoverageRestController())->getOne($uuid);
8511 RestConfig::apiLog($return);
8512 return $return;
8516 * @OA\Get(
8517 * path="/fhir/Device",
8518 * description="Returns a list of Device resources.",
8519 * tags={"fhir"},
8520 * @OA\Parameter(
8521 * name="_id",
8522 * in="query",
8523 * description="The uuid for the Device resource.",
8524 * required=false,
8525 * @OA\Schema(
8526 * type="string"
8528 * ),
8529 * @OA\Parameter(
8530 * name="patient",
8531 * in="query",
8532 * description="The uuid for the patient.",
8533 * required=false,
8534 * @OA\Schema(
8535 * type="string"
8537 * ),
8538 * @OA\Response(
8539 * response="200",
8540 * description="Standard Response",
8541 * @OA\MediaType(
8542 * mediaType="application/json",
8543 * @OA\Schema(
8544 * @OA\Property(
8545 * property="json object",
8546 * description="FHIR Json object.",
8547 * type="object"
8548 * ),
8549 * example={
8550 * "meta": {
8551 * "lastUpdated": "2021-09-14T09:13:51"
8552 * },
8553 * "resourceType": "Bundle",
8554 * "type": "collection",
8555 * "total": 0,
8556 * "link": {
8558 * "relation": "self",
8559 * "url": "https://localhost:9300/apis/default/fhir/Device"
8565 * ),
8566 * @OA\Response(
8567 * response="400",
8568 * ref="#/components/responses/badrequest"
8569 * ),
8570 * @OA\Response(
8571 * response="401",
8572 * ref="#/components/responses/unauthorized"
8573 * ),
8574 * security={{"openemr_auth":{}}}
8577 "GET /fhir/Device" => function (HttpRestRequest $request) {
8578 if ($request->isPatientRequest()) {
8579 // only allow access to data of binded patient
8580 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8581 } else {
8582 RestConfig::authorization_check("admin", "super");
8583 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8585 RestConfig::apiLog($return);
8586 return $return;
8590 * @OA\Get(
8591 * path="/fhir/Device/{uuid}",
8592 * description="Returns a single Device resource.",
8593 * tags={"fhir"},
8594 * @OA\Parameter(
8595 * name="uuid",
8596 * in="path",
8597 * description="The uuid for the Device resource.",
8598 * required=true,
8599 * @OA\Schema(
8600 * type="string"
8602 * ),
8603 * @OA\Response(
8604 * response="200",
8605 * description="Standard Response",
8606 * @OA\MediaType(
8607 * mediaType="application/json",
8608 * @OA\Schema(
8609 * @OA\Property(
8610 * property="json object",
8611 * description="FHIR Json object.",
8612 * type="object"
8613 * ),
8614 * example={
8615 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8616 * "meta": {
8617 * "versionId": "1",
8618 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8619 * },
8620 * "resourceType": "Device",
8621 * "udiCarrier": {
8623 * "deviceIdentifier": "08717648200274",
8624 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8626 * },
8627 * "distinctIdentifier": "A99971312345600",
8628 * "manufactureDate": "2013-02-01",
8629 * "expirationDate": "2014-02-01",
8630 * "lotNumber": "000000000000XYZ123",
8631 * "serialNumber": "000025",
8632 * "type": {
8633 * "extension": {
8635 * "valueCode": "unknown",
8636 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8639 * },
8640 * "patient": {
8641 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8642 * "type": "Patient"
8647 * ),
8648 * @OA\Response(
8649 * response="400",
8650 * ref="#/components/responses/badrequest"
8651 * ),
8652 * @OA\Response(
8653 * response="401",
8654 * ref="#/components/responses/unauthorized"
8655 * ),
8656 * @OA\Response(
8657 * response="404",
8658 * ref="#/components/responses/uuidnotfound"
8659 * ),
8660 * security={{"openemr_auth":{}}}
8663 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
8664 if ($request->isPatientRequest()) {
8665 // only allow access to data of binded patient
8666 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8667 } else {
8668 RestConfig::authorization_check("admin", "super");
8669 $return = (new FhirDeviceRestController())->getOne($uuid);
8671 RestConfig::apiLog($return);
8672 return $return;
8676 * @OA\Get(
8677 * path="/fhir/DiagnosticReport",
8678 * description="Returns a list of DiagnosticReport resources.",
8679 * tags={"fhir"},
8680 * @OA\Parameter(
8681 * name="_id",
8682 * in="query",
8683 * description="The uuid for the DiagnosticReport resource.",
8684 * required=false,
8685 * @OA\Schema(
8686 * type="string"
8688 * ),
8689 * @OA\Parameter(
8690 * name="patient",
8691 * in="query",
8692 * description="The uuid for the patient.",
8693 * required=false,
8694 * @OA\Schema(
8695 * type="string"
8697 * ),
8698 * @OA\Parameter(
8699 * name="code",
8700 * in="query",
8701 * description="The code of the DiagnosticReport resource.",
8702 * required=false,
8703 * @OA\Schema(
8704 * type="string"
8706 * ),
8707 * @OA\Parameter(
8708 * name="category",
8709 * in="query",
8710 * description="The category of the DiagnosticReport resource.",
8711 * required=false,
8712 * @OA\Schema(
8713 * type="string"
8715 * ),
8716 * @OA\Parameter(
8717 * name="date",
8718 * in="query",
8719 * description="The datetime of the DiagnosticReport resource.",
8720 * required=false,
8721 * @OA\Schema(
8722 * type="string"
8724 * ),
8725 * @OA\Response(
8726 * response="200",
8727 * description="Standard Response",
8728 * @OA\MediaType(
8729 * mediaType="application/json",
8730 * @OA\Schema(
8731 * @OA\Property(
8732 * property="json object",
8733 * description="FHIR Json object.",
8734 * type="object"
8735 * ),
8736 * example={
8737 * "meta": {
8738 * "lastUpdated": "2021-09-14T09:13:51"
8739 * },
8740 * "resourceType": "Bundle",
8741 * "type": "collection",
8742 * "total": 0,
8743 * "link": {
8745 * "relation": "self",
8746 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8752 * ),
8753 * @OA\Response(
8754 * response="400",
8755 * ref="#/components/responses/badrequest"
8756 * ),
8757 * @OA\Response(
8758 * response="401",
8759 * ref="#/components/responses/unauthorized"
8760 * ),
8761 * security={{"openemr_auth":{}}}
8764 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
8765 $getParams = $request->getQueryParams();
8766 if ($request->isPatientRequest()) {
8767 // only allow access to data of binded patient
8768 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8769 } else {
8770 RestConfig::authorization_check("admin", "super");
8771 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8773 RestConfig::apiLog($return);
8774 return $return;
8778 * @OA\Get(
8779 * path="/fhir/DiagnosticReport/{uuid}",
8780 * description="Returns a single DiagnosticReport resource.",
8781 * tags={"fhir"},
8782 * @OA\Parameter(
8783 * name="uuid",
8784 * in="path",
8785 * description="The uuid for the DiagnosticReport resource.",
8786 * required=true,
8787 * @OA\Schema(
8788 * type="string"
8790 * ),
8791 * @OA\Response(
8792 * response="200",
8793 * description="Standard Response",
8794 * @OA\MediaType(
8795 * mediaType="application/json",
8796 * @OA\Schema(
8797 * @OA\Property(
8798 * property="json object",
8799 * description="FHIR Json object.",
8800 * type="object"
8801 * ),
8802 * example={
8803 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8804 * "meta": {
8805 * "versionId": "1",
8806 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8807 * },
8808 * "resourceType": "DiagnosticReport",
8809 * "status": "final",
8810 * "category": {
8812 * "coding": {
8814 * "system": "http://loinc.org",
8815 * "code": "LP7839-6",
8816 * "display": "Pathology"
8820 * },
8821 * "code": {
8822 * "coding": {
8824 * "system": "http://loinc.org",
8825 * "code": "11502-2",
8826 * "display": "Laboratory report"
8829 * },
8830 * "subject": {
8831 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8832 * "type": "Patient"
8833 * },
8834 * "encounter": {
8835 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8836 * "type": "Encounter"
8837 * },
8838 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8839 * "issued": "2015-06-22T00:00:00+00:00",
8840 * "performer": {
8842 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8843 * "type": "Organization"
8845 * },
8846 * "presentedForm": {
8848 * "contentType": "text/plain",
8849 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8855 * ),
8856 * @OA\Response(
8857 * response="400",
8858 * ref="#/components/responses/badrequest"
8859 * ),
8860 * @OA\Response(
8861 * response="401",
8862 * ref="#/components/responses/unauthorized"
8863 * ),
8864 * @OA\Response(
8865 * response="404",
8866 * ref="#/components/responses/uuidnotfound"
8867 * ),
8868 * security={{"openemr_auth":{}}}
8871 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8872 $getParams = $request->getQueryParams();
8873 if ($request->isPatientRequest()) {
8874 // only allow access to data of binded patient
8875 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8876 } else {
8877 RestConfig::authorization_check("admin", "super");
8878 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8880 RestConfig::apiLog($return);
8881 return $return;
8885 * @OA\Get(
8886 * path="/fhir/DocumentReference",
8887 * description="Returns a list of DocumentReference resources.",
8888 * tags={"fhir"},
8889 * @OA\Parameter(
8890 * name="_id",
8891 * in="query",
8892 * description="The uuid for the DocumentReference resource.",
8893 * required=false,
8894 * @OA\Schema(
8895 * type="string"
8897 * ),
8898 * @OA\Parameter(
8899 * name="patient",
8900 * in="query",
8901 * description="The uuid for the patient.",
8902 * required=false,
8903 * @OA\Schema(
8904 * type="string"
8906 * ),
8907 * @OA\Parameter(
8908 * name="type",
8909 * in="query",
8910 * description="The type of the DocumentReference resource.",
8911 * required=false,
8912 * @OA\Schema(
8913 * type="string"
8915 * ),
8916 * @OA\Parameter(
8917 * name="category",
8918 * in="query",
8919 * description="The category of the DocumentReference resource.",
8920 * required=false,
8921 * @OA\Schema(
8922 * type="string"
8924 * ),
8925 * @OA\Parameter(
8926 * name="date",
8927 * in="query",
8928 * description="The datetime of the DocumentReference resource.",
8929 * required=false,
8930 * @OA\Schema(
8931 * type="string"
8933 * ),
8934 * @OA\Response(
8935 * response="200",
8936 * description="Standard Response",
8937 * @OA\MediaType(
8938 * mediaType="application/json",
8939 * @OA\Schema(
8940 * @OA\Property(
8941 * property="json object",
8942 * description="FHIR Json object.",
8943 * type="object"
8944 * ),
8945 * example={
8946 * "meta": {
8947 * "lastUpdated": "2021-09-14T09:13:51"
8948 * },
8949 * "resourceType": "Bundle",
8950 * "type": "collection",
8951 * "total": 0,
8952 * "link": {
8954 * "relation": "self",
8955 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8961 * ),
8962 * @OA\Response(
8963 * response="400",
8964 * ref="#/components/responses/badrequest"
8965 * ),
8966 * @OA\Response(
8967 * response="401",
8968 * ref="#/components/responses/unauthorized"
8969 * ),
8970 * security={{"openemr_auth":{}}}
8973 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8974 $getParams = $request->getQueryParams();
8975 if ($request->isPatientRequest()) {
8976 // only allow access to data of binded patient
8977 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8978 } else {
8979 RestConfig::authorization_check("admin", "super");
8980 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8982 RestConfig::apiLog($return);
8983 return $return;
8987 * @OA\POST(
8988 * path="/fhir/DocumentReference/$docref",
8989 * 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.",
8990 * tags={"fhir"},
8991 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8992 * @OA\Parameter(
8993 * name="patient",
8994 * in="query",
8995 * description="The uuid for the patient.",
8996 * required=true,
8997 * @OA\Schema(
8998 * type="string"
9000 * ),
9001 * @OA\Parameter(
9002 * name="start",
9003 * in="query",
9004 * 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.",
9005 * required=false,
9006 * @OA\Schema(
9007 * type="string"
9009 * ),
9010 * @OA\Parameter(
9011 * name="end",
9012 * in="query",
9013 * 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.",
9014 * required=false,
9015 * @OA\Schema(
9016 * type="string"
9018 * ),
9019 * @OA\Parameter(
9020 * name="type",
9021 * in="query",
9022 * 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).",
9023 * required=false,
9024 * @OA\Schema(
9025 * type="string"
9027 * ),
9028 * @OA\Response(
9029 * response="200",
9030 * description="A search bundle of DocumentReferences is returned"
9031 * ),
9032 * @OA\Response(
9033 * response="400",
9034 * ref="#/components/responses/badrequest"
9035 * ),
9036 * @OA\Response(
9037 * response="401",
9038 * ref="#/components/responses/unauthorized"
9039 * ),
9040 * security={{"openemr_auth":{}}}
9043 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest $request) {
9045 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
9046 if ($request->isPatientRequest()) {
9047 // only allow access to data of binded patient
9048 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9049 } else {
9050 // TODO: it seems like regular users should be able to grab authorship / provenance information
9051 RestConfig::authorization_check("patients", "demo");
9052 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
9054 RestConfig::apiLog($return);
9055 return $return;
9059 * @OA\Get(
9060 * path="/fhir/DocumentReference/{uuid}",
9061 * description="Returns a single DocumentReference resource.",
9062 * tags={"fhir"},
9063 * @OA\Parameter(
9064 * name="uuid",
9065 * in="path",
9066 * description="The uuid for the DocumentReference resource.",
9067 * required=true,
9068 * @OA\Schema(
9069 * type="string"
9071 * ),
9072 * @OA\Response(
9073 * response="200",
9074 * description="Standard Response",
9075 * @OA\MediaType(
9076 * mediaType="application/json",
9077 * @OA\Schema(
9078 * @OA\Property(
9079 * property="json object",
9080 * description="FHIR Json object.",
9081 * type="object"
9082 * ),
9083 * example={
9084 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9085 * "meta": {
9086 * "versionId": "1",
9087 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9088 * },
9089 * "resourceType": "DocumentReference",
9090 * "identifier": {
9092 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9094 * },
9095 * "status": "current",
9096 * "type": {
9097 * "coding": {
9099 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9100 * "code": "UNK",
9101 * "display": "unknown"
9104 * },
9105 * "category": {
9107 * "coding": {
9109 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9110 * "code": "openemr-document",
9111 * "display": "OpenEMR Document"
9115 * },
9116 * "subject": {
9117 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9118 * "type": "Patient"
9119 * },
9120 * "date": "2021-09-19T03:15:56+00:00",
9121 * "author": {
9122 * null
9123 * },
9124 * "content": {
9126 * "attachment": {
9127 * "contentType": "image/gif",
9128 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9129 * },
9130 * "format": {
9131 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9132 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9133 * "display": "mimeType Sufficient"
9140 * ),
9141 * @OA\Response(
9142 * response="400",
9143 * ref="#/components/responses/badrequest"
9144 * ),
9145 * @OA\Response(
9146 * response="401",
9147 * ref="#/components/responses/unauthorized"
9148 * ),
9149 * @OA\Response(
9150 * response="404",
9151 * ref="#/components/responses/uuidnotfound"
9152 * ),
9153 * security={{"openemr_auth":{}}}
9156 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
9157 $getParams = $request->getQueryParams();
9158 if ($request->isPatientRequest()) {
9159 // only allow access to data of binded patient
9160 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9161 } else {
9162 RestConfig::authorization_check("admin", "super");
9163 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9165 RestConfig::apiLog($return);
9166 return $return;
9170 * @OA\Get(
9171 * path="/fhir/Binary/{id}",
9172 * 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>",
9173 * tags={"fhir"},
9174 * @OA\Parameter(
9175 * name="id",
9176 * in="path",
9177 * description="The id for the Document.",
9178 * required=true,
9179 * @OA\Schema(
9180 * type="string"
9182 * ),
9183 * @OA\Response(
9184 * response="200",
9185 * 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>"
9186 * ),
9187 * @OA\Response(
9188 * response="400",
9189 * ref="#/components/responses/badrequest"
9190 * ),
9191 * @OA\Response(
9192 * response="401",
9193 * ref="#/components/responses/unauthorized"
9194 * ),
9195 * security={{"openemr_auth":{}}}
9198 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest $request) {
9199 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
9201 if ($request->isPatientRequest()) {
9202 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9203 } else {
9204 RestConfig::authorization_check("admin", "users");
9205 $response = $docController->downloadDocument($documentId);
9208 return $response;
9212 * @OA\Get(
9213 * path="/fhir/Encounter",
9214 * description="Returns a list of Encounter resources.",
9215 * tags={"fhir"},
9216 * @OA\Parameter(
9217 * name="_id",
9218 * in="query",
9219 * description="The uuid for the Encounter resource.",
9220 * required=false,
9221 * @OA\Schema(
9222 * type="string"
9224 * ),
9225 * @OA\Parameter(
9226 * name="patient",
9227 * in="query",
9228 * description="The uuid for the patient.",
9229 * required=false,
9230 * @OA\Schema(
9231 * type="string"
9233 * ),
9234 * @OA\Parameter(
9235 * name="date",
9236 * in="query",
9237 * description="The datetime of the Encounter resource.",
9238 * required=false,
9239 * @OA\Schema(
9240 * type="string"
9242 * ),
9243 * @OA\Response(
9244 * response="200",
9245 * description="Standard Response",
9246 * @OA\MediaType(
9247 * mediaType="application/json",
9248 * @OA\Schema(
9249 * @OA\Property(
9250 * property="json object",
9251 * description="FHIR Json object.",
9252 * type="object"
9253 * ),
9254 * example={
9255 * "meta": {
9256 * "lastUpdated": "2021-09-14T09:13:51"
9257 * },
9258 * "resourceType": "Bundle",
9259 * "type": "collection",
9260 * "total": 0,
9261 * "link": {
9263 * "relation": "self",
9264 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9270 * ),
9271 * @OA\Response(
9272 * response="400",
9273 * ref="#/components/responses/badrequest"
9274 * ),
9275 * @OA\Response(
9276 * response="401",
9277 * ref="#/components/responses/unauthorized"
9278 * ),
9279 * security={{"openemr_auth":{}}}
9282 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
9283 $getParams = $request->getQueryParams();
9284 if ($request->isPatientRequest()) {
9285 // only allow access to data of binded patient
9286 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9287 } else {
9288 RestConfig::authorization_check("encounters", "auth_a");
9289 $return = (new FhirEncounterRestController())->getAll($getParams);
9291 RestConfig::apiLog($return);
9292 return $return;
9296 * @OA\Get(
9297 * path="/fhir/Encounter/{uuid}",
9298 * description="Returns a single Encounter resource.",
9299 * tags={"fhir"},
9300 * @OA\Parameter(
9301 * name="uuid",
9302 * in="path",
9303 * description="The uuid for the Encounter resource.",
9304 * required=true,
9305 * @OA\Schema(
9306 * type="string"
9308 * ),
9309 * @OA\Response(
9310 * response="200",
9311 * description="Standard Response",
9312 * @OA\MediaType(
9313 * mediaType="application/json",
9314 * @OA\Schema(
9315 * @OA\Property(
9316 * property="json object",
9317 * description="FHIR Json object.",
9318 * type="object"
9319 * ),
9320 * example={
9321 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9322 * "meta": {
9323 * "versionId": "1",
9324 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9325 * },
9326 * "resourceType": "Encounter",
9327 * "identifier": {
9329 * "system": "urn:ietf:rfc:3986",
9330 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9332 * },
9333 * "status": "finished",
9334 * "class": {
9335 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9336 * "code": "AMB",
9337 * "display": "ambulatory"
9338 * },
9339 * "type": {
9341 * "coding": {
9343 * "system": "http://snomed.info/sct",
9344 * "code": "185349003",
9345 * "display": "Encounter for check up (procedure)"
9349 * },
9350 * "subject": {
9351 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9352 * "type": "Patient"
9353 * },
9354 * "participant": {
9356 * "type": {
9358 * "coding": {
9360 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9361 * "code": "PPRF",
9362 * "display": "Primary Performer"
9366 * },
9367 * "period": {
9368 * "start": "2012-08-13T00:00:00+00:00"
9369 * },
9370 * "individual": {
9371 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9372 * "type": "Practitioner"
9375 * },
9376 * "period": {
9377 * "start": "2012-08-13T00:00:00+00:00"
9382 * ),
9383 * @OA\Response(
9384 * response="400",
9385 * ref="#/components/responses/badrequest"
9386 * ),
9387 * @OA\Response(
9388 * response="401",
9389 * ref="#/components/responses/unauthorized"
9390 * ),
9391 * @OA\Response(
9392 * response="404",
9393 * ref="#/components/responses/uuidnotfound"
9394 * ),
9395 * security={{"openemr_auth":{}}}
9398 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
9399 if ($request->isPatientRequest()) {
9400 // only allow access to data of binded patient
9401 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9402 } else {
9403 RestConfig::authorization_check("admin", "super");
9404 $return = (new FhirEncounterRestController())->getOne($uuid);
9406 RestConfig::apiLog($return);
9407 return $return;
9411 * @OA\Get(
9412 * path="/fhir/Goal",
9413 * description="Returns a list of Condition resources.",
9414 * tags={"fhir"},
9415 * @OA\Parameter(
9416 * name="_id",
9417 * in="query",
9418 * description="The uuid for the Goal resource.",
9419 * required=false,
9420 * @OA\Schema(
9421 * type="string"
9423 * ),
9424 * @OA\Parameter(
9425 * name="patient",
9426 * in="query",
9427 * description="The uuid for the patient.",
9428 * required=false,
9429 * @OA\Schema(
9430 * type="string"
9432 * ),
9433 * @OA\Response(
9434 * response="200",
9435 * description="Standard Response",
9436 * @OA\MediaType(
9437 * mediaType="application/json",
9438 * @OA\Schema(
9439 * @OA\Property(
9440 * property="json object",
9441 * description="FHIR Json object.",
9442 * type="object"
9443 * ),
9444 * example={
9445 * "meta": {
9446 * "lastUpdated": "2021-09-14T09:13:51"
9447 * },
9448 * "resourceType": "Bundle",
9449 * "type": "collection",
9450 * "total": 0,
9451 * "link": {
9453 * "relation": "self",
9454 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9460 * ),
9461 * @OA\Response(
9462 * response="400",
9463 * ref="#/components/responses/badrequest"
9464 * ),
9465 * @OA\Response(
9466 * response="401",
9467 * ref="#/components/responses/unauthorized"
9468 * ),
9469 * security={{"openemr_auth":{}}}
9472 "GET /fhir/Goal" => function (HttpRestRequest $request) {
9473 $getParams = $request->getQueryParams();
9474 if ($request->isPatientRequest()) {
9475 // only allow access to data of binded patient
9476 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9477 } else {
9478 RestConfig::authorization_check("admin", "super");
9479 $return = (new FhirGoalRestController())->getAll($getParams);
9481 RestConfig::apiLog($return);
9482 return $return;
9486 * @OA\Get(
9487 * path="/fhir/Goal/{uuid}",
9488 * description="Returns a single Goal resource.",
9489 * tags={"fhir"},
9490 * @OA\Parameter(
9491 * name="uuid",
9492 * in="path",
9493 * description="The uuid for the Goal resource.",
9494 * required=true,
9495 * @OA\Schema(
9496 * type="string"
9498 * ),
9499 * @OA\Response(
9500 * response="200",
9501 * description="Standard Response",
9502 * @OA\MediaType(
9503 * mediaType="application/json",
9504 * @OA\Schema(
9505 * @OA\Property(
9506 * property="json object",
9507 * description="FHIR Json object.",
9508 * type="object"
9509 * ),
9510 * example={
9511 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9512 * "meta": {
9513 * "versionId": "1",
9514 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9515 * },
9516 * "resourceType": "Goal",
9517 * "lifecycleStatus": "active",
9518 * "description": {
9519 * "text": "Eating more vegetables."
9520 * },
9521 * "subject": {
9522 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9523 * "type": "Patient"
9524 * },
9525 * "target": {
9527 * "measure": {
9528 * "extension": {
9530 * "valueCode": "unknown",
9531 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9534 * },
9535 * "detailString": "Eating more vegetables.",
9536 * "dueDate": "2021-09-09"
9542 * ),
9543 * @OA\Response(
9544 * response="400",
9545 * ref="#/components/responses/badrequest"
9546 * ),
9547 * @OA\Response(
9548 * response="401",
9549 * ref="#/components/responses/unauthorized"
9550 * ),
9551 * @OA\Response(
9552 * response="404",
9553 * ref="#/components/responses/uuidnotfound"
9554 * ),
9555 * security={{"openemr_auth":{}}}
9558 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
9559 if ($request->isPatientRequest()) {
9560 // only allow access to data of binded patient
9561 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9562 } else {
9563 RestConfig::authorization_check("admin", "super");
9564 $return = (new FhirGoalRestController())->getOne($uuid);
9566 RestConfig::apiLog($return);
9567 return $return;
9571 * @OA\Get(
9572 * path="/fhir/Group",
9573 * 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>",
9574 * tags={"fhir"},
9575 * @OA\Parameter(
9576 * name="_id",
9577 * in="query",
9578 * description="The uuid for the Group resource.",
9579 * required=false,
9580 * @OA\Schema(
9581 * type="string"
9583 * ),
9584 * @OA\Parameter(
9585 * name="patient",
9586 * in="query",
9587 * description="The uuid for the patient.",
9588 * required=false,
9589 * @OA\Schema(
9590 * type="string"
9592 * ),
9593 * @OA\Response(
9594 * response="200",
9595 * description="Standard Response",
9596 * @OA\MediaType(
9597 * mediaType="application/json",
9598 * @OA\Schema(
9599 * @OA\Property(
9600 * property="json object",
9601 * description="FHIR Json object.",
9602 * type="object"
9603 * ),
9604 * example={
9605 * "meta": {
9606 * "lastUpdated": "2021-09-14T09:13:51"
9607 * },
9608 * "resourceType": "Bundle",
9609 * "type": "collection",
9610 * "total": 0,
9611 * "link": {
9613 * "relation": "self",
9614 * "url": "https://localhost:9300/apis/default/fhir/Group"
9620 * ),
9621 * @OA\Response(
9622 * response="400",
9623 * ref="#/components/responses/badrequest"
9624 * ),
9625 * @OA\Response(
9626 * response="401",
9627 * ref="#/components/responses/unauthorized"
9628 * ),
9629 * security={{"openemr_auth":{}}}
9632 'GET /fhir/Group' => function (HttpRestRequest $request) {
9633 RestConfig::authorization_check("admin", "users");
9634 $getParams = $request->getQueryParams();
9635 if ($request->isPatientRequest()) {
9636 // only allow access to data of binded patient
9637 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9638 } else {
9639 $return = (new FhirGroupRestController())->getAll($getParams);
9641 RestConfig::apiLog($return);
9642 return $return;
9646 * @OA\Get(
9647 * path="/fhir/Group/{uuid}",
9648 * 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>",
9649 * tags={"fhir"},
9650 * @OA\Parameter(
9651 * name="uuid",
9652 * in="path",
9653 * description="The uuid for the Group resource.",
9654 * required=true,
9655 * @OA\Schema(
9656 * type="string"
9658 * ),
9659 * @OA\Response(
9660 * response="200",
9661 * 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>"
9662 * ),
9663 * @OA\Response(
9664 * response="400",
9665 * ref="#/components/responses/badrequest"
9666 * ),
9667 * @OA\Response(
9668 * response="401",
9669 * ref="#/components/responses/unauthorized"
9670 * ),
9671 * @OA\Response(
9672 * response="404",
9673 * ref="#/components/responses/uuidnotfound"
9674 * ),
9675 * security={{"openemr_auth":{}}}
9678 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
9679 RestConfig::authorization_check("admin", "users");
9680 if ($request->isPatientRequest()) {
9681 // only allow access to data of binded patient
9682 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9683 } else {
9684 $return = (new FhirGroupRestController())->getOne($uuid);
9686 RestConfig::apiLog($return);
9687 return $return;
9691 * @OA\Get(
9692 * path="/fhir/Group/{id}/$export",
9693 * 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>",
9694 * tags={"fhir"},
9695 * @OA\Parameter(
9696 * name="id",
9697 * in="path",
9698 * description="The id for the Group resource.",
9699 * required=true,
9700 * @OA\Schema(
9701 * type="string"
9703 * ),
9704 * @OA\Response(
9705 * response="200",
9706 * 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>"
9707 * ),
9708 * @OA\Response(
9709 * response="400",
9710 * ref="#/components/responses/badrequest"
9711 * ),
9712 * @OA\Response(
9713 * response="401",
9714 * ref="#/components/responses/unauthorized"
9715 * ),
9716 * security={{"openemr_auth":{}}}
9719 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
9720 RestConfig::authorization_check("admin", "users");
9721 $fhirExportService = new FhirOperationExportRestController($request);
9722 $exportParams = $request->getQueryParams();
9723 $exportParams['groupId'] = $groupId;
9724 $return = $fhirExportService->processExport(
9725 $exportParams,
9726 'Group',
9727 $request->getHeader('Accept')[0] ?? '',
9728 $request->getHeader('Prefer')[0] ?? ''
9730 RestConfig::apiLog($return);
9731 return $return;
9735 * @OA\Get(
9736 * path="/fhir/Immunization",
9737 * description="Returns a list of Immunization resources.",
9738 * tags={"fhir"},
9739 * @OA\Parameter(
9740 * name="_id",
9741 * in="query",
9742 * description="The uuid for the Immunization resource.",
9743 * required=false,
9744 * @OA\Schema(
9745 * type="string"
9747 * ),
9748 * @OA\Parameter(
9749 * name="patient",
9750 * in="query",
9751 * description="The uuid for the patient.",
9752 * required=false,
9753 * @OA\Schema(
9754 * type="string"
9756 * ),
9757 * @OA\Response(
9758 * response="200",
9759 * description="Standard Response",
9760 * @OA\MediaType(
9761 * mediaType="application/json",
9762 * @OA\Schema(
9763 * @OA\Property(
9764 * property="json object",
9765 * description="FHIR Json object.",
9766 * type="object"
9767 * ),
9768 * example={
9769 * "meta": {
9770 * "lastUpdated": "2021-09-14T09:13:51"
9771 * },
9772 * "resourceType": "Bundle",
9773 * "type": "collection",
9774 * "total": 0,
9775 * "link": {
9777 * "relation": "self",
9778 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9784 * ),
9785 * @OA\Response(
9786 * response="400",
9787 * ref="#/components/responses/badrequest"
9788 * ),
9789 * @OA\Response(
9790 * response="401",
9791 * ref="#/components/responses/unauthorized"
9792 * ),
9793 * security={{"openemr_auth":{}}}
9796 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
9797 $getParams = $request->getQueryParams();
9798 if ($request->isPatientRequest()) {
9799 // only allow access to data of binded patient
9800 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9801 } else {
9802 RestConfig::authorization_check("patients", "med");
9803 $return = (new FhirImmunizationRestController())->getAll($getParams);
9805 RestConfig::apiLog($return);
9806 return $return;
9810 * @OA\Get(
9811 * path="/fhir/Immunization/{uuid}",
9812 * description="Returns a single Immunization resource.",
9813 * tags={"fhir"},
9814 * @OA\Parameter(
9815 * name="uuid",
9816 * in="path",
9817 * description="The uuid for the Immunization resource.",
9818 * required=true,
9819 * @OA\Schema(
9820 * type="string"
9822 * ),
9823 * @OA\Response(
9824 * response="200",
9825 * description="Standard Response",
9826 * @OA\MediaType(
9827 * mediaType="application/json",
9828 * @OA\Schema(
9829 * @OA\Property(
9830 * property="json object",
9831 * description="FHIR Json object.",
9832 * type="object"
9833 * ),
9834 * example={
9835 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9836 * "meta": {
9837 * "versionId": "1",
9838 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9839 * },
9840 * "resourceType": "Immunization",
9841 * "status": "completed",
9842 * "vaccineCode": {
9843 * "coding": {
9845 * "system": "http://hl7.org/fhir/sid/cvx",
9846 * "code": "207",
9847 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9850 * },
9851 * "patient": {
9852 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9853 * },
9854 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9855 * "recorded": "2022-03-26T05:42:26+00:00",
9856 * "primarySource": false
9860 * ),
9861 * @OA\Response(
9862 * response="400",
9863 * ref="#/components/responses/badrequest"
9864 * ),
9865 * @OA\Response(
9866 * response="401",
9867 * ref="#/components/responses/unauthorized"
9868 * ),
9869 * @OA\Response(
9870 * response="404",
9871 * ref="#/components/responses/uuidnotfound"
9872 * ),
9873 * security={{"openemr_auth":{}}}
9876 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
9877 if ($request->isPatientRequest()) {
9878 // only allow access to data of binded patient
9879 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9880 } else {
9881 RestConfig::authorization_check("patients", "med");
9882 $return = (new FhirImmunizationRestController())->getOne($uuid);
9884 RestConfig::apiLog($return);
9885 return $return;
9889 * @OA\Get(
9890 * path="/fhir/Location",
9891 * description="Returns a list of Location resources.",
9892 * tags={"fhir"},
9893 * @OA\Parameter(
9894 * name="_id",
9895 * in="query",
9896 * description="The uuid for the Location resource.",
9897 * required=false,
9898 * @OA\Schema(
9899 * type="string"
9901 * ),
9902 * @OA\Response(
9903 * response="200",
9904 * description="Standard Response",
9905 * @OA\MediaType(
9906 * mediaType="application/json",
9907 * @OA\Schema(
9908 * @OA\Property(
9909 * property="json object",
9910 * description="FHIR Json object.",
9911 * type="object"
9912 * ),
9913 * example={
9914 * "meta": {
9915 * "lastUpdated": "2021-09-14T09:13:51"
9916 * },
9917 * "resourceType": "Bundle",
9918 * "type": "collection",
9919 * "total": 0,
9920 * "link": {
9922 * "relation": "self",
9923 * "url": "https://localhost:9300/apis/default/fhir/Location"
9929 * ),
9930 * @OA\Response(
9931 * response="400",
9932 * ref="#/components/responses/badrequest"
9933 * ),
9934 * @OA\Response(
9935 * response="401",
9936 * ref="#/components/responses/unauthorized"
9937 * ),
9938 * security={{"openemr_auth":{}}}
9941 "GET /fhir/Location" => function (HttpRestRequest $request) {
9942 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9943 RestConfig::apiLog($return);
9944 return $return;
9948 * @OA\Get(
9949 * path="/fhir/Location/{uuid}",
9950 * description="Returns a single Location resource.",
9951 * tags={"fhir"},
9952 * @OA\Parameter(
9953 * name="uuid",
9954 * in="path",
9955 * description="The uuid for the Location resource.",
9956 * required=true,
9957 * @OA\Schema(
9958 * type="string"
9960 * ),
9961 * @OA\Response(
9962 * response="200",
9963 * description="Standard Response",
9964 * @OA\MediaType(
9965 * mediaType="application/json",
9966 * @OA\Schema(
9967 * @OA\Property(
9968 * property="json object",
9969 * description="FHIR Json object.",
9970 * type="object"
9971 * ),
9972 * example={
9973 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9974 * "meta": {
9975 * "versionId": "1",
9976 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9977 * },
9978 * "resourceType": "Location",
9979 * "status": "active",
9980 * "name": "Your Clinic Name Here",
9981 * "telecom": {
9983 * "system": "phone",
9984 * "value": "000-000-0000"
9985 * },
9987 * "system": "fax",
9988 * "value": "000-000-0000"
9994 * ),
9995 * @OA\Response(
9996 * response="400",
9997 * ref="#/components/responses/badrequest"
9998 * ),
9999 * @OA\Response(
10000 * response="401",
10001 * ref="#/components/responses/unauthorized"
10002 * ),
10003 * @OA\Response(
10004 * response="404",
10005 * ref="#/components/responses/uuidnotfound"
10006 * ),
10007 * security={{"openemr_auth":{}}}
10010 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
10011 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10012 RestConfig::apiLog($return);
10013 return $return;
10017 * @OA\Get(
10018 * path="/fhir/Medication",
10019 * description="Returns a list of Medication resources.",
10020 * tags={"fhir"},
10021 * @OA\Response(
10022 * response="200",
10023 * description="Standard Response",
10024 * @OA\MediaType(
10025 * mediaType="application/json",
10026 * @OA\Schema(
10027 * @OA\Property(
10028 * property="json object",
10029 * description="FHIR Json object.",
10030 * type="object"
10031 * ),
10032 * example={
10033 * "meta": {
10034 * "lastUpdated": "2021-09-14T09:13:51"
10035 * },
10036 * "resourceType": "Bundle",
10037 * "type": "collection",
10038 * "total": 0,
10039 * "link": {
10041 * "relation": "self",
10042 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10048 * ),
10049 * @OA\Response(
10050 * response="400",
10051 * ref="#/components/responses/badrequest"
10052 * ),
10053 * @OA\Response(
10054 * response="401",
10055 * ref="#/components/responses/unauthorized"
10056 * ),
10057 * security={{"openemr_auth":{}}}
10060 "GET /fhir/Medication" => function (HttpRestRequest $request) {
10061 RestConfig::authorization_check("patients", "med");
10062 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10063 RestConfig::apiLog($return);
10064 return $return;
10068 * @OA\Get(
10069 * path="/fhir/Medication/{uuid}",
10070 * description="Returns a single Medication resource.",
10071 * tags={"fhir"},
10072 * @OA\Parameter(
10073 * name="uuid",
10074 * in="path",
10075 * description="The uuid for the Medication resource.",
10076 * required=true,
10077 * @OA\Schema(
10078 * type="string"
10080 * ),
10081 * @OA\Response(
10082 * response="200",
10083 * description="Standard Response",
10084 * @OA\MediaType(
10085 * mediaType="application/json",
10086 * @OA\Schema(
10087 * @OA\Property(
10088 * property="json object",
10089 * description="FHIR Json object.",
10090 * type="object"
10091 * ),
10092 * example={
10093 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10094 * "meta": {
10095 * "versionId": "1",
10096 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10097 * },
10098 * "resourceType": "Medication",
10099 * "code": {
10100 * "coding": {
10102 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10103 * "code": 153165
10106 * },
10107 * "status": "active",
10108 * "batch": {
10109 * "lotNumber": "132",
10110 * "expirationDate": "0000-00-00"
10115 * ),
10116 * @OA\Response(
10117 * response="400",
10118 * ref="#/components/responses/badrequest"
10119 * ),
10120 * @OA\Response(
10121 * response="401",
10122 * ref="#/components/responses/unauthorized"
10123 * ),
10124 * @OA\Response(
10125 * response="404",
10126 * ref="#/components/responses/uuidnotfound"
10127 * ),
10128 * security={{"openemr_auth":{}}}
10131 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
10132 if ($request->isPatientRequest()) {
10133 // only allow access to data of binded patient
10134 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10135 } else {
10136 RestConfig::authorization_check("patients", "med");
10137 $return = (new FhirMedicationRestController())->getOne($uuid);
10139 RestConfig::apiLog($return);
10140 return $return;
10144 * @OA\Get(
10145 * path="/fhir/MedicationRequest",
10146 * description="Returns a list of MedicationRequest resources.",
10147 * tags={"fhir"},
10148 * @OA\Parameter(
10149 * name="_id",
10150 * in="query",
10151 * description="The uuid for the MedicationRequest resource.",
10152 * required=false,
10153 * @OA\Schema(
10154 * type="string"
10156 * ),
10157 * @OA\Parameter(
10158 * name="patient",
10159 * in="query",
10160 * description="The uuid for the patient.",
10161 * required=false,
10162 * @OA\Schema(
10163 * type="string"
10165 * ),
10166 * @OA\Parameter(
10167 * name="intent",
10168 * in="query",
10169 * description="The intent of the MedicationRequest resource.",
10170 * required=false,
10171 * @OA\Schema(
10172 * type="string"
10174 * ),
10175 * @OA\Parameter(
10176 * name="status",
10177 * in="query",
10178 * description="The status of the MedicationRequest resource.",
10179 * required=false,
10180 * @OA\Schema(
10181 * type="string"
10183 * ),
10184 * @OA\Response(
10185 * response="200",
10186 * description="Standard Response",
10187 * @OA\MediaType(
10188 * mediaType="application/json",
10189 * @OA\Schema(
10190 * @OA\Property(
10191 * property="json object",
10192 * description="FHIR Json object.",
10193 * type="object"
10194 * ),
10195 * example={
10196 * "meta": {
10197 * "lastUpdated": "2021-09-14T09:13:51"
10198 * },
10199 * "resourceType": "Bundle",
10200 * "type": "collection",
10201 * "total": 0,
10202 * "link": {
10204 * "relation": "self",
10205 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10211 * ),
10212 * @OA\Response(
10213 * response="400",
10214 * ref="#/components/responses/badrequest"
10215 * ),
10216 * @OA\Response(
10217 * response="401",
10218 * ref="#/components/responses/unauthorized"
10219 * ),
10220 * security={{"openemr_auth":{}}}
10223 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
10224 $getParams = $request->getQueryParams();
10225 if ($request->isPatientRequest()) {
10226 // only allow access to data of binded patient
10227 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10228 } else {
10229 RestConfig::authorization_check("patients", "med");
10230 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10232 RestConfig::apiLog($return);
10233 return $return;
10237 * @OA\Get(
10238 * path="/fhir/MedicationRequest/{uuid}",
10239 * description="Returns a single MedicationRequest resource.",
10240 * tags={"fhir"},
10241 * @OA\Parameter(
10242 * name="uuid",
10243 * in="path",
10244 * description="The uuid for the MedicationRequest resource.",
10245 * required=true,
10246 * @OA\Schema(
10247 * type="string"
10249 * ),
10250 * @OA\Response(
10251 * response="200",
10252 * description="Standard Response",
10253 * @OA\MediaType(
10254 * mediaType="application/json",
10255 * @OA\Schema(
10256 * @OA\Property(
10257 * property="json object",
10258 * description="FHIR Json object.",
10259 * type="object"
10260 * ),
10261 * example={
10262 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10263 * "meta": {
10264 * "versionId": "1",
10265 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10266 * },
10267 * "resourceType": "MedicationRequest",
10268 * "status": "active",
10269 * "intent": "order",
10270 * "category": {
10272 * "coding": {
10274 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10275 * "code": "community",
10276 * "display": "Home/Community"
10280 * },
10281 * "reportedBoolean": false,
10282 * "medicationCodeableConcept": {
10283 * "coding": {
10285 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10286 * "code": "1738139",
10287 * "display": "Acetaminophen 325 MG Oral Tablet"
10290 * },
10291 * "subject": {
10292 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10293 * "type": "Patient"
10294 * },
10295 * "authoredOn": "2021-09-18T00:00:00+00:00",
10296 * "requester": {
10297 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10298 * "type": "Practitioner"
10303 * ),
10304 * @OA\Response(
10305 * response="400",
10306 * ref="#/components/responses/badrequest"
10307 * ),
10308 * @OA\Response(
10309 * response="401",
10310 * ref="#/components/responses/unauthorized"
10311 * ),
10312 * @OA\Response(
10313 * response="404",
10314 * ref="#/components/responses/uuidnotfound"
10315 * ),
10316 * security={{"openemr_auth":{}}}
10319 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
10320 if ($request->isPatientRequest()) {
10321 // only allow access to data of binded patient
10322 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10323 } else {
10324 RestConfig::authorization_check("patients", "med");
10325 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10327 RestConfig::apiLog($return);
10328 return $return;
10332 * @OA\Get(
10333 * path="/fhir/Observation",
10334 * description="Returns a list of Observation resources.",
10335 * tags={"fhir"},
10336 * @OA\Parameter(
10337 * name="_id",
10338 * in="query",
10339 * description="The uuid for the Observation resource.",
10340 * required=false,
10341 * @OA\Schema(
10342 * type="string"
10344 * ),
10345 * @OA\Parameter(
10346 * name="patient",
10347 * in="query",
10348 * description="The uuid for the patient.",
10349 * required=false,
10350 * @OA\Schema(
10351 * type="string"
10353 * ),
10354 * @OA\Parameter(
10355 * name="code",
10356 * in="query",
10357 * description="The code of the Observation resource.",
10358 * required=false,
10359 * @OA\Schema(
10360 * type="string"
10362 * ),
10363 * @OA\Parameter(
10364 * name="category",
10365 * in="query",
10366 * description="The category of the Observation resource.",
10367 * required=false,
10368 * @OA\Schema(
10369 * type="string"
10371 * ),
10372 * @OA\Parameter(
10373 * name="date",
10374 * in="query",
10375 * description="The datetime of the Observation resource.",
10376 * required=false,
10377 * @OA\Schema(
10378 * type="string"
10380 * ),
10381 * @OA\Response(
10382 * response="200",
10383 * description="Standard Response",
10384 * @OA\MediaType(
10385 * mediaType="application/json",
10386 * @OA\Schema(
10387 * @OA\Property(
10388 * property="json object",
10389 * description="FHIR Json object.",
10390 * type="object"
10391 * ),
10392 * example={
10393 * "meta": {
10394 * "lastUpdated": "2021-09-14T09:13:51"
10395 * },
10396 * "resourceType": "Bundle",
10397 * "type": "collection",
10398 * "total": 0,
10399 * "link": {
10401 * "relation": "self",
10402 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10408 * ),
10409 * @OA\Response(
10410 * response="400",
10411 * ref="#/components/responses/badrequest"
10412 * ),
10413 * @OA\Response(
10414 * response="401",
10415 * ref="#/components/responses/unauthorized"
10416 * ),
10417 * security={{"openemr_auth":{}}}
10420 "GET /fhir/Observation" => function (HttpRestRequest $request) {
10421 $getParams = $request->getQueryParams();
10422 if ($request->isPatientRequest()) {
10423 // only allow access to data of binded patient
10424 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10425 } else {
10426 RestConfig::authorization_check("patients", "med");
10427 $return = (new FhirObservationRestController())->getAll($getParams);
10429 RestConfig::apiLog($return);
10430 return $return;
10434 * @OA\Get(
10435 * path="/fhir/Observation/{uuid}",
10436 * description="Returns a single Observation resource.",
10437 * tags={"fhir"},
10438 * @OA\Parameter(
10439 * name="uuid",
10440 * in="path",
10441 * description="The uuid for the Observation resource.",
10442 * required=true,
10443 * @OA\Schema(
10444 * type="string"
10446 * ),
10447 * @OA\Response(
10448 * response="200",
10449 * description="Standard Response",
10450 * @OA\MediaType(
10451 * mediaType="application/json",
10452 * @OA\Schema(
10453 * @OA\Property(
10454 * property="json object",
10455 * description="FHIR Json object.",
10456 * type="object"
10457 * ),
10458 * example={
10459 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10460 * "meta": {
10461 * "versionId": "1",
10462 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10463 * },
10464 * "resourceType": "Observation",
10465 * "status": "final",
10466 * "category": {
10468 * "coding": {
10470 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10471 * "code": "vital-signs"
10475 * },
10476 * "code": {
10477 * "coding": {
10479 * "system": "http://loinc.org",
10480 * "code": "85354-9",
10481 * "display": "Blood pressure systolic and diastolic"
10484 * },
10485 * "subject": {
10486 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10487 * "type": "Patient"
10488 * },
10489 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10490 * "component": {
10492 * "code": {
10493 * "coding": {
10495 * "system": "http://loinc.org",
10496 * "code": "8480-6",
10497 * "display": "Systolic blood pressure"
10500 * },
10501 * "valueQuantity": {
10502 * "value": 122,
10503 * "unit": "mm[Hg]",
10504 * "system": "http://unitsofmeasure.org",
10505 * "code": "mm[Hg]"
10507 * },
10509 * "code": {
10510 * "coding": {
10512 * "system": "http://loinc.org",
10513 * "code": "8462-4",
10514 * "display": "Diastolic blood pressure"
10517 * },
10518 * "valueQuantity": {
10519 * "value": 77,
10520 * "unit": "mm[Hg]",
10521 * "system": "http://unitsofmeasure.org",
10522 * "code": "mm[Hg]"
10529 * ),
10530 * @OA\Response(
10531 * response="400",
10532 * ref="#/components/responses/badrequest"
10533 * ),
10534 * @OA\Response(
10535 * response="401",
10536 * ref="#/components/responses/unauthorized"
10537 * ),
10538 * @OA\Response(
10539 * response="404",
10540 * ref="#/components/responses/uuidnotfound"
10541 * ),
10542 * security={{"openemr_auth":{}}}
10545 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
10546 if ($request->isPatientRequest()) {
10547 // only allow access to data of binded patient
10548 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10549 } else {
10550 RestConfig::authorization_check("patients", "med");
10551 $return = (new FhirObservationRestController())->getOne($uuid);
10553 RestConfig::apiLog($return);
10554 return $return;
10558 * @OA\Get(
10559 * path="/fhir/Organization",
10560 * description="Returns a list of Organization resources.",
10561 * tags={"fhir"},
10562 * @OA\Parameter(
10563 * name="_id",
10564 * in="query",
10565 * description="The uuid for the Organization resource.",
10566 * required=false,
10567 * @OA\Schema(
10568 * type="string"
10570 * ),
10571 * @OA\Parameter(
10572 * name="name",
10573 * in="query",
10574 * description="The name of the Organization resource.",
10575 * required=false,
10576 * @OA\Schema(
10577 * type="string"
10579 * ),
10580 * @OA\Parameter(
10581 * name="email",
10582 * in="query",
10583 * description="The email of the Organization resource.",
10584 * required=false,
10585 * @OA\Schema(
10586 * type="string"
10588 * ),
10589 * @OA\Parameter(
10590 * name="phone",
10591 * in="query",
10592 * description="The phone of the Organization resource.",
10593 * required=false,
10594 * @OA\Schema(
10595 * type="string"
10597 * ),
10598 * @OA\Parameter(
10599 * name="telecom",
10600 * in="query",
10601 * description="The telecom of the Organization resource.",
10602 * required=false,
10603 * @OA\Schema(
10604 * type="string"
10606 * ),
10607 * @OA\Parameter(
10608 * name="address",
10609 * in="query",
10610 * description="The address of the Organization resource.",
10611 * required=false,
10612 * @OA\Schema(
10613 * type="string"
10615 * ),
10616 * @OA\Parameter(
10617 * name="address-city",
10618 * in="query",
10619 * description="The address-city of the Organization resource.",
10620 * required=false,
10621 * @OA\Schema(
10622 * type="string"
10624 * ),
10625 * @OA\Parameter(
10626 * name="address-postalcode",
10627 * in="query",
10628 * description="The address-postalcode of the Organization resource.",
10629 * required=false,
10630 * @OA\Schema(
10631 * type="string"
10633 * ),
10634 * @OA\Parameter(
10635 * name="address-state",
10636 * in="query",
10637 * description="The address-state of the Organization resource.",
10638 * required=false,
10639 * @OA\Schema(
10640 * type="string"
10642 * ),
10643 * @OA\Response(
10644 * response="200",
10645 * description="Standard Response",
10646 * @OA\MediaType(
10647 * mediaType="application/json",
10648 * @OA\Schema(
10649 * @OA\Property(
10650 * property="json object",
10651 * description="FHIR Json object.",
10652 * type="object"
10653 * ),
10654 * example={
10655 * "meta": {
10656 * "lastUpdated": "2021-09-14T09:13:51"
10657 * },
10658 * "resourceType": "Bundle",
10659 * "type": "collection",
10660 * "total": 0,
10661 * "link": {
10663 * "relation": "self",
10664 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10670 * ),
10671 * @OA\Response(
10672 * response="400",
10673 * ref="#/components/responses/badrequest"
10674 * ),
10675 * @OA\Response(
10676 * response="401",
10677 * ref="#/components/responses/unauthorized"
10678 * ),
10679 * security={{"openemr_auth":{}}}
10682 "GET /fhir/Organization" => function (HttpRestRequest $request) {
10683 if (!$request->isPatientRequest()) {
10684 RestConfig::authorization_check("admin", "users");
10686 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10687 RestConfig::apiLog($return);
10688 return $return;
10692 * @OA\Get(
10693 * path="/fhir/Organization/{uuid}",
10694 * description="Returns a single Organization resource.",
10695 * tags={"fhir"},
10696 * @OA\Parameter(
10697 * name="uuid",
10698 * in="path",
10699 * description="The uuid for the Organization resource.",
10700 * required=true,
10701 * @OA\Schema(
10702 * type="string"
10704 * ),
10705 * @OA\Response(
10706 * response="200",
10707 * description="Standard Response",
10708 * @OA\MediaType(
10709 * mediaType="application/json",
10710 * @OA\Schema(
10711 * @OA\Property(
10712 * property="json object",
10713 * description="FHIR Json object.",
10714 * type="object"
10715 * ),
10716 * example={
10717 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10718 * "meta": {
10719 * "versionId": "1",
10720 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10721 * },
10722 * "resourceType": "Organization",
10723 * "text": {
10724 * "status": "generated",
10725 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10726 * },
10727 * "identifier": {
10729 * "system": "http://hl7.org/fhir/sid/us-npi",
10730 * "value": "1234567890"
10732 * },
10733 * "active": true,
10734 * "type": {
10736 * "coding": {
10738 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10739 * "code": "prov",
10740 * "display": "Healthcare Provider"
10744 * },
10745 * "name": "Your Clinic Name Here",
10746 * "telecom": {
10748 * "system": "phone",
10749 * "value": "000-000-0000",
10750 * "use": "work"
10751 * },
10753 * "system": "fax",
10754 * "value": "000-000-0000",
10755 * "use": "work"
10757 * },
10758 * "address": {
10759 * null
10764 * ),
10765 * @OA\Response(
10766 * response="400",
10767 * ref="#/components/responses/badrequest"
10768 * ),
10769 * @OA\Response(
10770 * response="401",
10771 * ref="#/components/responses/unauthorized"
10772 * ),
10773 * @OA\Response(
10774 * response="404",
10775 * ref="#/components/responses/uuidnotfound"
10776 * ),
10777 * security={{"openemr_auth":{}}}
10780 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
10781 $patientUUID = null;
10782 if (!$request->isPatientRequest()) {
10783 RestConfig::authorization_check("admin", "users");
10784 } else {
10785 $patientUUID = $request->getPatientUUIDString();
10787 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10789 RestConfig::apiLog($return);
10790 return $return;
10794 * @OA\Post(
10795 * path="/fhir/Organization",
10796 * description="Adds a Organization resource.",
10797 * tags={"fhir"},
10798 * @OA\RequestBody(
10799 * required=true,
10800 * @OA\MediaType(
10801 * mediaType="application/json",
10802 * @OA\Schema(
10803 * description="The json object for the Organization resource.",
10804 * type="object"
10805 * ),
10806 * example={
10807 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10808 * "meta": {
10809 * "versionId": "1",
10810 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10811 * },
10812 * "resourceType": "Organization",
10813 * "text": {
10814 * "status": "generated",
10815 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10816 * },
10817 * "identifier": {
10819 * "system": "http://hl7.org/fhir/sid/us-npi",
10820 * "value": "1234567890"
10822 * },
10823 * "active": true,
10824 * "type": {
10826 * "coding": {
10828 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10829 * "code": "prov",
10830 * "display": "Healthcare Provider"
10834 * },
10835 * "name": "Your Clinic Name Here Hey",
10836 * "telecom": {
10838 * "system": "phone",
10839 * "value": "000-000-0000",
10840 * "use": "work"
10841 * },
10843 * "system": "fax",
10844 * "value": "000-000-0000",
10845 * "use": "work"
10847 * },
10848 * "address": {
10849 * null
10853 * ),
10854 * @OA\Response(
10855 * response="200",
10856 * description="Standard Response",
10857 * @OA\MediaType(
10858 * mediaType="application/json",
10859 * @OA\Schema(
10860 * @OA\Property(
10861 * property="json object",
10862 * description="FHIR Json object.",
10863 * type="object"
10864 * ),
10865 * example={
10866 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10867 * "meta": {
10868 * "versionId": "1",
10869 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10870 * },
10871 * "resourceType": "Organization",
10872 * "text": {
10873 * "status": "generated",
10874 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10875 * },
10876 * "identifier": {
10878 * "system": "http://hl7.org/fhir/sid/us-npi",
10879 * "value": "1234567890"
10881 * },
10882 * "active": true,
10883 * "type": {
10885 * "coding": {
10887 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10888 * "code": "prov",
10889 * "display": "Healthcare Provider"
10893 * },
10894 * "name": "Your Clinic Name Here Now",
10895 * "telecom": {
10897 * "system": "phone",
10898 * "value": "000-000-0000",
10899 * "use": "work"
10900 * },
10902 * "system": "fax",
10903 * "value": "000-000-0000",
10904 * "use": "work"
10906 * },
10907 * "address": {
10908 * null
10913 * ),
10914 * @OA\Response(
10915 * response="400",
10916 * ref="#/components/responses/badrequest"
10917 * ),
10918 * @OA\Response(
10919 * response="401",
10920 * ref="#/components/responses/unauthorized"
10921 * ),
10922 * security={{"openemr_auth":{}}}
10925 "POST /fhir/Organization" => function (HttpRestRequest $request) {
10926 RestConfig::authorization_check("admin", "super");
10927 $data = (array) (json_decode(file_get_contents("php://input"), true));
10928 $return = (new FhirOrganizationRestController())->post($data);
10929 RestConfig::apiLog($return, $data);
10930 return $return;
10934 * @OA\Put(
10935 * path="/fhir/Organization/{uuid}",
10936 * description="Modifies a Organization resource.",
10937 * tags={"fhir"},
10938 * @OA\Parameter(
10939 * name="uuid",
10940 * in="path",
10941 * description="The uuid for the organization.",
10942 * required=true,
10943 * @OA\Schema(
10944 * type="string"
10946 * ),
10947 * @OA\RequestBody(
10948 * required=true,
10949 * @OA\MediaType(
10950 * mediaType="application/json",
10951 * @OA\Schema(
10952 * description="The json object for the Organization resource.",
10953 * type="object"
10954 * ),
10955 * example={
10956 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10957 * "meta": {
10958 * "versionId": "1",
10959 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10960 * },
10961 * "resourceType": "Organization",
10962 * "text": {
10963 * "status": "generated",
10964 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10965 * },
10966 * "identifier": {
10968 * "system": "http://hl7.org/fhir/sid/us-npi",
10969 * "value": "1234567890"
10971 * },
10972 * "active": true,
10973 * "type": {
10975 * "coding": {
10977 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10978 * "code": "prov",
10979 * "display": "Healthcare Provider"
10983 * },
10984 * "name": "Your Clinic Name Here",
10985 * "telecom": {
10987 * "system": "phone",
10988 * "value": "000-000-0000",
10989 * "use": "work"
10990 * },
10992 * "system": "fax",
10993 * "value": "000-000-0000",
10994 * "use": "work"
10996 * },
10997 * "address": {
10998 * null
11002 * ),
11003 * @OA\Response(
11004 * response="201",
11005 * description="Standard Response",
11006 * @OA\MediaType(
11007 * mediaType="application/json",
11008 * @OA\Schema(
11009 * example={
11010 * "id": 14,
11011 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11015 * ),
11016 * @OA\Response(
11017 * response="400",
11018 * ref="#/components/responses/badrequest"
11019 * ),
11020 * @OA\Response(
11021 * response="401",
11022 * ref="#/components/responses/unauthorized"
11023 * ),
11024 * security={{"openemr_auth":{}}}
11027 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
11028 RestConfig::authorization_check("admin", "super");
11029 $data = (array) (json_decode(file_get_contents("php://input"), true));
11030 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11031 RestConfig::apiLog($return, $data);
11032 return $return;
11036 * @OA\Post(
11037 * path="/fhir/Patient",
11038 * description="Adds a Patient resource.",
11039 * tags={"fhir"},
11040 * @OA\RequestBody(
11041 * required=true,
11042 * @OA\MediaType(
11043 * mediaType="application/json",
11044 * @OA\Schema(
11045 * description="The json object for the Patient resource.",
11046 * type="object"
11047 * ),
11048 * example={
11049 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11050 * "meta": {
11051 * "versionId": "1",
11052 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11053 * },
11054 * "resourceType": "Patient",
11055 * "text": {
11056 * "status": "generated",
11057 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11058 * },
11059 * "extension": {
11061 * "valueCode": "F",
11062 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11063 * },
11065 * "extension": {
11067 * "valueCoding": {
11068 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11069 * "code": "UNK",
11070 * "display": "Unknown"
11071 * },
11072 * "url": "ombCategory"
11073 * },
11075 * "valueString": "Unknown",
11076 * "url": "text"
11078 * },
11079 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11081 * },
11082 * "identifier": {
11084 * "use": "official",
11085 * "type": {
11086 * "coding": {
11088 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11089 * "code": "PT"
11092 * },
11093 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11094 * "value": "1"
11096 * },
11097 * "active": true,
11098 * "name": {
11100 * "use": "official",
11101 * "family": "Smith",
11102 * "given": {
11103 * "Brenda"
11106 * },
11107 * "gender": "female",
11108 * "birthDate": "2017-03-10",
11109 * "communication": {
11111 * "language": {
11112 * "coding": {
11114 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11115 * "code": "unknown",
11116 * "display": "Unknown"
11124 * ),
11125 * @OA\Response(
11126 * response="200",
11127 * description="Standard Response",
11128 * @OA\MediaType(
11129 * mediaType="application/json",
11130 * @OA\Schema(
11131 * @OA\Property(
11132 * property="json object",
11133 * description="FHIR Json object.",
11134 * type="object"
11135 * ),
11136 * example={
11137 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11138 * "meta": {
11139 * "versionId": "1",
11140 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11141 * },
11142 * "resourceType": "Patient",
11143 * "text": {
11144 * "status": "generated",
11145 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11146 * },
11147 * "extension": {
11149 * "valueCode": "F",
11150 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11151 * },
11153 * "extension": {
11155 * "valueCoding": {
11156 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11157 * "code": "UNK",
11158 * "display": "Unknown"
11159 * },
11160 * "url": "ombCategory"
11161 * },
11163 * "valueString": "Unknown",
11164 * "url": "text"
11166 * },
11167 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11169 * },
11170 * "identifier": {
11172 * "use": "official",
11173 * "type": {
11174 * "coding": {
11176 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11177 * "code": "PT"
11180 * },
11181 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11182 * "value": "1"
11184 * },
11185 * "active": true,
11186 * "name": {
11188 * "use": "official",
11189 * "family": "Smith",
11190 * "given": {
11191 * "Brenda"
11194 * },
11195 * "gender": "female",
11196 * "birthDate": "2017-03-10",
11197 * "communication": {
11199 * "language": {
11200 * "coding": {
11202 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11203 * "code": "unknown",
11204 * "display": "Unknown"
11213 * ),
11214 * @OA\Response(
11215 * response="400",
11216 * ref="#/components/responses/badrequest"
11217 * ),
11218 * @OA\Response(
11219 * response="401",
11220 * ref="#/components/responses/unauthorized"
11221 * ),
11222 * security={{"openemr_auth":{}}}
11225 "POST /fhir/Patient" => function (HttpRestRequest $request) {
11226 RestConfig::authorization_check("patients", "demo");
11227 $data = (array) (json_decode(file_get_contents("php://input"), true));
11228 $return = (new FhirPatientRestController())->post($data);
11229 RestConfig::apiLog($return, $data);
11230 return $return;
11234 * @OA\Put(
11235 * path="/fhir/Patient/{uuid}",
11236 * description="Modifies a Patient resource.",
11237 * tags={"fhir"},
11238 * @OA\Parameter(
11239 * name="uuid",
11240 * in="path",
11241 * description="The uuid for the Patient resource.",
11242 * required=true,
11243 * @OA\Schema(
11244 * type="string"
11246 * ),
11247 * @OA\RequestBody(
11248 * required=true,
11249 * @OA\MediaType(
11250 * mediaType="application/json",
11251 * @OA\Schema(
11252 * description="The json object for the Patient resource.",
11253 * type="object"
11254 * ),
11255 * example={
11256 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11257 * "meta": {
11258 * "versionId": "1",
11259 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11260 * },
11261 * "resourceType": "Patient",
11262 * "text": {
11263 * "status": "generated",
11264 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11265 * },
11266 * "extension": {
11268 * "valueCode": "F",
11269 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11270 * },
11272 * "extension": {
11274 * "valueCoding": {
11275 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11276 * "code": "UNK",
11277 * "display": "Unknown"
11278 * },
11279 * "url": "ombCategory"
11280 * },
11282 * "valueString": "Unknown",
11283 * "url": "text"
11285 * },
11286 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11288 * },
11289 * "identifier": {
11291 * "use": "official",
11292 * "type": {
11293 * "coding": {
11295 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11296 * "code": "PT"
11299 * },
11300 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11301 * "value": "1"
11303 * },
11304 * "active": true,
11305 * "name": {
11307 * "use": "official",
11308 * "family": "Smith",
11309 * "given": {
11310 * "Brenda"
11313 * },
11314 * "gender": "female",
11315 * "birthDate": "2017-03-10",
11316 * "communication": {
11318 * "language": {
11319 * "coding": {
11321 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11322 * "code": "unknown",
11323 * "display": "Unknown"
11331 * ),
11332 * @OA\Response(
11333 * response="201",
11334 * description="Standard Response",
11335 * @OA\MediaType(
11336 * mediaType="application/json",
11337 * @OA\Schema(
11338 * example={
11339 * "id": 2,
11340 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11344 * ),
11345 * @OA\Response(
11346 * response="400",
11347 * ref="#/components/responses/badrequest"
11348 * ),
11349 * @OA\Response(
11350 * response="401",
11351 * ref="#/components/responses/unauthorized"
11352 * ),
11353 * security={{"openemr_auth":{}}}
11356 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11357 RestConfig::authorization_check("patients", "demo");
11358 $data = (array) (json_decode(file_get_contents("php://input"), true));
11359 $return = (new FhirPatientRestController())->put($uuid, $data);
11360 RestConfig::apiLog($return, $data);
11361 return $return;
11365 * @OA\Get(
11366 * path="/fhir/Patient",
11367 * description="Returns a list of Patient resources.",
11368 * tags={"fhir"},
11369 * @OA\Parameter(
11370 * name="_id",
11371 * in="query",
11372 * description="The uuid for the Patient resource.",
11373 * required=false,
11374 * @OA\Schema(
11375 * type="string"
11377 * ),
11378 * @OA\Parameter(
11379 * name="identifier",
11380 * in="query",
11381 * description="The identifier of the Patient resource.",
11382 * required=false,
11383 * @OA\Schema(
11384 * type="string"
11386 * ),
11387 * @OA\Parameter(
11388 * name="name",
11389 * in="query",
11390 * description="The name of the Patient resource.",
11391 * required=false,
11392 * @OA\Schema(
11393 * type="string"
11395 * ),
11396 * @OA\Parameter(
11397 * name="birthdate",
11398 * in="query",
11399 * description="The birthdate of the Patient resource.",
11400 * required=false,
11401 * @OA\Schema(
11402 * type="string"
11404 * ),
11405 * @OA\Parameter(
11406 * name="gender",
11407 * in="query",
11408 * description="The gender of the Patient resource.",
11409 * required=false,
11410 * @OA\Schema(
11411 * type="string"
11413 * ),
11414 * @OA\Parameter(
11415 * name="address",
11416 * in="query",
11417 * description="The address of the Patient resource.",
11418 * required=false,
11419 * @OA\Schema(
11420 * type="string"
11422 * ),
11423 * @OA\Parameter(
11424 * name="address-city",
11425 * in="query",
11426 * description="The address-city of the Patient resource.",
11427 * required=false,
11428 * @OA\Schema(
11429 * type="string"
11431 * ),
11432 * @OA\Parameter(
11433 * name="address-postalcode",
11434 * in="query",
11435 * description="The address-postalcode of the Patient resource.",
11436 * required=false,
11437 * @OA\Schema(
11438 * type="string"
11440 * ),
11441 * @OA\Parameter(
11442 * name="address-state",
11443 * in="query",
11444 * description="The address-state of the Patient resource.",
11445 * required=false,
11446 * @OA\Schema(
11447 * type="string"
11449 * ),
11450 * @OA\Parameter(
11451 * name="email",
11452 * in="query",
11453 * description="The email of the Patient resource.",
11454 * required=false,
11455 * @OA\Schema(
11456 * type="string"
11458 * ),
11459 * @OA\Parameter(
11460 * name="family",
11461 * in="query",
11462 * description="The family name of the Patient resource.",
11463 * required=false,
11464 * @OA\Schema(
11465 * type="string"
11467 * ),
11468 * @OA\Parameter(
11469 * name="given",
11470 * in="query",
11471 * description="The given name of the Patient resource.",
11472 * required=false,
11473 * @OA\Schema(
11474 * type="string"
11476 * ),
11477 * @OA\Parameter(
11478 * name="phone",
11479 * in="query",
11480 * description="The phone number of the Patient resource.",
11481 * required=false,
11482 * @OA\Schema(
11483 * type="string"
11485 * ),
11486 * @OA\Parameter(
11487 * name="telecom",
11488 * in="query",
11489 * description="The fax number of the Patient resource.",
11490 * required=false,
11491 * @OA\Schema(
11492 * type="string"
11494 * ),
11495 * @OA\Parameter(
11496 * ref="#/components/parameters/_lastUpdated"
11497 * ),
11498 * @OA\Response(
11499 * response="200",
11500 * description="Standard Response",
11501 * @OA\MediaType(
11502 * mediaType="application/json",
11503 * @OA\Schema(
11504 * @OA\Property(
11505 * property="json object",
11506 * description="FHIR Json object.",
11507 * type="object"
11508 * ),
11509 * example={
11510 * "meta": {
11511 * "lastUpdated": "2021-09-14T09:13:51"
11512 * },
11513 * "resourceType": "Bundle",
11514 * "type": "collection",
11515 * "total": 0,
11516 * "link": {
11518 * "relation": "self",
11519 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11525 * ),
11526 * @OA\Response(
11527 * response="400",
11528 * ref="#/components/responses/badrequest"
11529 * ),
11530 * @OA\Response(
11531 * response="401",
11532 * ref="#/components/responses/unauthorized"
11533 * ),
11534 * security={{"openemr_auth":{}}}
11537 "GET /fhir/Patient" => function (HttpRestRequest $request) {
11538 $params = $request->getQueryParams();
11539 if ($request->isPatientRequest()) {
11540 // only allow access to data of binded patient
11541 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11542 // need to use getAll rather than getOne)
11543 $params['_id'] = $request->getPatientUUIDString();
11544 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11545 } else {
11546 RestConfig::authorization_check("patients", "demo");
11547 $return = (new FhirPatientRestController())->getAll($params);
11549 RestConfig::apiLog($return);
11550 return $return;
11554 * @OA\Get(
11555 * path="/fhir/Patient/$export",
11556 * 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>",
11557 * tags={"fhir"},
11558 * @OA\Response(
11559 * response="200",
11560 * 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>"
11561 * ),
11562 * @OA\Response(
11563 * response="400",
11564 * ref="#/components/responses/badrequest"
11565 * ),
11566 * @OA\Response(
11567 * response="401",
11568 * ref="#/components/responses/unauthorized"
11569 * ),
11570 * security={{"openemr_auth":{}}}
11573 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11574 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
11575 RestConfig::authorization_check("admin", "users");
11576 $fhirExportService = new FhirOperationExportRestController($request);
11577 $return = $fhirExportService->processExport(
11578 $request->getQueryParams(),
11579 'Patient',
11580 $request->getHeader('Accept')[0] ?? '',
11581 $request->getHeader('Prefer')[0] ?? ''
11583 RestConfig::apiLog($return);
11584 return $return;
11588 * @OA\Get(
11589 * path="/fhir/Patient/{uuid}",
11590 * description="Returns a single Patient resource.",
11591 * tags={"fhir"},
11592 * @OA\Parameter(
11593 * name="uuid",
11594 * in="path",
11595 * description="The uuid for the Patient resource.",
11596 * required=true,
11597 * @OA\Schema(
11598 * type="string"
11600 * ),
11601 * @OA\Response(
11602 * response="200",
11603 * description="Standard Response",
11604 * @OA\MediaType(
11605 * mediaType="application/json",
11606 * @OA\Schema(
11607 * @OA\Property(
11608 * property="json object",
11609 * description="FHIR Json object.",
11610 * type="object"
11611 * ),
11612 * example={
11613 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11614 * "meta": {
11615 * "versionId": "1",
11616 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11617 * },
11618 * "resourceType": "Patient",
11619 * "text": {
11620 * "status": "generated",
11621 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11622 * },
11623 * "extension": {
11625 * "valueCode": "F",
11626 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11627 * },
11629 * "extension": {
11631 * "valueCoding": {
11632 * "system": "urn:oid:2.16.840.1.113883.6.238",
11633 * "code": "1006-6",
11634 * "display": "Abenaki"
11635 * },
11636 * "url": "ombCategory"
11637 * },
11639 * "valueString": "Abenaki",
11640 * "url": "text"
11642 * },
11643 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11644 * },
11646 * "extension": {
11648 * "valueString": "Declined To Specify",
11649 * "url": "text"
11651 * },
11652 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11654 * },
11655 * "identifier": {
11657 * "use": "official",
11658 * "type": {
11659 * "coding": {
11661 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11662 * "code": "PT"
11665 * },
11666 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11667 * "value": "1"
11669 * },
11670 * "active": true,
11671 * "name": {
11673 * "use": "official",
11674 * "family": "Von197",
11675 * "given": {
11676 * "Aurore252"
11679 * },
11680 * "gender": "female",
11681 * "birthDate": "1970-07-03",
11682 * "address": {
11684 * "line": {
11685 * "245 Crona Wall"
11686 * },
11687 * "city": "Boston",
11688 * "state": "Massachusetts",
11689 * "postalCode": "02215",
11690 * "period": {
11691 * "start": "2020-09-21T17:08:03.532+00:00"
11694 * },
11695 * "communication": {
11697 * "language": {
11698 * "coding": {
11700 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11701 * "code": "unknown",
11702 * "display": "Unknown"
11711 * ),
11712 * @OA\Response(
11713 * response="400",
11714 * ref="#/components/responses/badrequest"
11715 * ),
11716 * @OA\Response(
11717 * response="401",
11718 * ref="#/components/responses/unauthorized"
11719 * ),
11720 * @OA\Response(
11721 * response="404",
11722 * ref="#/components/responses/uuidnotfound"
11723 * ),
11724 * security={{"openemr_auth":{}}}
11727 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
11728 if ($request->isPatientRequest()) {
11729 // only allow access to data of binded patient
11730 if (empty($uuid) || ($uuid != $request->getPatientUUIDString())) {
11731 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11733 $uuid = $request->getPatientUUIDString();
11734 } else {
11735 RestConfig::authorization_check("patients", "demo");
11737 $return = (new FhirPatientRestController())->getOne($uuid);
11738 RestConfig::apiLog($return);
11739 return $return;
11743 * @OA\Get(
11744 * path="/fhir/Person",
11745 * description="Returns a list of Person resources.",
11746 * tags={"fhir"},
11747 * @OA\Parameter(
11748 * name="name",
11749 * in="query",
11750 * description="The name of the Person resource.",
11751 * required=false,
11752 * @OA\Schema(
11753 * type="string"
11755 * ),
11756 * @OA\Parameter(
11757 * name="active",
11758 * in="query",
11759 * description="The active status of the Person resource.",
11760 * required=false,
11761 * @OA\Schema(
11762 * type="string"
11764 * ),
11765 * @OA\Parameter(
11766 * name="address",
11767 * in="query",
11768 * description="The address of the Person resource.",
11769 * required=false,
11770 * @OA\Schema(
11771 * type="string"
11773 * ),
11774 * @OA\Parameter(
11775 * name="address-city",
11776 * in="query",
11777 * description="The address-city of the Person resource.",
11778 * required=false,
11779 * @OA\Schema(
11780 * type="string"
11782 * ),
11783 * @OA\Parameter(
11784 * name="address-postalcode",
11785 * in="query",
11786 * description="The address-postalcode of the Person resource.",
11787 * required=false,
11788 * @OA\Schema(
11789 * type="string"
11791 * ),
11792 * @OA\Parameter(
11793 * name="address-state",
11794 * in="query",
11795 * description="The address-state of the Person resource.",
11796 * required=false,
11797 * @OA\Schema(
11798 * type="string"
11800 * ),
11801 * @OA\Parameter(
11802 * name="email",
11803 * in="query",
11804 * description="The email of the Person resource.",
11805 * required=false,
11806 * @OA\Schema(
11807 * type="string"
11809 * ),
11810 * @OA\Parameter(
11811 * name="family",
11812 * in="query",
11813 * description="The family name of the Person resource.",
11814 * required=false,
11815 * @OA\Schema(
11816 * type="string"
11818 * ),
11819 * @OA\Parameter(
11820 * name="given",
11821 * in="query",
11822 * description="The given name of the Person resource.",
11823 * required=false,
11824 * @OA\Schema(
11825 * type="string"
11827 * ),
11828 * @OA\Parameter(
11829 * name="phone",
11830 * in="query",
11831 * description="The phone number of the Person resource.",
11832 * required=false,
11833 * @OA\Schema(
11834 * type="string"
11836 * ),
11837 * @OA\Parameter(
11838 * name="telecom",
11839 * in="query",
11840 * description="The fax number of the Person resource.",
11841 * required=false,
11842 * @OA\Schema(
11843 * type="string"
11845 * ),
11846 * @OA\Response(
11847 * response="200",
11848 * description="Standard Response",
11849 * @OA\MediaType(
11850 * mediaType="application/json",
11851 * @OA\Schema(
11852 * @OA\Property(
11853 * property="json object",
11854 * description="FHIR Json object.",
11855 * type="object"
11856 * ),
11857 * example={
11858 * "meta": {
11859 * "lastUpdated": "2021-09-14T09:13:51"
11860 * },
11861 * "resourceType": "Bundle",
11862 * "type": "collection",
11863 * "total": 0,
11864 * "link": {
11866 * "relation": "self",
11867 * "url": "https://localhost:9300/apis/default/fhir/Person"
11873 * ),
11874 * @OA\Response(
11875 * response="400",
11876 * ref="#/components/responses/badrequest"
11877 * ),
11878 * @OA\Response(
11879 * response="401",
11880 * ref="#/components/responses/unauthorized"
11881 * ),
11882 * security={{"openemr_auth":{}}}
11885 "GET /fhir/Person" => function (HttpRestRequest $request) {
11886 RestConfig::authorization_check("admin", "users");
11887 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11888 RestConfig::apiLog($return);
11889 return $return;
11893 * @OA\Get(
11894 * path="/fhir/Person/{uuid}",
11895 * description="Returns a single Person resource.",
11896 * tags={"fhir"},
11897 * @OA\Parameter(
11898 * name="uuid",
11899 * in="path",
11900 * description="The uuid for the Person resource.",
11901 * required=true,
11902 * @OA\Schema(
11903 * type="string"
11905 * ),
11906 * @OA\Response(
11907 * response="200",
11908 * description="Standard Response",
11909 * @OA\MediaType(
11910 * mediaType="application/json",
11911 * @OA\Schema(
11912 * @OA\Property(
11913 * property="json object",
11914 * description="FHIR Json object.",
11915 * type="object"
11916 * ),
11917 * example={
11918 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11919 * "meta": {
11920 * "versionId": "1",
11921 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11922 * },
11923 * "resourceType": "Person",
11924 * "text": {
11925 * "status": "generated",
11926 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11927 * },
11928 * "name": {
11930 * "use": "official",
11931 * "family": "Administrator",
11932 * "given": {
11933 * "Administrator",
11934 * "Larry"
11937 * },
11938 * "telecom": {
11940 * "system": "phone",
11941 * "value": "1234567890",
11942 * "use": "home"
11943 * },
11945 * "system": "phone",
11946 * "value": "1234567890",
11947 * "use": "work"
11948 * },
11950 * "system": "phone",
11951 * "value": "1234567890",
11952 * "use": "mobile"
11953 * },
11955 * "system": "email",
11956 * "value": "hey@hey.com",
11957 * "use": "home"
11959 * },
11960 * "address": {
11962 * "line": {
11963 * "123 Lane Street"
11964 * },
11965 * "city": "Bellevue",
11966 * "state": "WA",
11967 * "period": {
11968 * "start": "2021-04-13T08:57:32.146+00:00"
11971 * },
11972 * "active": true
11976 * ),
11977 * @OA\Response(
11978 * response="400",
11979 * ref="#/components/responses/badrequest"
11980 * ),
11981 * @OA\Response(
11982 * response="401",
11983 * ref="#/components/responses/unauthorized"
11984 * ),
11985 * @OA\Response(
11986 * response="404",
11987 * ref="#/components/responses/uuidnotfound"
11988 * ),
11989 * security={{"openemr_auth":{}}}
11992 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
11993 // if the api user is requesting their own user we need to let it through
11994 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11995 // for the currently logged in user
11996 if ($request->getRequestUserUUIDString() == $uuid) {
11997 $return = (new FhirPersonRestController())->getOne($uuid);
11998 } else if (!$request->isPatientRequest()) {
11999 // not a patient ,make sure we have access to the users ACL
12000 RestConfig::authorization_check("admin", "users");
12001 $return = (new FhirPersonRestController())->getOne($uuid);
12002 } else {
12003 // if we are a patient bound request we need to make sure we are only bound to the patient
12004 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
12007 RestConfig::apiLog($return);
12008 return $return;
12012 * @OA\Get(
12013 * path="/fhir/Practitioner",
12014 * description="Returns a list of Practitioner resources.",
12015 * tags={"fhir"},
12016 * @OA\Parameter(
12017 * name="_id",
12018 * in="query",
12019 * description="The uuid for the Practitioner resource.",
12020 * required=false,
12021 * @OA\Schema(
12022 * type="string"
12024 * ),
12025 * @OA\Parameter(
12026 * name="name",
12027 * in="query",
12028 * description="The name of the Practitioner resource.",
12029 * required=false,
12030 * @OA\Schema(
12031 * type="string"
12033 * ),
12034 * @OA\Parameter(
12035 * name="active",
12036 * in="query",
12037 * description="The active status of the Practitioner resource.",
12038 * required=false,
12039 * @OA\Schema(
12040 * type="string"
12042 * ),
12043 * @OA\Parameter(
12044 * name="address",
12045 * in="query",
12046 * description="The address of the Practitioner resource.",
12047 * required=false,
12048 * @OA\Schema(
12049 * type="string"
12051 * ),
12052 * @OA\Parameter(
12053 * name="address-city",
12054 * in="query",
12055 * description="The address-city of the Practitioner resource.",
12056 * required=false,
12057 * @OA\Schema(
12058 * type="string"
12060 * ),
12061 * @OA\Parameter(
12062 * name="address-postalcode",
12063 * in="query",
12064 * description="The address-postalcode of the Practitioner resource.",
12065 * required=false,
12066 * @OA\Schema(
12067 * type="string"
12069 * ),
12070 * @OA\Parameter(
12071 * name="address-state",
12072 * in="query",
12073 * description="The address-state of the Practitioner resource.",
12074 * required=false,
12075 * @OA\Schema(
12076 * type="string"
12078 * ),
12079 * @OA\Parameter(
12080 * name="email",
12081 * in="query",
12082 * description="The email of the Practitioner resource.",
12083 * required=false,
12084 * @OA\Schema(
12085 * type="string"
12087 * ),
12088 * @OA\Parameter(
12089 * name="family",
12090 * in="query",
12091 * description="The family name of the Practitioner resource.",
12092 * required=false,
12093 * @OA\Schema(
12094 * type="string"
12096 * ),
12097 * @OA\Parameter(
12098 * name="given",
12099 * in="query",
12100 * description="The given name of the Practitioner resource.",
12101 * required=false,
12102 * @OA\Schema(
12103 * type="string"
12105 * ),
12106 * @OA\Parameter(
12107 * name="phone",
12108 * in="query",
12109 * description="The phone number of the Practitioner resource.",
12110 * required=false,
12111 * @OA\Schema(
12112 * type="string"
12114 * ),
12115 * @OA\Parameter(
12116 * name="telecom",
12117 * in="query",
12118 * description="The fax number of the Practitioner resource.",
12119 * required=false,
12120 * @OA\Schema(
12121 * type="string"
12123 * ),
12124 * @OA\Response(
12125 * response="200",
12126 * description="Standard Response",
12127 * @OA\MediaType(
12128 * mediaType="application/json",
12129 * @OA\Schema(
12130 * @OA\Property(
12131 * property="json object",
12132 * description="FHIR Json object.",
12133 * type="object"
12134 * ),
12135 * example={
12136 * "meta": {
12137 * "lastUpdated": "2021-09-14T09:13:51"
12138 * },
12139 * "resourceType": "Bundle",
12140 * "type": "collection",
12141 * "total": 0,
12142 * "link": {
12144 * "relation": "self",
12145 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12151 * ),
12152 * @OA\Response(
12153 * response="400",
12154 * ref="#/components/responses/badrequest"
12155 * ),
12156 * @OA\Response(
12157 * response="401",
12158 * ref="#/components/responses/unauthorized"
12159 * ),
12160 * security={{"openemr_auth":{}}}
12163 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
12165 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12166 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12167 // I don't believe patients are assigned to a particular practitioner
12168 // should we allow just open api access to admin information? Should we restrict particular pieces
12169 // of data in the practitioner side (phone number, address information) based on a permission set?
12170 if (!$request->isPatientRequest()) {
12171 RestConfig::authorization_check("admin", "users");
12173 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12174 RestConfig::apiLog($return);
12175 return $return;
12179 * @OA\Get(
12180 * path="/fhir/Practitioner/{uuid}",
12181 * description="Returns a single Practitioner resource.",
12182 * tags={"fhir"},
12183 * @OA\Parameter(
12184 * name="uuid",
12185 * in="path",
12186 * description="The uuid for the Practitioner resource.",
12187 * required=true,
12188 * @OA\Schema(
12189 * type="string"
12191 * ),
12192 * @OA\Response(
12193 * response="200",
12194 * description="Standard Response",
12195 * @OA\MediaType(
12196 * mediaType="application/json",
12197 * @OA\Schema(
12198 * @OA\Property(
12199 * property="json object",
12200 * description="FHIR Json object.",
12201 * type="object"
12202 * ),
12203 * example={
12204 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12205 * "meta": {
12206 * "versionId": "1",
12207 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12208 * },
12209 * "resourceType": "Practitioner",
12210 * "text": {
12211 * "status": "generated",
12212 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12213 * },
12214 * "identifier": {
12216 * "system": "http://hl7.org/fhir/sid/us-npi",
12217 * "value": "11223344554543"
12219 * },
12220 * "active": true,
12221 * "name": {
12223 * "use": "official",
12224 * "family": "Smith",
12225 * "given": {
12226 * "Billy"
12233 * ),
12234 * @OA\Response(
12235 * response="400",
12236 * ref="#/components/responses/badrequest"
12237 * ),
12238 * @OA\Response(
12239 * response="401",
12240 * ref="#/components/responses/unauthorized"
12241 * ),
12242 * @OA\Response(
12243 * response="404",
12244 * ref="#/components/responses/uuidnotfound"
12245 * ),
12246 * security={{"openemr_auth":{}}}
12249 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12250 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12251 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12252 // I don't believe patients are assigned to a particular practitioner
12253 // should we allow just open api access to admin information? Should we restrict particular pieces
12254 // of data in the practitioner side (phone number, address information) based on a permission set?
12255 if (!$request->isPatientRequest()) {
12256 RestConfig::authorization_check("admin", "users");
12258 $return = (new FhirPractitionerRestController())->getOne($uuid);
12259 RestConfig::apiLog($return);
12260 return $return;
12264 * @OA\Post(
12265 * path="/fhir/Practitioner",
12266 * description="Adds a Practitioner resources.",
12267 * tags={"fhir"},
12268 * @OA\RequestBody(
12269 * required=true,
12270 * @OA\MediaType(
12271 * mediaType="application/json",
12272 * @OA\Schema(
12273 * description="The json object for the Practitioner resource.",
12274 * type="object"
12275 * ),
12276 * example={
12277 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12278 * "meta": {
12279 * "versionId": "1",
12280 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12281 * },
12282 * "resourceType": "Practitioner",
12283 * "text": {
12284 * "status": "generated",
12285 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12286 * },
12287 * "identifier": {
12289 * "system": "http://hl7.org/fhir/sid/us-npi",
12290 * "value": "11223344554543"
12292 * },
12293 * "active": true,
12294 * "name": {
12296 * "use": "official",
12297 * "family": "Smith",
12298 * "given": {
12299 * "Danny"
12305 * ),
12306 * @OA\Response(
12307 * response="200",
12308 * description="Standard Response",
12309 * @OA\MediaType(
12310 * mediaType="application/json",
12311 * @OA\Schema(
12312 * @OA\Property(
12313 * property="json object",
12314 * description="FHIR Json object.",
12315 * type="object"
12316 * ),
12317 * example={
12318 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12319 * "meta": {
12320 * "versionId": "1",
12321 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12322 * },
12323 * "resourceType": "Practitioner",
12324 * "text": {
12325 * "status": "generated",
12326 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12327 * },
12328 * "identifier": {
12330 * "system": "http://hl7.org/fhir/sid/us-npi",
12331 * "value": "11223344554543"
12333 * },
12334 * "active": true,
12335 * "name": {
12337 * "use": "official",
12338 * "family": "Smith",
12339 * "given": {
12340 * "Danny"
12347 * ),
12348 * @OA\Response(
12349 * response="400",
12350 * ref="#/components/responses/badrequest"
12351 * ),
12352 * @OA\Response(
12353 * response="401",
12354 * ref="#/components/responses/unauthorized"
12355 * ),
12356 * security={{"openemr_auth":{}}}
12359 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
12360 RestConfig::authorization_check("admin", "users");
12361 $data = (array) (json_decode(file_get_contents("php://input"), true));
12362 $return = (new FhirPractitionerRestController())->post($data);
12363 RestConfig::apiLog($return, $data);
12364 return $return;
12368 * @OA\Put(
12369 * path="/fhir/Practitioner/{uuid}",
12370 * description="Modify a Practitioner resource.",
12371 * tags={"fhir"},
12372 * @OA\Parameter(
12373 * name="uuid",
12374 * in="path",
12375 * description="The uuid for the Practitioner resource.",
12376 * required=true,
12377 * @OA\Schema(
12378 * type="string"
12380 * ),
12381 * @OA\RequestBody(
12382 * required=true,
12383 * @OA\MediaType(
12384 * mediaType="application/json",
12385 * @OA\Schema(
12386 * description="The json object for the Practitioner resource.",
12387 * type="object"
12388 * ),
12389 * example={
12390 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12391 * "meta": {
12392 * "versionId": "1",
12393 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12394 * },
12395 * "resourceType": "Practitioner",
12396 * "text": {
12397 * "status": "generated",
12398 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12399 * },
12400 * "identifier": {
12402 * "system": "http://hl7.org/fhir/sid/us-npi",
12403 * "value": "11223344554543"
12405 * },
12406 * "active": true,
12407 * "name": {
12409 * "use": "official",
12410 * "family": "Smith",
12411 * "given": {
12412 * "Billy"
12418 * ),
12419 * @OA\Response(
12420 * response="201",
12421 * description="Standard Response",
12422 * @OA\MediaType(
12423 * mediaType="application/json",
12424 * @OA\Schema(
12425 * example={
12426 * "id": 5,
12427 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12431 * ),
12432 * @OA\Response(
12433 * response="400",
12434 * ref="#/components/responses/badrequest"
12435 * ),
12436 * @OA\Response(
12437 * response="401",
12438 * ref="#/components/responses/unauthorized"
12439 * ),
12440 * security={{"openemr_auth":{}}}
12443 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
12444 RestConfig::authorization_check("admin", "users");
12445 $data = (array) (json_decode(file_get_contents("php://input"), true));
12446 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12447 RestConfig::apiLog($return, $data);
12448 return $return;
12452 * @OA\Get(
12453 * path="/fhir/PractitionerRole",
12454 * description="Returns a list of PractitionerRole resources.",
12455 * tags={"fhir"},
12456 * @OA\Parameter(
12457 * name="specialty",
12458 * in="query",
12459 * description="The specialty of the PractitionerRole resource.",
12460 * required=false,
12461 * @OA\Schema(
12462 * type="string"
12464 * ),
12465 * @OA\Parameter(
12466 * name="practitioner",
12467 * in="query",
12468 * description="The practitioner of the PractitionerRole resource.",
12469 * required=false,
12470 * @OA\Schema(
12471 * type="string"
12473 * ),
12474 * @OA\Response(
12475 * response="200",
12476 * description="Standard Response",
12477 * @OA\MediaType(
12478 * mediaType="application/json",
12479 * @OA\Schema(
12480 * @OA\Property(
12481 * property="json object",
12482 * description="FHIR Json object.",
12483 * type="object"
12484 * ),
12485 * example={
12486 * "meta": {
12487 * "lastUpdated": "2021-09-14T09:13:51"
12488 * },
12489 * "resourceType": "Bundle",
12490 * "type": "collection",
12491 * "total": 0,
12492 * "link": {
12494 * "relation": "self",
12495 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12501 * ),
12502 * @OA\Response(
12503 * response="400",
12504 * ref="#/components/responses/badrequest"
12505 * ),
12506 * @OA\Response(
12507 * response="401",
12508 * ref="#/components/responses/unauthorized"
12509 * ),
12510 * security={{"openemr_auth":{}}}
12513 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
12514 RestConfig::authorization_check("admin", "users");
12515 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12516 RestConfig::apiLog($return);
12517 return $return;
12521 * @OA\Get(
12522 * path="/fhir/PractitionerRole/{uuid}",
12523 * description="Returns a single PractitionerRole resource.",
12524 * tags={"fhir"},
12525 * @OA\Parameter(
12526 * name="uuid",
12527 * in="path",
12528 * description="The uuid for the PractitionerRole resource.",
12529 * required=true,
12530 * @OA\Schema(
12531 * type="string"
12533 * ),
12534 * @OA\Response(
12535 * response="200",
12536 * description="Standard Response",
12537 * @OA\MediaType(
12538 * mediaType="application/json",
12539 * @OA\Schema(
12540 * @OA\Property(
12541 * property="json object",
12542 * description="FHIR Json object.",
12543 * type="object"
12544 * ),
12545 * example={
12546 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12547 * "meta": {
12548 * "versionId": "1",
12549 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12550 * },
12551 * "resourceType": "PractitionerRole",
12552 * "practitioner": {
12553 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12554 * "display": "Administrator Administrator"
12555 * },
12556 * "organization": {
12557 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12558 * "display": "Your Clinic Name Here"
12559 * },
12560 * "code": {
12562 * "coding": {
12563 * "102L00000X"
12564 * },
12565 * "text": "Psychoanalyst"
12566 * },
12568 * "coding": {
12569 * "101Y00000X"
12570 * },
12571 * "text": "Counselor"
12577 * ),
12578 * @OA\Response(
12579 * response="400",
12580 * ref="#/components/responses/badrequest"
12581 * ),
12582 * @OA\Response(
12583 * response="401",
12584 * ref="#/components/responses/unauthorized"
12585 * ),
12586 * @OA\Response(
12587 * response="404",
12588 * ref="#/components/responses/uuidnotfound"
12589 * ),
12590 * security={{"openemr_auth":{}}}
12593 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
12594 RestConfig::authorization_check("admin", "users");
12595 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12596 RestConfig::apiLog($return);
12597 return $return;
12601 * @OA\Get(
12602 * path="/fhir/Procedure",
12603 * description="Returns a list of Procedure resources.",
12604 * tags={"fhir"},
12605 * @OA\Parameter(
12606 * name="_id",
12607 * in="query",
12608 * description="The uuid for the Procedure resource.",
12609 * required=false,
12610 * @OA\Schema(
12611 * type="string"
12613 * ),
12614 * @OA\Parameter(
12615 * name="patient",
12616 * in="query",
12617 * description="The uuid for the patient.",
12618 * required=false,
12619 * @OA\Schema(
12620 * type="string"
12622 * ),
12623 * @OA\Parameter(
12624 * name="date",
12625 * in="query",
12626 * description="The datetime of the Procedure resource.",
12627 * required=false,
12628 * @OA\Schema(
12629 * type="string"
12631 * ),
12632 * @OA\Response(
12633 * response="200",
12634 * description="Standard Response",
12635 * @OA\MediaType(
12636 * mediaType="application/json",
12637 * @OA\Schema(
12638 * @OA\Property(
12639 * property="json object",
12640 * description="FHIR Json object.",
12641 * type="object"
12642 * ),
12643 * example={
12644 * "meta": {
12645 * "lastUpdated": "2021-09-14T09:13:51"
12646 * },
12647 * "resourceType": "Bundle",
12648 * "type": "collection",
12649 * "total": 0,
12650 * "link": {
12652 * "relation": "self",
12653 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12659 * ),
12660 * @OA\Response(
12661 * response="400",
12662 * ref="#/components/responses/badrequest"
12663 * ),
12664 * @OA\Response(
12665 * response="401",
12666 * ref="#/components/responses/unauthorized"
12667 * ),
12668 * security={{"openemr_auth":{}}}
12671 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
12672 if ($request->isPatientRequest()) {
12673 // only allow access to data of binded patient
12674 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12675 } else {
12676 RestConfig::authorization_check("patients", "med");
12677 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12679 RestConfig::apiLog($return);
12680 return $return;
12684 * @OA\Get(
12685 * path="/fhir/Procedure/{uuid}",
12686 * description="Returns a single Procedure resource.",
12687 * tags={"fhir"},
12688 * @OA\Parameter(
12689 * name="uuid",
12690 * in="path",
12691 * description="The uuid for the Procedure resource.",
12692 * required=true,
12693 * @OA\Schema(
12694 * type="string"
12696 * ),
12697 * @OA\Response(
12698 * response="200",
12699 * description="Standard Response",
12700 * @OA\MediaType(
12701 * mediaType="application/json",
12702 * @OA\Schema(
12703 * @OA\Property(
12704 * property="json object",
12705 * description="FHIR Json object.",
12706 * type="object"
12707 * ),
12708 * example={
12709 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12710 * "meta": {
12711 * "versionId": "1",
12712 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12713 * },
12714 * "resourceType": "Procedure",
12715 * "status": "in-progress",
12716 * "subject": {
12717 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12718 * "type": "Patient"
12723 * ),
12724 * @OA\Response(
12725 * response="400",
12726 * ref="#/components/responses/badrequest"
12727 * ),
12728 * @OA\Response(
12729 * response="401",
12730 * ref="#/components/responses/unauthorized"
12731 * ),
12732 * @OA\Response(
12733 * response="404",
12734 * ref="#/components/responses/uuidnotfound"
12735 * ),
12736 * security={{"openemr_auth":{}}}
12739 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
12740 if ($request->isPatientRequest()) {
12741 // only allow access to data of binded patient
12742 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12743 } else {
12744 RestConfig::authorization_check("patients", "med");
12745 $return = (new FhirProcedureRestController())->getOne($uuid);
12747 RestConfig::apiLog($return);
12748 return $return;
12752 * @OA\Get(
12753 * path="/fhir/Provenance/{uuid}",
12754 * description="Returns a single Provenance resource.",
12755 * tags={"fhir"},
12756 * @OA\Parameter(
12757 * name="uuid",
12758 * in="path",
12759 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12760 * required=true,
12761 * @OA\Schema(
12762 * type="string"
12764 * ),
12765 * @OA\Response(
12766 * response="200",
12767 * description="Standard Response",
12768 * @OA\MediaType(
12769 * mediaType="application/json",
12770 * @OA\Schema(
12771 * @OA\Property(
12772 * property="json object",
12773 * description="FHIR Json object.",
12774 * type="object"
12775 * ),
12776 * example={
12777 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12778 * "resourceType": "Provenance",
12779 * "target": {
12781 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12782 * "type": "AllergyIntolerance"
12784 * },
12785 * "recorded": "2022-03-26T22:43:30+00:00",
12786 * "agent": {
12788 * "type": {
12789 * "coding": {
12791 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12792 * "code": "author",
12793 * "display": "Author"
12796 * },
12797 * "who": {
12798 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12799 * "type": "Organization"
12800 * },
12801 * "onBehalfOf": {
12802 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12803 * "type": "Organization"
12805 * },
12807 * "type": {
12808 * "coding": {
12810 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12811 * "code": "transmitter",
12812 * "display": "Transmitter"
12816 * },
12817 * "who": {
12818 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12819 * "type": "Organization"
12820 * },
12821 * "onBehalfOf": {
12822 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12823 * "type": "Organization"
12829 * ),
12830 * @OA\Response(
12831 * response="400",
12832 * ref="#/components/responses/badrequest"
12833 * ),
12834 * @OA\Response(
12835 * response="401",
12836 * ref="#/components/responses/unauthorized"
12837 * ),
12838 * @OA\Response(
12839 * response="404",
12840 * ref="#/components/responses/uuidnotfound"
12841 * ),
12842 * security={{"openemr_auth":{}}}
12845 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
12846 if ($request->isPatientRequest()) {
12847 // only allow access to data of binded patient
12848 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12849 } else {
12850 RestConfig::authorization_check("admin", "super");
12851 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12853 RestConfig::apiLog($return);
12854 return $return;
12858 * @OA\Get(
12859 * path="/fhir/Provenance",
12860 * description="Returns a list of Provenance resources.",
12861 * tags={"fhir"},
12862 * @OA\Parameter(
12863 * name="_id",
12864 * in="query",
12865 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12866 * required=false,
12867 * @OA\Schema(
12868 * type="string"
12870 * ),
12871 * @OA\Response(
12872 * response="200",
12873 * description="Standard Response",
12874 * @OA\MediaType(
12875 * mediaType="application/json",
12876 * @OA\Schema(
12877 * @OA\Property(
12878 * property="json object",
12879 * description="FHIR Json object.",
12880 * type="object"
12881 * ),
12882 * example={
12883 * "meta": {
12884 * "lastUpdated": "2021-09-14T09:13:51"
12885 * },
12886 * "resourceType": "Bundle",
12887 * "type": "collection",
12888 * "total": 0,
12889 * "link": {
12891 * "relation": "self",
12892 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12898 * ),
12899 * @OA\Response(
12900 * response="400",
12901 * ref="#/components/responses/badrequest"
12902 * ),
12903 * @OA\Response(
12904 * response="401",
12905 * ref="#/components/responses/unauthorized"
12906 * ),
12907 * security={{"openemr_auth":{}}}
12910 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12911 // property to support which is why this endpoint exists.
12912 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
12913 if ($request->isPatientRequest()) {
12914 // only allow access to data of binded patient
12915 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12916 } else {
12917 // TODO: it seems like regular users should be able to grab authorship / provenance information
12918 RestConfig::authorization_check("admin", "super");
12919 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12921 RestConfig::apiLog($return);
12922 return $return;
12926 * @OA\Get(
12927 * path="/fhir/ValueSet",
12928 * description="Returns a list of ValueSet resources.",
12929 * tags={"fhir"},
12930 * @OA\Parameter(
12931 * name="_id",
12932 * in="query",
12933 * description="The uuid for the ValueSet resource.",
12934 * required=false,
12935 * @OA\Schema(
12936 * type="string"
12938 * ),
12939 * @OA\Response(
12940 * response="200",
12941 * description="Standard Response",
12942 * @OA\MediaType(
12943 * mediaType="application/json",
12944 * @OA\Schema(
12945 * @OA\Property(
12946 * property="json object",
12947 * description="FHIR Json object.",
12948 * type="object"
12949 * ),
12950 * example={
12951 * "meta": {
12952 * "lastUpdated": "2021-09-14T09:13:51"
12953 * },
12954 * "resourceType": "Bundle",
12955 * "type": "collection",
12956 * "total": 0,
12957 * "link": {
12959 * "relation": "self",
12960 * "url": "https://localhost:9300/apis/default/fhir/ValueSet"
12966 * ),
12967 * @OA\Response(
12968 * response="400",
12969 * ref="#/components/responses/badrequest"
12970 * ),
12971 * @OA\Response(
12972 * response="401",
12973 * ref="#/components/responses/unauthorized"
12974 * ),
12975 * security={{"openemr_auth":{}}}
12978 "GET /fhir/ValueSet" => function (HttpRestRequest $request) {
12979 RestConfig::authorization_check("admin", "super");
12980 $return = (new FhirValueSetRestController())->getAll($request->getQueryParams());
12981 RestConfig::apiLog($return);
12982 return $return;
12986 * @OA\Get(
12987 * path="/fhir/ValueSet/{uuid}",
12988 * description="Returns a single ValueSet resource.",
12989 * tags={"fhir"},
12990 * @OA\Parameter(
12991 * name="uuid",
12992 * in="path",
12993 * description="The uuid for the ValueSet resource.",
12994 * required=true,
12995 * @OA\Schema(
12996 * type="string"
12998 * ),
12999 * @OA\Response(
13000 * response="200",
13001 * description="Standard Response",
13002 * @OA\MediaType(
13003 * mediaType="application/json",
13004 * @OA\Schema(
13005 * @OA\Property(
13006 * property="json object",
13007 * description="FHIR Json object.",
13008 * type="object"
13009 * ),
13010 * example={
13011 * "resourceType": "ValueSet",
13012 * "id": "appointment-type",
13013 * "compose": {
13014 * "include": {
13016 * "concept": {
13018 * "code": "no_show",
13019 * "display": "No Show"
13020 * },
13022 * "code": "office_visit",
13023 * "display": "Office Visit"
13024 * },
13026 * "code": "established_patient",
13027 * "display": "Established Patient"
13028 * },
13030 * "code": "new_patient",
13031 * "display": "New Patient"
13032 * },
13034 * "code": "health_and_behavioral_assessment",
13035 * "display": "Health and Behavioral Assessment"
13036 * },
13038 * "code": "preventive_care_services",
13039 * "display": "Preventive Care Services"
13040 * },
13042 * "code": "ophthalmological_services",
13043 * "display": "Ophthalmological Services"
13052 * ),
13053 * @OA\Response(
13054 * response="400",
13055 * ref="#/components/responses/badrequest"
13056 * ),
13057 * @OA\Response(
13058 * response="401",
13059 * ref="#/components/responses/unauthorized"
13060 * ),
13061 * @OA\Response(
13062 * response="404",
13063 * ref="#/components/responses/uuidnotfound"
13064 * ),
13065 * security={{"openemr_auth":{}}}
13068 "GET /fhir/ValueSet/:uuid" => function ($uuid, HttpRestRequest $request) {
13069 RestConfig::authorization_check("admin", "super");
13070 $return = (new FhirValueSetRestController())->getOne($uuid);
13071 RestConfig::apiLog($return);
13072 return $return;
13075 // other endpoints
13078 * @OA\Get(
13079 * path="/fhir/metadata",
13080 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
13081 * tags={"fhir"},
13082 * @OA\Response(
13083 * response="200",
13084 * description="Return CapabilityStatement resource of the fhir server"
13088 "GET /fhir/metadata" => function () {
13089 $return = (new FhirMetaDataRestController())->getMetaData();
13090 RestConfig::apiLog($return);
13091 return $return;
13095 * @OA\Get(
13096 * path="/fhir/.well-known/smart-configuration",
13097 * description="Returns smart configuration of the fhir server.",
13098 * tags={"fhir"},
13099 * @OA\Response(
13100 * response="200",
13101 * description="Return smart configuration of the fhir server"
13105 "GET /fhir/.well-known/smart-configuration" => function () {
13106 $authController = new \OpenEMR\RestControllers\AuthorizationController();
13107 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
13108 RestConfig::apiLog($return);
13109 return $return;
13113 * @OA\Get(
13114 * path="/fhir/OperationDefinition",
13115 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
13116 * tags={"fhir"},
13117 * @OA\Response(
13118 * response="200",
13119 * description="Return list of OperationDefinition resources"
13123 "GET /fhir/OperationDefinition" => function (HttpRestRequest $request) {
13124 // for now we will just hard code the custom resources
13125 $operationDefinitionController = new FhirOperationDefinitionRestController();
13126 $return = $operationDefinitionController->getAll($request->getQueryParams());
13127 RestConfig::apiLog($return);
13128 return $return;
13132 * @OA\Get(
13133 * path="/fhir/OperationDefinition/{operation}",
13134 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
13135 * tags={"fhir"},
13136 * @OA\Parameter(
13137 * name="operation",
13138 * in="path",
13139 * description="The name of the operation to query. For example $bulkdata-status",
13140 * required=true,
13141 * @OA\Schema(
13142 * type="string"
13144 * ),
13145 * @OA\Response(
13146 * response="200",
13147 * description="Standard Response",
13148 * @OA\MediaType(
13149 * mediaType="application/json",
13150 * @OA\Schema(
13151 * @OA\Property(
13152 * property="json object",
13153 * description="FHIR Json object.",
13154 * type="object"
13155 * ),
13156 * example={
13157 * "resourceType": "OperationDefinition",
13158 * "name": "$bulkdata-status",
13159 * "status": "active",
13160 * "kind": "operation",
13161 * "parameter": {
13163 * "name": "job",
13164 * "use": "in",
13165 * "min": 1,
13166 * "max": 1,
13167 * "type": {
13168 * "system": "http://hl7.org/fhir/data-types",
13169 * "code": "string",
13170 * "display": "string"
13171 * },
13172 * "searchType": {
13173 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13174 * "code": "string",
13175 * "display": "string"
13182 * ),
13185 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest $request) {
13186 // for now we will just hard code the custom resources
13187 $operationDefinitionController = new FhirOperationDefinitionRestController();
13188 $return = $operationDefinitionController->getOne($operation);
13189 RestConfig::apiLog($return);
13190 return $return;
13193 // FHIR root level operations
13196 * @OA\Get(
13197 * path="/fhir/$export",
13198 * 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>",
13199 * tags={"fhir"},
13200 * @OA\Response(
13201 * response="200",
13202 * 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>"
13203 * ),
13204 * @OA\Response(
13205 * response="400",
13206 * ref="#/components/responses/badrequest"
13207 * ),
13208 * @OA\Response(
13209 * response="401",
13210 * ref="#/components/responses/unauthorized"
13211 * ),
13212 * security={{"openemr_auth":{}}}
13215 'GET /fhir/$export' => function (HttpRestRequest $request) {
13216 RestConfig::authorization_check("admin", "users");
13217 $fhirExportService = new FhirOperationExportRestController($request);
13218 $return = $fhirExportService->processExport(
13219 $request->getQueryParams(),
13220 'System',
13221 $request->getHeader('Accept')[0] ?? '',
13222 $request->getHeader('Prefer')[0] ?? ''
13224 RestConfig::apiLog($return);
13225 return $return;
13228 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13229 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13230 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13233 * @OA\Get(
13234 * path="/fhir/$bulkdata-status",
13235 * 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>",
13236 * tags={"fhir"},
13237 * @OA\Response(
13238 * response="200",
13239 * 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>"
13240 * ),
13241 * @OA\Response(
13242 * response="400",
13243 * ref="#/components/responses/badrequest"
13244 * ),
13245 * @OA\Response(
13246 * response="401",
13247 * ref="#/components/responses/unauthorized"
13248 * ),
13249 * security={{"openemr_auth":{}}}
13252 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13253 RestConfig::authorization_check("admin", "users");
13254 $jobUuidString = $request->getQueryParam('job');
13255 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13256 // since OpenEMR data is so small we just return the JSON from the database
13257 $fhirExportService = new FhirOperationExportRestController($request);
13258 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13259 RestConfig::apiLog($return);
13260 return $return;
13264 * @OA\Delete(
13265 * path="/fhir/$bulkdata-status",
13266 * 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>",
13267 * tags={"fhir"},
13268 * @OA\Response(
13269 * response="200",
13270 * 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>"
13271 * ),
13272 * @OA\Response(
13273 * response="400",
13274 * ref="#/components/responses/badrequest"
13275 * ),
13276 * @OA\Response(
13277 * response="401",
13278 * ref="#/components/responses/unauthorized"
13279 * ),
13280 * security={{"openemr_auth":{}}}
13283 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
13284 RestConfig::authorization_check("admin", "users");
13285 $job = $request->getQueryParam('job');
13286 $fhirExportService = new FhirOperationExportRestController($request);
13287 $return = $fhirExportService->processDeleteExportForJob($job);
13288 RestConfig::apiLog($return);
13289 return $return;
13293 // Note that the portal (api) route is only for patient role
13294 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13295 RestConfig::$PORTAL_ROUTE_MAP = array(
13297 * @OA\Get(
13298 * path="/portal/patient",
13299 * description="Returns the patient.",
13300 * tags={"standard-patient"},
13301 * @OA\Response(
13302 * response="200",
13303 * description="Standard response",
13304 * @OA\MediaType(
13305 * mediaType="application/json",
13306 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13308 * ),
13309 * @OA\Response(
13310 * response="401",
13311 * ref="#/components/responses/unauthorized"
13312 * ),
13313 * security={{"openemr_auth":{}}}
13316 "GET /portal/patient" => function (HttpRestRequest $request) {
13317 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13318 RestConfig::apiLog($return);
13319 return $return;
13323 * @OA\Get(
13324 * path="/portal/patient/encounter",
13325 * description="Returns encounters for the patient.",
13326 * tags={"standard-patient"},
13327 * @OA\Response(
13328 * response="200",
13329 * ref="#/components/responses/standard"
13330 * ),
13331 * @OA\Response(
13332 * response="400",
13333 * ref="#/components/responses/badrequest"
13334 * ),
13335 * @OA\Response(
13336 * response="401",
13337 * ref="#/components/responses/unauthorized"
13338 * ),
13339 * security={{"openemr_auth":{}}}
13342 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
13343 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13344 RestConfig::apiLog($return);
13345 return $return;
13349 * @OA\Get(
13350 * path="/portal/patient/encounter/{euuid}",
13351 * description="Returns a selected encounter by its uuid.",
13352 * tags={"standard-patient"},
13353 * @OA\Parameter(
13354 * name="euuid",
13355 * in="path",
13356 * description="The uuid for the encounter.",
13357 * required=true,
13358 * @OA\Schema(
13359 * type="string"
13361 * ),
13362 * @OA\Response(
13363 * response="200",
13364 * ref="#/components/responses/standard"
13365 * ),
13366 * @OA\Response(
13367 * response="400",
13368 * ref="#/components/responses/badrequest"
13369 * ),
13370 * @OA\Response(
13371 * response="401",
13372 * ref="#/components/responses/unauthorized"
13373 * ),
13374 * security={{"openemr_auth":{}}}
13377 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
13378 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13379 RestConfig::apiLog($return);
13380 return $return;
13384 * @OA\Get(
13385 * path="/portal/patient/appointment",
13386 * description="Retrieves all appointments for a patient",
13387 * tags={"standard-patient"},
13388 * @OA\Response(
13389 * response="200",
13390 * ref="#/components/responses/standard"
13391 * ),
13392 * @OA\Response(
13393 * response="400",
13394 * ref="#/components/responses/badrequest"
13395 * ),
13396 * @OA\Response(
13397 * response="401",
13398 * ref="#/components/responses/unauthorized"
13399 * ),
13400 * security={{"openemr_auth":{}}}
13403 "GET /portal/patient/appointment" => function (HttpRestRequest $request) {
13404 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13405 RestConfig::apiLog($return);
13406 return $return;
13411 * @OA\Get(
13412 * path="/portal/patient/appointment/{auuid}",
13413 * description="Returns a selected appointment by its uuid.",
13414 * tags={"standard-patient"},
13415 * @OA\Parameter(
13416 * name="auuid",
13417 * in="path",
13418 * description="The uuid for the appointment.",
13419 * required=true,
13420 * @OA\Schema(
13421 * type="string"
13423 * ),
13424 * @OA\Response(
13425 * response="200",
13426 * ref="#/components/responses/standard"
13427 * ),
13428 * @OA\Response(
13429 * response="400",
13430 * ref="#/components/responses/badrequest"
13431 * ),
13432 * @OA\Response(
13433 * response="401",
13434 * ref="#/components/responses/unauthorized"
13435 * ),
13436 * security={{"openemr_auth":{}}}
13439 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest $request) {
13440 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13441 RestConfig::apiLog($return);
13442 return $return;