ensure always a unique installation id when need it (#4654)
[openemr.git] / _rest_routes.inc.php
blobb091911671fa8cb9a98e6de7ca5d853eba67bb27
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="6.1.0")
22 * @OA\Server(url="/apis/default/")
23 * @OA\SecurityScheme(
24 * securityScheme="openemr_auth",
25 * type="oauth2",
26 * @OA\Flow(
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
31 * scopes={
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "api:fhir": "FHIR R4 API",
35 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
36 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
37 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
38 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
39 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
40 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
41 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
42 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
43 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
44 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
45 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
46 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
47 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
48 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
49 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
50 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
51 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
52 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
53 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
54 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
55 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
56 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
57 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
58 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
59 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
60 * "system/Device.read": "Read all device resources in the system (api:fhir)",
61 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
62 * "system/Document.read": "Read all document resources in the system (api:fhir)",
63 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
64 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
65 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
66 * "system/Group.read": "Read all group resources in the system (api:fhir)",
67 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
68 * "system/Location.read": "Read all location resources in the system (api:fhir)",
69 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
70 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
71 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
72 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
73 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
74 * "system/Person.read": "Read all person resources in the system (api:fhir)",
75 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
76 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
77 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
78 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
79 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
80 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
81 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
82 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
83 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
84 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
85 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
86 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
87 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
88 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
89 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
90 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
91 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
92 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
93 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
94 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
95 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
96 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
97 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
98 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
99 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
100 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
101 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
102 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
103 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
104 * "api:oemr": "Standard OpenEMR API",
105 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
106 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
107 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
108 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
109 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
110 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
111 * "user/document.read": "Read documents the user has access to (api:oemr)",
112 * "user/document.write": "Write documents the user has access to (api:oemr)",
113 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
114 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
115 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
116 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
117 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
118 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
119 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
120 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
121 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
122 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
123 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
124 * "user/list.read": "Read lists the user has access to (api:oemr)",
125 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
126 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
127 * "user/medication.read": "Read medications the user has access to (api:oemr)",
128 * "user/medication.write": "Write medications the user has access to (api:oemr)",
129 * "user/message.write": "Read messages the user has access to (api:oemr)",
130 * "user/patient.read": "Read patients the user has access to (api:oemr)",
131 * "user/patient.write": "Write patients the user has access to (api:oemr)",
132 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
133 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
134 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
135 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
136 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
137 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
138 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
139 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
140 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
141 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
142 * "api:port": "Standard Patient Portal OpenEMR API",
143 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
144 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
148 * @OA\Tag(
149 * name="fhir",
150 * description="FHIR R4 API"
152 * @OA\Tag(
153 * name="standard",
154 * description="Standard OpenEMR API"
156 * @OA\Tag(
157 * name="standard-patient",
158 * description="Standard Patient Portal OpenEMR API"
160 * @OA\Response(
161 * response="standard",
162 * description="Standard Response",
163 * @OA\MediaType(
164 * mediaType="application/json",
165 * @OA\Schema(
166 * @OA\Property(
167 * property="validationErrors",
168 * description="Validation errors.",
169 * type="array",
170 * @OA\Items(
171 * type="object",
172 * ),
173 * ),
174 * @OA\Property(
175 * property="internalErrors",
176 * description="Internal errors.",
177 * type="array",
178 * @OA\Items(
179 * type="object",
180 * ),
181 * ),
182 * @OA\Property(
183 * property="data",
184 * description="Returned data.",
185 * type="array",
186 * @OA\Items(
187 * type="object",
188 * ),
189 * ),
190 * example={
191 * "validationErrors": {},
192 * "error_description": {},
193 * "data": {}
198 * @OA\Response(
199 * response="badrequest",
200 * description="Bad Request",
201 * @OA\MediaType(
202 * mediaType="application/json",
203 * @OA\Schema(
204 * @OA\Property(
205 * property="validationErrors",
206 * description="Validation errors.",
207 * type="object"
208 * ),
209 * example={
210 * "validationErrors":
212 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
218 * @OA\Response(
219 * response="unauthorized",
220 * description="Unauthorized",
221 * @OA\MediaType(
222 * mediaType="application/json",
223 * @OA\Schema(
224 * @OA\Property(
225 * property="error",
226 * description="The error.",
227 * type="string"
228 * ),
229 * @OA\Property(
230 * property="error_description",
231 * description="The description of the error.",
232 * type="string"
233 * ),
234 * @OA\Property(
235 * property="hint",
236 * description="More specific information on the error.",
237 * type="string"
238 * ),
239 * @OA\Property(
240 * property="message",
241 * description="Message regarding the error.",
242 * type="string"
243 * ),
244 * example={
245 * "error": "access_denied",
246 * "error_description": "The resource owner or authorization server denied the request.",
247 * "hint": "Missing ""Authorization"" header",
248 * "message": "The resource owner or authorization server denied the request."
253 * @OA\Response(
254 * response="uuidnotfound",
255 * description="Not Found",
256 * @OA\MediaType(
257 * mediaType="application/json",
258 * @OA\Schema(
259 * @OA\Property(
260 * property="empty",
261 * description="empty",
262 * type="object"
263 * ),
264 * example={}
270 // Lets keep our controller classes with the routes.
272 use OpenEMR\Common\Acl\AccessDeniedException;
273 use OpenEMR\Common\Http\HttpRestRequest;
274 use OpenEMR\RestControllers\AllergyIntoleranceRestController;
275 use OpenEMR\RestControllers\FacilityRestController;
276 use OpenEMR\RestControllers\VersionRestController;
277 use OpenEMR\RestControllers\ProductRegistrationRestController;
278 use OpenEMR\RestControllers\PatientRestController;
279 use OpenEMR\RestControllers\EncounterRestController;
280 use OpenEMR\RestControllers\PractitionerRestController;
281 use OpenEMR\RestControllers\ListRestController;
282 use OpenEMR\RestControllers\InsuranceCompanyRestController;
283 use OpenEMR\RestControllers\AppointmentRestController;
284 use OpenEMR\RestControllers\ConditionRestController;
285 use OpenEMR\RestControllers\ONoteRestController;
286 use OpenEMR\RestControllers\DocumentRestController;
287 use OpenEMR\RestControllers\DrugRestController;
288 use OpenEMR\RestControllers\ImmunizationRestController;
289 use OpenEMR\RestControllers\InsuranceRestController;
290 use OpenEMR\RestControllers\MessageRestController;
291 use OpenEMR\RestControllers\PrescriptionRestController;
292 use OpenEMR\RestControllers\ProcedureRestController;
294 // Note some Http clients may not send auth as json so a function
295 // is implemented to determine and parse encoding on auth route's.
297 // Note that the api route is only for users role
298 // (there is a mechanism in place to ensure only user role can access the api route)
299 RestConfig::$ROUTE_MAP = array(
301 * @OA\Get(
302 * path="/api/facility",
303 * description="Returns a single facility.",
304 * tags={"standard"},
305 * @OA\Parameter(
306 * name="name",
307 * in="query",
308 * description="The name for the facility.",
309 * required=false,
310 * @OA\Schema(
311 * type="string"
313 * ),
314 * @OA\Parameter(
315 * name="facility_npi",
316 * in="query",
317 * description="The facility_npi for the facility.",
318 * required=false,
319 * @OA\Schema(
320 * type="string"
322 * ),
323 * @OA\Parameter(
324 * name="phone",
325 * in="query",
326 * description="The phone for the facility.",
327 * required=false,
328 * @OA\Schema(
329 * type="string"
331 * ),
332 * @OA\Parameter(
333 * name="fax",
334 * in="query",
335 * description="The fax for the facility.",
336 * required=false,
337 * @OA\Schema(
338 * type="string"
340 * ),
341 * @OA\Parameter(
342 * name="street",
343 * in="query",
344 * description="The street for the facility.",
345 * required=false,
346 * @OA\Schema(
347 * type="string"
349 * ),
350 * @OA\Parameter(
351 * name="city",
352 * in="query",
353 * description="The city for the facility.",
354 * required=false,
355 * @OA\Schema(
356 * type="string"
358 * ),
359 * @OA\Parameter(
360 * name="state",
361 * in="query",
362 * description="The state for the facility.",
363 * required=false,
364 * @OA\Schema(
365 * type="string"
367 * ),
368 * @OA\Parameter(
369 * name="postal_code",
370 * in="query",
371 * description="The postal_code for the facility.",
372 * required=false,
373 * @OA\Schema(
374 * type="string"
376 * ),
377 * @OA\Parameter(
378 * name="country_code",
379 * in="query",
380 * description="The country_code for the facility.",
381 * required=false,
382 * @OA\Schema(
383 * type="string"
385 * ),
386 * @OA\Parameter(
387 * name="federal_ein",
388 * in="query",
389 * description="The federal_ein for the facility.",
390 * required=false,
391 * @OA\Schema(
392 * type="string"
394 * ),
395 * @OA\Parameter(
396 * name="website",
397 * in="query",
398 * description="The website for the facility.",
399 * required=false,
400 * @OA\Schema(
401 * type="string"
403 * ),
404 * @OA\Parameter(
405 * name="email",
406 * in="query",
407 * description="The email for the facility.",
408 * required=false,
409 * @OA\Schema(
410 * type="string"
412 * ),
413 * @OA\Parameter(
414 * name="domain_identifier",
415 * in="query",
416 * description="The domain_identifier for the facility.",
417 * required=false,
418 * @OA\Schema(
419 * type="string"
421 * ),
422 * @OA\Parameter(
423 * name="facility_taxonomy",
424 * in="query",
425 * description="The facility_taxonomy for the facility.",
426 * required=false,
427 * @OA\Schema(
428 * type="string"
430 * ),
431 * @OA\Parameter(
432 * name="facility_code",
433 * in="query",
434 * description="The facility_code for the facility.",
435 * required=false,
436 * @OA\Schema(
437 * type="string"
439 * ),
440 * @OA\Parameter(
441 * name="billing_location",
442 * in="query",
443 * description="The billing_location setting for the facility.",
444 * required=false,
445 * @OA\Schema(
446 * type="string"
448 * ),
449 * @OA\Parameter(
450 * name="accepts_assignment",
451 * in="query",
452 * description="The accepts_assignment setting for the facility.",
453 * required=false,
454 * @OA\Schema(
455 * type="string"
457 * ),
458 * @OA\Parameter(
459 * name="oid",
460 * in="query",
461 * description="The oid for the facility.",
462 * required=false,
463 * @OA\Schema(
464 * type="string"
466 * ),
467 * @OA\Parameter(
468 * name="service_location",
469 * in="query",
470 * description="The service_location setting for the facility.",
471 * required=false,
472 * @OA\Schema(
473 * type="string"
475 * ),
476 * @OA\Response(
477 * response="200",
478 * ref="#/components/responses/standard"
479 * ),
480 * @OA\Response(
481 * response="400",
482 * ref="#/components/responses/badrequest"
483 * ),
484 * @OA\Response(
485 * response="401",
486 * ref="#/components/responses/unauthorized"
487 * ),
488 * security={{"openemr_auth":{}}}
491 "GET /api/facility" => function () {
492 RestConfig::authorization_check("admin", "users");
493 $return = (new FacilityRestController())->getAll($_GET);
494 RestConfig::apiLog($return);
495 return $return;
499 * @OA\Get(
500 * path="/api/facility/{fuuid}",
501 * description="Returns a single facility.",
502 * tags={"standard"},
503 * @OA\Parameter(
504 * name="fuuid",
505 * in="path",
506 * description="The uuid for the facility.",
507 * required=true,
508 * @OA\Schema(
509 * type="string"
511 * ),
512 * @OA\Response(
513 * response="200",
514 * ref="#/components/responses/standard"
515 * ),
516 * @OA\Response(
517 * response="400",
518 * ref="#/components/responses/badrequest"
519 * ),
520 * @OA\Response(
521 * response="401",
522 * ref="#/components/responses/unauthorized"
523 * ),
524 * security={{"openemr_auth":{}}}
527 "GET /api/facility/:fuuid" => function ($fuuid) {
528 RestConfig::authorization_check("admin", "users");
529 $return = (new FacilityRestController())->getOne($fuuid);
530 RestConfig::apiLog($return);
531 return $return;
535 * @OA\Post(
536 * path="/api/facility",
537 * description="Creates a facility in the system",
538 * tags={"standard"},
539 * @OA\RequestBody(
540 * required=true,
541 * @OA\MediaType(
542 * mediaType="application/json",
543 * @OA\Schema(
544 * @OA\Property(
545 * property="name",
546 * description="The name for the facility.",
547 * type="string"
548 * ),
549 * @OA\Property(
550 * property="facility_npi",
551 * description="The facility_npi for the facility.",
552 * type="string"
553 * ),
554 * @OA\Property(
555 * property="phone",
556 * description="The phone for the facility.",
557 * type="string"
558 * ),
559 * @OA\Property(
560 * property="fax",
561 * description="The fax for the facility.",
562 * type="string"
563 * ),
564 * @OA\Property(
565 * property="street",
566 * description="The street for the facility.",
567 * type="string"
568 * ),
569 * @OA\Property(
570 * property="city",
571 * description="The city for the facility.",
572 * type="string"
573 * ),
574 * @OA\Property(
575 * property="state",
576 * description="The state for the facility.",
577 * type="string"
578 * ),
579 * @OA\Property(
580 * property="postal_code",
581 * description="The postal_code for the facility.",
582 * type="string"
583 * ),
584 * @OA\Property(
585 * property="country_code",
586 * description="The country_code for the facility.",
587 * type="string"
588 * ),
589 * @OA\Property(
590 * property="federal_ein",
591 * description="The federal_ein for the facility.",
592 * type="string"
593 * ),
594 * @OA\Property(
595 * property="website",
596 * description="The website for the facility.",
597 * type="string"
598 * ),
599 * @OA\Property(
600 * property="email",
601 * description="The email for the facility.",
602 * type="string"
603 * ),
604 * @OA\Property(
605 * property="domain_identifier",
606 * description="The domain_identifier for the facility.",
607 * type="string"
608 * ),
609 * @OA\Property(
610 * property="facility_taxonomy",
611 * description="The facility_taxonomy for the facility.",
612 * type="string"
613 * ),
614 * @OA\Property(
615 * property="facility_code",
616 * description="The facility_code for the facility.",
617 * type="string"
618 * ),
619 * @OA\Property(
620 * property="billing_location",
621 * description="The billing_location setting for the facility.",
622 * type="string"
623 * ),
624 * @OA\Property(
625 * property="accepts_assignment",
626 * description="The accepts_assignment setting for the facility.",
627 * type="string"
628 * ),
629 * @OA\Property(
630 * property="oid",
631 * description="The oid for the facility.",
632 * type="string"
633 * ),
634 * @OA\Property(
635 * property="service_location",
636 * description="The service_location setting for the facility.",
637 * type="string"
638 * ),
639 * required={"name", "facility_npi"},
640 * example={
641 * "name": "Aquaria",
642 * "facility_npi": "123456789123",
643 * "phone": "808-606-3030",
644 * "fax": "808-606-3031",
645 * "street": "1337 Bit Shifter Ln",
646 * "city": "San Lorenzo",
647 * "state": "ZZ",
648 * "postal_code": "54321",
649 * "country_code": "US",
650 * "federal_ein": "4343434",
651 * "website": "https://example.com",
652 * "email": "foo@bar.com",
653 * "domain_identifier": "",
654 * "facility_taxonomy": "",
655 * "facility_code": "",
656 * "billing_location": "1",
657 * "accepts_assignment": "1",
658 * "oid": "",
659 * "service_location": "1"
663 * ),
664 * @OA\Response(
665 * response="200",
666 * ref="#/components/responses/standard"
667 * ),
668 * @OA\Response(
669 * response="400",
670 * ref="#/components/responses/badrequest"
671 * ),
672 * @OA\Response(
673 * response="401",
674 * ref="#/components/responses/unauthorized"
675 * ),
676 * security={{"openemr_auth":{}}}
679 "POST /api/facility" => function () {
680 RestConfig::authorization_check("admin", "super");
681 $data = (array) (json_decode(file_get_contents("php://input")));
682 $return = (new FacilityRestController())->post($data);
683 RestConfig::apiLog($return, $data);
684 return $return;
688 * @OA\Put(
689 * path="/api/facility/{fuuid}",
690 * description="Updates a facility in the system",
691 * tags={"standard"},
692 * @OA\Parameter(
693 * name="fuuid",
694 * in="path",
695 * description="The uuid for the facility.",
696 * required=true,
697 * @OA\Schema(
698 * type="string"
700 * ),
701 * @OA\RequestBody(
702 * required=true,
703 * @OA\MediaType(
704 * mediaType="application/json",
705 * @OA\Schema(
706 * @OA\Property(
707 * property="name",
708 * description="The name for the facility.",
709 * type="string"
710 * ),
711 * @OA\Property(
712 * property="facility_npi",
713 * description="The facility_npi for the facility.",
714 * type="string"
715 * ),
716 * @OA\Property(
717 * property="phone",
718 * description="The phone for the facility.",
719 * type="string"
720 * ),
721 * @OA\Property(
722 * property="fax",
723 * description="The fax for the facility.",
724 * type="string"
725 * ),
726 * @OA\Property(
727 * property="street",
728 * description="The street for the facility.",
729 * type="string"
730 * ),
731 * @OA\Property(
732 * property="city",
733 * description="The city for the facility.",
734 * type="string"
735 * ),
736 * @OA\Property(
737 * property="state",
738 * description="The state for the facility.",
739 * type="string"
740 * ),
741 * @OA\Property(
742 * property="postal_code",
743 * description="The postal_code for the facility.",
744 * type="string"
745 * ),
746 * @OA\Property(
747 * property="country_code",
748 * description="The country_code for the facility.",
749 * type="string"
750 * ),
751 * @OA\Property(
752 * property="federal_ein",
753 * description="The federal_ein for the facility.",
754 * type="string"
755 * ),
756 * @OA\Property(
757 * property="website",
758 * description="The website for the facility.",
759 * type="string"
760 * ),
761 * @OA\Property(
762 * property="email",
763 * description="The email for the facility.",
764 * type="string"
765 * ),
766 * @OA\Property(
767 * property="domain_identifier",
768 * description="The domain_identifier for the facility.",
769 * type="string"
770 * ),
771 * @OA\Property(
772 * property="facility_taxonomy",
773 * description="The facility_taxonomy for the facility.",
774 * type="string"
775 * ),
776 * @OA\Property(
777 * property="facility_code",
778 * description="The facility_code for the facility.",
779 * type="string"
780 * ),
781 * @OA\Property(
782 * property="billing_location",
783 * description="The billing_location setting for the facility.",
784 * type="string"
785 * ),
786 * @OA\Property(
787 * property="accepts_assignment",
788 * description="The accepts_assignment setting for the facility.",
789 * type="string"
790 * ),
791 * @OA\Property(
792 * property="oid",
793 * description="The oid for the facility.",
794 * type="string"
795 * ),
796 * @OA\Property(
797 * property="service_location",
798 * description="The service_location setting for the facility.",
799 * type="string"
800 * ),
801 * example={
802 * "name": "Aquaria",
803 * "facility_npi": "123456789123",
804 * "phone": "808-606-3030",
805 * "fax": "808-606-3031",
806 * "street": "1337 Bit Shifter Ln",
807 * "city": "San Lorenzo",
808 * "state": "ZZ",
809 * "postal_code": "54321",
810 * "country_code": "US",
811 * "federal_ein": "4343434",
812 * "website": "https://example.com",
813 * "email": "foo@bar.com",
814 * "domain_identifier": "",
815 * "facility_taxonomy": "",
816 * "facility_code": "",
817 * "billing_location": "1",
818 * "accepts_assignment": "1",
819 * "oid": "",
820 * "service_location": "1"
824 * ),
825 * @OA\Response(
826 * response="200",
827 * ref="#/components/responses/standard"
828 * ),
829 * @OA\Response(
830 * response="400",
831 * ref="#/components/responses/badrequest"
832 * ),
833 * @OA\Response(
834 * response="401",
835 * ref="#/components/responses/unauthorized"
836 * ),
837 * security={{"openemr_auth":{}}}
840 "PUT /api/facility/:fuuid" => function ($fuuid) {
841 RestConfig::authorization_check("admin", "super");
842 $data = (array) (json_decode(file_get_contents("php://input")));
843 $return = (new FacilityRestController())->patch($fuuid, $data);
844 RestConfig::apiLog($return, $data);
845 return $return;
849 * @OA\Get(
850 * path="/api/patient",
851 * description="Retrieves a list of patients",
852 * tags={"standard"},
853 * @OA\Parameter(
854 * name="fname",
855 * in="query",
856 * description="The first name for the patient.",
857 * required=false,
858 * @OA\Schema(
859 * type="string"
861 * ),
862 * @OA\Parameter(
863 * name="lname",
864 * in="query",
865 * description="The last name for the patient.",
866 * required=false,
867 * @OA\Schema(
868 * type="string"
870 * ),
871 * @OA\Parameter(
872 * name="ss",
873 * in="query",
874 * description="The social security number for the patient.",
875 * required=false,
876 * @OA\Schema(
877 * type="string"
879 * ),
880 * @OA\Parameter(
881 * name="street",
882 * in="query",
883 * description="The street for the patient.",
884 * required=false,
885 * @OA\Schema(
886 * type="string"
888 * ),
889 * @OA\Parameter(
890 * name="postal_code",
891 * in="query",
892 * description="The postal code for the patient.",
893 * required=false,
894 * @OA\Schema(
895 * type="string"
897 * ),
898 * @OA\Parameter(
899 * name="city",
900 * in="query",
901 * description="The city for the patient.",
902 * required=false,
903 * @OA\Schema(
904 * type="string"
906 * ),
907 * @OA\Parameter(
908 * name="state",
909 * in="query",
910 * description="The state for the patient.",
911 * required=false,
912 * @OA\Schema(
913 * type="string"
915 * ),
916 * @OA\Parameter(
917 * name="phone_home",
918 * in="query",
919 * description="The home phone for the patient.",
920 * required=false,
921 * @OA\Schema(
922 * type="string"
924 * ),
925 * @OA\Parameter(
926 * name="phone_biz",
927 * in="query",
928 * description="The business phone for the patient.",
929 * required=false,
930 * @OA\Schema(
931 * type="string"
933 * ),
934 * @OA\Parameter(
935 * name="phone_cell",
936 * in="query",
937 * description="The cell phone for the patient.",
938 * required=false,
939 * @OA\Schema(
940 * type="string"
942 * ),
943 * @OA\Parameter(
944 * name="postal_contact",
945 * in="query",
946 * description="The postal_contact for the patient.",
947 * required=false,
948 * @OA\Schema(
949 * type="string"
951 * ),
952 * @OA\Parameter(
953 * name="sex",
954 * in="query",
955 * description="The gender for the patient.",
956 * required=false,
957 * @OA\Schema(
958 * type="string"
960 * ),
961 * @OA\Parameter(
962 * name="country_code",
963 * in="query",
964 * description="The country code for the patient.",
965 * required=false,
966 * @OA\Schema(
967 * type="string"
969 * ),
970 * @OA\Parameter(
971 * name="email",
972 * in="query",
973 * description="The email for the patient.",
974 * required=false,
975 * @OA\Schema(
976 * type="string"
978 * ),
979 * @OA\Parameter(
980 * name="DOB",
981 * in="query",
982 * description="The DOB for the patient.",
983 * required=false,
984 * @OA\Schema(
985 * type="string"
987 * ),
988 * @OA\Response(
989 * response="200",
990 * ref="#/components/responses/standard"
991 * ),
992 * @OA\Response(
993 * response="400",
994 * ref="#/components/responses/badrequest"
995 * ),
996 * @OA\Response(
997 * response="401",
998 * ref="#/components/responses/unauthorized"
999 * ),
1000 * security={{"openemr_auth":{}}}
1003 "GET /api/patient" => function () {
1004 RestConfig::authorization_check("patients", "demo");
1005 $return = (new PatientRestController())->getAll($_GET);
1006 RestConfig::apiLog($return);
1007 return $return;
1011 * Schema for the patient request
1013 * @OA\Schema(
1014 * schema="api_patient_request",
1015 * @OA\Property(
1016 * property="title",
1017 * description="The title of patient.",
1018 * type="string"
1019 * ),
1020 * @OA\Property(
1021 * property="fname",
1022 * description="The fname of patient.",
1023 * type="string"
1024 * ),
1025 * @OA\Property(
1026 * property="mname",
1027 * description="The mname of patient.",
1028 * type="string"
1029 * ),
1030 * @OA\Property(
1031 * property="lname",
1032 * description="The lname of patient.",
1033 * type="string"
1034 * ),
1035 * @OA\Property(
1036 * property="street",
1037 * description="The street address of patient.",
1038 * type="string"
1039 * ),
1040 * @OA\Property(
1041 * property="postal_code",
1042 * description="The postal code of patient.",
1043 * type="string"
1044 * ),
1045 * @OA\Property(
1046 * property="city",
1047 * description="The city of patient.",
1048 * type="string"
1049 * ),
1050 * @OA\Property(
1051 * property="state",
1052 * description="The state of patient.",
1053 * type="string"
1054 * ),
1055 * @OA\Property(
1056 * property="country_code",
1057 * description="The country code of patient.",
1058 * type="string"
1059 * ),
1060 * @OA\Property(
1061 * property="phone_contact",
1062 * description="The phone contact of patient.",
1063 * type="string"
1064 * ),
1065 * @OA\Property(
1066 * property="DOB",
1067 * description="The DOB of patient.",
1068 * type="string"
1069 * ),
1070 * @OA\Property(
1071 * property="sex",
1072 * description="The lname of patient.",
1073 * type="string"
1074 * ),
1075 * @OA\Property(
1076 * property="race",
1077 * description="The race of patient.",
1078 * type="string"
1079 * ),
1080 * @OA\Property(
1081 * property="ethnicity",
1082 * description="The ethnicity of patient.",
1083 * type="string"
1084 * ),
1085 * required={"fname", "lname", "DOB", "sex"},
1086 * example={
1087 * "title": "Mr",
1088 * "fname": "Foo",
1089 * "mname": "",
1090 * "lname": "Bar",
1091 * "street": "456 Tree Lane",
1092 * "postal_code": "08642",
1093 * "city": "FooTown",
1094 * "state": "FL",
1095 * "country_code": "US",
1096 * "phone_contact": "123-456-7890",
1097 * "DOB": "1992-02-02",
1098 * "sex": "Male",
1099 * "race": "",
1100 * "ethnicity": ""
1105 * @OA\Post(
1106 * path="/api/patient",
1107 * description="Creates a new patient",
1108 * tags={"standard"},
1109 * @OA\RequestBody(
1110 * required=true,
1111 * @OA\MediaType(
1112 * mediaType="application/json",
1113 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1115 * ),
1116 * @OA\Response(
1117 * response="200",
1118 * description="Standard response",
1119 * @OA\MediaType(
1120 * mediaType="application/json",
1121 * @OA\Schema(
1122 * @OA\Property(
1123 * property="validationErrors",
1124 * description="Validation errors.",
1125 * type="array",
1126 * @OA\Items(
1127 * type="object",
1128 * ),
1129 * ),
1130 * @OA\Property(
1131 * property="internalErrors",
1132 * description="Internal errors.",
1133 * type="array",
1134 * @OA\Items(
1135 * type="object",
1136 * ),
1137 * ),
1138 * @OA\Property(
1139 * property="data",
1140 * description="Returned data.",
1141 * type="array",
1142 * @OA\Items(
1143 * @OA\Property(
1144 * property="pid",
1145 * description="patient pid",
1146 * type="integer",
1148 * ),
1149 * ),
1150 * example={
1151 * "validationErrors": {},
1152 * "error_description": {},
1153 * "data": {
1154 * "pid": 1
1159 * ),
1160 * @OA\Response(
1161 * response="401",
1162 * ref="#/components/responses/unauthorized"
1163 * ),
1164 * security={{"openemr_auth":{}}}
1167 "POST /api/patient" => function () {
1168 RestConfig::authorization_check("patients", "demo");
1169 $data = (array) (json_decode(file_get_contents("php://input")));
1170 $return = (new PatientRestController())->post($data);
1171 RestConfig::apiLog($return, $data);
1172 return $return;
1176 * Schema for the patient response
1178 * @OA\Schema(
1179 * schema="api_patient_response",
1180 * @OA\Property(
1181 * property="validationErrors",
1182 * description="Validation errors.",
1183 * type="array",
1184 * @OA\Items(
1185 * type="object",
1186 * ),
1187 * ),
1188 * @OA\Property(
1189 * property="internalErrors",
1190 * description="Internal errors.",
1191 * type="array",
1192 * @OA\Items(
1193 * type="object",
1194 * ),
1195 * ),
1196 * @OA\Property(
1197 * property="data",
1198 * description="Returned data.",
1199 * type="array",
1200 * @OA\Items(
1201 * @OA\Property(
1202 * property="id",
1203 * description="patient id",
1204 * type="string",
1205 * ),
1206 * @OA\Property(
1207 * property="pid",
1208 * description="patient pid",
1209 * type="string",
1210 * ),
1211 * @OA\Property(
1212 * property="pubpid",
1213 * description="patient public id",
1214 * type="string",
1215 * ),
1216 * @OA\Property(
1217 * property="title",
1218 * description="patient title",
1219 * type="string",
1220 * ),
1221 * @OA\Property(
1222 * property="fname",
1223 * description="patient first name",
1224 * type="string",
1225 * ),
1226 * @OA\Property(
1227 * property="mname",
1228 * description="patient middle name",
1229 * type="string",
1230 * ),
1231 * @OA\Property(
1232 * property="lname",
1233 * description="patient last name",
1234 * type="string",
1235 * ),
1236 * @OA\Property(
1237 * property="ss",
1238 * description="patient social security number",
1239 * type="string",
1240 * ),
1241 * @OA\Property(
1242 * property="street",
1243 * description="patient street address",
1244 * type="string",
1245 * ),
1246 * @OA\Property(
1247 * property="postal_code",
1248 * description="patient postal code",
1249 * type="string",
1250 * ),
1251 * @OA\Property(
1252 * property="city",
1253 * description="patient city",
1254 * type="string",
1255 * ),
1256 * @OA\Property(
1257 * property="state",
1258 * description="patient state",
1259 * type="string",
1260 * ),
1261 * @OA\Property(
1262 * property="county",
1263 * description="patient county",
1264 * type="string",
1265 * ),
1266 * @OA\Property(
1267 * property="country_code",
1268 * description="patient country code",
1269 * type="string",
1270 * ),
1271 * @OA\Property(
1272 * property="drivers_license",
1273 * description="patient drivers license id",
1274 * type="string",
1275 * ),
1276 * @OA\Property(
1277 * property="contact_relationship",
1278 * description="patient contact relationship",
1279 * type="string",
1280 * ),
1281 * @OA\Property(
1282 * property="phone_contact",
1283 * description="patient phone contact",
1284 * type="string",
1285 * ),
1286 * @OA\Property(
1287 * property="phone_home",
1288 * description="patient home phone",
1289 * type="string",
1290 * ),
1291 * @OA\Property(
1292 * property="phone_biz",
1293 * description="patient work phone",
1294 * type="string",
1295 * ),
1296 * @OA\Property(
1297 * property="phone_cell",
1298 * description="patient mobile phone",
1299 * type="string",
1300 * ),
1301 * @OA\Property(
1302 * property="email",
1303 * description="patient email",
1304 * type="string",
1305 * ),
1306 * @OA\Property(
1307 * property="DOB",
1308 * description="patient DOB",
1309 * type="string",
1310 * ),
1311 * @OA\Property(
1312 * property="sex",
1313 * description="patient sex (gender)",
1314 * type="string",
1315 * ),
1316 * @OA\Property(
1317 * property="race",
1318 * description="patient race",
1319 * type="string",
1320 * ),
1321 * @OA\Property(
1322 * property="ethnicity",
1323 * description="patient ethnicity",
1324 * type="string",
1325 * ),
1326 * @OA\Property(
1327 * property="status",
1328 * description="patient status",
1329 * type="string",
1330 * ),
1331 * ),
1332 * ),
1333 * example={
1334 * "validationErrors": {},
1335 * "error_description": {},
1336 * "data": {
1337 * "id": "193",
1338 * "pid": "1",
1339 * "pubpid": "",
1340 * "title": "Mr",
1341 * "fname": "Baz",
1342 * "mname": "",
1343 * "lname": "Bop",
1344 * "ss": "",
1345 * "street": "456 Tree Lane",
1346 * "postal_code": "08642",
1347 * "city": "FooTown",
1348 * "state": "FL",
1349 * "county": "",
1350 * "country_code": "US",
1351 * "drivers_license": "",
1352 * "contact_relationship": "",
1353 * "phone_contact": "123-456-7890",
1354 * "phone_home": "",
1355 * "phone_biz": "",
1356 * "phone_cell": "",
1357 * "email": "",
1358 * "DOB": "1992-02-03",
1359 * "sex": "Male",
1360 * "race": "",
1361 * "ethnicity": "",
1362 * "status": ""
1368 * @OA\Put(
1369 * path="/api/patient/{puuid}",
1370 * description="Updates a patient",
1371 * tags={"standard"},
1372 * @OA\Parameter(
1373 * name="puuid",
1374 * in="path",
1375 * description="The uuid for the patient.",
1376 * required=true,
1377 * @OA\Schema(
1378 * type="string"
1380 * ),
1381 * @OA\RequestBody(
1382 * required=true,
1383 * @OA\MediaType(
1384 * mediaType="application/json",
1385 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1387 * ),
1388 * @OA\Response(
1389 * response="200",
1390 * description="Standard response",
1391 * @OA\MediaType(
1392 * mediaType="application/json",
1393 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1395 * ),
1396 * @OA\Response(
1397 * response="401",
1398 * ref="#/components/responses/unauthorized"
1399 * ),
1400 * security={{"openemr_auth":{}}}
1403 "PUT /api/patient/:puuid" => function ($puuid) {
1404 RestConfig::authorization_check("patients", "demo");
1405 $data = (array) (json_decode(file_get_contents("php://input")));
1406 $return = (new PatientRestController())->put($puuid, $data);
1407 RestConfig::apiLog($return, $data);
1408 return $return;
1412 * @OA\Get(
1413 * path="/api/patient/{puuid}",
1414 * description="Retrieves a single patient by their uuid",
1415 * tags={"standard"},
1416 * @OA\Parameter(
1417 * name="puuid",
1418 * in="path",
1419 * description="The uuid for the patient.",
1420 * required=true,
1421 * @OA\Schema(
1422 * type="string"
1424 * ),
1425 * @OA\Response(
1426 * response="200",
1427 * description="Standard response",
1428 * @OA\MediaType(
1429 * mediaType="application/json",
1430 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1432 * ),
1433 * @OA\Response(
1434 * response="401",
1435 * ref="#/components/responses/unauthorized"
1436 * ),
1437 * security={{"openemr_auth":{}}}
1440 "GET /api/patient/:puuid" => function ($puuid) {
1441 RestConfig::authorization_check("patients", "demo");
1442 $return = (new PatientRestController())->getOne($puuid);
1443 RestConfig::apiLog($return);
1444 return $return;
1448 * @OA\Get(
1449 * path="/api/patient/{puuid}/encounter",
1450 * description="Retrieves a list of encounters for a single patient",
1451 * tags={"standard"},
1452 * @OA\Parameter(
1453 * name="puuid",
1454 * in="path",
1455 * description="The uuid for the patient.",
1456 * required=true,
1457 * @OA\Schema(
1458 * type="string"
1460 * ),
1461 * @OA\Response(
1462 * response="200",
1463 * ref="#/components/responses/standard"
1464 * ),
1465 * @OA\Response(
1466 * response="400",
1467 * ref="#/components/responses/badrequest"
1468 * ),
1469 * @OA\Response(
1470 * response="401",
1471 * ref="#/components/responses/unauthorized"
1472 * ),
1473 * security={{"openemr_auth":{}}}
1476 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1477 RestConfig::authorization_check("encounters", "auth_a");
1478 $return = (new EncounterRestController())->getAll($puuid);
1479 RestConfig::apiLog($return);
1480 return $return;
1484 * Schema for the encounter request
1486 * @OA\Schema(
1487 * schema="api_encounter_request",
1488 * @OA\Property(
1489 * property="date",
1490 * description="The date of encounter.",
1491 * type="string"
1492 * ),
1493 * @OA\Property(
1494 * property="onset_date",
1495 * description="The onset date of encounter.",
1496 * type="string"
1497 * ),
1498 * @OA\Property(
1499 * property="reason",
1500 * description="The reason of encounter.",
1501 * type="string"
1502 * ),
1503 * @OA\Property(
1504 * property="facility",
1505 * description="The facility of encounter.",
1506 * type="string"
1507 * ),
1508 * @OA\Property(
1509 * property="pc_catid",
1510 * description="The pc_catid of encounter.",
1511 * type="string"
1512 * ),
1513 * @OA\Property(
1514 * property="facility_id",
1515 * description="The facility id of encounter.",
1516 * type="string"
1517 * ),
1518 * @OA\Property(
1519 * property="billing_facility",
1520 * description="The billing facility id of encounter.",
1521 * type="string"
1522 * ),
1523 * @OA\Property(
1524 * property="sensitivity",
1525 * description="The sensitivity of encounter.",
1526 * type="string"
1527 * ),
1528 * @OA\Property(
1529 * property="referral_source",
1530 * description="The referral source of encounter.",
1531 * type="string"
1532 * ),
1533 * @OA\Property(
1534 * property="pos_code",
1535 * description="The pos_code of encounter.",
1536 * type="string"
1537 * ),
1538 * @OA\Property(
1539 * property="external_id",
1540 * description="The external id of encounter.",
1541 * type="string"
1542 * ),
1543 * @OA\Property(
1544 * property="provider_id",
1545 * description="The provider id of encounter.",
1546 * type="string"
1547 * ),
1548 * @OA\Property(
1549 * property="class_code",
1550 * description="The class_code of encounter.",
1551 * type="string"
1552 * ),
1553 * required={"pc_catid", "class_code"},
1554 * example={
1555 * "date":"2020-11-10",
1556 * "onset_date": "",
1557 * "reason": "Pregnancy Test",
1558 * "facility": "Owerri General Hospital",
1559 * "pc_catid": "5",
1560 * "facility_id": "3",
1561 * "billing_facility": "3",
1562 * "sensitivity": "normal",
1563 * "referral_source": "",
1564 * "pos_code": "0",
1565 * "external_id": "",
1566 * "provider_id": "1",
1567 * "class_code" : "AMB"
1572 * @OA\Post(
1573 * path="/api/patient/{puuid}/encounter",
1574 * description="Creates a new encounter",
1575 * tags={"standard"},
1576 * @OA\Parameter(
1577 * name="puuid",
1578 * in="path",
1579 * description="The uuid for the patient.",
1580 * required=true,
1581 * @OA\Schema(
1582 * type="string"
1584 * ),
1585 * @OA\RequestBody(
1586 * required=true,
1587 * @OA\MediaType(
1588 * mediaType="application/json",
1589 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1591 * ),
1592 * @OA\Response(
1593 * response="200",
1594 * description="Standard response",
1595 * @OA\MediaType(
1596 * mediaType="application/json",
1597 * @OA\Schema(
1598 * @OA\Property(
1599 * property="validationErrors",
1600 * description="Validation errors.",
1601 * type="array",
1602 * @OA\Items(
1603 * type="object",
1604 * ),
1605 * ),
1606 * @OA\Property(
1607 * property="internalErrors",
1608 * description="Internal errors.",
1609 * type="array",
1610 * @OA\Items(
1611 * type="object",
1612 * ),
1613 * ),
1614 * @OA\Property(
1615 * property="data",
1616 * description="Returned data.",
1617 * type="array",
1618 * @OA\Items(
1619 * @OA\Property(
1620 * property="encounter",
1621 * description="encounter id",
1622 * type="integer",
1623 * ),
1624 * @OA\Property(
1625 * property="uuid",
1626 * description="encounter uuid",
1627 * type="string",
1629 * ),
1630 * ),
1631 * example={
1632 * "validationErrors": {},
1633 * "error_description": {},
1634 * "data": {
1635 * "encounter": 1,
1636 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1641 * ),
1642 * @OA\Response(
1643 * response="401",
1644 * ref="#/components/responses/unauthorized"
1645 * ),
1646 * security={{"openemr_auth":{}}}
1649 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1650 RestConfig::authorization_check("encounters", "auth_a");
1651 $data = (array) (json_decode(file_get_contents("php://input")));
1652 $return = (new EncounterRestController())->post($puuid, $data);
1653 RestConfig::apiLog($return, $data);
1654 return $return;
1658 * Schema for the encounter response
1660 * @OA\Schema(
1661 * schema="api_encounter_response",
1662 * @OA\Property(
1663 * property="validationErrors",
1664 * description="Validation errors.",
1665 * type="array",
1666 * @OA\Items(
1667 * type="object",
1668 * ),
1669 * ),
1670 * @OA\Property(
1671 * property="internalErrors",
1672 * description="Internal errors.",
1673 * type="array",
1674 * @OA\Items(
1675 * type="object",
1676 * ),
1677 * ),
1678 * @OA\Property(
1679 * property="data",
1680 * description="Returned data.",
1681 * type="array",
1682 * @OA\Items(
1683 * @OA\Property(
1684 * property="id",
1685 * description="encounter id",
1686 * type="string",
1687 * ),
1688 * @OA\Property(
1689 * property="uuid",
1690 * description="encounter uuid",
1691 * type="string",
1692 * ),
1693 * @OA\Property(
1694 * property="date",
1695 * description="encounter date",
1696 * type="string",
1697 * ),
1698 * @OA\Property(
1699 * property="reason",
1700 * description="encounter reason",
1701 * type="string",
1702 * ),
1703 * @OA\Property(
1704 * property="facility",
1705 * description="encounter facility name",
1706 * type="string",
1707 * ),
1708 * @OA\Property(
1709 * property="facility_id",
1710 * description="encounter facility id name",
1711 * type="string",
1712 * ),
1713 * @OA\Property(
1714 * property="pid",
1715 * description="encounter for patient pid",
1716 * type="string",
1717 * ),
1718 * @OA\Property(
1719 * property="onset_date",
1720 * description="encounter onset date",
1721 * type="string",
1722 * ),
1723 * @OA\Property(
1724 * property="sensitivity",
1725 * description="encounter sensitivity",
1726 * type="string",
1727 * ),
1728 * @OA\Property(
1729 * property="billing_note",
1730 * description="encounter billing note",
1731 * type="string",
1732 * ),
1733 * @OA\Property(
1734 * property="pc_catid",
1735 * description="encounter pc_catid",
1736 * type="string",
1737 * ),
1738 * @OA\Property(
1739 * property="last_level_billed",
1740 * description="encounter last_level_billed",
1741 * type="string",
1742 * ),
1743 * @OA\Property(
1744 * property="last_level_closed",
1745 * description="encounter last_level_closed",
1746 * type="string",
1747 * ),
1748 * @OA\Property(
1749 * property="last_stmt_date",
1750 * description="encounter last_stmt_date",
1751 * type="string",
1752 * ),
1753 * @OA\Property(
1754 * property="stmt_count",
1755 * description="encounter stmt_count",
1756 * type="string",
1757 * ),
1758 * @OA\Property(
1759 * property="provider_id",
1760 * description="provider id",
1761 * type="string",
1762 * ),
1763 * @OA\Property(
1764 * property="supervisor_id",
1765 * description="encounter supervisor id",
1766 * type="string",
1767 * ),
1768 * @OA\Property(
1769 * property="invoice_refno",
1770 * description="encounter invoice_refno",
1771 * type="string",
1772 * ),
1773 * @OA\Property(
1774 * property="referral_source",
1775 * description="encounter referral source",
1776 * type="string",
1777 * ),
1778 * @OA\Property(
1779 * property="billing_facility",
1780 * description="encounter billing facility id",
1781 * type="string",
1782 * ),
1783 * @OA\Property(
1784 * property="external_id",
1785 * description="encounter external id",
1786 * type="string",
1787 * ),
1788 * @OA\Property(
1789 * property="pos_code",
1790 * description="encounter pos_code",
1791 * type="string",
1792 * ),
1793 * @OA\Property(
1794 * property="class_code",
1795 * description="encounter class_code",
1796 * type="string",
1797 * ),
1798 * @OA\Property(
1799 * property="class_title",
1800 * description="encounter class_title",
1801 * type="string",
1802 * ),
1803 * @OA\Property(
1804 * property="pc_catname",
1805 * description="encounter pc_catname",
1806 * type="string",
1807 * ),
1808 * @OA\Property(
1809 * property="billing_facility_name",
1810 * description="encounter billing facility name",
1811 * type="string",
1812 * ),
1813 * ),
1814 * ),
1815 * example={
1816 * "validationErrors": {},
1817 * "error_description": {},
1818 * "data": {
1819 * "id": "1",
1820 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1821 * "date": "2019-09-14 00:00:00",
1822 * "reason": "Pregnancy Test",
1823 * "facility": "Owerri General Hospital",
1824 * "facility_id": "3",
1825 * "pid": "1",
1826 * "onset_date": "2019-04-20 00:00:00",
1827 * "sensitivity": "normal",
1828 * "billing_note": null,
1829 * "pc_catid": "5",
1830 * "last_level_billed": "0",
1831 * "last_level_closed": "0",
1832 * "last_stmt_date": null,
1833 * "stmt_count": "0",
1834 * "provider_id": "1",
1835 * "supervisor_id": "0",
1836 * "invoice_refno": "",
1837 * "referral_source": "",
1838 * "billing_facility": "3",
1839 * "external_id": "",
1840 * "pos_code": "0",
1841 * "class_code": "AMB",
1842 * "class_title": "ambulatory",
1843 * "pc_catname": "Office Visit",
1844 * "billing_facility_name": "Owerri General Hospital"
1850 * @OA\Put(
1851 * path="/api/patient/{puuid}/encounter/{euuid}",
1852 * description="Modify a encounter",
1853 * tags={"standard"},
1854 * @OA\Parameter(
1855 * name="puuid",
1856 * in="path",
1857 * description="The uuid for the patient.",
1858 * required=true,
1859 * @OA\Schema(
1860 * type="string"
1862 * ),
1863 * @OA\Parameter(
1864 * name="euuid",
1865 * in="path",
1866 * description="The uuid for the encounter.",
1867 * required=true,
1868 * @OA\Schema(
1869 * type="string"
1871 * ),
1872 * @OA\RequestBody(
1873 * required=true,
1874 * @OA\MediaType(
1875 * mediaType="application/json",
1876 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1878 * ),
1879 * @OA\Response(
1880 * response="200",
1881 * description="Standard response",
1882 * @OA\MediaType(
1883 * mediaType="application/json",
1884 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1886 * ),
1887 * @OA\Response(
1888 * response="401",
1889 * ref="#/components/responses/unauthorized"
1890 * ),
1891 * security={{"openemr_auth":{}}}
1894 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1895 RestConfig::authorization_check("encounters", "auth_a");
1896 $data = (array) (json_decode(file_get_contents("php://input")));
1897 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1898 RestConfig::apiLog($return, $data);
1899 return $return;
1903 * @OA\Get(
1904 * path="/api/patient/{puuid}/encounter/{euuid}",
1905 * description="Retrieves a single encounter for a patient",
1906 * tags={"standard"},
1907 * @OA\Parameter(
1908 * name="puuid",
1909 * in="path",
1910 * description="The uuid for the patient.",
1911 * required=true,
1912 * @OA\Schema(
1913 * type="string"
1915 * ),
1916 * @OA\Parameter(
1917 * name="euuid",
1918 * in="path",
1919 * description="The uuid for the encounter.",
1920 * required=true,
1921 * @OA\Schema(
1922 * type="string"
1924 * ),
1925 * @OA\Response(
1926 * response="200",
1927 * description="Standard response",
1928 * @OA\MediaType(
1929 * mediaType="application/json",
1930 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1932 * ),
1933 * @OA\Response(
1934 * response="401",
1935 * ref="#/components/responses/unauthorized"
1936 * ),
1937 * security={{"openemr_auth":{}}}
1940 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1941 RestConfig::authorization_check("encounters", "auth_a");
1942 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1943 RestConfig::apiLog($return);
1944 return $return;
1948 * @OA\Get(
1949 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1950 * description="Retrieves soap notes from an encounter for a patient",
1951 * tags={"standard"},
1952 * @OA\Parameter(
1953 * name="pid",
1954 * in="path",
1955 * description="The pid for the patient.",
1956 * required=true,
1957 * @OA\Schema(
1958 * type="string"
1960 * ),
1961 * @OA\Parameter(
1962 * name="eid",
1963 * in="path",
1964 * description="The id for the encounter.",
1965 * required=true,
1966 * @OA\Schema(
1967 * type="string"
1969 * ),
1970 * @OA\Response(
1971 * response="200",
1972 * ref="#/components/responses/standard"
1973 * ),
1974 * @OA\Response(
1975 * response="400",
1976 * ref="#/components/responses/badrequest"
1977 * ),
1978 * @OA\Response(
1979 * response="401",
1980 * ref="#/components/responses/unauthorized"
1981 * ),
1982 * security={{"openemr_auth":{}}}
1985 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1986 RestConfig::authorization_check("encounters", "notes");
1987 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1988 RestConfig::apiLog($return);
1989 return $return;
1993 * Schema for the vital request
1995 * @OA\Schema(
1996 * schema="api_vital_request",
1997 * @OA\Property(
1998 * property="bps",
1999 * description="The bps of vitals.",
2000 * type="string"
2001 * ),
2002 * @OA\Property(
2003 * property="bpd",
2004 * description="The bpd of vitals.",
2005 * type="string"
2006 * ),
2007 * @OA\Property(
2008 * property="weight",
2009 * description="The weight of vitals. (unit is lb)",
2010 * type="string"
2011 * ),
2012 * @OA\Property(
2013 * property="height",
2014 * description="The height of vitals. (unit is inches)",
2015 * type="string"
2016 * ),
2017 * @OA\Property(
2018 * property="temperature",
2019 * description="The temperature of temperature. (unit is F)",
2020 * type="string"
2021 * ),
2022 * @OA\Property(
2023 * property="temp_method",
2024 * description="The temp_method of vitals.",
2025 * type="string"
2026 * ),
2027 * @OA\Property(
2028 * property="pulse",
2029 * description="The pulse of vitals.",
2030 * type="string"
2031 * ),
2032 * @OA\Property(
2033 * property="respiration",
2034 * description="The respiration of vitals.",
2035 * type="string"
2036 * ),
2037 * @OA\Property(
2038 * property="note",
2039 * description="The note (ie. comments) of vitals.",
2040 * type="string"
2041 * ),
2042 * @OA\Property(
2043 * property="waist_circ",
2044 * description="The waist circumference of vitals. (unit is inches)",
2045 * type="string"
2046 * ),
2047 * @OA\Property(
2048 * property="head_circ",
2049 * description="The head circumference of vitals. (unit is inches)",
2050 * type="string"
2051 * ),
2052 * @OA\Property(
2053 * property="oxygen_saturation",
2054 * description="The oxygen_saturation of vitals.",
2055 * type="string"
2056 * ),
2057 * example={
2058 * "bps": "130",
2059 * "bpd": "80",
2060 * "weight": "220",
2061 * "height": "70",
2062 * "temperature": "98",
2063 * "temp_method": "Oral",
2064 * "pulse": "60",
2065 * "respiration": "20",
2066 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2067 * "waist_circ": "37",
2068 * "head_circ": "22.2",
2069 * "oxygen_saturation": "96"
2074 * @OA\Post(
2075 * path="/api/patient/{pid}/encounter/{eid}/vital",
2076 * description="Submits a new vitals form",
2077 * tags={"standard"},
2078 * @OA\Parameter(
2079 * name="pid",
2080 * in="path",
2081 * description="The id for the patient.",
2082 * required=true,
2083 * @OA\Schema(
2084 * type="string"
2086 * ),
2087 * @OA\Parameter(
2088 * name="eid",
2089 * in="path",
2090 * description="The id for the encounter.",
2091 * required=true,
2092 * @OA\Schema(
2093 * type="string"
2095 * ),
2096 * @OA\RequestBody(
2097 * required=true,
2098 * @OA\MediaType(
2099 * mediaType="application/json",
2100 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2102 * ),
2103 * @OA\Response(
2104 * response="200",
2105 * ref="#/components/responses/standard"
2106 * ),
2107 * @OA\Response(
2108 * response="400",
2109 * ref="#/components/responses/badrequest"
2110 * ),
2111 * @OA\Response(
2112 * response="401",
2113 * ref="#/components/responses/unauthorized"
2114 * ),
2115 * security={{"openemr_auth":{}}}
2118 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2119 RestConfig::authorization_check("encounters", "notes");
2120 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2121 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2122 RestConfig::apiLog($return, $data);
2123 return $return;
2127 * @OA\Put(
2128 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2129 * description="Edit a vitals form",
2130 * tags={"standard"},
2131 * @OA\Parameter(
2132 * name="pid",
2133 * in="path",
2134 * description="The id for the patient.",
2135 * required=true,
2136 * @OA\Schema(
2137 * type="string"
2139 * ),
2140 * @OA\Parameter(
2141 * name="eid",
2142 * in="path",
2143 * description="The id for the encounter.",
2144 * required=true,
2145 * @OA\Schema(
2146 * type="string"
2148 * ),
2149 * @OA\Parameter(
2150 * name="vid",
2151 * in="path",
2152 * description="The id for the vitalss form.",
2153 * required=true,
2154 * @OA\Schema(
2155 * type="string"
2157 * ),
2158 * @OA\RequestBody(
2159 * required=true,
2160 * @OA\MediaType(
2161 * mediaType="application/json",
2162 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2164 * ),
2165 * @OA\Response(
2166 * response="200",
2167 * ref="#/components/responses/standard"
2168 * ),
2169 * @OA\Response(
2170 * response="400",
2171 * ref="#/components/responses/badrequest"
2172 * ),
2173 * @OA\Response(
2174 * response="401",
2175 * ref="#/components/responses/unauthorized"
2176 * ),
2177 * security={{"openemr_auth":{}}}
2180 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2181 RestConfig::authorization_check("encounters", "notes");
2182 $data = json_decode(file_get_contents("php://input"), true) ?? [];
2183 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2184 RestConfig::apiLog($return, $data);
2185 return $return;
2189 * @OA\Get(
2190 * path="/api/patient/{pid}/encounter/{eid}/vital",
2191 * description="Retrieves all vitals from an encounter for a patient",
2192 * tags={"standard"},
2193 * @OA\Parameter(
2194 * name="pid",
2195 * in="path",
2196 * description="The pid for the patient.",
2197 * required=true,
2198 * @OA\Schema(
2199 * type="string"
2201 * ),
2202 * @OA\Parameter(
2203 * name="eid",
2204 * in="path",
2205 * description="The id for the encounter.",
2206 * required=true,
2207 * @OA\Schema(
2208 * type="string"
2210 * ),
2211 * @OA\Response(
2212 * response="200",
2213 * ref="#/components/responses/standard"
2214 * ),
2215 * @OA\Response(
2216 * response="400",
2217 * ref="#/components/responses/badrequest"
2218 * ),
2219 * @OA\Response(
2220 * response="401",
2221 * ref="#/components/responses/unauthorized"
2222 * ),
2223 * security={{"openemr_auth":{}}}
2226 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2227 RestConfig::authorization_check("encounters", "notes");
2228 $return = (new EncounterRestController())->getVitals($pid, $eid);
2229 RestConfig::apiLog($return);
2230 return $return;
2234 * @OA\Get(
2235 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2236 * description="Retrieves a vitals form from an encounter for a patient",
2237 * tags={"standard"},
2238 * @OA\Parameter(
2239 * name="pid",
2240 * in="path",
2241 * description="The pid for the patient.",
2242 * required=true,
2243 * @OA\Schema(
2244 * type="string"
2246 * ),
2247 * @OA\Parameter(
2248 * name="eid",
2249 * in="path",
2250 * description="The id for the encounter.",
2251 * required=true,
2252 * @OA\Schema(
2253 * type="string"
2255 * ),
2256 * @OA\Parameter(
2257 * name="vid",
2258 * in="path",
2259 * description="The id for the vitals form.",
2260 * required=true,
2261 * @OA\Schema(
2262 * type="string"
2264 * ),
2265 * @OA\Response(
2266 * response="200",
2267 * ref="#/components/responses/standard"
2268 * ),
2269 * @OA\Response(
2270 * response="400",
2271 * ref="#/components/responses/badrequest"
2272 * ),
2273 * @OA\Response(
2274 * response="401",
2275 * ref="#/components/responses/unauthorized"
2276 * ),
2277 * security={{"openemr_auth":{}}}
2280 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2281 RestConfig::authorization_check("encounters", "notes");
2282 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2283 RestConfig::apiLog($return);
2284 return $return;
2288 * @OA\Get(
2289 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2290 * description="Retrieves a soap note from an encounter for a patient",
2291 * tags={"standard"},
2292 * @OA\Parameter(
2293 * name="pid",
2294 * in="path",
2295 * description="The pid for the patient.",
2296 * required=true,
2297 * @OA\Schema(
2298 * type="string"
2300 * ),
2301 * @OA\Parameter(
2302 * name="eid",
2303 * in="path",
2304 * description="The id for the encounter.",
2305 * required=true,
2306 * @OA\Schema(
2307 * type="string"
2309 * ),
2310 * @OA\Parameter(
2311 * name="sid",
2312 * in="path",
2313 * description="The id for the soap note.",
2314 * required=true,
2315 * @OA\Schema(
2316 * type="string"
2318 * ),
2319 * @OA\Response(
2320 * response="200",
2321 * ref="#/components/responses/standard"
2322 * ),
2323 * @OA\Response(
2324 * response="400",
2325 * ref="#/components/responses/badrequest"
2326 * ),
2327 * @OA\Response(
2328 * response="401",
2329 * ref="#/components/responses/unauthorized"
2330 * ),
2331 * security={{"openemr_auth":{}}}
2334 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2335 RestConfig::authorization_check("encounters", "notes");
2336 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2337 RestConfig::apiLog($return);
2338 return $return;
2342 * Schema for the soap_note request
2344 * @OA\Schema(
2345 * schema="api_soap_note_request",
2346 * @OA\Property(
2347 * property="subjective",
2348 * description="The subjective of soap note.",
2349 * type="string"
2350 * ),
2351 * @OA\Property(
2352 * property="objective",
2353 * description="The objective of soap note.",
2354 * type="string"
2355 * ),
2356 * @OA\Property(
2357 * property="assessment",
2358 * description="The assessment of soap note.",
2359 * type="string"
2360 * ),
2361 * @OA\Property(
2362 * property="plan",
2363 * description="The plan of soap note.",
2364 * type="string"
2365 * ),
2366 * example={
2367 * "subjective": "The patient with mechanical fall and cut finger.",
2368 * "objective": "The patient with finger laceration on exam.",
2369 * "assessment": "The patient with finger laceration requiring sutures.",
2370 * "plan": "Sutured finger laceration."
2375 * @OA\Post(
2376 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2377 * description="Submits a new soap note",
2378 * tags={"standard"},
2379 * @OA\Parameter(
2380 * name="pid",
2381 * in="path",
2382 * description="The id for the patient.",
2383 * required=true,
2384 * @OA\Schema(
2385 * type="string"
2387 * ),
2388 * @OA\Parameter(
2389 * name="eid",
2390 * in="path",
2391 * description="The id for the encounter.",
2392 * required=true,
2393 * @OA\Schema(
2394 * type="string"
2396 * ),
2397 * @OA\RequestBody(
2398 * required=true,
2399 * @OA\MediaType(
2400 * mediaType="application/json",
2401 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2403 * ),
2404 * @OA\Response(
2405 * response="200",
2406 * ref="#/components/responses/standard"
2407 * ),
2408 * @OA\Response(
2409 * response="400",
2410 * ref="#/components/responses/badrequest"
2411 * ),
2412 * @OA\Response(
2413 * response="401",
2414 * ref="#/components/responses/unauthorized"
2415 * ),
2416 * security={{"openemr_auth":{}}}
2419 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2420 RestConfig::authorization_check("encounters", "notes");
2421 $data = (array) (json_decode(file_get_contents("php://input")));
2422 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2423 RestConfig::apiLog($return, $data);
2424 return $return;
2428 * @OA\Put(
2429 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2430 * description="Edit a soap note",
2431 * tags={"standard"},
2432 * @OA\Parameter(
2433 * name="pid",
2434 * in="path",
2435 * description="The id for the patient.",
2436 * required=true,
2437 * @OA\Schema(
2438 * type="string"
2440 * ),
2441 * @OA\Parameter(
2442 * name="eid",
2443 * in="path",
2444 * description="The id for the encounter.",
2445 * required=true,
2446 * @OA\Schema(
2447 * type="string"
2449 * ),
2450 * @OA\Parameter(
2451 * name="sid",
2452 * in="path",
2453 * description="The id for the soap noted.",
2454 * required=true,
2455 * @OA\Schema(
2456 * type="string"
2458 * ),
2459 * @OA\RequestBody(
2460 * required=true,
2461 * @OA\MediaType(
2462 * mediaType="application/json",
2463 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2465 * ),
2466 * @OA\Response(
2467 * response="200",
2468 * ref="#/components/responses/standard"
2469 * ),
2470 * @OA\Response(
2471 * response="400",
2472 * ref="#/components/responses/badrequest"
2473 * ),
2474 * @OA\Response(
2475 * response="401",
2476 * ref="#/components/responses/unauthorized"
2477 * ),
2478 * security={{"openemr_auth":{}}}
2481 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2482 RestConfig::authorization_check("encounters", "notes");
2483 $data = (array) (json_decode(file_get_contents("php://input")));
2484 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2485 RestConfig::apiLog($return, $data);
2486 return $return;
2491 * @OA\Get(
2492 * path="/api/practitioner",
2493 * description="Retrieves a list of practitioners",
2494 * tags={"standard"},
2495 * @OA\Parameter(
2496 * name="title",
2497 * in="query",
2498 * description="The title for the practitioner.",
2499 * required=false,
2500 * @OA\Schema(
2501 * type="string"
2503 * ),
2504 * @OA\Parameter(
2505 * name="fname",
2506 * in="query",
2507 * description="The first name for the practitioner.",
2508 * required=false,
2509 * @OA\Schema(
2510 * type="string"
2512 * ),
2513 * @OA\Parameter(
2514 * name="lname",
2515 * in="query",
2516 * description="The last name for the practitioner.",
2517 * required=false,
2518 * @OA\Schema(
2519 * type="string"
2521 * ),
2522 * @OA\Parameter(
2523 * name="mname",
2524 * in="query",
2525 * description="The middle name for the practitioner.",
2526 * required=false,
2527 * @OA\Schema(
2528 * type="string"
2530 * ),
2531 * @OA\Parameter(
2532 * name="federaltaxid",
2533 * in="query",
2534 * description="The federal tax id for the practitioner.",
2535 * required=false,
2536 * @OA\Schema(
2537 * type="string"
2539 * ),
2540 * @OA\Parameter(
2541 * name="federaldrugid",
2542 * in="query",
2543 * description="The federal drug id for the practitioner.",
2544 * required=false,
2545 * @OA\Schema(
2546 * type="string"
2548 * ),
2549 * @OA\Parameter(
2550 * name="upin",
2551 * in="query",
2552 * description="The upin for the practitioner.",
2553 * required=false,
2554 * @OA\Schema(
2555 * type="string"
2557 * ),
2558 * @OA\Parameter(
2559 * name="facility_id",
2560 * in="query",
2561 * description="The facility id for the practitioner.",
2562 * required=false,
2563 * @OA\Schema(
2564 * type="string"
2566 * ),
2567 * @OA\Parameter(
2568 * name="facility",
2569 * in="query",
2570 * description="The facility for the practitioner.",
2571 * required=false,
2572 * @OA\Schema(
2573 * type="string"
2575 * ),
2576 * @OA\Parameter(
2577 * name="npi",
2578 * in="query",
2579 * description="The npi for the practitioner.",
2580 * required=false,
2581 * @OA\Schema(
2582 * type="string"
2584 * ),
2585 * @OA\Parameter(
2586 * name="email",
2587 * in="query",
2588 * description="The email for the practitioner.",
2589 * required=false,
2590 * @OA\Schema(
2591 * type="string"
2593 * ),
2594 * @OA\Parameter(
2595 * name="specialty",
2596 * in="query",
2597 * description="The specialty for the practitioner.",
2598 * required=false,
2599 * @OA\Schema(
2600 * type="string"
2602 * ),
2603 * @OA\Parameter(
2604 * name="billname",
2605 * in="query",
2606 * description="The billname for the practitioner.",
2607 * required=false,
2608 * @OA\Schema(
2609 * type="string"
2611 * ),
2612 * @OA\Parameter(
2613 * name="url",
2614 * in="query",
2615 * description="The url for the practitioner.",
2616 * required=false,
2617 * @OA\Schema(
2618 * type="string"
2620 * ),
2621 * @OA\Parameter(
2622 * name="assistant",
2623 * in="query",
2624 * description="The assistant for the practitioner.",
2625 * required=false,
2626 * @OA\Schema(
2627 * type="string"
2629 * ),
2630 * @OA\Parameter(
2631 * name="organization",
2632 * in="query",
2633 * description="The organization for the practitioner.",
2634 * required=false,
2635 * @OA\Schema(
2636 * type="string"
2638 * ),
2639 * @OA\Parameter(
2640 * name="valedictory",
2641 * in="query",
2642 * description="The valedictory for the practitioner.",
2643 * required=false,
2644 * @OA\Schema(
2645 * type="string"
2647 * ),
2648 * @OA\Parameter(
2649 * name="street",
2650 * in="query",
2651 * description="The street for the practitioner.",
2652 * required=false,
2653 * @OA\Schema(
2654 * type="string"
2656 * ),
2657 * @OA\Parameter(
2658 * name="streetb",
2659 * in="query",
2660 * description="The street (line 2) for the practitioner.",
2661 * required=false,
2662 * @OA\Schema(
2663 * type="string"
2665 * ),
2666 * @OA\Parameter(
2667 * name="city",
2668 * in="query",
2669 * description="The city for the practitioner.",
2670 * required=false,
2671 * @OA\Schema(
2672 * type="string"
2674 * ),
2675 * @OA\Parameter(
2676 * name="state",
2677 * in="query",
2678 * description="The state for the practitioner.",
2679 * required=false,
2680 * @OA\Schema(
2681 * type="string"
2683 * ),
2684 * @OA\Parameter(
2685 * name="zip",
2686 * in="query",
2687 * description="The zip for the practitioner.",
2688 * required=false,
2689 * @OA\Schema(
2690 * type="string"
2692 * ),
2693 * @OA\Parameter(
2694 * name="phone",
2695 * in="query",
2696 * description="The phone for the practitioner.",
2697 * required=false,
2698 * @OA\Schema(
2699 * type="string"
2701 * ),
2702 * @OA\Parameter(
2703 * name="fax",
2704 * in="query",
2705 * description="The fax for the practitioner.",
2706 * required=false,
2707 * @OA\Schema(
2708 * type="string"
2710 * ),
2711 * @OA\Parameter(
2712 * name="phonew1",
2713 * in="query",
2714 * description="The phonew1 for the practitioner.",
2715 * required=false,
2716 * @OA\Schema(
2717 * type="string"
2719 * ),
2720 * @OA\Parameter(
2721 * name="phonecell",
2722 * in="query",
2723 * description="The phonecell for the practitioner.",
2724 * required=false,
2725 * @OA\Schema(
2726 * type="string"
2728 * ),
2729 * @OA\Parameter(
2730 * name="notes",
2731 * in="query",
2732 * description="The notes for the practitioner.",
2733 * required=false,
2734 * @OA\Schema(
2735 * type="string"
2737 * ),
2738 * @OA\Parameter(
2739 * name="state_license_number2",
2740 * in="query",
2741 * description="The state license number for the practitioner.",
2742 * required=false,
2743 * @OA\Schema(
2744 * type="string"
2746 * ),
2747 * @OA\Parameter(
2748 * name="username",
2749 * in="query",
2750 * description="The username for the practitioner.",
2751 * required=false,
2752 * @OA\Schema(
2753 * type="string"
2755 * ),
2756 * @OA\Response(
2757 * response="200",
2758 * ref="#/components/responses/standard"
2759 * ),
2760 * @OA\Response(
2761 * response="400",
2762 * ref="#/components/responses/badrequest"
2763 * ),
2764 * @OA\Response(
2765 * response="401",
2766 * ref="#/components/responses/unauthorized"
2767 * ),
2768 * security={{"openemr_auth":{}}}
2771 "GET /api/practitioner" => function () {
2772 RestConfig::authorization_check("admin", "users");
2773 $return = (new PractitionerRestController())->getAll($_GET);
2774 RestConfig::apiLog($return);
2775 return $return;
2779 * @OA\Get(
2780 * path="/api/practitioner/{pruuid}",
2781 * description="Retrieves a single practitioner by their uuid",
2782 * tags={"standard"},
2783 * @OA\Parameter(
2784 * name="pruuid",
2785 * in="path",
2786 * description="The uuid for the practitioner.",
2787 * required=true,
2788 * @OA\Schema(
2789 * type="string"
2791 * ),
2792 * @OA\Response(
2793 * response="200",
2794 * ref="#/components/responses/standard"
2795 * ),
2796 * @OA\Response(
2797 * response="400",
2798 * ref="#/components/responses/badrequest"
2799 * ),
2800 * @OA\Response(
2801 * response="401",
2802 * ref="#/components/responses/unauthorized"
2803 * ),
2804 * security={{"openemr_auth":{}}}
2807 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2808 RestConfig::authorization_check("admin", "users");
2809 $return = (new PractitionerRestController())->getOne($pruuid);
2810 RestConfig::apiLog($return);
2811 return $return;
2815 * @OA\Post(
2816 * path="/api/practitioner",
2817 * description="Submits a new practitioner",
2818 * tags={"standard"},
2819 * @OA\RequestBody(
2820 * required=true,
2821 * @OA\MediaType(
2822 * mediaType="application/json",
2823 * @OA\Schema(
2824 * @OA\Property(
2825 * property="title",
2826 * description="The title for the practitioner.",
2827 * type="string"
2828 * ),
2829 * @OA\Property(
2830 * property="fname",
2831 * description="The first name for the practitioner.",
2832 * type="string"
2833 * ),
2834 * @OA\Property(
2835 * property="mname",
2836 * description="The middle name for the practitioner.",
2837 * type="string"
2838 * ),
2839 * @OA\Property(
2840 * property="lname",
2841 * description="The last name for the practitioner.",
2842 * type="string"
2843 * ),
2844 * @OA\Property(
2845 * property="federaltaxid",
2846 * description="The federal tax id for the practitioner.",
2847 * type="string"
2848 * ),
2849 * @OA\Property(
2850 * property="federaldrugid",
2851 * description="The federal drug id for the practitioner.",
2852 * type="string"
2853 * ),
2854 * @OA\Property(
2855 * property="upin",
2856 * description="The upin for the practitioner.",
2857 * type="string"
2858 * ),
2859 * @OA\Property(
2860 * property="facility_id",
2861 * description="The facility_id for the practitioner.",
2862 * type="string"
2863 * ),
2864 * @OA\Property(
2865 * property="facility",
2866 * description="The facility name for the practitioner.",
2867 * type="string"
2868 * ),
2869 * @OA\Property(
2870 * property="npi",
2871 * description="The npi for the practitioner.",
2872 * type="string"
2873 * ),
2874 * @OA\Property(
2875 * property="email",
2876 * description="The email for the practitioner.",
2877 * type="string"
2878 * ),
2879 * @OA\Property(
2880 * property="specialty",
2881 * description="The specialty for the practitioner.",
2882 * type="string"
2883 * ),
2884 * @OA\Property(
2885 * property="billname",
2886 * description="The billname for the practitioner.",
2887 * type="string"
2888 * ),
2889 * @OA\Property(
2890 * property="url",
2891 * description="The url for the practitioner.",
2892 * type="string"
2893 * ),
2894 * @OA\Property(
2895 * property="assistant",
2896 * description="The assistant for the practitioner.",
2897 * type="string"
2898 * ),
2899 * @OA\Property(
2900 * property="valedictory",
2901 * description="The valedictory for the practitioner.",
2902 * type="string"
2903 * ),
2904 * @OA\Property(
2905 * property="street",
2906 * description="The street address for the practitioner.",
2907 * type="string"
2908 * ),
2909 * @OA\Property(
2910 * property="streetb",
2911 * description="The streetb address for the practitioner.",
2912 * type="string"
2913 * ),
2914 * @OA\Property(
2915 * property="city",
2916 * description="The city for the practitioner.",
2917 * type="string"
2918 * ),
2919 * @OA\Property(
2920 * property="state",
2921 * description="The state for the practitioner.",
2922 * type="string"
2923 * ),
2924 * @OA\Property(
2925 * property="zip",
2926 * description="The zip for the practitioner.",
2927 * type="string"
2928 * ),
2929 * @OA\Property(
2930 * property="phone",
2931 * description="The phone for the practitioner.",
2932 * type="string"
2933 * ),
2934 * @OA\Property(
2935 * property="fax",
2936 * description="The fax for the practitioner.",
2937 * type="string"
2938 * ),
2939 * @OA\Property(
2940 * property="phonew1",
2941 * description="The phonew1 for the practitioner.",
2942 * type="string"
2943 * ),
2944 * @OA\Property(
2945 * property="phonecell",
2946 * description="The phonecell for the practitioner.",
2947 * type="string"
2948 * ),
2949 * @OA\Property(
2950 * property="notes",
2951 * description="The notes for the practitioner.",
2952 * type="string"
2953 * ),
2954 * @OA\Property(
2955 * property="state_license_number",
2956 * description="The state license number for the practitioner.",
2957 * type="string"
2958 * ),
2959 * @OA\Property(
2960 * property="username",
2961 * description="The username for the practitioner.",
2962 * type="string"
2963 * ),
2964 * required={"fname", "lname", "npi"},
2965 * example={
2966 * "title": "Mrs.",
2967 * "fname": "Eduardo",
2968 * "mname": "Kathy",
2969 * "lname": "Perez",
2970 * "federaltaxid": "",
2971 * "federaldrugid": "",
2972 * "upin": "",
2973 * "facility_id": "3",
2974 * "facility": "Your Clinic Name Here",
2975 * "npi": "12345678901",
2976 * "email": "info@pennfirm.com",
2977 * "specialty": "",
2978 * "billname": null,
2979 * "url": null,
2980 * "assistant": null,
2981 * "organization": null,
2982 * "valedictory": null,
2983 * "street": "789 Third Avenue",
2984 * "streetb": "123 Cannaut Street",
2985 * "city": "San Diego",
2986 * "state": "CA",
2987 * "zip": "90210",
2988 * "phone": "(619) 555-9827",
2989 * "fax": null,
2990 * "phonew1": "(619) 555-7822",
2991 * "phonecell": "(619) 555-7821",
2992 * "notes": null,
2993 * "state_license_number": "123456",
2994 * "username": "eduardoperez"
2998 * ),
2999 * @OA\Response(
3000 * response="200",
3001 * description="Standard response",
3002 * @OA\MediaType(
3003 * mediaType="application/json",
3004 * @OA\Schema(
3005 * @OA\Property(
3006 * property="validationErrors",
3007 * description="Validation errors.",
3008 * type="array",
3009 * @OA\Items(
3010 * type="object",
3011 * ),
3012 * ),
3013 * @OA\Property(
3014 * property="internalErrors",
3015 * description="Internal errors.",
3016 * type="array",
3017 * @OA\Items(
3018 * type="object",
3019 * ),
3020 * ),
3021 * @OA\Property(
3022 * property="data",
3023 * description="Returned data.",
3024 * type="array",
3025 * @OA\Items(
3026 * @OA\Property(
3027 * property="id",
3028 * description="practitioner id",
3029 * type="integer",
3030 * ),
3031 * @OA\Property(
3032 * property="uuid",
3033 * description="practitioner uuid",
3034 * type="string",
3035 * ),
3036 * ),
3037 * ),
3038 * example={
3039 * "validationErrors": {},
3040 * "error_description": {},
3041 * "data": {
3042 * "id": 7,
3043 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3048 * ),
3049 * @OA\Response(
3050 * response="401",
3051 * ref="#/components/responses/unauthorized"
3052 * ),
3053 * security={{"openemr_auth":{}}}
3056 "POST /api/practitioner" => function () {
3057 RestConfig::authorization_check("admin", "users");
3058 $data = (array) (json_decode(file_get_contents("php://input")));
3059 $return = (new PractitionerRestController())->post($data);
3060 RestConfig::apiLog($return, $data);
3061 return $return;
3065 * @OA\Put(
3066 * path="/api/practitioner/{pruuid}",
3067 * description="Edit a practitioner",
3068 * tags={"standard"},
3069 * @OA\Parameter(
3070 * name="pruuid",
3071 * in="path",
3072 * description="The uuid for the practitioner.",
3073 * required=true,
3074 * @OA\Schema(
3075 * type="string"
3077 * ),
3078 * @OA\RequestBody(
3079 * required=true,
3080 * @OA\MediaType(
3081 * mediaType="application/json",
3082 * @OA\Schema(
3083 * @OA\Property(
3084 * property="title",
3085 * description="The title for the practitioner.",
3086 * type="string"
3087 * ),
3088 * @OA\Property(
3089 * property="fname",
3090 * description="The first name for the practitioner.",
3091 * type="string"
3092 * ),
3093 * @OA\Property(
3094 * property="mname",
3095 * description="The middle name for the practitioner.",
3096 * type="string"
3097 * ),
3098 * @OA\Property(
3099 * property="lname",
3100 * description="The last name for the practitioner.",
3101 * type="string"
3102 * ),
3103 * @OA\Property(
3104 * property="federaltaxid",
3105 * description="The federal tax id for the practitioner.",
3106 * type="string"
3107 * ),
3108 * @OA\Property(
3109 * property="federaldrugid",
3110 * description="The federal drug id for the practitioner.",
3111 * type="string"
3112 * ),
3113 * @OA\Property(
3114 * property="upin",
3115 * description="The upin for the practitioner.",
3116 * type="string"
3117 * ),
3118 * @OA\Property(
3119 * property="facility_id",
3120 * description="The facility_id for the practitioner.",
3121 * type="string"
3122 * ),
3123 * @OA\Property(
3124 * property="facility",
3125 * description="The facility name for the practitioner.",
3126 * type="string"
3127 * ),
3128 * @OA\Property(
3129 * property="npi",
3130 * description="The npi for the practitioner.",
3131 * type="string"
3132 * ),
3133 * @OA\Property(
3134 * property="email",
3135 * description="The email for the practitioner.",
3136 * type="string"
3137 * ),
3138 * @OA\Property(
3139 * property="specialty",
3140 * description="The specialty for the practitioner.",
3141 * type="string"
3142 * ),
3143 * @OA\Property(
3144 * property="billname",
3145 * description="The billname for the practitioner.",
3146 * type="string"
3147 * ),
3148 * @OA\Property(
3149 * property="url",
3150 * description="The url for the practitioner.",
3151 * type="string"
3152 * ),
3153 * @OA\Property(
3154 * property="assistant",
3155 * description="The assistant for the practitioner.",
3156 * type="string"
3157 * ),
3158 * @OA\Property(
3159 * property="valedictory",
3160 * description="The valedictory for the practitioner.",
3161 * type="string"
3162 * ),
3163 * @OA\Property(
3164 * property="street",
3165 * description="The street address for the practitioner.",
3166 * type="string"
3167 * ),
3168 * @OA\Property(
3169 * property="streetb",
3170 * description="The streetb address for the practitioner.",
3171 * type="string"
3172 * ),
3173 * @OA\Property(
3174 * property="city",
3175 * description="The city for the practitioner.",
3176 * type="string"
3177 * ),
3178 * @OA\Property(
3179 * property="state",
3180 * description="The state for the practitioner.",
3181 * type="string"
3182 * ),
3183 * @OA\Property(
3184 * property="zip",
3185 * description="The zip for the practitioner.",
3186 * type="string"
3187 * ),
3188 * @OA\Property(
3189 * property="phone",
3190 * description="The phone for the practitioner.",
3191 * type="string"
3192 * ),
3193 * @OA\Property(
3194 * property="fax",
3195 * description="The fax for the practitioner.",
3196 * type="string"
3197 * ),
3198 * @OA\Property(
3199 * property="phonew1",
3200 * description="The phonew1 for the practitioner.",
3201 * type="string"
3202 * ),
3203 * @OA\Property(
3204 * property="phonecell",
3205 * description="The phonecell for the practitioner.",
3206 * type="string"
3207 * ),
3208 * @OA\Property(
3209 * property="notes",
3210 * description="The notes for the practitioner.",
3211 * type="string"
3212 * ),
3213 * @OA\Property(
3214 * property="state_license_number",
3215 * description="The state license number for the practitioner.",
3216 * type="string"
3217 * ),
3218 * @OA\Property(
3219 * property="username",
3220 * description="The username for the practitioner.",
3221 * type="string"
3222 * ),
3223 * example={
3224 * "title": "Mr",
3225 * "fname": "Baz",
3226 * "mname": "",
3227 * "lname": "Bop",
3228 * "street": "456 Tree Lane",
3229 * "zip": "08642",
3230 * "city": "FooTown",
3231 * "state": "FL",
3232 * "phone": "123-456-7890"
3236 * ),
3237 * @OA\Response(
3238 * response="200",
3239 * description="Standard response",
3240 * @OA\MediaType(
3241 * mediaType="application/json",
3242 * @OA\Schema(
3243 * @OA\Property(
3244 * property="validationErrors",
3245 * description="Validation errors.",
3246 * type="array",
3247 * @OA\Items(
3248 * type="object",
3249 * ),
3250 * ),
3251 * @OA\Property(
3252 * property="internalErrors",
3253 * description="Internal errors.",
3254 * type="array",
3255 * @OA\Items(
3256 * type="object",
3257 * ),
3258 * ),
3259 * @OA\Property(
3260 * property="data",
3261 * description="Returned data.",
3262 * type="array",
3263 * @OA\Items(
3264 * @OA\Property(
3265 * property="id",
3266 * description="practitioner id",
3267 * type="string",
3268 * ),
3269 * @OA\Property(
3270 * property="uuid",
3271 * description="practitioner uuid",
3272 * type="string",
3273 * ),
3274 * @OA\Property(
3275 * property="title",
3276 * description="practitioner title",
3277 * type="string",
3278 * ),
3279 * @OA\Property(
3280 * property="fname",
3281 * description="practitioner fname",
3282 * type="string",
3283 * ),
3284 * @OA\Property(
3285 * property="lname",
3286 * description="practitioner lname",
3287 * type="string",
3288 * ),
3289 * @OA\Property(
3290 * property="mname",
3291 * description="practitioner mname",
3292 * type="string",
3293 * ),
3294 * @OA\Property(
3295 * property="federaltaxid",
3296 * description="practitioner federaltaxid",
3297 * type="string",
3298 * ),
3299 * @OA\Property(
3300 * property="federaldrugid",
3301 * description="practitioner federaldrugid",
3302 * type="string",
3303 * ),
3304 * @OA\Property(
3305 * property="upin",
3306 * description="practitioner upin",
3307 * type="string",
3308 * ),
3309 * @OA\Property(
3310 * property="facility_id",
3311 * description="practitioner facility_id",
3312 * type="string",
3313 * ),
3314 * @OA\Property(
3315 * property="facility",
3316 * description="practitioner facility",
3317 * type="string",
3318 * ),
3319 * @OA\Property(
3320 * property="npi",
3321 * description="practitioner npi",
3322 * type="string",
3323 * ),
3324 * @OA\Property(
3325 * property="email",
3326 * description="practitioner email",
3327 * type="string",
3328 * ),
3329 * @OA\Property(
3330 * property="active",
3331 * description="practitioner active setting",
3332 * type="string",
3333 * ),
3334 * @OA\Property(
3335 * property="specialty",
3336 * description="practitioner specialty",
3337 * type="string",
3338 * ),
3339 * @OA\Property(
3340 * property="billname",
3341 * description="practitioner billname",
3342 * type="string",
3343 * ),
3344 * @OA\Property(
3345 * property="url",
3346 * description="practitioner url",
3347 * type="string",
3348 * ),
3349 * @OA\Property(
3350 * property="assistant",
3351 * description="practitioner assistant",
3352 * type="string",
3353 * ),
3354 * @OA\Property(
3355 * property="organization",
3356 * description="practitioner organization",
3357 * type="string",
3358 * ),
3359 * @OA\Property(
3360 * property="valedictory",
3361 * description="practitioner valedictory",
3362 * type="string",
3363 * ),
3364 * @OA\Property(
3365 * property="street",
3366 * description="practitioner street",
3367 * type="string",
3368 * ),
3369 * @OA\Property(
3370 * property="streetb",
3371 * description="practitioner streetb",
3372 * type="string",
3373 * ),
3374 * @OA\Property(
3375 * property="city",
3376 * description="practitioner city",
3377 * type="string",
3378 * ),
3379 * @OA\Property(
3380 * property="state",
3381 * description="practitioner state",
3382 * type="string",
3383 * ),
3384 * @OA\Property(
3385 * property="zip",
3386 * description="practitioner zip",
3387 * type="string",
3388 * ),
3389 * @OA\Property(
3390 * property="phone",
3391 * description="practitioner phone",
3392 * type="string",
3393 * ),
3394 * @OA\Property(
3395 * property="fax",
3396 * description="fax",
3397 * type="string",
3398 * ),
3399 * @OA\Property(
3400 * property="phonew1",
3401 * description="practitioner phonew1",
3402 * type="string",
3403 * ),
3404 * @OA\Property(
3405 * property="phonecell",
3406 * description="practitioner phonecell",
3407 * type="string",
3408 * ),
3409 * @OA\Property(
3410 * property="notes",
3411 * description="practitioner notes",
3412 * type="string",
3413 * ),
3414 * @OA\Property(
3415 * property="state_license_number",
3416 * description="practitioner state license number",
3417 * type="string",
3418 * ),
3419 * @OA\Property(
3420 * property="abook_title",
3421 * description="practitioner abook title",
3422 * type="string",
3423 * ),
3424 * @OA\Property(
3425 * property="physician_title",
3426 * description="practitioner physician title",
3427 * type="string",
3428 * ),
3429 * @OA\Property(
3430 * property="physician_code",
3431 * description="practitioner physician code",
3432 * type="string",
3434 * ),
3435 * ),
3436 * example={
3437 * "validationErrors": {},
3438 * "error_description": {},
3439 * "data": {
3440 * "id": 7,
3441 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3442 * "title": "Mr",
3443 * "fname": "Baz",
3444 * "lname": "Bop",
3445 * "mname": "",
3446 * "federaltaxid": "",
3447 * "federaldrugid": "",
3448 * "upin": "",
3449 * "facility_id": "3",
3450 * "facility": "Your Clinic Name Here",
3451 * "npi": "0123456789",
3452 * "email": "info@pennfirm.com",
3453 * "active": "1",
3454 * "specialty": "",
3455 * "billname": "",
3456 * "url": "",
3457 * "assistant": "",
3458 * "organization": "",
3459 * "valedictory": "",
3460 * "street": "456 Tree Lane",
3461 * "streetb": "123 Cannaut Street",
3462 * "city": "FooTown",
3463 * "state": "FL",
3464 * "zip": "08642",
3465 * "phone": "123-456-7890",
3466 * "fax": "",
3467 * "phonew1": "(619) 555-7822",
3468 * "phonecell": "(619) 555-7821",
3469 * "notes": "",
3470 * "state_license_number": "123456",
3471 * "abook_title": null,
3472 * "physician_title": null,
3473 * "physician_code": null
3478 * ),
3479 * @OA\Response(
3480 * response="401",
3481 * ref="#/components/responses/unauthorized"
3482 * ),
3483 * security={{"openemr_auth":{}}}
3486 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3487 RestConfig::authorization_check("admin", "users");
3488 $data = (array) (json_decode(file_get_contents("php://input")));
3489 $return = (new PractitionerRestController())->patch($pruuid, $data);
3490 RestConfig::apiLog($return, $data);
3491 return $return;
3495 * @OA\Get(
3496 * path="/api/medical_problem",
3497 * description="Retrieves a list of medical problems",
3498 * tags={"standard"},
3499 * @OA\Parameter(
3500 * name="puuid",
3501 * in="query",
3502 * description="The uuid for the patient.",
3503 * required=false,
3504 * @OA\Schema(
3505 * type="string"
3507 * ),
3508 * @OA\Parameter(
3509 * name="condition_uuid",
3510 * in="query",
3511 * description="The uuid for the medical problem.",
3512 * required=false,
3513 * @OA\Schema(
3514 * type="string"
3516 * ),
3517 * @OA\Parameter(
3518 * name="title",
3519 * in="query",
3520 * description="The title for the medical problem.",
3521 * required=false,
3522 * @OA\Schema(
3523 * type="string"
3525 * ),
3526 * @OA\Parameter(
3527 * name="begdate",
3528 * in="query",
3529 * description="The start date for the medical problem.",
3530 * required=false,
3531 * @OA\Schema(
3532 * type="string"
3534 * ),
3535 * @OA\Parameter(
3536 * name="enddate",
3537 * in="query",
3538 * description="The end date for the medical problem.",
3539 * required=false,
3540 * @OA\Schema(
3541 * type="string"
3543 * ),
3544 * @OA\Parameter(
3545 * name="diagnosis",
3546 * in="query",
3547 * description="The diagnosis for the medical problem.",
3548 * required=false,
3549 * @OA\Schema(
3550 * type="string"
3552 * ),
3553 * @OA\Response(
3554 * response="200",
3555 * ref="#/components/responses/standard"
3556 * ),
3557 * @OA\Response(
3558 * response="400",
3559 * ref="#/components/responses/badrequest"
3560 * ),
3561 * @OA\Response(
3562 * response="401",
3563 * ref="#/components/responses/unauthorized"
3564 * ),
3565 * security={{"openemr_auth":{}}}
3568 "GET /api/medical_problem" => function () {
3569 RestConfig::authorization_check("encounters", "notes");
3570 $return = (new ConditionRestController())->getAll();
3571 RestConfig::apiLog($return);
3572 return $return;
3576 * @OA\Get(
3577 * path="/api/medical_problem/{muuid}",
3578 * description="Retrieves a single medical problem by their uuid",
3579 * tags={"standard"},
3580 * @OA\Parameter(
3581 * name="muuid",
3582 * in="path",
3583 * description="The uuid for the medical problem.",
3584 * required=true,
3585 * @OA\Schema(
3586 * type="string"
3588 * ),
3589 * @OA\Response(
3590 * response="200",
3591 * ref="#/components/responses/standard"
3592 * ),
3593 * @OA\Response(
3594 * response="400",
3595 * ref="#/components/responses/badrequest"
3596 * ),
3597 * @OA\Response(
3598 * response="401",
3599 * ref="#/components/responses/unauthorized"
3600 * ),
3601 * security={{"openemr_auth":{}}}
3604 "GET /api/medical_problem/:muuid" => function ($muuid) {
3605 RestConfig::authorization_check("encounters", "notes");
3606 $return = (new ConditionRestController())->getOne($muuid);
3607 RestConfig::apiLog($return);
3608 return $return;
3612 * @OA\Get(
3613 * path="/api/patient/{puuid}/medical_problem",
3614 * description="Retrieves all medical problems for a patient",
3615 * tags={"standard"},
3616 * @OA\Parameter(
3617 * name="puuid",
3618 * in="path",
3619 * description="The uuid for the patient.",
3620 * required=true,
3621 * @OA\Schema(
3622 * type="string"
3624 * ),
3625 * @OA\Response(
3626 * response="200",
3627 * ref="#/components/responses/standard"
3628 * ),
3629 * @OA\Response(
3630 * response="400",
3631 * ref="#/components/responses/badrequest"
3632 * ),
3633 * @OA\Response(
3634 * response="401",
3635 * ref="#/components/responses/unauthorized"
3636 * ),
3637 * security={{"openemr_auth":{}}}
3640 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3641 RestConfig::authorization_check("encounters", "notes");
3642 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3643 RestConfig::apiLog($return);
3644 return $return;
3648 * @OA\Get(
3649 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3650 * description="Retrieves a medical problem for a patient",
3651 * tags={"standard"},
3652 * @OA\Parameter(
3653 * name="puuid",
3654 * in="path",
3655 * description="The uuid for the patient.",
3656 * required=true,
3657 * @OA\Schema(
3658 * type="string"
3660 * ),
3661 * @OA\Parameter(
3662 * name="muuid",
3663 * in="path",
3664 * description="The uuid for the medical problem.",
3665 * required=true,
3666 * @OA\Schema(
3667 * type="string"
3669 * ),
3670 * @OA\Response(
3671 * response="200",
3672 * ref="#/components/responses/standard"
3673 * ),
3674 * @OA\Response(
3675 * response="400",
3676 * ref="#/components/responses/badrequest"
3677 * ),
3678 * @OA\Response(
3679 * response="401",
3680 * ref="#/components/responses/unauthorized"
3681 * ),
3682 * security={{"openemr_auth":{}}}
3685 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3686 RestConfig::authorization_check("patients", "med");
3687 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3688 RestConfig::apiLog($return);
3689 return $return;
3693 * Schema for the medical_problem request
3695 * @OA\Schema(
3696 * schema="api_medical_problem_request",
3697 * @OA\Property(
3698 * property="title",
3699 * description="The title of medical problem.",
3700 * type="string"
3701 * ),
3702 * @OA\Property(
3703 * property="begdate",
3704 * description="The beginning date of medical problem.",
3705 * type="string"
3706 * ),
3707 * @OA\Property(
3708 * property="enddate",
3709 * description="The end date of medical problem.",
3710 * type="string"
3711 * ),
3712 * @OA\Property(
3713 * property="diagnosis",
3714 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3715 * type="string"
3716 * ),
3717 * required={"title", "begdate"},
3718 * example={
3719 * "title": "Dermatochalasis",
3720 * "begdate": "2010-10-13",
3721 * "enddate": null,
3722 * "diagnosis": "ICD10:H02.839"
3727 * @OA\Post(
3728 * path="/api/patient/{puuid}/medical_problem",
3729 * description="Submits a new medical problem",
3730 * tags={"standard"},
3731 * @OA\Parameter(
3732 * name="puuid",
3733 * in="path",
3734 * description="The uuid for the patient.",
3735 * required=true,
3736 * @OA\Schema(
3737 * type="string"
3739 * ),
3740 * @OA\RequestBody(
3741 * required=true,
3742 * @OA\MediaType(
3743 * mediaType="application/json",
3744 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3746 * ),
3747 * @OA\Response(
3748 * response="200",
3749 * ref="#/components/responses/standard"
3750 * ),
3751 * @OA\Response(
3752 * response="400",
3753 * ref="#/components/responses/badrequest"
3754 * ),
3755 * @OA\Response(
3756 * response="401",
3757 * ref="#/components/responses/unauthorized"
3758 * ),
3759 * security={{"openemr_auth":{}}}
3762 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3763 RestConfig::authorization_check("patients", "med");
3764 $data = (array) (json_decode(file_get_contents("php://input")));
3765 $return = (new ConditionRestController())->post($puuid, $data);
3766 RestConfig::apiLog($return, $data);
3767 return $return;
3771 * @OA\Put(
3772 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3773 * description="Edit a medical problem",
3774 * tags={"standard"},
3775 * @OA\Parameter(
3776 * name="puuid",
3777 * in="path",
3778 * description="The uuid for the patient.",
3779 * required=true,
3780 * @OA\Schema(
3781 * type="string"
3783 * ),
3784 * @OA\Parameter(
3785 * name="muuid",
3786 * in="path",
3787 * description="The uuid for the medical problem.",
3788 * required=true,
3789 * @OA\Schema(
3790 * type="string"
3792 * ),
3793 * @OA\RequestBody(
3794 * required=true,
3795 * @OA\MediaType(
3796 * mediaType="application/json",
3797 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3799 * ),
3800 * @OA\Response(
3801 * response="200",
3802 * ref="#/components/responses/standard"
3803 * ),
3804 * @OA\Response(
3805 * response="400",
3806 * ref="#/components/responses/badrequest"
3807 * ),
3808 * @OA\Response(
3809 * response="401",
3810 * ref="#/components/responses/unauthorized"
3811 * ),
3812 * security={{"openemr_auth":{}}}
3815 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3816 RestConfig::authorization_check("patients", "med");
3817 $data = (array) (json_decode(file_get_contents("php://input")));
3818 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3819 RestConfig::apiLog($return, $data);
3820 return $return;
3824 * @OA\Delete(
3825 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3826 * description="Delete a medical problem",
3827 * tags={"standard"},
3828 * @OA\Parameter(
3829 * name="puuid",
3830 * in="path",
3831 * description="The uuid for the patient.",
3832 * required=true,
3833 * @OA\Schema(
3834 * type="string"
3836 * ),
3837 * @OA\Parameter(
3838 * name="muuid",
3839 * in="path",
3840 * description="The uuid for the medical problem.",
3841 * required=true,
3842 * @OA\Schema(
3843 * type="string"
3845 * ),
3846 * @OA\Response(
3847 * response="200",
3848 * ref="#/components/responses/standard"
3849 * ),
3850 * @OA\Response(
3851 * response="400",
3852 * ref="#/components/responses/badrequest"
3853 * ),
3854 * @OA\Response(
3855 * response="401",
3856 * ref="#/components/responses/unauthorized"
3857 * ),
3858 * security={{"openemr_auth":{}}}
3861 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3862 RestConfig::authorization_check("patients", "med");
3863 $return = (new ConditionRestController())->delete($puuid, $muuid);
3864 RestConfig::apiLog($return);
3865 return $return;
3869 * @OA\Get(
3870 * path="/api/allergy",
3871 * description="Retrieves a list of allergies",
3872 * tags={"standard"},
3873 * @OA\Parameter(
3874 * name="lists.pid",
3875 * in="query",
3876 * description="The uuid for the patient.",
3877 * required=false,
3878 * @OA\Schema(
3879 * type="string"
3881 * ),
3882 * @OA\Parameter(
3883 * name="lists.id",
3884 * in="query",
3885 * description="The uuid for the allergy.",
3886 * required=false,
3887 * @OA\Schema(
3888 * type="string"
3890 * ),
3891 * @OA\Parameter(
3892 * name="title",
3893 * in="query",
3894 * description="The title for the allergy.",
3895 * required=false,
3896 * @OA\Schema(
3897 * type="string"
3899 * ),
3900 * @OA\Parameter(
3901 * name="begdate",
3902 * in="query",
3903 * description="The start date for the allergy.",
3904 * required=false,
3905 * @OA\Schema(
3906 * type="string"
3908 * ),
3909 * @OA\Parameter(
3910 * name="enddate",
3911 * in="query",
3912 * description="The end date for the allergy.",
3913 * required=false,
3914 * @OA\Schema(
3915 * type="string"
3917 * ),
3918 * @OA\Parameter(
3919 * name="diagnosis",
3920 * in="query",
3921 * description="The diagnosis for the allergy.",
3922 * required=false,
3923 * @OA\Schema(
3924 * type="string"
3926 * ),
3927 * @OA\Response(
3928 * response="200",
3929 * ref="#/components/responses/standard"
3930 * ),
3931 * @OA\Response(
3932 * response="400",
3933 * ref="#/components/responses/badrequest"
3934 * ),
3935 * @OA\Response(
3936 * response="401",
3937 * ref="#/components/responses/unauthorized"
3938 * ),
3939 * security={{"openemr_auth":{}}}
3942 "GET /api/allergy" => function () {
3943 RestConfig::authorization_check("patients", "med");
3944 $return = (new AllergyIntoleranceRestController())->getAll();
3945 RestConfig::apiLog($return);
3946 return $return;
3950 * @OA\Get(
3951 * path="/api/allergy/{auuid}",
3952 * description="Retrieves a single allergy by their uuid",
3953 * tags={"standard"},
3954 * @OA\Parameter(
3955 * name="auuid",
3956 * in="path",
3957 * description="The uuid for the allergy.",
3958 * required=true,
3959 * @OA\Schema(
3960 * type="string"
3962 * ),
3963 * @OA\Response(
3964 * response="200",
3965 * ref="#/components/responses/standard"
3966 * ),
3967 * @OA\Response(
3968 * response="400",
3969 * ref="#/components/responses/badrequest"
3970 * ),
3971 * @OA\Response(
3972 * response="401",
3973 * ref="#/components/responses/unauthorized"
3974 * ),
3975 * security={{"openemr_auth":{}}}
3978 "GET /api/allergy/:auuid" => function ($auuid) {
3979 RestConfig::authorization_check("patients", "med");
3980 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3981 RestConfig::apiLog($return);
3982 return $return;
3986 * @OA\Get(
3987 * path="/api/patient/{puuid}/allergy",
3988 * description="Retrieves all allergies for a patient",
3989 * tags={"standard"},
3990 * @OA\Parameter(
3991 * name="puuid",
3992 * in="path",
3993 * description="The uuid for the patient.",
3994 * required=true,
3995 * @OA\Schema(
3996 * type="string"
3998 * ),
3999 * @OA\Response(
4000 * response="200",
4001 * ref="#/components/responses/standard"
4002 * ),
4003 * @OA\Response(
4004 * response="400",
4005 * ref="#/components/responses/badrequest"
4006 * ),
4007 * @OA\Response(
4008 * response="401",
4009 * ref="#/components/responses/unauthorized"
4010 * ),
4011 * security={{"openemr_auth":{}}}
4014 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4015 RestConfig::authorization_check("patients", "med");
4016 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4017 RestConfig::apiLog($return);
4018 return $return;
4022 * @OA\Get(
4023 * path="/api/patient/{puuid}/allergy/{auuid}",
4024 * description="Retrieves a allergy for a patient",
4025 * tags={"standard"},
4026 * @OA\Parameter(
4027 * name="puuid",
4028 * in="path",
4029 * description="The uuid for the patient.",
4030 * required=true,
4031 * @OA\Schema(
4032 * type="string"
4034 * ),
4035 * @OA\Parameter(
4036 * name="auuid",
4037 * in="path",
4038 * description="The uuid for the allergy.",
4039 * required=true,
4040 * @OA\Schema(
4041 * type="string"
4043 * ),
4044 * @OA\Response(
4045 * response="200",
4046 * ref="#/components/responses/standard"
4047 * ),
4048 * @OA\Response(
4049 * response="400",
4050 * ref="#/components/responses/badrequest"
4051 * ),
4052 * @OA\Response(
4053 * response="401",
4054 * ref="#/components/responses/unauthorized"
4055 * ),
4056 * security={{"openemr_auth":{}}}
4059 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4060 RestConfig::authorization_check("patients", "med");
4061 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4062 RestConfig::apiLog($return);
4063 return $return;
4067 * Schema for the allergy request
4069 * @OA\Schema(
4070 * schema="api_allergy_request",
4071 * @OA\Property(
4072 * property="title",
4073 * description="The title of allergy.",
4074 * type="string"
4075 * ),
4076 * @OA\Property(
4077 * property="begdate",
4078 * description="The beginning date of allergy.",
4079 * type="string"
4080 * ),
4081 * @OA\Property(
4082 * property="enddate",
4083 * description="The end date of allergy.",
4084 * type="string"
4085 * ),
4086 * @OA\Property(
4087 * property="diagnosis",
4088 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4089 * type="string"
4090 * ),
4091 * required={"title", "begdate"},
4092 * example={
4093 * "title": "Iodine",
4094 * "begdate": "2010-10-13",
4095 * "enddate": null
4100 * @OA\Post(
4101 * path="/api/patient/{puuid}/allergy",
4102 * description="Submits a new allergy",
4103 * tags={"standard"},
4104 * @OA\Parameter(
4105 * name="puuid",
4106 * in="path",
4107 * description="The uuid for the patient.",
4108 * required=true,
4109 * @OA\Schema(
4110 * type="string"
4112 * ),
4113 * @OA\RequestBody(
4114 * required=true,
4115 * @OA\MediaType(
4116 * mediaType="application/json",
4117 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4119 * ),
4120 * @OA\Response(
4121 * response="200",
4122 * ref="#/components/responses/standard"
4123 * ),
4124 * @OA\Response(
4125 * response="400",
4126 * ref="#/components/responses/badrequest"
4127 * ),
4128 * @OA\Response(
4129 * response="401",
4130 * ref="#/components/responses/unauthorized"
4131 * ),
4132 * security={{"openemr_auth":{}}}
4135 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4136 RestConfig::authorization_check("patients", "med");
4137 $data = (array) (json_decode(file_get_contents("php://input")));
4138 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4139 RestConfig::apiLog($return, $data);
4140 return $return;
4144 * @OA\Put(
4145 * path="/api/patient/{puuid}/allergy/{auuid}",
4146 * description="Edit a allergy",
4147 * tags={"standard"},
4148 * @OA\Parameter(
4149 * name="puuid",
4150 * in="path",
4151 * description="The uuid for the patient.",
4152 * required=true,
4153 * @OA\Schema(
4154 * type="string"
4156 * ),
4157 * @OA\Parameter(
4158 * name="auuid",
4159 * in="path",
4160 * description="The uuid for the allergy.",
4161 * required=true,
4162 * @OA\Schema(
4163 * type="string"
4165 * ),
4166 * @OA\RequestBody(
4167 * required=true,
4168 * @OA\MediaType(
4169 * mediaType="application/json",
4170 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4172 * ),
4173 * @OA\Response(
4174 * response="200",
4175 * ref="#/components/responses/standard"
4176 * ),
4177 * @OA\Response(
4178 * response="400",
4179 * ref="#/components/responses/badrequest"
4180 * ),
4181 * @OA\Response(
4182 * response="401",
4183 * ref="#/components/responses/unauthorized"
4184 * ),
4185 * security={{"openemr_auth":{}}}
4188 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4189 RestConfig::authorization_check("patients", "med");
4190 $data = (array) (json_decode(file_get_contents("php://input")));
4191 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4192 RestConfig::apiLog($return, $data);
4193 return $return;
4197 * @OA\Delete(
4198 * path="/api/patient/{puuid}/allergy/{auuid}",
4199 * description="Delete a medical problem",
4200 * tags={"standard"},
4201 * @OA\Parameter(
4202 * name="puuid",
4203 * in="path",
4204 * description="The uuid for the patient.",
4205 * required=true,
4206 * @OA\Schema(
4207 * type="string"
4209 * ),
4210 * @OA\Parameter(
4211 * name="auuid",
4212 * in="path",
4213 * description="The uuid for the allergy.",
4214 * required=true,
4215 * @OA\Schema(
4216 * type="string"
4218 * ),
4219 * @OA\Response(
4220 * response="200",
4221 * ref="#/components/responses/standard"
4222 * ),
4223 * @OA\Response(
4224 * response="400",
4225 * ref="#/components/responses/badrequest"
4226 * ),
4227 * @OA\Response(
4228 * response="401",
4229 * ref="#/components/responses/unauthorized"
4230 * ),
4231 * security={{"openemr_auth":{}}}
4234 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4235 RestConfig::authorization_check("patients", "med");
4236 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4237 RestConfig::apiLog($return);
4238 return $return;
4242 * @OA\Get(
4243 * path="/api/patient/{pid}/medication",
4244 * description="Retrieves all medications for a patient",
4245 * tags={"standard"},
4246 * @OA\Parameter(
4247 * name="pid",
4248 * in="path",
4249 * description="The pid for the patient.",
4250 * required=true,
4251 * @OA\Schema(
4252 * type="string"
4254 * ),
4255 * @OA\Response(
4256 * response="200",
4257 * ref="#/components/responses/standard"
4258 * ),
4259 * @OA\Response(
4260 * response="400",
4261 * ref="#/components/responses/badrequest"
4262 * ),
4263 * @OA\Response(
4264 * response="401",
4265 * ref="#/components/responses/unauthorized"
4266 * ),
4267 * security={{"openemr_auth":{}}}
4270 "GET /api/patient/:pid/medication" => function ($pid) {
4271 RestConfig::authorization_check("patients", "med");
4272 $return = (new ListRestController())->getAll($pid, "medication");
4273 RestConfig::apiLog($return);
4274 return $return;
4278 * Schema for the medication request
4280 * @OA\Schema(
4281 * schema="api_medication_request",
4282 * @OA\Property(
4283 * property="title",
4284 * description="The title of medication.",
4285 * type="string"
4286 * ),
4287 * @OA\Property(
4288 * property="begdate",
4289 * description="The beginning date of medication.",
4290 * type="string"
4291 * ),
4292 * @OA\Property(
4293 * property="enddate",
4294 * description="The end date of medication.",
4295 * type="string"
4296 * ),
4297 * @OA\Property(
4298 * property="diagnosis",
4299 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4300 * type="string"
4301 * ),
4302 * required={"title", "begdate"},
4303 * example={
4304 * "title": "Norvasc",
4305 * "begdate": "2013-04-13",
4306 * "enddate": null
4311 * @OA\Post(
4312 * path="/api/patient/{pid}/medication",
4313 * description="Submits a new medication",
4314 * tags={"standard"},
4315 * @OA\Parameter(
4316 * name="pid",
4317 * in="path",
4318 * description="The pid for the patient.",
4319 * required=true,
4320 * @OA\Schema(
4321 * type="string"
4323 * ),
4324 * @OA\RequestBody(
4325 * required=true,
4326 * @OA\MediaType(
4327 * mediaType="application/json",
4328 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4330 * ),
4331 * @OA\Response(
4332 * response="200",
4333 * ref="#/components/responses/standard"
4334 * ),
4335 * @OA\Response(
4336 * response="400",
4337 * ref="#/components/responses/badrequest"
4338 * ),
4339 * @OA\Response(
4340 * response="401",
4341 * ref="#/components/responses/unauthorized"
4342 * ),
4343 * security={{"openemr_auth":{}}}
4346 "POST /api/patient/:pid/medication" => function ($pid) {
4347 RestConfig::authorization_check("patients", "med");
4348 $data = (array) (json_decode(file_get_contents("php://input")));
4349 $return = (new ListRestController())->post($pid, "medication", $data);
4350 RestConfig::apiLog($return, $data);
4351 return $return;
4355 * @OA\Put(
4356 * path="/api/patient/{pid}/medication/{mid}",
4357 * description="Edit a medication",
4358 * tags={"standard"},
4359 * @OA\Parameter(
4360 * name="pid",
4361 * in="path",
4362 * description="The pid for the patient.",
4363 * required=true,
4364 * @OA\Schema(
4365 * type="string"
4367 * ),
4368 * @OA\Parameter(
4369 * name="mid",
4370 * in="path",
4371 * description="The id for the medication.",
4372 * required=true,
4373 * @OA\Schema(
4374 * type="string"
4376 * ),
4377 * @OA\RequestBody(
4378 * required=true,
4379 * @OA\MediaType(
4380 * mediaType="application/json",
4381 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4383 * ),
4384 * @OA\Response(
4385 * response="200",
4386 * ref="#/components/responses/standard"
4387 * ),
4388 * @OA\Response(
4389 * response="400",
4390 * ref="#/components/responses/badrequest"
4391 * ),
4392 * @OA\Response(
4393 * response="401",
4394 * ref="#/components/responses/unauthorized"
4395 * ),
4396 * security={{"openemr_auth":{}}}
4399 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4400 RestConfig::authorization_check("patients", "med");
4401 $data = (array) (json_decode(file_get_contents("php://input")));
4402 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4403 RestConfig::apiLog($return, $data);
4404 return $return;
4408 * @OA\Get(
4409 * path="/api/patient/{pid}/medication/{mid}",
4410 * description="Retrieves a medication for a patient",
4411 * tags={"standard"},
4412 * @OA\Parameter(
4413 * name="pid",
4414 * in="path",
4415 * description="The id for the patient.",
4416 * required=true,
4417 * @OA\Schema(
4418 * type="string"
4420 * ),
4421 * @OA\Parameter(
4422 * name="mid",
4423 * in="path",
4424 * description="The id for the medication.",
4425 * required=true,
4426 * @OA\Schema(
4427 * type="string"
4429 * ),
4430 * @OA\Response(
4431 * response="200",
4432 * ref="#/components/responses/standard"
4433 * ),
4434 * @OA\Response(
4435 * response="400",
4436 * ref="#/components/responses/badrequest"
4437 * ),
4438 * @OA\Response(
4439 * response="401",
4440 * ref="#/components/responses/unauthorized"
4441 * ),
4442 * security={{"openemr_auth":{}}}
4445 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4446 RestConfig::authorization_check("patients", "med");
4447 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4448 RestConfig::apiLog($return);
4449 return $return;
4453 * @OA\Delete(
4454 * path="/api/patient/{pid}/medication/{mid}",
4455 * description="Delete a medication",
4456 * tags={"standard"},
4457 * @OA\Parameter(
4458 * name="pid",
4459 * in="path",
4460 * description="The id for the patient.",
4461 * required=true,
4462 * @OA\Schema(
4463 * type="string"
4465 * ),
4466 * @OA\Parameter(
4467 * name="mid",
4468 * in="path",
4469 * description="The id for the medication.",
4470 * required=true,
4471 * @OA\Schema(
4472 * type="string"
4474 * ),
4475 * @OA\Response(
4476 * response="200",
4477 * ref="#/components/responses/standard"
4478 * ),
4479 * @OA\Response(
4480 * response="400",
4481 * ref="#/components/responses/badrequest"
4482 * ),
4483 * @OA\Response(
4484 * response="401",
4485 * ref="#/components/responses/unauthorized"
4486 * ),
4487 * security={{"openemr_auth":{}}}
4490 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4491 RestConfig::authorization_check("patients", "med");
4492 $return = (new ListRestController())->delete($pid, $mid, "medication");
4493 RestConfig::apiLog($return);
4494 return $return;
4498 * @OA\Get(
4499 * path="/api/patient/{pid}/surgery",
4500 * description="Retrieves all surgeries for a patient",
4501 * tags={"standard"},
4502 * @OA\Parameter(
4503 * name="pid",
4504 * in="path",
4505 * description="The pid for the patient.",
4506 * required=true,
4507 * @OA\Schema(
4508 * type="string"
4510 * ),
4511 * @OA\Response(
4512 * response="200",
4513 * ref="#/components/responses/standard"
4514 * ),
4515 * @OA\Response(
4516 * response="400",
4517 * ref="#/components/responses/badrequest"
4518 * ),
4519 * @OA\Response(
4520 * response="401",
4521 * ref="#/components/responses/unauthorized"
4522 * ),
4523 * security={{"openemr_auth":{}}}
4526 "GET /api/patient/:pid/surgery" => function ($pid) {
4527 RestConfig::authorization_check("patients", "med");
4528 $return = (new ListRestController())->getAll($pid, "surgery");
4529 RestConfig::apiLog($return);
4530 return $return;
4534 * @OA\Get(
4535 * path="/api/patient/{pid}/surgery/{sid}",
4536 * description="Retrieves a surgery for a patient",
4537 * tags={"standard"},
4538 * @OA\Parameter(
4539 * name="pid",
4540 * in="path",
4541 * description="The id for the patient.",
4542 * required=true,
4543 * @OA\Schema(
4544 * type="string"
4546 * ),
4547 * @OA\Parameter(
4548 * name="sid",
4549 * in="path",
4550 * description="The id for the surgery.",
4551 * required=true,
4552 * @OA\Schema(
4553 * type="string"
4555 * ),
4556 * @OA\Response(
4557 * response="200",
4558 * ref="#/components/responses/standard"
4559 * ),
4560 * @OA\Response(
4561 * response="400",
4562 * ref="#/components/responses/badrequest"
4563 * ),
4564 * @OA\Response(
4565 * response="401",
4566 * ref="#/components/responses/unauthorized"
4567 * ),
4568 * security={{"openemr_auth":{}}}
4571 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4572 RestConfig::authorization_check("patients", "med");
4573 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4574 RestConfig::apiLog($return);
4575 return $return;
4579 * @OA\Delete(
4580 * path="/api/patient/{pid}/surgery/{sid}",
4581 * description="Delete a surgery",
4582 * tags={"standard"},
4583 * @OA\Parameter(
4584 * name="pid",
4585 * in="path",
4586 * description="The id for the patient.",
4587 * required=true,
4588 * @OA\Schema(
4589 * type="string"
4591 * ),
4592 * @OA\Parameter(
4593 * name="sid",
4594 * in="path",
4595 * description="The id for the surgery.",
4596 * required=true,
4597 * @OA\Schema(
4598 * type="string"
4600 * ),
4601 * @OA\Response(
4602 * response="200",
4603 * ref="#/components/responses/standard"
4604 * ),
4605 * @OA\Response(
4606 * response="400",
4607 * ref="#/components/responses/badrequest"
4608 * ),
4609 * @OA\Response(
4610 * response="401",
4611 * ref="#/components/responses/unauthorized"
4612 * ),
4613 * security={{"openemr_auth":{}}}
4616 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4617 RestConfig::authorization_check("patients", "med");
4618 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4619 RestConfig::apiLog($return);
4620 return $return;
4624 * Schema for the surgery request
4626 * @OA\Schema(
4627 * schema="api_surgery_request",
4628 * @OA\Property(
4629 * property="title",
4630 * description="The title of surgery.",
4631 * type="string"
4632 * ),
4633 * @OA\Property(
4634 * property="begdate",
4635 * description="The beginning date of surgery.",
4636 * type="string"
4637 * ),
4638 * @OA\Property(
4639 * property="enddate",
4640 * description="The end date of surgery.",
4641 * type="string"
4642 * ),
4643 * @OA\Property(
4644 * property="diagnosis",
4645 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4646 * type="string"
4647 * ),
4648 * required={"title", "begdate"},
4649 * example={
4650 * "title": "Blepharoplasty",
4651 * "begdate": "2013-10-14",
4652 * "enddate": null,
4653 * "diagnosis": "CPT4:15823-50"
4658 * @OA\Post(
4659 * path="/api/patient/{pid}/surgery",
4660 * description="Submits a new surgery",
4661 * tags={"standard"},
4662 * @OA\Parameter(
4663 * name="pid",
4664 * in="path",
4665 * description="The pid for the patient.",
4666 * required=true,
4667 * @OA\Schema(
4668 * type="string"
4670 * ),
4671 * @OA\RequestBody(
4672 * required=true,
4673 * @OA\MediaType(
4674 * mediaType="application/json",
4675 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4677 * ),
4678 * @OA\Response(
4679 * response="200",
4680 * ref="#/components/responses/standard"
4681 * ),
4682 * @OA\Response(
4683 * response="400",
4684 * ref="#/components/responses/badrequest"
4685 * ),
4686 * @OA\Response(
4687 * response="401",
4688 * ref="#/components/responses/unauthorized"
4689 * ),
4690 * security={{"openemr_auth":{}}}
4693 "POST /api/patient/:pid/surgery" => function ($pid) {
4694 RestConfig::authorization_check("patients", "med");
4695 $data = (array) (json_decode(file_get_contents("php://input")));
4696 $return = (new ListRestController())->post($pid, "surgery", $data);
4697 RestConfig::apiLog($return, $data);
4698 return $return;
4702 * @OA\Put(
4703 * path="/api/patient/{pid}/surgery/{sid}",
4704 * description="Edit a surgery",
4705 * tags={"standard"},
4706 * @OA\Parameter(
4707 * name="pid",
4708 * in="path",
4709 * description="The pid for the patient.",
4710 * required=true,
4711 * @OA\Schema(
4712 * type="string"
4714 * ),
4715 * @OA\Parameter(
4716 * name="sid",
4717 * in="path",
4718 * description="The id for the surgery.",
4719 * required=true,
4720 * @OA\Schema(
4721 * type="string"
4723 * ),
4724 * @OA\RequestBody(
4725 * required=true,
4726 * @OA\MediaType(
4727 * mediaType="application/json",
4728 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4730 * ),
4731 * @OA\Response(
4732 * response="200",
4733 * ref="#/components/responses/standard"
4734 * ),
4735 * @OA\Response(
4736 * response="400",
4737 * ref="#/components/responses/badrequest"
4738 * ),
4739 * @OA\Response(
4740 * response="401",
4741 * ref="#/components/responses/unauthorized"
4742 * ),
4743 * security={{"openemr_auth":{}}}
4746 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4747 RestConfig::authorization_check("patients", "med");
4748 $data = (array) (json_decode(file_get_contents("php://input")));
4749 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4750 RestConfig::apiLog($return, $data);
4751 return $return;
4755 * @OA\Get(
4756 * path="/api/patient/{pid}/dental_issue",
4757 * description="Retrieves all dental issues for a patient",
4758 * tags={"standard"},
4759 * @OA\Parameter(
4760 * name="pid",
4761 * in="path",
4762 * description="The pid for the patient.",
4763 * required=true,
4764 * @OA\Schema(
4765 * type="string"
4767 * ),
4768 * @OA\Response(
4769 * response="200",
4770 * ref="#/components/responses/standard"
4771 * ),
4772 * @OA\Response(
4773 * response="400",
4774 * ref="#/components/responses/badrequest"
4775 * ),
4776 * @OA\Response(
4777 * response="401",
4778 * ref="#/components/responses/unauthorized"
4779 * ),
4780 * security={{"openemr_auth":{}}}
4783 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4784 RestConfig::authorization_check("patients", "med");
4785 $return = (new ListRestController())->getAll($pid, "dental");
4786 RestConfig::apiLog($return);
4787 return $return;
4791 * @OA\Get(
4792 * path="/api/patient/{pid}/dental_issue/{did}",
4793 * description="Retrieves a dental issue for a patient",
4794 * tags={"standard"},
4795 * @OA\Parameter(
4796 * name="pid",
4797 * in="path",
4798 * description="The id for the patient.",
4799 * required=true,
4800 * @OA\Schema(
4801 * type="string"
4803 * ),
4804 * @OA\Parameter(
4805 * name="did",
4806 * in="path",
4807 * description="The id for the dental issue.",
4808 * required=true,
4809 * @OA\Schema(
4810 * type="string"
4812 * ),
4813 * @OA\Response(
4814 * response="200",
4815 * ref="#/components/responses/standard"
4816 * ),
4817 * @OA\Response(
4818 * response="400",
4819 * ref="#/components/responses/badrequest"
4820 * ),
4821 * @OA\Response(
4822 * response="401",
4823 * ref="#/components/responses/unauthorized"
4824 * ),
4825 * security={{"openemr_auth":{}}}
4828 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4829 RestConfig::authorization_check("patients", "med");
4830 $return = (new ListRestController())->getOne($pid, "dental", $did);
4831 RestConfig::apiLog($return);
4832 return $return;
4836 * @OA\Delete(
4837 * path="/api/patient/{pid}/dental_issue/{did}",
4838 * description="Delete a dental issue",
4839 * tags={"standard"},
4840 * @OA\Parameter(
4841 * name="pid",
4842 * in="path",
4843 * description="The id for the patient.",
4844 * required=true,
4845 * @OA\Schema(
4846 * type="string"
4848 * ),
4849 * @OA\Parameter(
4850 * name="did",
4851 * in="path",
4852 * description="The id for the dental issue.",
4853 * required=true,
4854 * @OA\Schema(
4855 * type="string"
4857 * ),
4858 * @OA\Response(
4859 * response="200",
4860 * ref="#/components/responses/standard"
4861 * ),
4862 * @OA\Response(
4863 * response="400",
4864 * ref="#/components/responses/badrequest"
4865 * ),
4866 * @OA\Response(
4867 * response="401",
4868 * ref="#/components/responses/unauthorized"
4869 * ),
4870 * security={{"openemr_auth":{}}}
4873 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4874 RestConfig::authorization_check("patients", "med");
4875 $return = (new ListRestController())->delete($pid, $did, "dental");
4876 RestConfig::apiLog($return);
4877 return $return;
4881 * Schema for the dental_issue request
4883 * @OA\Schema(
4884 * schema="api_dental_issue_request",
4885 * @OA\Property(
4886 * property="title",
4887 * description="The title of dental issue.",
4888 * type="string"
4889 * ),
4890 * @OA\Property(
4891 * property="begdate",
4892 * description="The beginning date of dental issue.",
4893 * type="string"
4894 * ),
4895 * @OA\Property(
4896 * property="enddate",
4897 * description="The end date of dental issue.",
4898 * type="string"
4899 * ),
4900 * @OA\Property(
4901 * property="diagnosis",
4902 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4903 * type="string"
4904 * ),
4905 * required={"title", "begdate"},
4906 * example={
4907 * "title": "Halitosis",
4908 * "begdate": "2015-03-17",
4909 * "enddate": null,
4914 * @OA\Post(
4915 * path="/api/patient/{pid}/dental_issue",
4916 * description="Submits a new dental issue",
4917 * tags={"standard"},
4918 * @OA\Parameter(
4919 * name="pid",
4920 * in="path",
4921 * description="The pid for the patient.",
4922 * required=true,
4923 * @OA\Schema(
4924 * type="string"
4926 * ),
4927 * @OA\RequestBody(
4928 * required=true,
4929 * @OA\MediaType(
4930 * mediaType="application/json",
4931 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4933 * ),
4934 * @OA\Response(
4935 * response="200",
4936 * ref="#/components/responses/standard"
4937 * ),
4938 * @OA\Response(
4939 * response="400",
4940 * ref="#/components/responses/badrequest"
4941 * ),
4942 * @OA\Response(
4943 * response="401",
4944 * ref="#/components/responses/unauthorized"
4945 * ),
4946 * security={{"openemr_auth":{}}}
4949 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4950 RestConfig::authorization_check("patients", "med");
4951 $data = (array) (json_decode(file_get_contents("php://input")));
4952 $return = (new ListRestController())->post($pid, "dental", $data);
4953 RestConfig::apiLog($return, $data);
4954 return $return;
4958 * @OA\Put(
4959 * path="/api/patient/{pid}/dental_issue/{did}",
4960 * description="Edit a dental issue",
4961 * tags={"standard"},
4962 * @OA\Parameter(
4963 * name="pid",
4964 * in="path",
4965 * description="The pid for the patient.",
4966 * required=true,
4967 * @OA\Schema(
4968 * type="string"
4970 * ),
4971 * @OA\Parameter(
4972 * name="did",
4973 * in="path",
4974 * description="The id for the dental issue.",
4975 * required=true,
4976 * @OA\Schema(
4977 * type="string"
4979 * ),
4980 * @OA\RequestBody(
4981 * required=true,
4982 * @OA\MediaType(
4983 * mediaType="application/json",
4984 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4986 * ),
4987 * @OA\Response(
4988 * response="200",
4989 * ref="#/components/responses/standard"
4990 * ),
4991 * @OA\Response(
4992 * response="400",
4993 * ref="#/components/responses/badrequest"
4994 * ),
4995 * @OA\Response(
4996 * response="401",
4997 * ref="#/components/responses/unauthorized"
4998 * ),
4999 * security={{"openemr_auth":{}}}
5002 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5003 RestConfig::authorization_check("patients", "med");
5004 $data = (array) (json_decode(file_get_contents("php://input")));
5005 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5006 RestConfig::apiLog($return, $data);
5007 return $return;
5011 * @OA\Get(
5012 * path="/api/patient/{pid}/appointment",
5013 * description="Retrieves all appointments for a patient",
5014 * tags={"standard"},
5015 * @OA\Parameter(
5016 * name="pid",
5017 * in="path",
5018 * description="The pid for the patient.",
5019 * required=true,
5020 * @OA\Schema(
5021 * type="string"
5023 * ),
5024 * @OA\Response(
5025 * response="200",
5026 * ref="#/components/responses/standard"
5027 * ),
5028 * @OA\Response(
5029 * response="400",
5030 * ref="#/components/responses/badrequest"
5031 * ),
5032 * @OA\Response(
5033 * response="401",
5034 * ref="#/components/responses/unauthorized"
5035 * ),
5036 * security={{"openemr_auth":{}}}
5039 "GET /api/patient/:pid/appointment" => function ($pid) {
5040 RestConfig::authorization_check("patients", "appt");
5041 $return = (new AppointmentRestController())->getAllForPatient($pid);
5042 RestConfig::apiLog($return);
5043 return $return;
5047 * @OA\Post(
5048 * path="/api/patient/{pid}/appointment",
5049 * description="Submits a new appointment",
5050 * tags={"standard"},
5051 * @OA\Parameter(
5052 * name="pid",
5053 * in="path",
5054 * description="The id for the patient.",
5055 * required=true,
5056 * @OA\Schema(
5057 * type="string"
5059 * ),
5060 * @OA\RequestBody(
5061 * required=true,
5062 * @OA\MediaType(
5063 * mediaType="application/json",
5064 * @OA\Schema(
5065 * @OA\Property(
5066 * property="pc_catid",
5067 * description="The category of the appointment.",
5068 * type="string"
5069 * ),
5070 * @OA\Property(
5071 * property="pc_title",
5072 * description="The title of the appointment.",
5073 * type="string"
5074 * ),
5075 * @OA\Property(
5076 * property="pc_duration",
5077 * description="The duration of the appointment.",
5078 * type="string"
5079 * ),
5080 * @OA\Property(
5081 * property="pc_hometext",
5082 * description="Comments for the appointment.",
5083 * type="string"
5084 * ),
5085 * @OA\Property(
5086 * property="pc_apptstatus",
5087 * description="use an option from resource=/api/list/apptstat",
5088 * type="string"
5089 * ),
5090 * @OA\Property(
5091 * property="pc_eventDate",
5092 * description="The date of the appointment.",
5093 * type="string"
5094 * ),
5095 * @OA\Property(
5096 * property="pc_startTime",
5097 * description="The time of the appointment.",
5098 * type="string"
5099 * ),
5100 * @OA\Property(
5101 * property="pc_facility",
5102 * description="The facility id of the appointment.",
5103 * type="string"
5104 * ),
5105 * @OA\Property(
5106 * property="pc_billing_location",
5107 * description="The billinag location id of the appointment.",
5108 * type="string"
5109 * ),
5110 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5111 * example={
5112 * "pc_catid": "5",
5113 * "pc_title": "Office Visit",
5114 * "pc_duration": "900",
5115 * "pc_hometext": "Test",
5116 * "pc_apptstatus": "-",
5117 * "pc_eventDate": "2018-10-19",
5118 * "pc_startTime": "09:00",
5119 * "pc_facility": "9",
5120 * "pc_billing_location": "10"
5124 * ),
5125 * @OA\Response(
5126 * response="200",
5127 * ref="#/components/responses/standard"
5128 * ),
5129 * @OA\Response(
5130 * response="400",
5131 * ref="#/components/responses/badrequest"
5132 * ),
5133 * @OA\Response(
5134 * response="401",
5135 * ref="#/components/responses/unauthorized"
5136 * ),
5137 * security={{"openemr_auth":{}}}
5140 "POST /api/patient/:pid/appointment" => function ($pid) {
5141 RestConfig::authorization_check("patients", "appt");
5142 $data = (array) (json_decode(file_get_contents("php://input")));
5143 $return = (new AppointmentRestController())->post($pid, $data);
5144 RestConfig::apiLog($return, $data);
5145 return $return;
5149 * @OA\Get(
5150 * path="/api/appointment",
5151 * description="Retrieves all appointments",
5152 * tags={"standard"},
5153 * @OA\Response(
5154 * response="200",
5155 * ref="#/components/responses/standard"
5156 * ),
5157 * @OA\Response(
5158 * response="400",
5159 * ref="#/components/responses/badrequest"
5160 * ),
5161 * @OA\Response(
5162 * response="401",
5163 * ref="#/components/responses/unauthorized"
5164 * ),
5165 * security={{"openemr_auth":{}}}
5168 "GET /api/appointment" => function () {
5169 RestConfig::authorization_check("patients", "appt");
5170 $return = (new AppointmentRestController())->getAll();
5171 RestConfig::apiLog($return);
5172 return $return;
5176 * @OA\Get(
5177 * path="/api/appointment/{eid}",
5178 * description="Retrieves an appointment",
5179 * tags={"standard"},
5180 * @OA\Parameter(
5181 * name="eid",
5182 * in="path",
5183 * description="The eid for the appointment.",
5184 * required=true,
5185 * @OA\Schema(
5186 * type="string"
5188 * ),
5189 * @OA\Response(
5190 * response="200",
5191 * ref="#/components/responses/standard"
5192 * ),
5193 * @OA\Response(
5194 * response="400",
5195 * ref="#/components/responses/badrequest"
5196 * ),
5197 * @OA\Response(
5198 * response="401",
5199 * ref="#/components/responses/unauthorized"
5200 * ),
5201 * security={{"openemr_auth":{}}}
5204 "GET /api/appointment/:eid" => function ($eid) {
5205 RestConfig::authorization_check("patients", "appt");
5206 $return = (new AppointmentRestController())->getOne($eid);
5207 RestConfig::apiLog($return);
5208 return $return;
5212 * @OA\Delete(
5213 * path="/api/patient/{pid}/appointment/{eid}",
5214 * description="Delete a appointment",
5215 * tags={"standard"},
5216 * @OA\Parameter(
5217 * name="pid",
5218 * in="path",
5219 * description="The id for the patient.",
5220 * required=true,
5221 * @OA\Schema(
5222 * type="string"
5224 * ),
5225 * @OA\Parameter(
5226 * name="eid",
5227 * in="path",
5228 * description="The eid for the appointment.",
5229 * required=true,
5230 * @OA\Schema(
5231 * type="string"
5233 * ),
5234 * @OA\Response(
5235 * response="200",
5236 * ref="#/components/responses/standard"
5237 * ),
5238 * @OA\Response(
5239 * response="400",
5240 * ref="#/components/responses/badrequest"
5241 * ),
5242 * @OA\Response(
5243 * response="401",
5244 * ref="#/components/responses/unauthorized"
5245 * ),
5246 * security={{"openemr_auth":{}}}
5249 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5250 RestConfig::authorization_check("patients", "appt");
5251 $return = (new AppointmentRestController())->delete($eid);
5252 RestConfig::apiLog($return);
5253 return $return;
5257 * @OA\Get(
5258 * path="/api/patient/{pid}/appointment/{eid}",
5259 * description="Retrieves a appointment for a patient",
5260 * tags={"standard"},
5261 * @OA\Parameter(
5262 * name="pid",
5263 * in="path",
5264 * description="The id for the patient.",
5265 * required=true,
5266 * @OA\Schema(
5267 * type="string"
5269 * ),
5270 * @OA\Parameter(
5271 * name="eid",
5272 * in="path",
5273 * description="The eid for the appointment.",
5274 * required=true,
5275 * @OA\Schema(
5276 * type="string"
5278 * ),
5279 * @OA\Response(
5280 * response="200",
5281 * ref="#/components/responses/standard"
5282 * ),
5283 * @OA\Response(
5284 * response="400",
5285 * ref="#/components/responses/badrequest"
5286 * ),
5287 * @OA\Response(
5288 * response="401",
5289 * ref="#/components/responses/unauthorized"
5290 * ),
5291 * security={{"openemr_auth":{}}}
5294 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5295 RestConfig::authorization_check("patients", "appt");
5296 $return = (new AppointmentRestController())->getOne($eid);
5297 RestConfig::apiLog($return);
5298 return $return;
5302 * @OA\Get(
5303 * path="/api/list/{list_name}",
5304 * description="Retrieves a list",
5305 * tags={"standard"},
5306 * @OA\Parameter(
5307 * name="list_name",
5308 * in="path",
5309 * description="The list_id of the list.",
5310 * required=true,
5311 * @OA\Schema(
5312 * type="string"
5314 * ),
5315 * @OA\Response(
5316 * response="200",
5317 * ref="#/components/responses/standard"
5318 * ),
5319 * @OA\Response(
5320 * response="400",
5321 * ref="#/components/responses/badrequest"
5322 * ),
5323 * @OA\Response(
5324 * response="401",
5325 * ref="#/components/responses/unauthorized"
5326 * ),
5327 * security={{"openemr_auth":{}}}
5330 "GET /api/list/:list_name" => function ($list_name) {
5331 RestConfig::authorization_check("lists", "default");
5332 $return = (new ListRestController())->getOptions($list_name);
5333 RestConfig::apiLog($return);
5334 return $return;
5338 * @OA\Get(
5339 * path="/api/version",
5340 * description="Retrieves the OpenEMR version information",
5341 * tags={"standard"},
5342 * @OA\Response(
5343 * response="200",
5344 * ref="#/components/responses/standard"
5345 * ),
5346 * @OA\Response(
5347 * response="400",
5348 * ref="#/components/responses/badrequest"
5349 * ),
5350 * @OA\Response(
5351 * response="401",
5352 * ref="#/components/responses/unauthorized"
5353 * ),
5354 * security={{"openemr_auth":{}}}
5357 "GET /api/version" => function () {
5358 $return = (new VersionRestController())->getOne();
5359 RestConfig::apiLog($return);
5360 return $return;
5364 * @OA\Get(
5365 * path="/api/product",
5366 * description="Retrieves the OpenEMR product registration information",
5367 * tags={"standard"},
5368 * @OA\Response(
5369 * response="200",
5370 * ref="#/components/responses/standard"
5371 * ),
5372 * @OA\Response(
5373 * response="400",
5374 * ref="#/components/responses/badrequest"
5375 * ),
5376 * @OA\Response(
5377 * response="401",
5378 * ref="#/components/responses/unauthorized"
5379 * ),
5380 * security={{"openemr_auth":{}}}
5383 "GET /api/product" => function () {
5384 $return = (new ProductRegistrationRestController())->getOne();
5385 RestConfig::apiLog($return);
5386 return $return;
5390 * @OA\Get(
5391 * path="/api/insurance_company",
5392 * description="Retrieves all insurance companies",
5393 * tags={"standard"},
5394 * @OA\Response(
5395 * response="200",
5396 * ref="#/components/responses/standard"
5397 * ),
5398 * @OA\Response(
5399 * response="400",
5400 * ref="#/components/responses/badrequest"
5401 * ),
5402 * @OA\Response(
5403 * response="401",
5404 * ref="#/components/responses/unauthorized"
5405 * ),
5406 * security={{"openemr_auth":{}}}
5409 "GET /api/insurance_company" => function () {
5410 $return = (new InsuranceCompanyRestController())->getAll();
5411 RestConfig::apiLog($return);
5412 return $return;
5416 * @OA\Get(
5417 * path="/api/insurance_company/{iid}",
5418 * description="Retrieves insurance company",
5419 * tags={"standard"},
5420 * @OA\Parameter(
5421 * name="iid",
5422 * in="path",
5423 * description="The id of the insurance company.",
5424 * required=true,
5425 * @OA\Schema(
5426 * type="string"
5428 * ),
5429 * @OA\Response(
5430 * response="200",
5431 * ref="#/components/responses/standard"
5432 * ),
5433 * @OA\Response(
5434 * response="400",
5435 * ref="#/components/responses/badrequest"
5436 * ),
5437 * @OA\Response(
5438 * response="401",
5439 * ref="#/components/responses/unauthorized"
5440 * ),
5441 * security={{"openemr_auth":{}}}
5444 "GET /api/insurance_company/:iid" => function ($iid) {
5445 $return = (new InsuranceCompanyRestController())->getOne($iid);
5446 RestConfig::apiLog($return);
5447 return $return;
5451 * @OA\Get(
5452 * path="/api/insurance_type",
5453 * description="Retrieves all insurance types",
5454 * tags={"standard"},
5455 * @OA\Response(
5456 * response="200",
5457 * ref="#/components/responses/standard"
5458 * ),
5459 * @OA\Response(
5460 * response="400",
5461 * ref="#/components/responses/badrequest"
5462 * ),
5463 * @OA\Response(
5464 * response="401",
5465 * ref="#/components/responses/unauthorized"
5466 * ),
5467 * security={{"openemr_auth":{}}}
5470 "GET /api/insurance_type" => function () {
5471 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5472 RestConfig::apiLog($return);
5473 return $return;
5477 * Schema for the insurance_company request
5479 * @OA\Schema(
5480 * schema="api_insurance_company_request",
5481 * @OA\Property(
5482 * property="name",
5483 * description="The name of insurance company.",
5484 * type="string"
5485 * ),
5486 * @OA\Property(
5487 * property="attn",
5488 * description="The attn of insurance company.",
5489 * type="string"
5490 * ),
5491 * @OA\Property(
5492 * property="cms_id",
5493 * description="The cms id of insurance company.",
5494 * type="string"
5495 * ),
5496 * @OA\Property(
5497 * property="ins_type_code",
5498 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5499 * type="string"
5500 * ),
5501 * @OA\Property(
5502 * property="x12_receiver_id",
5503 * description="The x12 receiver id of insurance company.",
5504 * type="string"
5505 * ),
5506 * @OA\Property(
5507 * property="x12_default_partner_id",
5508 * description="The x12 default partner id of insurance company.",
5509 * type="string"
5510 * ),
5511 * @OA\Property(
5512 * property="alt_cms_id",
5513 * description="The alternate cms id of insurance company.",
5514 * type="string"
5515 * ),
5516 * @OA\Property(
5517 * property="line1",
5518 * description="The line1 address of insurance company.",
5519 * type="string"
5520 * ),
5521 * @OA\Property(
5522 * property="line2",
5523 * description="The line2 address of insurance company.",
5524 * type="string"
5525 * ),
5526 * @OA\Property(
5527 * property="city",
5528 * description="The city of insurance company.",
5529 * type="string"
5530 * ),
5531 * @OA\Property(
5532 * property="state",
5533 * description="The state of insurance company.",
5534 * type="string"
5535 * ),
5536 * @OA\Property(
5537 * property="zip",
5538 * description="The zip of insurance company.",
5539 * type="string"
5540 * ),
5541 * @OA\Property(
5542 * property="country",
5543 * description="The country of insurance company.",
5544 * type="string"
5545 * ),
5546 * required={"name"},
5547 * example={
5548 * "name": "Cool Insurance Company",
5549 * "attn": null,
5550 * "cms_id": null,
5551 * "ins_type_code": "2",
5552 * "x12_receiver_id": null,
5553 * "x12_default_partner_id": null,
5554 * "alt_cms_id": "",
5555 * "line1": "123 Cool Lane",
5556 * "line2": "Suite 123",
5557 * "city": "Cooltown",
5558 * "state": "CA",
5559 * "zip": "12245",
5560 * "country": "USA"
5565 * @OA\Post(
5566 * path="/api/insurance_company",
5567 * description="Submits a new insurance company",
5568 * tags={"standard"},
5569 * @OA\RequestBody(
5570 * required=true,
5571 * @OA\MediaType(
5572 * mediaType="application/json",
5573 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5575 * ),
5576 * @OA\Response(
5577 * response="200",
5578 * ref="#/components/responses/standard"
5579 * ),
5580 * @OA\Response(
5581 * response="400",
5582 * ref="#/components/responses/badrequest"
5583 * ),
5584 * @OA\Response(
5585 * response="401",
5586 * ref="#/components/responses/unauthorized"
5587 * ),
5588 * security={{"openemr_auth":{}}}
5591 "POST /api/insurance_company" => function () {
5592 $data = (array) (json_decode(file_get_contents("php://input")));
5593 $return = (new InsuranceCompanyRestController())->post($data);
5594 RestConfig::apiLog($return, $data);
5595 return $return;
5599 * @OA\Put(
5600 * path="/api/insurance_company/{iid}",
5601 * description="Edit a insurance company",
5602 * tags={"standard"},
5603 * @OA\Parameter(
5604 * name="iid",
5605 * in="path",
5606 * description="The id for the insurance company.",
5607 * required=true,
5608 * @OA\Schema(
5609 * type="string"
5611 * ),
5612 * @OA\RequestBody(
5613 * required=true,
5614 * @OA\MediaType(
5615 * mediaType="application/json",
5616 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5618 * ),
5619 * @OA\Response(
5620 * response="200",
5621 * ref="#/components/responses/standard"
5622 * ),
5623 * @OA\Response(
5624 * response="400",
5625 * ref="#/components/responses/badrequest"
5626 * ),
5627 * @OA\Response(
5628 * response="401",
5629 * ref="#/components/responses/unauthorized"
5630 * ),
5631 * security={{"openemr_auth":{}}}
5634 "PUT /api/insurance_company/:iid" => function ($iid) {
5635 $data = (array) (json_decode(file_get_contents("php://input")));
5636 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5637 RestConfig::apiLog($return, $data);
5638 return $return;
5642 * @OA\Post(
5643 * path="/api/patient/{pid}/document",
5644 * description="Submits a new patient document",
5645 * tags={"standard"},
5646 * @OA\Parameter(
5647 * name="pid",
5648 * in="path",
5649 * description="The pid for the patient.",
5650 * required=true,
5651 * @OA\Schema(
5652 * type="string"
5654 * ),
5655 * @OA\Parameter(
5656 * name="path",
5657 * in="query",
5658 * description="The category of the document.",
5659 * required=true,
5660 * @OA\Schema(
5661 * type="string"
5663 * ),
5664 * @OA\RequestBody(
5665 * required=true,
5666 * @OA\MediaType(
5667 * mediaType="multipart/form-data",
5668 * @OA\Schema(
5669 * @OA\Property(
5670 * property="document",
5671 * description="document",
5672 * type="string",
5673 * format="binary"
5674 * ),
5675 * ),
5676 * ),
5677 * ),
5678 * @OA\Response(
5679 * response="200",
5680 * ref="#/components/responses/standard"
5681 * ),
5682 * @OA\Response(
5683 * response="400",
5684 * ref="#/components/responses/badrequest"
5685 * ),
5686 * @OA\Response(
5687 * response="401",
5688 * ref="#/components/responses/unauthorized"
5689 * ),
5690 * security={{"openemr_auth":{}}}
5693 "POST /api/patient/:pid/document" => function ($pid) {
5694 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5695 RestConfig::apiLog($return);
5696 return $return;
5700 * @OA\Get(
5701 * path="/api/patient/{pid}/document",
5702 * description="Retrieves all file information of documents from a category for a patient",
5703 * tags={"standard"},
5704 * @OA\Parameter(
5705 * name="pid",
5706 * in="path",
5707 * description="The pid for the patient.",
5708 * required=true,
5709 * @OA\Schema(
5710 * type="string"
5712 * ),
5713 * @OA\Parameter(
5714 * name="path",
5715 * in="query",
5716 * description="The category of the documents.",
5717 * required=true,
5718 * @OA\Schema(
5719 * type="string"
5721 * ),
5722 * @OA\Response(
5723 * response="200",
5724 * ref="#/components/responses/standard"
5725 * ),
5726 * @OA\Response(
5727 * response="400",
5728 * ref="#/components/responses/badrequest"
5729 * ),
5730 * @OA\Response(
5731 * response="401",
5732 * ref="#/components/responses/unauthorized"
5733 * ),
5734 * security={{"openemr_auth":{}}}
5737 "GET /api/patient/:pid/document" => function ($pid) {
5738 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5739 RestConfig::apiLog($return);
5740 return $return;
5744 * @OA\Get(
5745 * path="/api/patient/{pid}/document/{did}",
5746 * description="Retrieves a document for a patient",
5747 * tags={"standard"},
5748 * @OA\Parameter(
5749 * name="pid",
5750 * in="path",
5751 * description="The pid for the patient.",
5752 * required=true,
5753 * @OA\Schema(
5754 * type="string"
5756 * ),
5757 * @OA\Parameter(
5758 * name="did",
5759 * in="path",
5760 * description="The id for the patient document.",
5761 * required=true,
5762 * @OA\Schema(
5763 * type="string"
5765 * ),
5766 * @OA\Response(
5767 * response="200",
5768 * ref="#/components/responses/standard"
5769 * ),
5770 * @OA\Response(
5771 * response="400",
5772 * ref="#/components/responses/badrequest"
5773 * ),
5774 * @OA\Response(
5775 * response="401",
5776 * ref="#/components/responses/unauthorized"
5777 * ),
5778 * security={{"openemr_auth":{}}}
5781 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5782 $return = (new DocumentRestController())->downloadFile($pid, $did);
5783 RestConfig::apiLog($return);
5784 return $return;
5788 * @OA\Get(
5789 * path="/api/patient/{pid}/insurance",
5790 * description="Retrieves all insurances for a patient",
5791 * tags={"standard"},
5792 * @OA\Parameter(
5793 * name="pid",
5794 * in="path",
5795 * description="The pid for the patient.",
5796 * required=true,
5797 * @OA\Schema(
5798 * type="string"
5800 * ),
5801 * @OA\Response(
5802 * response="200",
5803 * ref="#/components/responses/standard"
5804 * ),
5805 * @OA\Response(
5806 * response="400",
5807 * ref="#/components/responses/badrequest"
5808 * ),
5809 * @OA\Response(
5810 * response="401",
5811 * ref="#/components/responses/unauthorized"
5812 * ),
5813 * security={{"openemr_auth":{}}}
5816 "GET /api/patient/:pid/insurance" => function ($pid) {
5817 $return = (new InsuranceRestController())->getAll($pid);
5818 RestConfig::apiLog($return);
5819 return $return;
5823 * @OA\Get(
5824 * path="/api/patient/{pid}/insurance/{type}",
5825 * description="Retrieves a insurance (by type) for a patient",
5826 * tags={"standard"},
5827 * @OA\Parameter(
5828 * name="pid",
5829 * in="path",
5830 * description="The pid for the patient.",
5831 * required=true,
5832 * @OA\Schema(
5833 * type="string"
5835 * ),
5836 * @OA\Parameter(
5837 * name="type",
5838 * in="path",
5839 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5840 * required=true,
5841 * @OA\Schema(
5842 * type="string"
5844 * ),
5845 * @OA\Response(
5846 * response="200",
5847 * ref="#/components/responses/standard"
5848 * ),
5849 * @OA\Response(
5850 * response="400",
5851 * ref="#/components/responses/badrequest"
5852 * ),
5853 * @OA\Response(
5854 * response="401",
5855 * ref="#/components/responses/unauthorized"
5856 * ),
5857 * security={{"openemr_auth":{}}}
5860 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5861 $return = (new InsuranceRestController())->getOne($pid, $type);
5862 RestConfig::apiLog($return);
5863 return $return;
5867 * Schema for the insurance request
5869 * @OA\Schema(
5870 * schema="api_insurance_request",
5871 * @OA\Property(
5872 * property="provider",
5873 * description="The insurance company id.",
5874 * type="string"
5875 * ),
5876 * @OA\Property(
5877 * property="plan_name",
5878 * description="The plan name of insurance.",
5879 * type="string"
5880 * ),
5881 * @OA\Property(
5882 * property="policy_number",
5883 * description="The policy number of insurance.",
5884 * type="string"
5885 * ),
5886 * @OA\Property(
5887 * property="group_number",
5888 * description="The group number of insurance.",
5889 * type="string"
5890 * ),
5891 * @OA\Property(
5892 * property="subscriber_lname",
5893 * description="The subscriber last name of insurance.",
5894 * type="string"
5895 * ),
5896 * @OA\Property(
5897 * property="subscriber_mname",
5898 * description="The subscriber middle name of insurance.",
5899 * type="string"
5900 * ),
5901 * @OA\Property(
5902 * property="subscriber_fname",
5903 * description="The subscriber first name of insurance.",
5904 * type="string"
5905 * ),
5906 * @OA\Property(
5907 * property="subscriber_relationship",
5908 * description="The subscriber relationship of insurance.",
5909 * type="string"
5910 * ),
5911 * @OA\Property(
5912 * property="subscriber_ss",
5913 * description="The subscriber ss number of insurance.",
5914 * type="string"
5915 * ),
5916 * @OA\Property(
5917 * property="subscriber_DOB",
5918 * description="The subscriber DOB of insurance.",
5919 * type="string"
5920 * ),
5921 * @OA\Property(
5922 * property="subscriber_street",
5923 * description="The subscriber street address of insurance.",
5924 * type="string"
5925 * ),
5926 * @OA\Property(
5927 * property="subscriber_postal_code",
5928 * description="The subscriber postal code of insurance.",
5929 * type="string"
5930 * ),
5931 * @OA\Property(
5932 * property="subscriber_city",
5933 * description="The subscriber city of insurance.",
5934 * type="string"
5935 * ),
5936 * @OA\Property(
5937 * property="subscriber_state",
5938 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5939 * type="string"
5940 * ),
5941 * @OA\Property(
5942 * property="subscriber_country",
5943 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5944 * type="string"
5945 * ),
5946 * @OA\Property(
5947 * property="subscriber_phone",
5948 * description="The subscriber phone of insurance.",
5949 * type="string"
5950 * ),
5951 * @OA\Property(
5952 * property="subscriber_employer",
5953 * description="The subscriber employer of insurance.",
5954 * type="string"
5955 * ),
5956 * @OA\Property(
5957 * property="subscriber_employer_street",
5958 * description="The subscriber employer street of insurance.",
5959 * type="string"
5960 * ),
5961 * @OA\Property(
5962 * property="subscriber_employer_postal_code",
5963 * description="The subscriber employer postal code of insurance.",
5964 * type="string"
5965 * ),
5966 * @OA\Property(
5967 * property="subscriber_employer_state",
5968 * description="The subscriber employer state of insurance.",
5969 * type="string"
5970 * ),
5971 * @OA\Property(
5972 * property="subscriber_employer_country",
5973 * description="The subscriber employer country of insurance.",
5974 * type="string"
5975 * ),
5976 * @OA\Property(
5977 * property="subscriber_employer_city",
5978 * description="The subscriber employer city of insurance.",
5979 * type="string"
5980 * ),
5981 * @OA\Property(
5982 * property="copay",
5983 * description="The copay of insurance.",
5984 * type="string"
5985 * ),
5986 * @OA\Property(
5987 * property="date",
5988 * description="The date of insurance.",
5989 * type="string"
5990 * ),
5991 * @OA\Property(
5992 * property="subscriber_sex",
5993 * description="The subscriber sex of insurance.",
5994 * type="string"
5995 * ),
5996 * @OA\Property(
5997 * property="accept_assignment",
5998 * description="The accept_assignment of insurance.",
5999 * type="string"
6000 * ),
6001 * @OA\Property(
6002 * property="policy_type",
6003 * description="The policy_type of insurance.",
6004 * type="string"
6005 * ),
6006 * 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"},
6007 * example={
6008 * "provider": "33",
6009 * "plan_name": "Some Plan",
6010 * "policy_number": "12345",
6011 * "group_number": "252412",
6012 * "subscriber_lname": "Tester",
6013 * "subscriber_mname": "Xi",
6014 * "subscriber_fname": "Foo",
6015 * "subscriber_relationship": "other",
6016 * "subscriber_ss": "234231234",
6017 * "subscriber_DOB": "2018-10-03",
6018 * "subscriber_street": "183 Cool St",
6019 * "subscriber_postal_code": "23418",
6020 * "subscriber_city": "Cooltown",
6021 * "subscriber_state": "AZ",
6022 * "subscriber_country": "USA",
6023 * "subscriber_phone": "234-598-2123",
6024 * "subscriber_employer": "Some Employer",
6025 * "subscriber_employer_street": "123 Heather Lane",
6026 * "subscriber_employer_postal_code": "23415",
6027 * "subscriber_employer_state": "AZ",
6028 * "subscriber_employer_country": "USA",
6029 * "subscriber_employer_city": "Cooltown",
6030 * "copay": "35",
6031 * "date": "2018-10-15",
6032 * "subscriber_sex": "Female",
6033 * "accept_assignment": "TRUE",
6034 * "policy_type": "a"
6039 * @OA\Post(
6040 * path="/api/patient/{pid}/insurance/{type}",
6041 * description="Submits a new patient insurance (with type)",
6042 * tags={"standard"},
6043 * @OA\Parameter(
6044 * name="pid",
6045 * in="path",
6046 * description="The pid for the patient.",
6047 * required=true,
6048 * @OA\Schema(
6049 * type="string"
6051 * ),
6052 * @OA\Parameter(
6053 * name="type",
6054 * in="path",
6055 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6056 * required=true,
6057 * @OA\Schema(
6058 * type="string"
6060 * ),
6061 * @OA\RequestBody(
6062 * required=true,
6063 * @OA\MediaType(
6064 * mediaType="application/json",
6065 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6067 * ),
6068 * @OA\Response(
6069 * response="200",
6070 * ref="#/components/responses/standard"
6071 * ),
6072 * @OA\Response(
6073 * response="400",
6074 * ref="#/components/responses/badrequest"
6075 * ),
6076 * @OA\Response(
6077 * response="401",
6078 * ref="#/components/responses/unauthorized"
6079 * ),
6080 * security={{"openemr_auth":{}}}
6083 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6084 $data = (array) (json_decode(file_get_contents("php://input")));
6085 $return = (new InsuranceRestController())->post($pid, $type, $data);
6086 RestConfig::apiLog($return, $data);
6087 return $return;
6091 * @OA\Put(
6092 * path="/api/patient/{pid}/insurance/{type}",
6093 * description="Edit a patient insurance (by type)",
6094 * tags={"standard"},
6095 * @OA\Parameter(
6096 * name="pid",
6097 * in="path",
6098 * description="The pid for the patient.",
6099 * required=true,
6100 * @OA\Schema(
6101 * type="string"
6103 * ),
6104 * @OA\Parameter(
6105 * name="type",
6106 * in="path",
6107 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6108 * required=true,
6109 * @OA\Schema(
6110 * type="string"
6112 * ),
6113 * @OA\RequestBody(
6114 * required=true,
6115 * @OA\MediaType(
6116 * mediaType="application/json",
6117 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6119 * ),
6120 * @OA\Response(
6121 * response="200",
6122 * ref="#/components/responses/standard"
6123 * ),
6124 * @OA\Response(
6125 * response="400",
6126 * ref="#/components/responses/badrequest"
6127 * ),
6128 * @OA\Response(
6129 * response="401",
6130 * ref="#/components/responses/unauthorized"
6131 * ),
6132 * security={{"openemr_auth":{}}}
6135 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6136 $data = (array) (json_decode(file_get_contents("php://input")));
6137 $return = (new InsuranceRestController())->put($pid, $type, $data);
6138 RestConfig::apiLog($return, $data);
6139 return $return;
6143 * Schema for the message request
6145 * @OA\Schema(
6146 * schema="api_message_request",
6147 * @OA\Property(
6148 * property="body",
6149 * description="The body of message.",
6150 * type="string"
6151 * ),
6152 * @OA\Property(
6153 * property="groupname",
6154 * description="The group name (usually is 'Default').",
6155 * type="string"
6156 * ),
6157 * @OA\Property(
6158 * property="from",
6159 * description="The sender of the message.",
6160 * type="string"
6161 * ),
6162 * @OA\Property(
6163 * property="to",
6164 * description="The recipient of the message.",
6165 * type="string"
6166 * ),
6167 * @OA\Property(
6168 * property="title",
6169 * description="use an option from resource=/api/list/note_type",
6170 * type="string"
6171 * ),
6172 * @OA\Property(
6173 * property="message_status",
6174 * description="use an option from resource=/api/list/message_status",
6175 * type="string"
6176 * ),
6177 * required={"body", "groupname", "from", "to", "title", "message_status"},
6178 * example={
6179 * "body": "Test 456",
6180 * "groupname": "Default",
6181 * "from": "Matthew",
6182 * "to": "admin",
6183 * "title": "Other",
6184 * "message_status": "New"
6189 * @OA\Post(
6190 * path="/api/patient/{pid}/message",
6191 * description="Submits a pnote message",
6192 * tags={"standard"},
6193 * @OA\Parameter(
6194 * name="pid",
6195 * in="path",
6196 * description="The id for the patient.",
6197 * required=true,
6198 * @OA\Schema(
6199 * type="string"
6201 * ),
6202 * @OA\RequestBody(
6203 * required=true,
6204 * @OA\MediaType(
6205 * mediaType="application/json",
6206 * @OA\Schema(ref="#/components/schemas/api_message_request")
6208 * ),
6209 * @OA\Response(
6210 * response="200",
6211 * ref="#/components/responses/standard"
6212 * ),
6213 * @OA\Response(
6214 * response="400",
6215 * ref="#/components/responses/badrequest"
6216 * ),
6217 * @OA\Response(
6218 * response="401",
6219 * ref="#/components/responses/unauthorized"
6220 * ),
6221 * security={{"openemr_auth":{}}}
6224 "POST /api/patient/:pid/message" => function ($pid) {
6225 RestConfig::authorization_check("patients", "notes");
6226 $data = (array) (json_decode(file_get_contents("php://input")));
6227 $return = (new MessageRestController())->post($pid, $data);
6228 RestConfig::apiLog($return, $data);
6229 return $return;
6234 * @OA\Put(
6235 * path="/api/patient/{pid}/message/{mid}",
6236 * description="Edit a pnote message",
6237 * tags={"standard"},
6238 * @OA\Parameter(
6239 * name="pid",
6240 * in="path",
6241 * description="The id for the patient.",
6242 * required=true,
6243 * @OA\Schema(
6244 * type="string"
6246 * ),
6247 * @OA\Parameter(
6248 * name="mid",
6249 * in="path",
6250 * description="The id for the pnote message.",
6251 * required=true,
6252 * @OA\Schema(
6253 * type="string"
6255 * ),
6256 * @OA\RequestBody(
6257 * required=true,
6258 * @OA\MediaType(
6259 * mediaType="application/json",
6260 * @OA\Schema(ref="#/components/schemas/api_message_request")
6262 * ),
6263 * @OA\Response(
6264 * response="200",
6265 * ref="#/components/responses/standard"
6266 * ),
6267 * @OA\Response(
6268 * response="400",
6269 * ref="#/components/responses/badrequest"
6270 * ),
6271 * @OA\Response(
6272 * response="401",
6273 * ref="#/components/responses/unauthorized"
6274 * ),
6275 * security={{"openemr_auth":{}}}
6278 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6279 RestConfig::authorization_check("patients", "notes");
6280 $data = (array) (json_decode(file_get_contents("php://input")));
6281 $return = (new MessageRestController())->put($pid, $mid, $data);
6282 RestConfig::apiLog($return, $data);
6283 return $return;
6287 * @OA\Delete(
6288 * path="/api/patient/{pid}/message/{mid}",
6289 * description="Delete a pnote message",
6290 * tags={"standard"},
6291 * @OA\Parameter(
6292 * name="pid",
6293 * in="path",
6294 * description="The id for the patient.",
6295 * required=true,
6296 * @OA\Schema(
6297 * type="string"
6299 * ),
6300 * @OA\Parameter(
6301 * name="eid",
6302 * in="path",
6303 * description="The id for the pnote message.",
6304 * required=true,
6305 * @OA\Schema(
6306 * type="string"
6308 * ),
6309 * @OA\Response(
6310 * response="200",
6311 * ref="#/components/responses/standard"
6312 * ),
6313 * @OA\Response(
6314 * response="400",
6315 * ref="#/components/responses/badrequest"
6316 * ),
6317 * @OA\Response(
6318 * response="401",
6319 * ref="#/components/responses/unauthorized"
6320 * ),
6321 * security={{"openemr_auth":{}}}
6324 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6325 RestConfig::authorization_check("patients", "notes");
6326 $return = (new MessageRestController())->delete($pid, $mid);
6327 RestConfig::apiLog($return);
6328 return $return;
6332 * @OA\Get(
6333 * path="/api/immunization",
6334 * description="Retrieves a list of immunizations",
6335 * tags={"standard"},
6336 * @OA\Parameter(
6337 * name="patient_id",
6338 * in="query",
6339 * description="The pid for the patient.",
6340 * required=false,
6341 * @OA\Schema(
6342 * type="string"
6344 * ),
6345 * @OA\Parameter(
6346 * name="id",
6347 * in="query",
6348 * description="The id for the immunization.",
6349 * required=false,
6350 * @OA\Schema(
6351 * type="string"
6353 * ),
6354 * @OA\Parameter(
6355 * name="uuid",
6356 * in="query",
6357 * description="The uuid for the immunization.",
6358 * required=false,
6359 * @OA\Schema(
6360 * type="string"
6362 * ),
6363 * @OA\Parameter(
6364 * name="administered_date",
6365 * in="query",
6366 * description="The administered date for the immunization.",
6367 * required=false,
6368 * @OA\Schema(
6369 * type="string"
6371 * ),
6372 * @OA\Parameter(
6373 * name="immunization_id",
6374 * in="query",
6375 * description="The immunization list_id for the immunization.",
6376 * required=false,
6377 * @OA\Schema(
6378 * type="string"
6380 * ),
6381 * @OA\Parameter(
6382 * name="cvx_code",
6383 * in="query",
6384 * description="The cvx code for the immunization.",
6385 * required=false,
6386 * @OA\Schema(
6387 * type="string"
6389 * ),
6390 * @OA\Parameter(
6391 * name="manufacturer",
6392 * in="query",
6393 * description="The manufacturer for the immunization.",
6394 * required=false,
6395 * @OA\Schema(
6396 * type="string"
6398 * ),
6399 * @OA\Parameter(
6400 * name="lot_number",
6401 * in="query",
6402 * description="The lot number for the immunization.",
6403 * required=false,
6404 * @OA\Schema(
6405 * type="string"
6407 * ),
6408 * @OA\Parameter(
6409 * name="administered_by_id",
6410 * in="query",
6411 * description="The administered by id for the immunization.",
6412 * required=false,
6413 * @OA\Schema(
6414 * type="string"
6416 * ),
6417 * @OA\Parameter(
6418 * name="administered_by",
6419 * in="query",
6420 * description="The administered by for the immunization.",
6421 * required=false,
6422 * @OA\Schema(
6423 * type="string"
6425 * ),
6426 * @OA\Parameter(
6427 * name="education_date",
6428 * in="query",
6429 * description="The education date for the immunization.",
6430 * required=false,
6431 * @OA\Schema(
6432 * type="string"
6434 * ),
6435 * @OA\Parameter(
6436 * name="vis_date",
6437 * in="query",
6438 * description="The vis date for the immunization.",
6439 * required=false,
6440 * @OA\Schema(
6441 * type="string"
6443 * ),
6444 * @OA\Parameter(
6445 * name="note",
6446 * in="query",
6447 * description="The note for the immunization.",
6448 * required=false,
6449 * @OA\Schema(
6450 * type="string"
6452 * ),
6453 * @OA\Parameter(
6454 * name="create_date",
6455 * in="query",
6456 * description="The create date for the immunization.",
6457 * required=false,
6458 * @OA\Schema(
6459 * type="string"
6461 * ),
6462 * @OA\Parameter(
6463 * name="update_date",
6464 * in="query",
6465 * description="The update date for the immunization.",
6466 * required=false,
6467 * @OA\Schema(
6468 * type="string"
6470 * ),
6471 * @OA\Parameter(
6472 * name="created_by",
6473 * in="query",
6474 * description="The created_by for the immunization.",
6475 * required=false,
6476 * @OA\Schema(
6477 * type="string"
6479 * ),
6480 * @OA\Parameter(
6481 * name="updated_by",
6482 * in="query",
6483 * description="The updated_by for the immunization.",
6484 * required=false,
6485 * @OA\Schema(
6486 * type="string"
6488 * ),
6489 * @OA\Parameter(
6490 * name="amount_administered",
6491 * in="query",
6492 * description="The amount administered for the immunization.",
6493 * required=false,
6494 * @OA\Schema(
6495 * type="string"
6497 * ),
6498 * @OA\Parameter(
6499 * name="amount_administered_unit",
6500 * in="query",
6501 * description="The amount administered unit for the immunization.",
6502 * required=false,
6503 * @OA\Schema(
6504 * type="string"
6506 * ),
6507 * @OA\Parameter(
6508 * name="expiration_date",
6509 * in="query",
6510 * description="The expiration date for the immunization.",
6511 * required=false,
6512 * @OA\Schema(
6513 * type="string"
6515 * ),
6516 * @OA\Parameter(
6517 * name="route",
6518 * in="query",
6519 * description="The route for the immunization.",
6520 * required=false,
6521 * @OA\Schema(
6522 * type="string"
6524 * ),
6525 * @OA\Parameter(
6526 * name="administration_site",
6527 * in="query",
6528 * description="The administration site for the immunization.",
6529 * required=false,
6530 * @OA\Schema(
6531 * type="string"
6533 * ),
6534 * @OA\Parameter(
6535 * name="added_erroneously",
6536 * in="query",
6537 * description="The added_erroneously for the immunization.",
6538 * required=false,
6539 * @OA\Schema(
6540 * type="string"
6542 * ),
6543 * @OA\Parameter(
6544 * name="external_id",
6545 * in="query",
6546 * description="The external_id for the immunization.",
6547 * required=false,
6548 * @OA\Schema(
6549 * type="string"
6551 * ),
6552 * @OA\Parameter(
6553 * name="completion_status",
6554 * in="query",
6555 * description="The completion status for the immunization.",
6556 * required=false,
6557 * @OA\Schema(
6558 * type="string"
6560 * ),
6561 * @OA\Parameter(
6562 * name="information_source",
6563 * in="query",
6564 * description="The information source for the immunization.",
6565 * required=false,
6566 * @OA\Schema(
6567 * type="string"
6569 * ),
6570 * @OA\Parameter(
6571 * name="refusal_reason",
6572 * in="query",
6573 * description="The refusal reason for the immunization.",
6574 * required=false,
6575 * @OA\Schema(
6576 * type="string"
6578 * ),
6579 * @OA\Parameter(
6580 * name="ordering_provider",
6581 * in="query",
6582 * description="The ordering provider for the immunization.",
6583 * required=false,
6584 * @OA\Schema(
6585 * type="string"
6587 * ),
6588 * @OA\Response(
6589 * response="200",
6590 * ref="#/components/responses/standard"
6591 * ),
6592 * @OA\Response(
6593 * response="400",
6594 * ref="#/components/responses/badrequest"
6595 * ),
6596 * @OA\Response(
6597 * response="401",
6598 * ref="#/components/responses/unauthorized"
6599 * ),
6600 * security={{"openemr_auth":{}}}
6603 "GET /api/immunization" => function () {
6604 RestConfig::authorization_check("patients", "med");
6605 $return = (new ImmunizationRestController())->getAll($_GET);
6606 RestConfig::apiLog($return);
6607 return $return;
6611 * @OA\Get(
6612 * path="/api/immunization/{uuid}",
6613 * description="Retrieves a immunization",
6614 * tags={"standard"},
6615 * @OA\Parameter(
6616 * name="uuid",
6617 * in="path",
6618 * description="The uuid for the immunization.",
6619 * required=true,
6620 * @OA\Schema(
6621 * type="string"
6623 * ),
6624 * @OA\Response(
6625 * response="200",
6626 * ref="#/components/responses/standard"
6627 * ),
6628 * @OA\Response(
6629 * response="400",
6630 * ref="#/components/responses/badrequest"
6631 * ),
6632 * @OA\Response(
6633 * response="401",
6634 * ref="#/components/responses/unauthorized"
6635 * ),
6636 * security={{"openemr_auth":{}}}
6639 "GET /api/immunization/:uuid" => function ($uuid) {
6640 RestConfig::authorization_check("patients", "med");
6641 $return = (new ImmunizationRestController())->getOne($uuid);
6642 RestConfig::apiLog($return);
6643 return $return;
6647 * @OA\Get(
6648 * path="/api/procedure",
6649 * description="Retrieves a list of all procedures",
6650 * tags={"standard"},
6651 * @OA\Response(
6652 * response="200",
6653 * ref="#/components/responses/standard"
6654 * ),
6655 * @OA\Response(
6656 * response="400",
6657 * ref="#/components/responses/badrequest"
6658 * ),
6659 * @OA\Response(
6660 * response="401",
6661 * ref="#/components/responses/unauthorized"
6662 * ),
6663 * security={{"openemr_auth":{}}}
6666 "GET /api/procedure" => function () {
6667 RestConfig::authorization_check("patients", "med");
6668 $return = (new ProcedureRestController())->getAll();
6669 RestConfig::apiLog($return);
6670 return $return;
6674 * @OA\Get(
6675 * path="/api/procedure/{uuid}",
6676 * description="Retrieves a procedure",
6677 * tags={"standard"},
6678 * @OA\Parameter(
6679 * name="uuid",
6680 * in="path",
6681 * description="The uuid for the procedure.",
6682 * required=true,
6683 * @OA\Schema(
6684 * type="string"
6686 * ),
6687 * @OA\Response(
6688 * response="200",
6689 * ref="#/components/responses/standard"
6690 * ),
6691 * @OA\Response(
6692 * response="400",
6693 * ref="#/components/responses/badrequest"
6694 * ),
6695 * @OA\Response(
6696 * response="401",
6697 * ref="#/components/responses/unauthorized"
6698 * ),
6699 * security={{"openemr_auth":{}}}
6702 "GET /api/procedure/:uuid" => function ($uuid) {
6703 RestConfig::authorization_check("patients", "med");
6704 $return = (new ProcedureRestController())->getOne($uuid);
6705 RestConfig::apiLog($return);
6706 return $return;
6710 * @OA\Get(
6711 * path="/api/drug",
6712 * description="Retrieves a list of all drugs",
6713 * tags={"standard"},
6714 * @OA\Response(
6715 * response="200",
6716 * ref="#/components/responses/standard"
6717 * ),
6718 * @OA\Response(
6719 * response="400",
6720 * ref="#/components/responses/badrequest"
6721 * ),
6722 * @OA\Response(
6723 * response="401",
6724 * ref="#/components/responses/unauthorized"
6725 * ),
6726 * security={{"openemr_auth":{}}}
6729 "GET /api/drug" => function () {
6730 RestConfig::authorization_check("patients", "med");
6731 $return = (new DrugRestController())->getAll();
6732 RestConfig::apiLog($return);
6733 return $return;
6737 * @OA\Get(
6738 * path="/api/drug/{uuid}",
6739 * description="Retrieves a drug",
6740 * tags={"standard"},
6741 * @OA\Parameter(
6742 * name="uuid",
6743 * in="path",
6744 * description="The uuid for the drug.",
6745 * required=true,
6746 * @OA\Schema(
6747 * type="string"
6749 * ),
6750 * @OA\Response(
6751 * response="200",
6752 * ref="#/components/responses/standard"
6753 * ),
6754 * @OA\Response(
6755 * response="400",
6756 * ref="#/components/responses/badrequest"
6757 * ),
6758 * @OA\Response(
6759 * response="401",
6760 * ref="#/components/responses/unauthorized"
6761 * ),
6762 * security={{"openemr_auth":{}}}
6765 "GET /api/drug/:uuid" => function ($uuid) {
6766 RestConfig::authorization_check("patients", "med");
6767 $return = (new DrugRestController())->getOne($uuid);
6768 RestConfig::apiLog($return);
6769 return $return;
6773 * @OA\Get(
6774 * path="/api/prescription",
6775 * description="Retrieves a list of all prescriptions",
6776 * tags={"standard"},
6777 * @OA\Response(
6778 * response="200",
6779 * ref="#/components/responses/standard"
6780 * ),
6781 * @OA\Response(
6782 * response="400",
6783 * ref="#/components/responses/badrequest"
6784 * ),
6785 * @OA\Response(
6786 * response="401",
6787 * ref="#/components/responses/unauthorized"
6788 * ),
6789 * security={{"openemr_auth":{}}}
6792 "GET /api/prescription" => function () {
6793 RestConfig::authorization_check("patients", "med");
6794 $return = (new PrescriptionRestController())->getAll();
6795 RestConfig::apiLog($return);
6796 return $return;
6800 * @OA\Get(
6801 * path="/api/prescription/{uuid}",
6802 * description="Retrieves a prescription",
6803 * tags={"standard"},
6804 * @OA\Parameter(
6805 * name="uuid",
6806 * in="path",
6807 * description="The uuid for the prescription.",
6808 * required=true,
6809 * @OA\Schema(
6810 * type="string"
6812 * ),
6813 * @OA\Response(
6814 * response="200",
6815 * ref="#/components/responses/standard"
6816 * ),
6817 * @OA\Response(
6818 * response="400",
6819 * ref="#/components/responses/badrequest"
6820 * ),
6821 * @OA\Response(
6822 * response="401",
6823 * ref="#/components/responses/unauthorized"
6824 * ),
6825 * security={{"openemr_auth":{}}}
6828 "GET /api/prescription/:uuid" => function ($uuid) {
6829 RestConfig::authorization_check("patients", "med");
6830 $return = (new PrescriptionRestController())->getOne($uuid);
6831 RestConfig::apiLog($return);
6832 return $return;
6836 use OpenEMR\Common\Http\StatusCode;
6837 use OpenEMR\Common\Http\Psr17Factory;
6838 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController;
6839 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController;
6840 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController;
6841 use OpenEMR\RestControllers\FHIR\FhirConditionRestController;
6842 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController;
6843 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController;
6844 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController;
6845 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController;
6846 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController;
6847 use OpenEMR\RestControllers\FHIR\FhirExportRestController;
6848 use OpenEMR\RestControllers\FHIR\FhirObservationRestController;
6849 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController;
6850 use OpenEMR\RestControllers\FHIR\FhirGoalRestController;
6851 use OpenEMR\RestControllers\FHIR\FhirGroupRestController;
6852 use OpenEMR\RestControllers\FHIR\FhirLocationRestController;
6853 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController;
6854 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController;
6855 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController;
6856 use OpenEMR\RestControllers\FHIR\FhirPatientRestController;
6857 use OpenEMR\RestControllers\FHIR\FhirPersonRestController;
6858 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController;
6859 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController;
6860 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController;
6861 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController;
6862 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController;
6864 // Note that the fhir route includes both user role and patient role
6865 // (there is a mechanism in place to ensure patient role is binded
6866 // to only see the data of the one patient)
6867 RestConfig::$FHIR_ROUTE_MAP = array(
6869 * @OA\Get(
6870 * path="/fhir/AllergyIntolerance",
6871 * description="Returns a list of AllergyIntolerance resources.",
6872 * tags={"fhir"},
6873 * @OA\Parameter(
6874 * name="_id",
6875 * in="query",
6876 * description="The uuid for the AllergyIntolerance resource.",
6877 * required=false,
6878 * @OA\Schema(
6879 * type="string"
6881 * ),
6882 * @OA\Parameter(
6883 * name="patient",
6884 * in="query",
6885 * description="The uuid for the patient.",
6886 * required=false,
6887 * @OA\Schema(
6888 * type="string"
6890 * ),
6891 * @OA\Response(
6892 * response="200",
6893 * description="Standard Response",
6894 * @OA\MediaType(
6895 * mediaType="application/json",
6896 * @OA\Schema(
6897 * @OA\Property(
6898 * property="json object",
6899 * description="FHIR Json object.",
6900 * type="object"
6901 * ),
6902 * example={
6903 * "meta": {
6904 * "lastUpdated": "2021-09-14T09:13:51"
6905 * },
6906 * "resourceType": "Bundle",
6907 * "type": "collection",
6908 * "total": 0,
6909 * "link": {
6911 * "relation": "self",
6912 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
6918 * ),
6919 * @OA\Response(
6920 * response="400",
6921 * ref="#/components/responses/badrequest"
6922 * ),
6923 * @OA\Response(
6924 * response="401",
6925 * ref="#/components/responses/unauthorized"
6926 * ),
6927 * security={{"openemr_auth":{}}}
6930 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest $request) {
6931 $getParams = $request->getQueryParams();
6932 if ($request->isPatientRequest()) {
6933 // only allow access to data of binded patient
6934 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
6935 } else {
6936 RestConfig::authorization_check("patients", "med");
6937 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
6939 RestConfig::apiLog($return);
6940 return $return;
6944 * @OA\Get(
6945 * path="/fhir/AllergyIntolerance/{uuid}",
6946 * description="Returns a single AllergyIntolerance resource.",
6947 * tags={"fhir"},
6948 * @OA\Parameter(
6949 * name="uuid",
6950 * in="path",
6951 * description="The uuid for the AllergyIntolerance resource.",
6952 * required=true,
6953 * @OA\Schema(
6954 * type="string"
6956 * ),
6957 * @OA\Response(
6958 * response="200",
6959 * description="Standard Response",
6960 * @OA\MediaType(
6961 * mediaType="application/json",
6962 * @OA\Schema(
6963 * @OA\Property(
6964 * property="json object",
6965 * description="FHIR Json object.",
6966 * type="object"
6967 * ),
6968 * example={
6969 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
6970 * "meta": {
6971 * "versionId": "1",
6972 * "lastUpdated": "2021-09-16T00:27:32+00:00"
6973 * },
6974 * "resourceType": "AllergyIntolerance",
6975 * "text": {
6976 * "status": "additional",
6977 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
6978 * },
6979 * "clinicalStatus": {
6980 * "coding": {
6982 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
6983 * "code": "active",
6984 * "display": "Active"
6987 * },
6988 * "verificationStatus": {
6989 * "coding": {
6991 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
6992 * "code": "confirmed",
6993 * "display": "Confirmed"
6996 * },
6997 * "category": {
6998 * "medication"
6999 * },
7000 * "criticality": "low",
7001 * "code": {
7002 * "coding": {
7004 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7005 * "code": "unknown",
7006 * "display": "Unknown"
7009 * },
7010 * "patient": {
7011 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7012 * },
7013 * "reaction": {
7015 * "manifestation": {
7017 * "coding": {
7019 * "system": "http://snomed.info/sct",
7020 * "code": "422587007",
7021 * "display": "Nausea"
7023 * },
7024 * "text": "Nausea"
7032 * ),
7033 * @OA\Response(
7034 * response="400",
7035 * ref="#/components/responses/badrequest"
7036 * ),
7037 * @OA\Response(
7038 * response="401",
7039 * ref="#/components/responses/unauthorized"
7040 * ),
7041 * @OA\Response(
7042 * response="404",
7043 * ref="#/components/responses/uuidnotfound"
7044 * ),
7045 * security={{"openemr_auth":{}}}
7048 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest $request) {
7049 if ($request->isPatientRequest()) {
7050 // only allow access to data of binded patient
7051 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7052 } else {
7053 RestConfig::authorization_check("patients", "med");
7054 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7056 RestConfig::apiLog($return);
7057 return $return;
7061 * @OA\Get(
7062 * path="/fhir/CarePlan",
7063 * description="Returns a list of CarePlan resources.",
7064 * tags={"fhir"},
7065 * @OA\Parameter(
7066 * name="_id",
7067 * in="query",
7068 * description="The uuid for the CarePlan resource.",
7069 * required=false,
7070 * @OA\Schema(
7071 * type="string"
7073 * ),
7074 * @OA\Parameter(
7075 * name="patient",
7076 * in="query",
7077 * description="The uuid for the patient.",
7078 * required=false,
7079 * @OA\Schema(
7080 * type="string"
7082 * ),
7083 * @OA\Parameter(
7084 * name="category",
7085 * in="query",
7086 * description="The category of the CarePlan resource.",
7087 * required=false,
7088 * @OA\Schema(
7089 * type="string"
7091 * ),
7092 * @OA\Response(
7093 * response="200",
7094 * description="Standard Response",
7095 * @OA\MediaType(
7096 * mediaType="application/json",
7097 * @OA\Schema(
7098 * @OA\Property(
7099 * property="json object",
7100 * description="FHIR Json object.",
7101 * type="object"
7102 * ),
7103 * example={
7104 * "meta": {
7105 * "lastUpdated": "2021-09-14T09:13:51"
7106 * },
7107 * "resourceType": "Bundle",
7108 * "type": "collection",
7109 * "total": 0,
7110 * "link": {
7112 * "relation": "self",
7113 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7119 * ),
7120 * @OA\Response(
7121 * response="400",
7122 * ref="#/components/responses/badrequest"
7123 * ),
7124 * @OA\Response(
7125 * response="401",
7126 * ref="#/components/responses/unauthorized"
7127 * ),
7128 * security={{"openemr_auth":{}}}
7131 "GET /fhir/CarePlan" => function (HttpRestRequest $request) {
7132 $getParams = $request->getQueryParams();
7133 if ($request->isPatientRequest()) {
7134 // only allow access to data of binded patient
7135 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7136 } else {
7137 RestConfig::authorization_check("patients", "med");
7138 $return = (new FhirCarePlanRestController())->getAll($getParams);
7140 RestConfig::apiLog($return);
7141 return $return;
7145 * @OA\Get(
7146 * path="/fhir/CarePlan/{uuid}",
7147 * description="Returns a single CarePlan resource.",
7148 * tags={"fhir"},
7149 * @OA\Parameter(
7150 * name="uuid",
7151 * in="path",
7152 * description="The uuid for the CarePlan resource.",
7153 * required=true,
7154 * @OA\Schema(
7155 * type="string"
7157 * ),
7158 * @OA\Response(
7159 * response="200",
7160 * description="Standard Response",
7161 * @OA\MediaType(
7162 * mediaType="application/json",
7163 * @OA\Schema(
7164 * @OA\Property(
7165 * property="json object",
7166 * description="FHIR Json object.",
7167 * type="object"
7168 * ),
7169 * example={
7170 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7171 * "meta": {
7172 * "versionId": "1",
7173 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7174 * },
7175 * "resourceType": "CarePlan",
7176 * "text": {
7177 * "status": "generated",
7178 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7179 * },
7180 * "status": "active",
7181 * "intent": "plan",
7182 * "category": {
7184 * "coding": {
7186 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7187 * "code": "assess-plan"
7191 * },
7192 * "description": "Treat flu.",
7193 * "subject": {
7194 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7195 * "type": "Patient"
7200 * ),
7201 * @OA\Response(
7202 * response="400",
7203 * ref="#/components/responses/badrequest"
7204 * ),
7205 * @OA\Response(
7206 * response="401",
7207 * ref="#/components/responses/unauthorized"
7208 * ),
7209 * @OA\Response(
7210 * response="404",
7211 * ref="#/components/responses/uuidnotfound"
7212 * ),
7213 * security={{"openemr_auth":{}}}
7216 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest $request) {
7217 if ($request->isPatientRequest()) {
7218 // only allow access to data of binded patient
7219 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7220 } else {
7221 RestConfig::authorization_check("patients", "med");
7222 $return = (new FhirCarePlanRestController())->getOne($uuid);
7224 RestConfig::apiLog($return);
7225 return $return;
7229 * @OA\Get(
7230 * path="/fhir/CareTeam",
7231 * description="Returns a list of CareTeam resources.",
7232 * tags={"fhir"},
7233 * @OA\Parameter(
7234 * name="_id",
7235 * in="query",
7236 * description="The uuid for the CareTeam resource.",
7237 * required=false,
7238 * @OA\Schema(
7239 * type="string"
7241 * ),
7242 * @OA\Parameter(
7243 * name="patient",
7244 * in="query",
7245 * description="The uuid for the patient.",
7246 * required=false,
7247 * @OA\Schema(
7248 * type="string"
7250 * ),
7251 * @OA\Parameter(
7252 * name="status",
7253 * in="query",
7254 * description="The status of the CarePlan resource.",
7255 * required=false,
7256 * @OA\Schema(
7257 * type="string"
7259 * ),
7260 * @OA\Response(
7261 * response="200",
7262 * description="Standard Response",
7263 * @OA\MediaType(
7264 * mediaType="application/json",
7265 * @OA\Schema(
7266 * @OA\Property(
7267 * property="json object",
7268 * description="FHIR Json object.",
7269 * type="object"
7270 * ),
7271 * example={
7272 * "meta": {
7273 * "lastUpdated": "2021-09-14T09:13:51"
7274 * },
7275 * "resourceType": "Bundle",
7276 * "type": "collection",
7277 * "total": 0,
7278 * "link": {
7280 * "relation": "self",
7281 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7287 * ),
7288 * @OA\Response(
7289 * response="400",
7290 * ref="#/components/responses/badrequest"
7291 * ),
7292 * @OA\Response(
7293 * response="401",
7294 * ref="#/components/responses/unauthorized"
7295 * ),
7296 * security={{"openemr_auth":{}}}
7299 "GET /fhir/CareTeam" => function (HttpRestRequest $request) {
7300 $getParams = $request->getQueryParams();
7301 if ($request->isPatientRequest()) {
7302 // only allow access to data of binded patient
7303 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7304 } else {
7305 RestConfig::authorization_check("patients", "med");
7306 $return = (new FhirCareTeamRestController())->getAll($getParams);
7308 RestConfig::apiLog($return);
7309 return $return;
7313 * @OA\Get(
7314 * path="/fhir/CareTeam/{uuid}",
7315 * description="Returns a single CareTeam resource.",
7316 * tags={"fhir"},
7317 * @OA\Parameter(
7318 * name="uuid",
7319 * in="path",
7320 * description="The uuid for the CareTeam resource.",
7321 * required=true,
7322 * @OA\Schema(
7323 * type="string"
7325 * ),
7326 * @OA\Response(
7327 * response="200",
7328 * description="Standard Response",
7329 * @OA\MediaType(
7330 * mediaType="application/json",
7331 * @OA\Schema(
7332 * @OA\Property(
7333 * property="json object",
7334 * description="FHIR Json object.",
7335 * type="object"
7336 * ),
7337 * example={
7338 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7339 * "meta": {
7340 * "versionId": "1",
7341 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7342 * },
7343 * "resourceType": "CareTeam",
7344 * "status": "active",
7345 * "subject": {
7346 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7347 * "type": "Patient"
7348 * },
7349 * "participant": {
7351 * "role": {
7353 * "coding": {
7355 * "system": "http://nucc.org/provider-taxonomy",
7356 * "code": "102L00000X",
7357 * "display": "Psychoanalyst"
7361 * },
7362 * "member": {
7363 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7364 * "type": "Practitioner"
7365 * },
7366 * "onBehalfOf": {
7367 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7368 * "type": "Organization"
7370 * },
7372 * "role": {
7374 * "coding": {
7376 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7377 * "code": "unknown",
7378 * "display": "Unknown"
7382 * },
7383 * "member": {
7384 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7385 * "type": "Organization"
7392 * ),
7393 * @OA\Response(
7394 * response="400",
7395 * ref="#/components/responses/badrequest"
7396 * ),
7397 * @OA\Response(
7398 * response="401",
7399 * ref="#/components/responses/unauthorized"
7400 * ),
7401 * @OA\Response(
7402 * response="404",
7403 * ref="#/components/responses/uuidnotfound"
7404 * ),
7405 * security={{"openemr_auth":{}}}
7408 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest $request) {
7409 if ($request->isPatientRequest()) {
7410 // only allow access to data of binded patient
7411 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7412 } else {
7413 RestConfig::authorization_check("patients", "med");
7414 $return = (new FhirCareTeamRestController())->getOne($uuid);
7416 RestConfig::apiLog($return);
7417 return $return;
7421 * @OA\Get(
7422 * path="/fhir/Condition",
7423 * description="Returns a list of Condition resources.",
7424 * tags={"fhir"},
7425 * @OA\Parameter(
7426 * name="_id",
7427 * in="query",
7428 * description="The uuid for the Condition resource.",
7429 * required=false,
7430 * @OA\Schema(
7431 * type="string"
7433 * ),
7434 * @OA\Parameter(
7435 * name="patient",
7436 * in="query",
7437 * description="The uuid for the patient.",
7438 * required=false,
7439 * @OA\Schema(
7440 * type="string"
7442 * ),
7443 * @OA\Response(
7444 * response="200",
7445 * description="Standard Response",
7446 * @OA\MediaType(
7447 * mediaType="application/json",
7448 * @OA\Schema(
7449 * @OA\Property(
7450 * property="json object",
7451 * description="FHIR Json object.",
7452 * type="object"
7453 * ),
7454 * example={
7455 * "meta": {
7456 * "lastUpdated": "2021-09-14T09:13:51"
7457 * },
7458 * "resourceType": "Bundle",
7459 * "type": "collection",
7460 * "total": 0,
7461 * "link": {
7463 * "relation": "self",
7464 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7470 * ),
7471 * @OA\Response(
7472 * response="400",
7473 * ref="#/components/responses/badrequest"
7474 * ),
7475 * @OA\Response(
7476 * response="401",
7477 * ref="#/components/responses/unauthorized"
7478 * ),
7479 * security={{"openemr_auth":{}}}
7482 "GET /fhir/Condition" => function (HttpRestRequest $request) {
7483 $getParams = $request->getQueryParams();
7484 if ($request->isPatientRequest()) {
7485 // only allow access to data of binded patient
7486 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7487 } else {
7488 RestConfig::authorization_check("patients", "med");
7489 $return = (new FhirConditionRestController())->getAll($getParams);
7491 RestConfig::apiLog($return);
7492 return $return;
7496 * @OA\Get(
7497 * path="/fhir/Condition/{uuid}",
7498 * description="Returns a single Condition resource.",
7499 * tags={"fhir"},
7500 * @OA\Parameter(
7501 * name="uuid",
7502 * in="path",
7503 * description="The uuid for the Condition resource.",
7504 * required=true,
7505 * @OA\Schema(
7506 * type="string"
7508 * ),
7509 * @OA\Response(
7510 * response="200",
7511 * description="Standard Response",
7512 * @OA\MediaType(
7513 * mediaType="application/json",
7514 * @OA\Schema(
7515 * @OA\Property(
7516 * property="json object",
7517 * description="FHIR Json object.",
7518 * type="object"
7519 * ),
7520 * example={
7521 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7522 * "meta": {
7523 * "versionId": "1",
7524 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7525 * },
7526 * "resourceType": "Condition",
7527 * "clinicalStatus": {
7528 * "coding": {
7530 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7531 * "code": "inactive",
7532 * "display": "Inactive"
7535 * },
7536 * "verificationStatus": {
7537 * "coding": {
7539 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7540 * "code": "unconfirmed",
7541 * "display": "Unconfirmed"
7544 * },
7545 * "category": {
7547 * "coding": {
7549 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7550 * "code": "problem-list-item",
7551 * "display": "Problem List Item"
7555 * },
7556 * "code": {
7557 * "coding": {
7559 * "system": "http://snomed.info/sct",
7560 * "code": "444814009",
7561 * "display": ""
7564 * },
7565 * "subject": {
7566 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7571 * ),
7572 * @OA\Response(
7573 * response="400",
7574 * ref="#/components/responses/badrequest"
7575 * ),
7576 * @OA\Response(
7577 * response="401",
7578 * ref="#/components/responses/unauthorized"
7579 * ),
7580 * @OA\Response(
7581 * response="404",
7582 * ref="#/components/responses/uuidnotfound"
7583 * ),
7584 * security={{"openemr_auth":{}}}
7587 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest $request) {
7588 if ($request->isPatientRequest()) {
7589 // only allow access to data of binded patient
7590 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7591 } else {
7592 RestConfig::authorization_check("patients", "med");
7593 $return = (new FhirConditionRestController())->getOne($uuid);
7595 RestConfig::apiLog($return);
7596 return $return;
7600 * @OA\Get(
7601 * path="/fhir/Coverage",
7602 * description="Returns a list of Coverage resources.",
7603 * tags={"fhir"},
7604 * @OA\Parameter(
7605 * name="_id",
7606 * in="query",
7607 * description="The uuid for the Coverage resource.",
7608 * required=false,
7609 * @OA\Schema(
7610 * type="string"
7612 * ),
7613 * @OA\Parameter(
7614 * name="patient",
7615 * in="query",
7616 * description="The uuid for the patient.",
7617 * required=false,
7618 * @OA\Schema(
7619 * type="string"
7621 * ),
7622 * @OA\Parameter(
7623 * name="payor",
7624 * in="query",
7625 * description="The payor of the Coverage resource.",
7626 * required=false,
7627 * @OA\Schema(
7628 * type="string"
7630 * ),
7631 * @OA\Response(
7632 * response="200",
7633 * description="Standard Response",
7634 * @OA\MediaType(
7635 * mediaType="application/json",
7636 * @OA\Schema(
7637 * @OA\Property(
7638 * property="json object",
7639 * description="FHIR Json object.",
7640 * type="object"
7641 * ),
7642 * example={
7643 * "meta": {
7644 * "lastUpdated": "2021-09-14T09:13:51"
7645 * },
7646 * "resourceType": "Bundle",
7647 * "type": "collection",
7648 * "total": 0,
7649 * "link": {
7651 * "relation": "self",
7652 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7658 * ),
7659 * @OA\Response(
7660 * response="400",
7661 * ref="#/components/responses/badrequest"
7662 * ),
7663 * @OA\Response(
7664 * response="401",
7665 * ref="#/components/responses/unauthorized"
7666 * ),
7667 * security={{"openemr_auth":{}}}
7671 * TODO
7672 * 1. Broken when trying to search with parameters.
7674 "GET /fhir/Coverage" => function (HttpRestRequest $request) {
7675 RestConfig::authorization_check("admin", "super");
7676 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7677 RestConfig::apiLog($return);
7678 return $return;
7682 * @OA\Get(
7683 * path="/fhir/Coverage/{uuid}",
7684 * description="Returns a single Coverage resource.",
7685 * tags={"fhir"},
7686 * @OA\Parameter(
7687 * name="uuid",
7688 * in="path",
7689 * description="The uuid for the Coverage resource.",
7690 * required=true,
7691 * @OA\Schema(
7692 * type="string"
7694 * ),
7695 * @OA\Response(
7696 * response="200",
7697 * ref="#/components/responses/standard"
7698 * ),
7699 * @OA\Response(
7700 * response="400",
7701 * ref="#/components/responses/badrequest"
7702 * ),
7703 * @OA\Response(
7704 * response="401",
7705 * ref="#/components/responses/unauthorized"
7706 * ),
7707 * @OA\Response(
7708 * response="404",
7709 * ref="#/components/responses/uuidnotfound"
7710 * ),
7711 * security={{"openemr_auth":{}}}
7715 * TODO
7716 * 1. Broken. Fix and then add standard response example.
7718 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest $request) {
7719 RestConfig::authorization_check("admin", "super");
7720 $return = (new FhirCoverageRestController())->getOne($uuid);
7721 RestConfig::apiLog($return);
7722 return $return;
7726 * @OA\Get(
7727 * path="/fhir/Device",
7728 * description="Returns a list of Device resources.",
7729 * tags={"fhir"},
7730 * @OA\Parameter(
7731 * name="_id",
7732 * in="query",
7733 * description="The uuid for the Device resource.",
7734 * required=false,
7735 * @OA\Schema(
7736 * type="string"
7738 * ),
7739 * @OA\Parameter(
7740 * name="patient",
7741 * in="query",
7742 * description="The uuid for the patient.",
7743 * required=false,
7744 * @OA\Schema(
7745 * type="string"
7747 * ),
7748 * @OA\Response(
7749 * response="200",
7750 * description="Standard Response",
7751 * @OA\MediaType(
7752 * mediaType="application/json",
7753 * @OA\Schema(
7754 * @OA\Property(
7755 * property="json object",
7756 * description="FHIR Json object.",
7757 * type="object"
7758 * ),
7759 * example={
7760 * "meta": {
7761 * "lastUpdated": "2021-09-14T09:13:51"
7762 * },
7763 * "resourceType": "Bundle",
7764 * "type": "collection",
7765 * "total": 0,
7766 * "link": {
7768 * "relation": "self",
7769 * "url": "https://localhost:9300/apis/default/fhir/Device"
7775 * ),
7776 * @OA\Response(
7777 * response="400",
7778 * ref="#/components/responses/badrequest"
7779 * ),
7780 * @OA\Response(
7781 * response="401",
7782 * ref="#/components/responses/unauthorized"
7783 * ),
7784 * security={{"openemr_auth":{}}}
7787 "GET /fhir/Device" => function (HttpRestRequest $request) {
7788 if ($request->isPatientRequest()) {
7789 // only allow access to data of binded patient
7790 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7791 } else {
7792 RestConfig::authorization_check("admin", "super");
7793 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
7795 RestConfig::apiLog($return);
7796 return $return;
7800 * @OA\Get(
7801 * path="/fhir/Device/{uuid}",
7802 * description="Returns a single Device resource.",
7803 * tags={"fhir"},
7804 * @OA\Parameter(
7805 * name="uuid",
7806 * in="path",
7807 * description="The uuid for the Device resource.",
7808 * required=true,
7809 * @OA\Schema(
7810 * type="string"
7812 * ),
7813 * @OA\Response(
7814 * response="200",
7815 * description="Standard Response",
7816 * @OA\MediaType(
7817 * mediaType="application/json",
7818 * @OA\Schema(
7819 * @OA\Property(
7820 * property="json object",
7821 * description="FHIR Json object.",
7822 * type="object"
7823 * ),
7824 * example={
7825 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
7826 * "meta": {
7827 * "versionId": "1",
7828 * "lastUpdated": "2021-09-18T19:28:59+00:00"
7829 * },
7830 * "resourceType": "Device",
7831 * "udiCarrier": {
7833 * "deviceIdentifier": "08717648200274",
7834 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
7836 * },
7837 * "distinctIdentifier": "A99971312345600",
7838 * "manufactureDate": "2013-02-01",
7839 * "expirationDate": "2014-02-01",
7840 * "lotNumber": "000000000000XYZ123",
7841 * "serialNumber": "000025",
7842 * "type": {
7843 * "extension": {
7845 * "valueCode": "unknown",
7846 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
7849 * },
7850 * "patient": {
7851 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
7852 * "type": "Patient"
7857 * ),
7858 * @OA\Response(
7859 * response="400",
7860 * ref="#/components/responses/badrequest"
7861 * ),
7862 * @OA\Response(
7863 * response="401",
7864 * ref="#/components/responses/unauthorized"
7865 * ),
7866 * @OA\Response(
7867 * response="404",
7868 * ref="#/components/responses/uuidnotfound"
7869 * ),
7870 * security={{"openemr_auth":{}}}
7873 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest $request) {
7874 if ($request->isPatientRequest()) {
7875 // only allow access to data of binded patient
7876 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
7877 } else {
7878 RestConfig::authorization_check("admin", "super");
7879 $return = (new FhirDeviceRestController())->getOne($uuid);
7881 RestConfig::apiLog($return);
7882 return $return;
7886 * @OA\Get(
7887 * path="/fhir/DiagnosticReport",
7888 * description="Returns a list of DiagnosticReport resources.",
7889 * tags={"fhir"},
7890 * @OA\Parameter(
7891 * name="_id",
7892 * in="query",
7893 * description="The uuid for the DiagnosticReport resource.",
7894 * required=false,
7895 * @OA\Schema(
7896 * type="string"
7898 * ),
7899 * @OA\Parameter(
7900 * name="patient",
7901 * in="query",
7902 * description="The uuid for the patient.",
7903 * required=false,
7904 * @OA\Schema(
7905 * type="string"
7907 * ),
7908 * @OA\Parameter(
7909 * name="code",
7910 * in="query",
7911 * description="The code of the DiagnosticReport resource.",
7912 * required=false,
7913 * @OA\Schema(
7914 * type="string"
7916 * ),
7917 * @OA\Parameter(
7918 * name="category",
7919 * in="query",
7920 * description="The category of the DiagnosticReport resource.",
7921 * required=false,
7922 * @OA\Schema(
7923 * type="string"
7925 * ),
7926 * @OA\Parameter(
7927 * name="date",
7928 * in="query",
7929 * description="The datetime of the DiagnosticReport resource.",
7930 * required=false,
7931 * @OA\Schema(
7932 * type="string"
7934 * ),
7935 * @OA\Response(
7936 * response="200",
7937 * description="Standard Response",
7938 * @OA\MediaType(
7939 * mediaType="application/json",
7940 * @OA\Schema(
7941 * @OA\Property(
7942 * property="json object",
7943 * description="FHIR Json object.",
7944 * type="object"
7945 * ),
7946 * example={
7947 * "meta": {
7948 * "lastUpdated": "2021-09-14T09:13:51"
7949 * },
7950 * "resourceType": "Bundle",
7951 * "type": "collection",
7952 * "total": 0,
7953 * "link": {
7955 * "relation": "self",
7956 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
7962 * ),
7963 * @OA\Response(
7964 * response="400",
7965 * ref="#/components/responses/badrequest"
7966 * ),
7967 * @OA\Response(
7968 * response="401",
7969 * ref="#/components/responses/unauthorized"
7970 * ),
7971 * security={{"openemr_auth":{}}}
7974 "GET /fhir/DiagnosticReport" => function (HttpRestRequest $request) {
7975 $getParams = $request->getQueryParams();
7976 if ($request->isPatientRequest()) {
7977 // only allow access to data of binded patient
7978 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
7979 } else {
7980 RestConfig::authorization_check("admin", "super");
7981 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
7983 RestConfig::apiLog($return);
7984 return $return;
7988 * @OA\Get(
7989 * path="/fhir/DiagnosticReport/{uuid}",
7990 * description="Returns a single DiagnosticReport resource.",
7991 * tags={"fhir"},
7992 * @OA\Parameter(
7993 * name="uuid",
7994 * in="path",
7995 * description="The uuid for the DiagnosticReport resource.",
7996 * required=true,
7997 * @OA\Schema(
7998 * type="string"
8000 * ),
8001 * @OA\Response(
8002 * response="200",
8003 * description="Standard Response",
8004 * @OA\MediaType(
8005 * mediaType="application/json",
8006 * @OA\Schema(
8007 * @OA\Property(
8008 * property="json object",
8009 * description="FHIR Json object.",
8010 * type="object"
8011 * ),
8012 * example={
8013 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8014 * "meta": {
8015 * "versionId": "1",
8016 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8017 * },
8018 * "resourceType": "DiagnosticReport",
8019 * "status": "final",
8020 * "category": {
8022 * "coding": {
8024 * "system": "http://loinc.org",
8025 * "code": "LP7839-6",
8026 * "display": "Pathology"
8030 * },
8031 * "code": {
8032 * "coding": {
8034 * "system": "http://loinc.org",
8035 * "code": "11502-2",
8036 * "display": "Laboratory report"
8039 * },
8040 * "subject": {
8041 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8042 * "type": "Patient"
8043 * },
8044 * "encounter": {
8045 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8046 * "type": "Encounter"
8047 * },
8048 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8049 * "issued": "2015-06-22T00:00:00+00:00",
8050 * "performer": {
8052 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8053 * "type": "Organization"
8055 * },
8056 * "presentedForm": {
8058 * "contentType": "text/plain",
8059 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8065 * ),
8066 * @OA\Response(
8067 * response="400",
8068 * ref="#/components/responses/badrequest"
8069 * ),
8070 * @OA\Response(
8071 * response="401",
8072 * ref="#/components/responses/unauthorized"
8073 * ),
8074 * @OA\Response(
8075 * response="404",
8076 * ref="#/components/responses/uuidnotfound"
8077 * ),
8078 * security={{"openemr_auth":{}}}
8081 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest $request) {
8082 $getParams = $request->getQueryParams();
8083 if ($request->isPatientRequest()) {
8084 // only allow access to data of binded patient
8085 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8086 } else {
8087 RestConfig::authorization_check("admin", "super");
8088 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8090 RestConfig::apiLog($return);
8091 return $return;
8095 * @OA\Get(
8096 * path="/fhir/DocumentReference",
8097 * description="Returns a list of DocumentReference resources.",
8098 * tags={"fhir"},
8099 * @OA\Parameter(
8100 * name="_id",
8101 * in="query",
8102 * description="The uuid for the DocumentReference resource.",
8103 * required=false,
8104 * @OA\Schema(
8105 * type="string"
8107 * ),
8108 * @OA\Parameter(
8109 * name="patient",
8110 * in="query",
8111 * description="The uuid for the patient.",
8112 * required=false,
8113 * @OA\Schema(
8114 * type="string"
8116 * ),
8117 * @OA\Parameter(
8118 * name="type",
8119 * in="query",
8120 * description="The type of the DocumentReference resource.",
8121 * required=false,
8122 * @OA\Schema(
8123 * type="string"
8125 * ),
8126 * @OA\Parameter(
8127 * name="category",
8128 * in="query",
8129 * description="The category of the DocumentReference resource.",
8130 * required=false,
8131 * @OA\Schema(
8132 * type="string"
8134 * ),
8135 * @OA\Parameter(
8136 * name="date",
8137 * in="query",
8138 * description="The datetime of the DocumentReference resource.",
8139 * required=false,
8140 * @OA\Schema(
8141 * type="string"
8143 * ),
8144 * @OA\Response(
8145 * response="200",
8146 * description="Standard Response",
8147 * @OA\MediaType(
8148 * mediaType="application/json",
8149 * @OA\Schema(
8150 * @OA\Property(
8151 * property="json object",
8152 * description="FHIR Json object.",
8153 * type="object"
8154 * ),
8155 * example={
8156 * "meta": {
8157 * "lastUpdated": "2021-09-14T09:13:51"
8158 * },
8159 * "resourceType": "Bundle",
8160 * "type": "collection",
8161 * "total": 0,
8162 * "link": {
8164 * "relation": "self",
8165 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8171 * ),
8172 * @OA\Response(
8173 * response="400",
8174 * ref="#/components/responses/badrequest"
8175 * ),
8176 * @OA\Response(
8177 * response="401",
8178 * ref="#/components/responses/unauthorized"
8179 * ),
8180 * security={{"openemr_auth":{}}}
8183 'GET /fhir/DocumentReference' => function (HttpRestRequest $request) {
8184 $getParams = $request->getQueryParams();
8185 if ($request->isPatientRequest()) {
8186 // only allow access to data of binded patient
8187 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8188 } else {
8189 RestConfig::authorization_check("admin", "super");
8190 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8192 RestConfig::apiLog($return);
8193 return $return;
8197 * @OA\Get(
8198 * path="/fhir/DocumentReference/{uuid}",
8199 * description="Returns a single DocumentReference resource.",
8200 * tags={"fhir"},
8201 * @OA\Parameter(
8202 * name="uuid",
8203 * in="path",
8204 * description="The uuid for the DocumentReference resource.",
8205 * required=true,
8206 * @OA\Schema(
8207 * type="string"
8209 * ),
8210 * @OA\Response(
8211 * response="200",
8212 * description="Standard Response",
8213 * @OA\MediaType(
8214 * mediaType="application/json",
8215 * @OA\Schema(
8216 * @OA\Property(
8217 * property="json object",
8218 * description="FHIR Json object.",
8219 * type="object"
8220 * ),
8221 * example={
8222 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8223 * "meta": {
8224 * "versionId": "1",
8225 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8226 * },
8227 * "resourceType": "DocumentReference",
8228 * "identifier": {
8230 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8232 * },
8233 * "status": "current",
8234 * "type": {
8235 * "coding": {
8237 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8238 * "code": "UNK",
8239 * "display": "unknown"
8242 * },
8243 * "category": {
8245 * "coding": {
8247 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8248 * "code": "openemr-document",
8249 * "display": "OpenEMR Document"
8253 * },
8254 * "subject": {
8255 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8256 * "type": "Patient"
8257 * },
8258 * "date": "2021-09-19T03:15:56+00:00",
8259 * "author": {
8260 * null
8261 * },
8262 * "content": {
8264 * "attachment": {
8265 * "contentType": "image/gif",
8266 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8267 * },
8268 * "format": {
8269 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8270 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8271 * "display": "mimeType Sufficient"
8278 * ),
8279 * @OA\Response(
8280 * response="400",
8281 * ref="#/components/responses/badrequest"
8282 * ),
8283 * @OA\Response(
8284 * response="401",
8285 * ref="#/components/responses/unauthorized"
8286 * ),
8287 * @OA\Response(
8288 * response="404",
8289 * ref="#/components/responses/uuidnotfound"
8290 * ),
8291 * security={{"openemr_auth":{}}}
8294 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest $request) {
8295 $getParams = $request->getQueryParams();
8296 if ($request->isPatientRequest()) {
8297 // only allow access to data of binded patient
8298 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8299 } else {
8300 RestConfig::authorization_check("admin", "super");
8301 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8303 RestConfig::apiLog($return);
8304 return $return;
8308 * @OA\Get(
8309 * path="/fhir/Document/{id}/Binary",
8310 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8311 * tags={"fhir"},
8312 * @OA\Parameter(
8313 * name="id",
8314 * in="path",
8315 * description="The id for the Document.",
8316 * required=true,
8317 * @OA\Schema(
8318 * type="string"
8320 * ),
8321 * @OA\Response(
8322 * response="200",
8323 * ref="#/components/responses/standard"
8324 * ),
8325 * @OA\Response(
8326 * response="400",
8327 * ref="#/components/responses/badrequest"
8328 * ),
8329 * @OA\Response(
8330 * response="401",
8331 * ref="#/components/responses/unauthorized"
8332 * ),
8333 * security={{"openemr_auth":{}}}
8337 * TODO
8339 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest $request) {
8340 // currently only allow users with the same permissions as export to take a file out
8341 // this could be relaxed to allow other types of files ie such as patient access etc.
8342 RestConfig::authorization_check("admin", "users");
8344 // Grab the document id
8345 $docController = new \OpenEMR\RestControllers\FHIR\FhirDocumentRestController($request);
8346 $response = $docController->downloadDocument($documentId, $request->getRequestUserId());
8347 return $response;
8351 * @OA\Get(
8352 * path="/fhir/Encounter",
8353 * description="Returns a list of Encounter resources.",
8354 * tags={"fhir"},
8355 * @OA\Parameter(
8356 * name="_id",
8357 * in="query",
8358 * description="The uuid for the Encounter resource.",
8359 * required=false,
8360 * @OA\Schema(
8361 * type="string"
8363 * ),
8364 * @OA\Parameter(
8365 * name="patient",
8366 * in="query",
8367 * description="The uuid for the patient.",
8368 * required=false,
8369 * @OA\Schema(
8370 * type="string"
8372 * ),
8373 * @OA\Parameter(
8374 * name="date",
8375 * in="query",
8376 * description="The datetime of the Encounter resource.",
8377 * required=false,
8378 * @OA\Schema(
8379 * type="string"
8381 * ),
8382 * @OA\Response(
8383 * response="200",
8384 * description="Standard Response",
8385 * @OA\MediaType(
8386 * mediaType="application/json",
8387 * @OA\Schema(
8388 * @OA\Property(
8389 * property="json object",
8390 * description="FHIR Json object.",
8391 * type="object"
8392 * ),
8393 * example={
8394 * "meta": {
8395 * "lastUpdated": "2021-09-14T09:13:51"
8396 * },
8397 * "resourceType": "Bundle",
8398 * "type": "collection",
8399 * "total": 0,
8400 * "link": {
8402 * "relation": "self",
8403 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8409 * ),
8410 * @OA\Response(
8411 * response="400",
8412 * ref="#/components/responses/badrequest"
8413 * ),
8414 * @OA\Response(
8415 * response="401",
8416 * ref="#/components/responses/unauthorized"
8417 * ),
8418 * security={{"openemr_auth":{}}}
8421 "GET /fhir/Encounter" => function (HttpRestRequest $request) {
8422 $getParams = $request->getQueryParams();
8423 if ($request->isPatientRequest()) {
8424 // only allow access to data of binded patient
8425 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8426 } else {
8427 RestConfig::authorization_check("encounters", "auth_a");
8428 $return = (new FhirEncounterRestController())->getAll($getParams);
8430 RestConfig::apiLog($return);
8431 return $return;
8435 * @OA\Get(
8436 * path="/fhir/Encounter/{uuid}",
8437 * description="Returns a single Encounter resource.",
8438 * tags={"fhir"},
8439 * @OA\Parameter(
8440 * name="uuid",
8441 * in="path",
8442 * description="The uuid for the Encounter resource.",
8443 * required=true,
8444 * @OA\Schema(
8445 * type="string"
8447 * ),
8448 * @OA\Response(
8449 * response="200",
8450 * description="Standard Response",
8451 * @OA\MediaType(
8452 * mediaType="application/json",
8453 * @OA\Schema(
8454 * @OA\Property(
8455 * property="json object",
8456 * description="FHIR Json object.",
8457 * type="object"
8458 * ),
8459 * example={
8460 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8461 * "meta": {
8462 * "versionId": "1",
8463 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8464 * },
8465 * "resourceType": "Encounter",
8466 * "identifier": {
8468 * "system": "urn:ietf:rfc:3986",
8469 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8471 * },
8472 * "status": "finished",
8473 * "class": {
8474 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8475 * "code": "AMB",
8476 * "display": "ambulatory"
8477 * },
8478 * "type": {
8480 * "coding": {
8482 * "system": "http://snomed.info/sct",
8483 * "code": "185349003",
8484 * "display": "Encounter for check up (procedure)"
8488 * },
8489 * "subject": {
8490 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8491 * "type": "Patient"
8492 * },
8493 * "participant": {
8495 * "type": {
8497 * "coding": {
8499 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8500 * "code": "PPRF",
8501 * "display": "Primary Performer"
8505 * },
8506 * "period": {
8507 * "start": "2012-08-13T00:00:00+00:00"
8508 * },
8509 * "individual": {
8510 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8511 * "type": "Practitioner"
8514 * },
8515 * "period": {
8516 * "start": "2012-08-13T00:00:00+00:00"
8521 * ),
8522 * @OA\Response(
8523 * response="400",
8524 * ref="#/components/responses/badrequest"
8525 * ),
8526 * @OA\Response(
8527 * response="401",
8528 * ref="#/components/responses/unauthorized"
8529 * ),
8530 * @OA\Response(
8531 * response="404",
8532 * ref="#/components/responses/uuidnotfound"
8533 * ),
8534 * security={{"openemr_auth":{}}}
8537 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest $request) {
8538 if ($request->isPatientRequest()) {
8539 // only allow access to data of binded patient
8540 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8541 } else {
8542 RestConfig::authorization_check("admin", "super");
8543 $return = (new FhirEncounterRestController())->getOne($uuid);
8545 RestConfig::apiLog($return);
8546 return $return;
8550 * @OA\Get(
8551 * path="/fhir/Goal",
8552 * description="Returns a list of Condition resources.",
8553 * tags={"fhir"},
8554 * @OA\Parameter(
8555 * name="_id",
8556 * in="query",
8557 * description="The uuid for the Goal resource.",
8558 * required=false,
8559 * @OA\Schema(
8560 * type="string"
8562 * ),
8563 * @OA\Parameter(
8564 * name="patient",
8565 * in="query",
8566 * description="The uuid for the patient.",
8567 * required=false,
8568 * @OA\Schema(
8569 * type="string"
8571 * ),
8572 * @OA\Response(
8573 * response="200",
8574 * description="Standard Response",
8575 * @OA\MediaType(
8576 * mediaType="application/json",
8577 * @OA\Schema(
8578 * @OA\Property(
8579 * property="json object",
8580 * description="FHIR Json object.",
8581 * type="object"
8582 * ),
8583 * example={
8584 * "meta": {
8585 * "lastUpdated": "2021-09-14T09:13:51"
8586 * },
8587 * "resourceType": "Bundle",
8588 * "type": "collection",
8589 * "total": 0,
8590 * "link": {
8592 * "relation": "self",
8593 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8599 * ),
8600 * @OA\Response(
8601 * response="400",
8602 * ref="#/components/responses/badrequest"
8603 * ),
8604 * @OA\Response(
8605 * response="401",
8606 * ref="#/components/responses/unauthorized"
8607 * ),
8608 * security={{"openemr_auth":{}}}
8611 "GET /fhir/Goal" => function (HttpRestRequest $request) {
8612 $getParams = $request->getQueryParams();
8613 if ($request->isPatientRequest()) {
8614 // only allow access to data of binded patient
8615 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8616 } else {
8617 RestConfig::authorization_check("admin", "super");
8618 $return = (new FhirGoalRestController())->getAll($getParams);
8620 RestConfig::apiLog($return);
8621 return $return;
8625 * @OA\Get(
8626 * path="/fhir/Goal/{uuid}",
8627 * description="Returns a single Goal resource.",
8628 * tags={"fhir"},
8629 * @OA\Parameter(
8630 * name="uuid",
8631 * in="path",
8632 * description="The uuid for the Goal resource.",
8633 * required=true,
8634 * @OA\Schema(
8635 * type="string"
8637 * ),
8638 * @OA\Response(
8639 * response="200",
8640 * description="Standard Response",
8641 * @OA\MediaType(
8642 * mediaType="application/json",
8643 * @OA\Schema(
8644 * @OA\Property(
8645 * property="json object",
8646 * description="FHIR Json object.",
8647 * type="object"
8648 * ),
8649 * example={
8650 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8651 * "meta": {
8652 * "versionId": "1",
8653 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8654 * },
8655 * "resourceType": "Goal",
8656 * "lifecycleStatus": "active",
8657 * "description": {
8658 * "text": "Eating more vegetables."
8659 * },
8660 * "subject": {
8661 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8662 * "type": "Patient"
8663 * },
8664 * "target": {
8666 * "measure": {
8667 * "extension": {
8669 * "valueCode": "unknown",
8670 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8673 * },
8674 * "detailString": "Eating more vegetables.",
8675 * "dueDate": "2021-09-09"
8681 * ),
8682 * @OA\Response(
8683 * response="400",
8684 * ref="#/components/responses/badrequest"
8685 * ),
8686 * @OA\Response(
8687 * response="401",
8688 * ref="#/components/responses/unauthorized"
8689 * ),
8690 * @OA\Response(
8691 * response="404",
8692 * ref="#/components/responses/uuidnotfound"
8693 * ),
8694 * security={{"openemr_auth":{}}}
8697 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest $request) {
8698 if ($request->isPatientRequest()) {
8699 // only allow access to data of binded patient
8700 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
8701 } else {
8702 RestConfig::authorization_check("admin", "super");
8703 $return = (new FhirGoalRestController())->getOne($uuid);
8705 RestConfig::apiLog($return);
8706 return $return;
8710 * @OA\Get(
8711 * path="/fhir/Group",
8712 * description="Returns a list of Group resources.",
8713 * tags={"fhir"},
8714 * @OA\Parameter(
8715 * name="_id",
8716 * in="query",
8717 * description="The uuid for the Group resource.",
8718 * required=false,
8719 * @OA\Schema(
8720 * type="string"
8722 * ),
8723 * @OA\Parameter(
8724 * name="patient",
8725 * in="query",
8726 * description="The uuid for the patient.",
8727 * required=false,
8728 * @OA\Schema(
8729 * type="string"
8731 * ),
8732 * @OA\Response(
8733 * response="200",
8734 * description="Standard Response",
8735 * @OA\MediaType(
8736 * mediaType="application/json",
8737 * @OA\Schema(
8738 * @OA\Property(
8739 * property="json object",
8740 * description="FHIR Json object.",
8741 * type="object"
8742 * ),
8743 * example={
8744 * "meta": {
8745 * "lastUpdated": "2021-09-14T09:13:51"
8746 * },
8747 * "resourceType": "Bundle",
8748 * "type": "collection",
8749 * "total": 0,
8750 * "link": {
8752 * "relation": "self",
8753 * "url": "https://localhost:9300/apis/default/fhir/Group"
8759 * ),
8760 * @OA\Response(
8761 * response="400",
8762 * ref="#/components/responses/badrequest"
8763 * ),
8764 * @OA\Response(
8765 * response="401",
8766 * ref="#/components/responses/unauthorized"
8767 * ),
8768 * security={{"openemr_auth":{}}}
8772 * TODO
8774 'GET /fhir/Group' => function (HttpRestRequest $request) {
8775 RestConfig::authorization_check("admin", "users");
8776 $getParams = $request->getQueryParams();
8777 if ($request->isPatientRequest()) {
8778 // only allow access to data of binded patient
8779 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
8780 } else {
8781 $return = (new FhirGroupRestController())->getAll($getParams);
8783 RestConfig::apiLog($return);
8784 return $return;
8788 * @OA\Get(
8789 * path="/fhir/Group/{uuid}",
8790 * description="Returns a single Group resource.",
8791 * tags={"fhir"},
8792 * @OA\Parameter(
8793 * name="uuid",
8794 * in="path",
8795 * description="The uuid for the Group resource.",
8796 * required=true,
8797 * @OA\Schema(
8798 * type="string"
8800 * ),
8801 * @OA\Response(
8802 * response="200",
8803 * ref="#/components/responses/standard"
8804 * ),
8805 * @OA\Response(
8806 * response="400",
8807 * ref="#/components/responses/badrequest"
8808 * ),
8809 * @OA\Response(
8810 * response="401",
8811 * ref="#/components/responses/unauthorized"
8812 * ),
8813 * @OA\Response(
8814 * response="404",
8815 * ref="#/components/responses/uuidnotfound"
8816 * ),
8817 * security={{"openemr_auth":{}}}
8821 * TODO
8823 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest $request) {
8824 RestConfig::authorization_check("admin", "users");
8825 if ($request->isPatientRequest()) {
8826 // only allow access to data of binded patient
8827 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
8828 } else {
8829 $return = (new FhirGroupRestController())->getOne($uuid);
8831 RestConfig::apiLog($return);
8832 return $return;
8836 * @OA\Get(
8837 * path="/fhir/Group/{id}/$export",
8838 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8839 * tags={"fhir"},
8840 * @OA\Response(
8841 * response="200",
8842 * ref="#/components/responses/standard"
8843 * ),
8844 * @OA\Response(
8845 * response="400",
8846 * ref="#/components/responses/badrequest"
8847 * ),
8848 * @OA\Response(
8849 * response="401",
8850 * ref="#/components/responses/unauthorized"
8851 * ),
8852 * security={{"openemr_auth":{}}}
8856 * TODO
8858 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest $request) {
8859 RestConfig::authorization_check("admin", "users");
8860 $fhirExportService = new FhirExportRestController($request);
8861 $exportParams = $request->getQueryParams();
8862 $exportParams['groupId'] = $groupId;
8863 $return = $fhirExportService->processExport(
8864 $exportParams,
8865 'Group',
8866 $request->getHeader('Accept'),
8867 $request->getHeader('Prefer')
8869 RestConfig::apiLog($return);
8870 return $return;
8874 * @OA\Get(
8875 * path="/fhir/Immunization",
8876 * description="Returns a list of Immunization resources.",
8877 * tags={"fhir"},
8878 * @OA\Parameter(
8879 * name="_id",
8880 * in="query",
8881 * description="The uuid for the Immunization resource.",
8882 * required=false,
8883 * @OA\Schema(
8884 * type="string"
8886 * ),
8887 * @OA\Parameter(
8888 * name="patient",
8889 * in="query",
8890 * description="The uuid for the patient.",
8891 * required=false,
8892 * @OA\Schema(
8893 * type="string"
8895 * ),
8896 * @OA\Response(
8897 * response="200",
8898 * description="Standard Response",
8899 * @OA\MediaType(
8900 * mediaType="application/json",
8901 * @OA\Schema(
8902 * @OA\Property(
8903 * property="json object",
8904 * description="FHIR Json object.",
8905 * type="object"
8906 * ),
8907 * example={
8908 * "meta": {
8909 * "lastUpdated": "2021-09-14T09:13:51"
8910 * },
8911 * "resourceType": "Bundle",
8912 * "type": "collection",
8913 * "total": 0,
8914 * "link": {
8916 * "relation": "self",
8917 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
8923 * ),
8924 * @OA\Response(
8925 * response="400",
8926 * ref="#/components/responses/badrequest"
8927 * ),
8928 * @OA\Response(
8929 * response="401",
8930 * ref="#/components/responses/unauthorized"
8931 * ),
8932 * security={{"openemr_auth":{}}}
8936 * TODO
8937 * 1. Broken sql query.
8939 "GET /fhir/Immunization" => function (HttpRestRequest $request) {
8940 $getParams = $request->getQueryParams();
8941 if ($request->isPatientRequest()) {
8942 // only allow access to data of binded patient
8943 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
8944 } else {
8945 RestConfig::authorization_check("patients", "med");
8946 $return = (new FhirImmunizationRestController())->getAll($getParams);
8948 RestConfig::apiLog($return);
8949 return $return;
8953 * @OA\Get(
8954 * path="/fhir/Immunization/{uuid}",
8955 * description="Returns a single Immunization resource.",
8956 * tags={"fhir"},
8957 * @OA\Parameter(
8958 * name="uuid",
8959 * in="path",
8960 * description="The uuid for the Immunization resource.",
8961 * required=true,
8962 * @OA\Schema(
8963 * type="string"
8965 * ),
8966 * @OA\Response(
8967 * response="200",
8968 * ref="#/components/responses/standard"
8969 * ),
8970 * @OA\Response(
8971 * response="400",
8972 * ref="#/components/responses/badrequest"
8973 * ),
8974 * @OA\Response(
8975 * response="401",
8976 * ref="#/components/responses/unauthorized"
8977 * ),
8978 * @OA\Response(
8979 * response="404",
8980 * ref="#/components/responses/uuidnotfound"
8981 * ),
8982 * security={{"openemr_auth":{}}}
8986 * TODO
8987 * 1. Broken sql query.
8989 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest $request) {
8990 if ($request->isPatientRequest()) {
8991 // only allow access to data of binded patient
8992 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
8993 } else {
8994 RestConfig::authorization_check("patients", "med");
8995 $return = (new FhirImmunizationRestController())->getOne($uuid);
8997 RestConfig::apiLog($return);
8998 return $return;
9002 * @OA\Get(
9003 * path="/fhir/Location",
9004 * description="Returns a list of Location resources.",
9005 * tags={"fhir"},
9006 * @OA\Parameter(
9007 * name="_id",
9008 * in="query",
9009 * description="The uuid for the Location resource.",
9010 * required=false,
9011 * @OA\Schema(
9012 * type="string"
9014 * ),
9015 * @OA\Response(
9016 * response="200",
9017 * description="Standard Response",
9018 * @OA\MediaType(
9019 * mediaType="application/json",
9020 * @OA\Schema(
9021 * @OA\Property(
9022 * property="json object",
9023 * description="FHIR Json object.",
9024 * type="object"
9025 * ),
9026 * example={
9027 * "meta": {
9028 * "lastUpdated": "2021-09-14T09:13:51"
9029 * },
9030 * "resourceType": "Bundle",
9031 * "type": "collection",
9032 * "total": 0,
9033 * "link": {
9035 * "relation": "self",
9036 * "url": "https://localhost:9300/apis/default/fhir/Location"
9042 * ),
9043 * @OA\Response(
9044 * response="400",
9045 * ref="#/components/responses/badrequest"
9046 * ),
9047 * @OA\Response(
9048 * response="401",
9049 * ref="#/components/responses/unauthorized"
9050 * ),
9051 * security={{"openemr_auth":{}}}
9054 "GET /fhir/Location" => function (HttpRestRequest $request) {
9055 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9056 RestConfig::apiLog($return);
9057 return $return;
9061 * @OA\Get(
9062 * path="/fhir/Location/{uuid}",
9063 * description="Returns a single Location resource.",
9064 * tags={"fhir"},
9065 * @OA\Parameter(
9066 * name="uuid",
9067 * in="path",
9068 * description="The uuid for the Location resource.",
9069 * required=true,
9070 * @OA\Schema(
9071 * type="string"
9073 * ),
9074 * @OA\Response(
9075 * response="200",
9076 * description="Standard Response",
9077 * @OA\MediaType(
9078 * mediaType="application/json",
9079 * @OA\Schema(
9080 * @OA\Property(
9081 * property="json object",
9082 * description="FHIR Json object.",
9083 * type="object"
9084 * ),
9085 * example={
9086 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9087 * "meta": {
9088 * "versionId": "1",
9089 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9090 * },
9091 * "resourceType": "Location",
9092 * "status": "active",
9093 * "name": "Your Clinic Name Here",
9094 * "telecom": {
9096 * "system": "phone",
9097 * "value": "000-000-0000"
9098 * },
9100 * "system": "fax",
9101 * "value": "000-000-0000"
9107 * ),
9108 * @OA\Response(
9109 * response="400",
9110 * ref="#/components/responses/badrequest"
9111 * ),
9112 * @OA\Response(
9113 * response="401",
9114 * ref="#/components/responses/unauthorized"
9115 * ),
9116 * @OA\Response(
9117 * response="404",
9118 * ref="#/components/responses/uuidnotfound"
9119 * ),
9120 * security={{"openemr_auth":{}}}
9123 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest $request) {
9124 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9125 RestConfig::apiLog($return);
9126 return $return;
9130 * @OA\Get(
9131 * path="/fhir/Medication",
9132 * description="Returns a list of Medication resources.",
9133 * tags={"fhir"},
9134 * @OA\Response(
9135 * response="200",
9136 * description="Standard Response",
9137 * @OA\MediaType(
9138 * mediaType="application/json",
9139 * @OA\Schema(
9140 * @OA\Property(
9141 * property="json object",
9142 * description="FHIR Json object.",
9143 * type="object"
9144 * ),
9145 * example={
9146 * "meta": {
9147 * "lastUpdated": "2021-09-14T09:13:51"
9148 * },
9149 * "resourceType": "Bundle",
9150 * "type": "collection",
9151 * "total": 0,
9152 * "link": {
9154 * "relation": "self",
9155 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9161 * ),
9162 * @OA\Response(
9163 * response="400",
9164 * ref="#/components/responses/badrequest"
9165 * ),
9166 * @OA\Response(
9167 * response="401",
9168 * ref="#/components/responses/unauthorized"
9169 * ),
9170 * security={{"openemr_auth":{}}}
9173 "GET /fhir/Medication" => function (HttpRestRequest $request) {
9174 RestConfig::authorization_check("patients", "med");
9175 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9176 RestConfig::apiLog($return);
9177 return $return;
9181 * @OA\Get(
9182 * path="/fhir/Medication/{uuid}",
9183 * description="Returns a single Medication resource.",
9184 * tags={"fhir"},
9185 * @OA\Parameter(
9186 * name="uuid",
9187 * in="path",
9188 * description="The uuid for the Medication resource.",
9189 * required=true,
9190 * @OA\Schema(
9191 * type="string"
9193 * ),
9194 * @OA\Response(
9195 * response="200",
9196 * ref="#/components/responses/standard"
9197 * ),
9198 * @OA\Response(
9199 * response="400",
9200 * ref="#/components/responses/badrequest"
9201 * ),
9202 * @OA\Response(
9203 * response="401",
9204 * ref="#/components/responses/unauthorized"
9205 * ),
9206 * @OA\Response(
9207 * response="404",
9208 * ref="#/components/responses/uuidnotfound"
9209 * ),
9210 * security={{"openemr_auth":{}}}
9214 * TODO
9215 * 1. Broken uuid validation.
9217 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest $request) {
9218 RestConfig::authorization_check("patients", "med");
9219 $return = (new FhirMedicationRestController())->getOne($uuid);
9220 RestConfig::apiLog($return);
9221 return $return;
9225 * @OA\Get(
9226 * path="/fhir/MedicationRequest",
9227 * description="Returns a list of MedicationRequest resources.",
9228 * tags={"fhir"},
9229 * @OA\Parameter(
9230 * name="_id",
9231 * in="query",
9232 * description="The uuid for the MedicationRequest resource.",
9233 * required=false,
9234 * @OA\Schema(
9235 * type="string"
9237 * ),
9238 * @OA\Parameter(
9239 * name="patient",
9240 * in="query",
9241 * description="The uuid for the patient.",
9242 * required=false,
9243 * @OA\Schema(
9244 * type="string"
9246 * ),
9247 * @OA\Parameter(
9248 * name="intent",
9249 * in="query",
9250 * description="The intent of the MedicationRequest resource.",
9251 * required=false,
9252 * @OA\Schema(
9253 * type="string"
9255 * ),
9256 * @OA\Parameter(
9257 * name="status",
9258 * in="query",
9259 * description="The status of the MedicationRequest resource.",
9260 * required=false,
9261 * @OA\Schema(
9262 * type="string"
9264 * ),
9265 * @OA\Response(
9266 * response="200",
9267 * description="Standard Response",
9268 * @OA\MediaType(
9269 * mediaType="application/json",
9270 * @OA\Schema(
9271 * @OA\Property(
9272 * property="json object",
9273 * description="FHIR Json object.",
9274 * type="object"
9275 * ),
9276 * example={
9277 * "meta": {
9278 * "lastUpdated": "2021-09-14T09:13:51"
9279 * },
9280 * "resourceType": "Bundle",
9281 * "type": "collection",
9282 * "total": 0,
9283 * "link": {
9285 * "relation": "self",
9286 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9292 * ),
9293 * @OA\Response(
9294 * response="400",
9295 * ref="#/components/responses/badrequest"
9296 * ),
9297 * @OA\Response(
9298 * response="401",
9299 * ref="#/components/responses/unauthorized"
9300 * ),
9301 * security={{"openemr_auth":{}}}
9304 "GET /fhir/MedicationRequest" => function (HttpRestRequest $request) {
9305 $getParams = $request->getQueryParams();
9306 if ($request->isPatientRequest()) {
9307 // only allow access to data of binded patient
9308 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9309 } else {
9310 RestConfig::authorization_check("patients", "med");
9311 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9313 RestConfig::apiLog($return);
9314 return $return;
9318 * @OA\Get(
9319 * path="/fhir/MedicationRequest/{uuid}",
9320 * description="Returns a single MedicationRequest resource.",
9321 * tags={"fhir"},
9322 * @OA\Parameter(
9323 * name="uuid",
9324 * in="path",
9325 * description="The uuid for the MedicationRequest resource.",
9326 * required=true,
9327 * @OA\Schema(
9328 * type="string"
9330 * ),
9331 * @OA\Response(
9332 * response="200",
9333 * description="Standard Response",
9334 * @OA\MediaType(
9335 * mediaType="application/json",
9336 * @OA\Schema(
9337 * @OA\Property(
9338 * property="json object",
9339 * description="FHIR Json object.",
9340 * type="object"
9341 * ),
9342 * example={
9343 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9344 * "meta": {
9345 * "versionId": "1",
9346 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9347 * },
9348 * "resourceType": "MedicationRequest",
9349 * "status": "active",
9350 * "intent": "order",
9351 * "category": {
9353 * "coding": {
9355 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9356 * "code": "community",
9357 * "display": "Home/Community"
9361 * },
9362 * "reportedBoolean": false,
9363 * "medicationCodeableConcept": {
9364 * "coding": {
9366 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9367 * "code": "1738139",
9368 * "display": "Acetaminophen 325 MG Oral Tablet"
9371 * },
9372 * "subject": {
9373 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9374 * "type": "Patient"
9375 * },
9376 * "authoredOn": "2021-09-18T00:00:00+00:00",
9377 * "requester": {
9378 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9379 * "type": "Practitioner"
9384 * ),
9385 * @OA\Response(
9386 * response="400",
9387 * ref="#/components/responses/badrequest"
9388 * ),
9389 * @OA\Response(
9390 * response="401",
9391 * ref="#/components/responses/unauthorized"
9392 * ),
9393 * @OA\Response(
9394 * response="404",
9395 * ref="#/components/responses/uuidnotfound"
9396 * ),
9397 * security={{"openemr_auth":{}}}
9400 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest $request) {
9401 if ($request->isPatientRequest()) {
9402 // only allow access to data of binded patient
9403 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9404 } else {
9405 RestConfig::authorization_check("patients", "med");
9406 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9408 RestConfig::apiLog($return);
9409 return $return;
9413 * @OA\Get(
9414 * path="/fhir/Observation",
9415 * description="Returns a list of Observation resources.",
9416 * tags={"fhir"},
9417 * @OA\Parameter(
9418 * name="_id",
9419 * in="query",
9420 * description="The uuid for the Observation resource.",
9421 * required=false,
9422 * @OA\Schema(
9423 * type="string"
9425 * ),
9426 * @OA\Parameter(
9427 * name="patient",
9428 * in="query",
9429 * description="The uuid for the patient.",
9430 * required=false,
9431 * @OA\Schema(
9432 * type="string"
9434 * ),
9435 * @OA\Parameter(
9436 * name="code",
9437 * in="query",
9438 * description="The code of the Observation resource.",
9439 * required=false,
9440 * @OA\Schema(
9441 * type="string"
9443 * ),
9444 * @OA\Parameter(
9445 * name="category",
9446 * in="query",
9447 * description="The category of the Observation resource.",
9448 * required=false,
9449 * @OA\Schema(
9450 * type="string"
9452 * ),
9453 * @OA\Parameter(
9454 * name="date",
9455 * in="query",
9456 * description="The datetime of the Observation resource.",
9457 * required=false,
9458 * @OA\Schema(
9459 * type="string"
9461 * ),
9462 * @OA\Response(
9463 * response="200",
9464 * description="Standard Response",
9465 * @OA\MediaType(
9466 * mediaType="application/json",
9467 * @OA\Schema(
9468 * @OA\Property(
9469 * property="json object",
9470 * description="FHIR Json object.",
9471 * type="object"
9472 * ),
9473 * example={
9474 * "meta": {
9475 * "lastUpdated": "2021-09-14T09:13:51"
9476 * },
9477 * "resourceType": "Bundle",
9478 * "type": "collection",
9479 * "total": 0,
9480 * "link": {
9482 * "relation": "self",
9483 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9489 * ),
9490 * @OA\Response(
9491 * response="400",
9492 * ref="#/components/responses/badrequest"
9493 * ),
9494 * @OA\Response(
9495 * response="401",
9496 * ref="#/components/responses/unauthorized"
9497 * ),
9498 * security={{"openemr_auth":{}}}
9501 "GET /fhir/Observation" => function (HttpRestRequest $request) {
9502 $getParams = $request->getQueryParams();
9503 if ($request->isPatientRequest()) {
9504 // only allow access to data of binded patient
9505 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9506 } else {
9507 RestConfig::authorization_check("patients", "med");
9508 $return = (new FhirObservationRestController())->getAll($getParams);
9510 RestConfig::apiLog($return);
9511 return $return;
9515 * @OA\Get(
9516 * path="/fhir/Observation/{uuid}",
9517 * description="Returns a single Observation resource.",
9518 * tags={"fhir"},
9519 * @OA\Parameter(
9520 * name="uuid",
9521 * in="path",
9522 * description="The uuid for the Observation resource.",
9523 * required=true,
9524 * @OA\Schema(
9525 * type="string"
9527 * ),
9528 * @OA\Response(
9529 * response="200",
9530 * description="Standard Response",
9531 * @OA\MediaType(
9532 * mediaType="application/json",
9533 * @OA\Schema(
9534 * @OA\Property(
9535 * property="json object",
9536 * description="FHIR Json object.",
9537 * type="object"
9538 * ),
9539 * example={
9540 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9541 * "meta": {
9542 * "versionId": "1",
9543 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9544 * },
9545 * "resourceType": "Observation",
9546 * "status": "final",
9547 * "category": {
9549 * "coding": {
9551 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9552 * "code": "vital-signs"
9556 * },
9557 * "code": {
9558 * "coding": {
9560 * "system": "http://loinc.org",
9561 * "code": "85354-9",
9562 * "display": "Blood pressure systolic and diastolic"
9565 * },
9566 * "subject": {
9567 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9568 * "type": "Patient"
9569 * },
9570 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9571 * "component": {
9573 * "code": {
9574 * "coding": {
9576 * "system": "http://loinc.org",
9577 * "code": "8480-6",
9578 * "display": "Systolic blood pressure"
9581 * },
9582 * "valueQuantity": {
9583 * "value": 122,
9584 * "unit": "mm[Hg]",
9585 * "system": "http://unitsofmeasure.org",
9586 * "code": "mm[Hg]"
9588 * },
9590 * "code": {
9591 * "coding": {
9593 * "system": "http://loinc.org",
9594 * "code": "8462-4",
9595 * "display": "Diastolic blood pressure"
9598 * },
9599 * "valueQuantity": {
9600 * "value": 77,
9601 * "unit": "mm[Hg]",
9602 * "system": "http://unitsofmeasure.org",
9603 * "code": "mm[Hg]"
9610 * ),
9611 * @OA\Response(
9612 * response="400",
9613 * ref="#/components/responses/badrequest"
9614 * ),
9615 * @OA\Response(
9616 * response="401",
9617 * ref="#/components/responses/unauthorized"
9618 * ),
9619 * @OA\Response(
9620 * response="404",
9621 * ref="#/components/responses/uuidnotfound"
9622 * ),
9623 * security={{"openemr_auth":{}}}
9626 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest $request) {
9627 if ($request->isPatientRequest()) {
9628 // only allow access to data of binded patient
9629 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
9630 } else {
9631 RestConfig::authorization_check("patients", "med");
9632 $return = (new FhirObservationRestController())->getOne($uuid);
9634 RestConfig::apiLog($return);
9635 return $return;
9639 * @OA\Get(
9640 * path="/fhir/Organization",
9641 * description="Returns a list of Organization resources.",
9642 * tags={"fhir"},
9643 * @OA\Parameter(
9644 * name="_id",
9645 * in="query",
9646 * description="The uuid for the Organization resource.",
9647 * required=false,
9648 * @OA\Schema(
9649 * type="string"
9651 * ),
9652 * @OA\Parameter(
9653 * name="name",
9654 * in="query",
9655 * description="The name of the Organization resource.",
9656 * required=false,
9657 * @OA\Schema(
9658 * type="string"
9660 * ),
9661 * @OA\Parameter(
9662 * name="email",
9663 * in="query",
9664 * description="The email of the Organization resource.",
9665 * required=false,
9666 * @OA\Schema(
9667 * type="string"
9669 * ),
9670 * @OA\Parameter(
9671 * name="phone",
9672 * in="query",
9673 * description="The phone of the Organization resource.",
9674 * required=false,
9675 * @OA\Schema(
9676 * type="string"
9678 * ),
9679 * @OA\Parameter(
9680 * name="telecom",
9681 * in="query",
9682 * description="The telecom of the Organization resource.",
9683 * required=false,
9684 * @OA\Schema(
9685 * type="string"
9687 * ),
9688 * @OA\Parameter(
9689 * name="address",
9690 * in="query",
9691 * description="The address of the Organization resource.",
9692 * required=false,
9693 * @OA\Schema(
9694 * type="string"
9696 * ),
9697 * @OA\Parameter(
9698 * name="address-city",
9699 * in="query",
9700 * description="The address-city of the Organization resource.",
9701 * required=false,
9702 * @OA\Schema(
9703 * type="string"
9705 * ),
9706 * @OA\Parameter(
9707 * name="address-postalcode",
9708 * in="query",
9709 * description="The address-postalcode of the Organization resource.",
9710 * required=false,
9711 * @OA\Schema(
9712 * type="string"
9714 * ),
9715 * @OA\Parameter(
9716 * name="address-state",
9717 * in="query",
9718 * description="The address-state of the Organization resource.",
9719 * required=false,
9720 * @OA\Schema(
9721 * type="string"
9723 * ),
9724 * @OA\Response(
9725 * response="200",
9726 * description="Standard Response",
9727 * @OA\MediaType(
9728 * mediaType="application/json",
9729 * @OA\Schema(
9730 * @OA\Property(
9731 * property="json object",
9732 * description="FHIR Json object.",
9733 * type="object"
9734 * ),
9735 * example={
9736 * "meta": {
9737 * "lastUpdated": "2021-09-14T09:13:51"
9738 * },
9739 * "resourceType": "Bundle",
9740 * "type": "collection",
9741 * "total": 0,
9742 * "link": {
9744 * "relation": "self",
9745 * "url": "https://localhost:9300/apis/default/fhir/Organization"
9751 * ),
9752 * @OA\Response(
9753 * response="400",
9754 * ref="#/components/responses/badrequest"
9755 * ),
9756 * @OA\Response(
9757 * response="401",
9758 * ref="#/components/responses/unauthorized"
9759 * ),
9760 * security={{"openemr_auth":{}}}
9763 "GET /fhir/Organization" => function (HttpRestRequest $request) {
9764 if (!$request->isPatientRequest()) {
9765 RestConfig::authorization_check("admin", "users");
9767 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
9768 RestConfig::apiLog($return);
9769 return $return;
9773 * @OA\Get(
9774 * path="/fhir/Organization/{uuid}",
9775 * description="Returns a single Organization resource.",
9776 * tags={"fhir"},
9777 * @OA\Parameter(
9778 * name="uuid",
9779 * in="path",
9780 * description="The uuid for the Organization resource.",
9781 * required=true,
9782 * @OA\Schema(
9783 * type="string"
9785 * ),
9786 * @OA\Response(
9787 * response="200",
9788 * description="Standard Response",
9789 * @OA\MediaType(
9790 * mediaType="application/json",
9791 * @OA\Schema(
9792 * @OA\Property(
9793 * property="json object",
9794 * description="FHIR Json object.",
9795 * type="object"
9796 * ),
9797 * example={
9798 * "id": "946da616-fae2-409d-b24d-56425bfb3316",
9799 * "meta": {
9800 * "versionId": "1",
9801 * "lastUpdated": "2021-09-21T16:47:36+00:00"
9802 * },
9803 * "resourceType": "Organization",
9804 * "text": {
9805 * "status": "generated",
9806 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Your Clinic Name Here</p></div>"
9807 * },
9808 * "active": true,
9809 * "type": {
9811 * "coding": {
9813 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
9814 * "code": "prov",
9815 * "display": "Healthcare Provider"
9819 * },
9820 * "name": "Your Clinic Name Here",
9821 * "telecom": {
9823 * "system": "phone",
9824 * "value": "000-000-0000",
9825 * "use": "work"
9826 * },
9828 * "system": "fax",
9829 * "value": "000-000-0000",
9830 * "use": "work"
9832 * },
9833 * "address": {
9834 * null
9839 * ),
9840 * @OA\Response(
9841 * response="400",
9842 * ref="#/components/responses/badrequest"
9843 * ),
9844 * @OA\Response(
9845 * response="401",
9846 * ref="#/components/responses/unauthorized"
9847 * ),
9848 * @OA\Response(
9849 * response="404",
9850 * ref="#/components/responses/uuidnotfound"
9851 * ),
9852 * security={{"openemr_auth":{}}}
9855 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
9856 $patientUUID = null;
9857 if (!$request->isPatientRequest()) {
9858 RestConfig::authorization_check("admin", "users");
9859 } else {
9860 $patientUUID = $request->getPatientUUIDString();
9862 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
9864 RestConfig::apiLog($return);
9865 return $return;
9869 * @OA\Post(
9870 * path="/fhir/Organization",
9871 * description="Adds a Organization resource.",
9872 * tags={"fhir"},
9873 * @OA\RequestBody(
9874 * required=true,
9875 * @OA\MediaType(
9876 * mediaType="application/json",
9877 * @OA\Schema(
9878 * description="The json object for the Organization resource.",
9879 * type="object"
9882 * ),
9883 * @OA\Response(
9884 * response="200",
9885 * ref="#/components/responses/standard"
9886 * ),
9887 * @OA\Response(
9888 * response="400",
9889 * ref="#/components/responses/badrequest"
9890 * ),
9891 * @OA\Response(
9892 * response="401",
9893 * ref="#/components/responses/unauthorized"
9894 * ),
9895 * security={{"openemr_auth":{}}}
9899 * TODO
9901 "POST /fhir/Organization" => function (HttpRestRequest $request) {
9902 RestConfig::authorization_check("admin", "super");
9903 $data = (array) (json_decode(file_get_contents("php://input"), true));
9904 $return = (new FhirOrganizationRestController())->post($data);
9905 RestConfig::apiLog($return, $data);
9906 return $return;
9910 * @OA\Put(
9911 * path="/fhir/Organization/{uuid}",
9912 * description="Modifies a Organization resource.",
9913 * tags={"fhir"},
9914 * @OA\Parameter(
9915 * name="uuid",
9916 * in="path",
9917 * description="The uuid for the organization.",
9918 * required=true,
9919 * @OA\Schema(
9920 * type="string"
9922 * ),
9923 * @OA\RequestBody(
9924 * required=true,
9925 * @OA\MediaType(
9926 * mediaType="application/json",
9927 * @OA\Schema(
9928 * description="The json object for the Organization resource.",
9929 * type="object"
9932 * ),
9933 * @OA\Response(
9934 * response="200",
9935 * ref="#/components/responses/standard"
9936 * ),
9937 * @OA\Response(
9938 * response="400",
9939 * ref="#/components/responses/badrequest"
9940 * ),
9941 * @OA\Response(
9942 * response="401",
9943 * ref="#/components/responses/unauthorized"
9944 * ),
9945 * security={{"openemr_auth":{}}}
9949 * TODO
9951 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest $request) {
9952 RestConfig::authorization_check("admin", "super");
9953 $data = (array) (json_decode(file_get_contents("php://input"), true));
9954 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
9955 RestConfig::apiLog($return, $data);
9956 return $return;
9960 * @OA\Post(
9961 * path="/fhir/Patient",
9962 * description="Adds a Patient resource.",
9963 * tags={"fhir"},
9964 * @OA\RequestBody(
9965 * required=true,
9966 * @OA\MediaType(
9967 * mediaType="application/json",
9968 * @OA\Schema(
9969 * description="The json object for the Patient resource.",
9970 * type="object"
9973 * ),
9974 * @OA\Response(
9975 * response="200",
9976 * ref="#/components/responses/standard"
9977 * ),
9978 * @OA\Response(
9979 * response="400",
9980 * ref="#/components/responses/badrequest"
9981 * ),
9982 * @OA\Response(
9983 * response="401",
9984 * ref="#/components/responses/unauthorized"
9985 * ),
9986 * security={{"openemr_auth":{}}}
9990 * TODO
9992 "POST /fhir/Patient" => function (HttpRestRequest $request) {
9993 RestConfig::authorization_check("patients", "demo");
9994 $data = (array) (json_decode(file_get_contents("php://input"), true));
9995 $return = (new FhirPatientRestController())->post($data);
9996 RestConfig::apiLog($return, $data);
9997 return $return;
10001 * @OA\Put(
10002 * path="/fhir/Patient/{uuid}",
10003 * description="Modifies a Patient resource.",
10004 * tags={"fhir"},
10005 * @OA\Parameter(
10006 * name="uuid",
10007 * in="path",
10008 * description="The uuid for the Patient resource.",
10009 * required=true,
10010 * @OA\Schema(
10011 * type="string"
10013 * ),
10014 * @OA\RequestBody(
10015 * required=true,
10016 * @OA\MediaType(
10017 * mediaType="application/json",
10018 * @OA\Schema(
10019 * description="The json object for the Patient resource.",
10020 * type="object"
10023 * ),
10024 * @OA\Response(
10025 * response="200",
10026 * ref="#/components/responses/standard"
10027 * ),
10028 * @OA\Response(
10029 * response="400",
10030 * ref="#/components/responses/badrequest"
10031 * ),
10032 * @OA\Response(
10033 * response="401",
10034 * ref="#/components/responses/unauthorized"
10035 * ),
10036 * security={{"openemr_auth":{}}}
10040 * TODO
10042 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10043 RestConfig::authorization_check("patients", "demo");
10044 $data = (array) (json_decode(file_get_contents("php://input"), true));
10045 $return = (new FhirPatientRestController())->put($uuid, $data);
10046 RestConfig::apiLog($return, $data);
10047 return $return;
10051 * @OA\Get(
10052 * path="/fhir/Patient",
10053 * description="Returns a list of Patient resources.",
10054 * tags={"fhir"},
10055 * @OA\Parameter(
10056 * name="_id",
10057 * in="query",
10058 * description="The uuid for the Patient resource.",
10059 * required=false,
10060 * @OA\Schema(
10061 * type="string"
10063 * ),
10064 * @OA\Parameter(
10065 * name="identifier",
10066 * in="query",
10067 * description="The identifier of the Patient resource.",
10068 * required=false,
10069 * @OA\Schema(
10070 * type="string"
10072 * ),
10073 * @OA\Parameter(
10074 * name="name",
10075 * in="query",
10076 * description="The name of the Patient resource.",
10077 * required=false,
10078 * @OA\Schema(
10079 * type="string"
10081 * ),
10082 * @OA\Parameter(
10083 * name="birthdate",
10084 * in="query",
10085 * description="The birthdate of the Patient resource.",
10086 * required=false,
10087 * @OA\Schema(
10088 * type="string"
10090 * ),
10091 * @OA\Parameter(
10092 * name="gender",
10093 * in="query",
10094 * description="The gender of the Patient resource.",
10095 * required=false,
10096 * @OA\Schema(
10097 * type="string"
10099 * ),
10100 * @OA\Parameter(
10101 * name="address",
10102 * in="query",
10103 * description="The address of the Patient resource.",
10104 * required=false,
10105 * @OA\Schema(
10106 * type="string"
10108 * ),
10109 * @OA\Parameter(
10110 * name="address-city",
10111 * in="query",
10112 * description="The address-city of the Patient resource.",
10113 * required=false,
10114 * @OA\Schema(
10115 * type="string"
10117 * ),
10118 * @OA\Parameter(
10119 * name="address-postalcode",
10120 * in="query",
10121 * description="The address-postalcode of the Patient resource.",
10122 * required=false,
10123 * @OA\Schema(
10124 * type="string"
10126 * ),
10127 * @OA\Parameter(
10128 * name="address-state",
10129 * in="query",
10130 * description="The address-state of the Patient resource.",
10131 * required=false,
10132 * @OA\Schema(
10133 * type="string"
10135 * ),
10136 * @OA\Parameter(
10137 * name="email",
10138 * in="query",
10139 * description="The email of the Patient resource.",
10140 * required=false,
10141 * @OA\Schema(
10142 * type="string"
10144 * ),
10145 * @OA\Parameter(
10146 * name="family",
10147 * in="query",
10148 * description="The family name of the Patient resource.",
10149 * required=false,
10150 * @OA\Schema(
10151 * type="string"
10153 * ),
10154 * @OA\Parameter(
10155 * name="given",
10156 * in="query",
10157 * description="The given name of the Patient resource.",
10158 * required=false,
10159 * @OA\Schema(
10160 * type="string"
10162 * ),
10163 * @OA\Parameter(
10164 * name="phone",
10165 * in="query",
10166 * description="The phone number of the Patient resource.",
10167 * required=false,
10168 * @OA\Schema(
10169 * type="string"
10171 * ),
10172 * @OA\Parameter(
10173 * name="telecom",
10174 * in="query",
10175 * description="The fax number of the Patient resource.",
10176 * required=false,
10177 * @OA\Schema(
10178 * type="string"
10180 * ),
10181 * @OA\Response(
10182 * response="200",
10183 * description="Standard Response",
10184 * @OA\MediaType(
10185 * mediaType="application/json",
10186 * @OA\Schema(
10187 * @OA\Property(
10188 * property="json object",
10189 * description="FHIR Json object.",
10190 * type="object"
10191 * ),
10192 * example={
10193 * "meta": {
10194 * "lastUpdated": "2021-09-14T09:13:51"
10195 * },
10196 * "resourceType": "Bundle",
10197 * "type": "collection",
10198 * "total": 0,
10199 * "link": {
10201 * "relation": "self",
10202 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10208 * ),
10209 * @OA\Response(
10210 * response="400",
10211 * ref="#/components/responses/badrequest"
10212 * ),
10213 * @OA\Response(
10214 * response="401",
10215 * ref="#/components/responses/unauthorized"
10216 * ),
10217 * security={{"openemr_auth":{}}}
10220 "GET /fhir/Patient" => function (HttpRestRequest $request) {
10221 $params = $request->getQueryParams();
10222 if ($request->isPatientRequest()) {
10223 // only allow access to data of binded patient
10224 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
10225 // need to use getAll rather than getOne)
10226 $params['_id'] = $request->getPatientUUIDString();
10227 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
10228 } else {
10229 RestConfig::authorization_check("patients", "demo");
10230 $return = (new FhirPatientRestController())->getAll($params);
10232 RestConfig::apiLog($return);
10233 return $return;
10237 * @OA\Get(
10238 * path="/fhir/Patient/$export",
10239 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
10240 * tags={"fhir"},
10241 * @OA\Response(
10242 * response="200",
10243 * ref="#/components/responses/standard"
10244 * ),
10245 * @OA\Response(
10246 * response="400",
10247 * ref="#/components/responses/badrequest"
10248 * ),
10249 * @OA\Response(
10250 * response="401",
10251 * ref="#/components/responses/unauthorized"
10252 * ),
10253 * security={{"openemr_auth":{}}}
10257 * TODO
10259 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
10260 'GET /fhir/Patient/$export' => function (HttpRestRequest $request) {
10261 RestConfig::authorization_check("admin", "users");
10262 $fhirExportService = new FhirExportRestController($request);
10263 $return = $fhirExportService->processExport(
10264 $request->getQueryParams(),
10265 'Patient',
10266 $request->getHeader('Accept'),
10267 $request->getHeader('Prefer')
10269 RestConfig::apiLog($return);
10270 return $return;
10274 * @OA\Get(
10275 * path="/fhir/Patient/{uuid}",
10276 * description="Returns a single Patient resource.",
10277 * tags={"fhir"},
10278 * @OA\Parameter(
10279 * name="uuid",
10280 * in="path",
10281 * description="The uuid for the Patient resource.",
10282 * required=true,
10283 * @OA\Schema(
10284 * type="string"
10286 * ),
10287 * @OA\Response(
10288 * response="200",
10289 * description="Standard Response",
10290 * @OA\MediaType(
10291 * mediaType="application/json",
10292 * @OA\Schema(
10293 * @OA\Property(
10294 * property="json object",
10295 * description="FHIR Json object.",
10296 * type="object"
10297 * ),
10298 * example={
10299 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
10300 * "meta": {
10301 * "versionId": "1",
10302 * "lastUpdated": "2021-09-21T17:08:03+00:00"
10303 * },
10304 * "resourceType": "Patient",
10305 * "text": {
10306 * "status": "generated",
10307 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
10308 * },
10309 * "extension": {
10311 * "valueCode": "F",
10312 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10313 * },
10315 * "extension": {
10317 * "valueCoding": {
10318 * "system": "urn:oid:2.16.840.1.113883.6.238",
10319 * "code": "1006-6",
10320 * "display": "Abenaki"
10321 * },
10322 * "url": "ombCategory"
10323 * },
10325 * "valueString": "Abenaki",
10326 * "url": "text"
10328 * },
10329 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10330 * },
10332 * "extension": {
10334 * "valueString": "Declined To Specify",
10335 * "url": "text"
10337 * },
10338 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
10340 * },
10341 * "identifier": {
10343 * "use": "official",
10344 * "type": {
10345 * "coding": {
10347 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10348 * "code": "PT"
10351 * },
10352 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10353 * "value": "1"
10355 * },
10356 * "active": true,
10357 * "name": {
10359 * "use": "official",
10360 * "family": "Von197",
10361 * "given": {
10362 * "Aurore252"
10365 * },
10366 * "gender": "female",
10367 * "birthDate": "1970-07-03",
10368 * "address": {
10370 * "line": {
10371 * "245 Crona Wall"
10372 * },
10373 * "city": "Boston",
10374 * "state": "Massachusetts",
10375 * "postalCode": "02215",
10376 * "period": {
10377 * "start": "2020-09-21T17:08:03.532+00:00"
10380 * },
10381 * "communication": {
10383 * "language": {
10384 * "coding": {
10386 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10387 * "code": "unknown",
10388 * "display": "Unknown"
10397 * ),
10398 * @OA\Response(
10399 * response="400",
10400 * ref="#/components/responses/badrequest"
10401 * ),
10402 * @OA\Response(
10403 * response="401",
10404 * ref="#/components/responses/unauthorized"
10405 * ),
10406 * @OA\Response(
10407 * response="404",
10408 * ref="#/components/responses/uuidnotfound"
10409 * ),
10410 * security={{"openemr_auth":{}}}
10413 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest $request) {
10414 if ($request->isPatientRequest()) {
10415 // only allow access to data of binded patient
10416 if (empty($id) || ($id != $request->getPatientUUIDString())) {
10417 throw new AccessDeniedException("patients", "demo", "patient id invalid");
10419 $id = $request->getPatientUUIDString();
10420 } else {
10421 RestConfig::authorization_check("patients", "demo");
10423 $return = (new FhirPatientRestController())->getOne($uuid);
10424 RestConfig::apiLog($return);
10425 return $return;
10429 * @OA\Get(
10430 * path="/fhir/Person",
10431 * description="Returns a list of Person resources.",
10432 * tags={"fhir"},
10433 * @OA\Parameter(
10434 * name="name",
10435 * in="query",
10436 * description="The name of the Person resource.",
10437 * required=false,
10438 * @OA\Schema(
10439 * type="string"
10441 * ),
10442 * @OA\Parameter(
10443 * name="active",
10444 * in="query",
10445 * description="The active status of the Person resource.",
10446 * required=false,
10447 * @OA\Schema(
10448 * type="string"
10450 * ),
10451 * @OA\Parameter(
10452 * name="address",
10453 * in="query",
10454 * description="The address of the Person resource.",
10455 * required=false,
10456 * @OA\Schema(
10457 * type="string"
10459 * ),
10460 * @OA\Parameter(
10461 * name="address-city",
10462 * in="query",
10463 * description="The address-city of the Person resource.",
10464 * required=false,
10465 * @OA\Schema(
10466 * type="string"
10468 * ),
10469 * @OA\Parameter(
10470 * name="address-postalcode",
10471 * in="query",
10472 * description="The address-postalcode of the Person resource.",
10473 * required=false,
10474 * @OA\Schema(
10475 * type="string"
10477 * ),
10478 * @OA\Parameter(
10479 * name="address-state",
10480 * in="query",
10481 * description="The address-state of the Person resource.",
10482 * required=false,
10483 * @OA\Schema(
10484 * type="string"
10486 * ),
10487 * @OA\Parameter(
10488 * name="email",
10489 * in="query",
10490 * description="The email of the Person resource.",
10491 * required=false,
10492 * @OA\Schema(
10493 * type="string"
10495 * ),
10496 * @OA\Parameter(
10497 * name="family",
10498 * in="query",
10499 * description="The family name of the Person resource.",
10500 * required=false,
10501 * @OA\Schema(
10502 * type="string"
10504 * ),
10505 * @OA\Parameter(
10506 * name="given",
10507 * in="query",
10508 * description="The given name of the Person resource.",
10509 * required=false,
10510 * @OA\Schema(
10511 * type="string"
10513 * ),
10514 * @OA\Parameter(
10515 * name="phone",
10516 * in="query",
10517 * description="The phone number of the Person resource.",
10518 * required=false,
10519 * @OA\Schema(
10520 * type="string"
10522 * ),
10523 * @OA\Parameter(
10524 * name="telecom",
10525 * in="query",
10526 * description="The fax number of the Person resource.",
10527 * required=false,
10528 * @OA\Schema(
10529 * type="string"
10531 * ),
10532 * @OA\Response(
10533 * response="200",
10534 * description="Standard Response",
10535 * @OA\MediaType(
10536 * mediaType="application/json",
10537 * @OA\Schema(
10538 * @OA\Property(
10539 * property="json object",
10540 * description="FHIR Json object.",
10541 * type="object"
10542 * ),
10543 * example={
10544 * "meta": {
10545 * "lastUpdated": "2021-09-14T09:13:51"
10546 * },
10547 * "resourceType": "Bundle",
10548 * "type": "collection",
10549 * "total": 0,
10550 * "link": {
10552 * "relation": "self",
10553 * "url": "https://localhost:9300/apis/default/fhir/Person"
10559 * ),
10560 * @OA\Response(
10561 * response="400",
10562 * ref="#/components/responses/badrequest"
10563 * ),
10564 * @OA\Response(
10565 * response="401",
10566 * ref="#/components/responses/unauthorized"
10567 * ),
10568 * security={{"openemr_auth":{}}}
10572 * TODO
10573 * 1. Broken sql query.
10575 "GET /fhir/Person" => function (HttpRestRequest $request) {
10576 RestConfig::authorization_check("admin", "users");
10577 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
10578 RestConfig::apiLog($return);
10579 return $return;
10583 * @OA\Get(
10584 * path="/fhir/Person/{uuid}",
10585 * description="Returns a single Person resource.",
10586 * tags={"fhir"},
10587 * @OA\Parameter(
10588 * name="uuid",
10589 * in="path",
10590 * description="The uuid for the Person resource.",
10591 * required=true,
10592 * @OA\Schema(
10593 * type="string"
10595 * ),
10596 * @OA\Response(
10597 * response="200",
10598 * ref="#/components/responses/standard"
10599 * ),
10600 * @OA\Response(
10601 * response="400",
10602 * ref="#/components/responses/badrequest"
10603 * ),
10604 * @OA\Response(
10605 * response="401",
10606 * ref="#/components/responses/unauthorized"
10607 * ),
10608 * @OA\Response(
10609 * response="404",
10610 * ref="#/components/responses/uuidnotfound"
10611 * ),
10612 * security={{"openemr_auth":{}}}
10616 * TODO
10617 * 1. Broken sql query.
10619 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest $request) {
10620 RestConfig::authorization_check("admin", "users");
10621 $return = (new FhirPersonRestController())->getOne($uuid);
10622 RestConfig::apiLog($return);
10623 return $return;
10627 * @OA\Get(
10628 * path="/fhir/Practitioner",
10629 * description="Returns a list of Practitioner resources.",
10630 * tags={"fhir"},
10631 * @OA\Parameter(
10632 * name="_id",
10633 * in="query",
10634 * description="The uuid for the Practitioner resource.",
10635 * required=false,
10636 * @OA\Schema(
10637 * type="string"
10639 * ),
10640 * @OA\Parameter(
10641 * name="name",
10642 * in="query",
10643 * description="The name of the Practitioner resource.",
10644 * required=false,
10645 * @OA\Schema(
10646 * type="string"
10648 * ),
10649 * @OA\Parameter(
10650 * name="active",
10651 * in="query",
10652 * description="The active status of the Practitioner resource.",
10653 * required=false,
10654 * @OA\Schema(
10655 * type="string"
10657 * ),
10658 * @OA\Parameter(
10659 * name="address",
10660 * in="query",
10661 * description="The address of the Practitioner resource.",
10662 * required=false,
10663 * @OA\Schema(
10664 * type="string"
10666 * ),
10667 * @OA\Parameter(
10668 * name="address-city",
10669 * in="query",
10670 * description="The address-city of the Practitioner resource.",
10671 * required=false,
10672 * @OA\Schema(
10673 * type="string"
10675 * ),
10676 * @OA\Parameter(
10677 * name="address-postalcode",
10678 * in="query",
10679 * description="The address-postalcode of the Practitioner resource.",
10680 * required=false,
10681 * @OA\Schema(
10682 * type="string"
10684 * ),
10685 * @OA\Parameter(
10686 * name="address-state",
10687 * in="query",
10688 * description="The address-state of the Practitioner resource.",
10689 * required=false,
10690 * @OA\Schema(
10691 * type="string"
10693 * ),
10694 * @OA\Parameter(
10695 * name="email",
10696 * in="query",
10697 * description="The email of the Practitioner resource.",
10698 * required=false,
10699 * @OA\Schema(
10700 * type="string"
10702 * ),
10703 * @OA\Parameter(
10704 * name="family",
10705 * in="query",
10706 * description="The family name of the Practitioner resource.",
10707 * required=false,
10708 * @OA\Schema(
10709 * type="string"
10711 * ),
10712 * @OA\Parameter(
10713 * name="given",
10714 * in="query",
10715 * description="The given name of the Practitioner resource.",
10716 * required=false,
10717 * @OA\Schema(
10718 * type="string"
10720 * ),
10721 * @OA\Parameter(
10722 * name="phone",
10723 * in="query",
10724 * description="The phone number of the Practitioner resource.",
10725 * required=false,
10726 * @OA\Schema(
10727 * type="string"
10729 * ),
10730 * @OA\Parameter(
10731 * name="telecom",
10732 * in="query",
10733 * description="The fax number of the Practitioner resource.",
10734 * required=false,
10735 * @OA\Schema(
10736 * type="string"
10738 * ),
10739 * @OA\Response(
10740 * response="200",
10741 * description="Standard Response",
10742 * @OA\MediaType(
10743 * mediaType="application/json",
10744 * @OA\Schema(
10745 * @OA\Property(
10746 * property="json object",
10747 * description="FHIR Json object.",
10748 * type="object"
10749 * ),
10750 * example={
10751 * "meta": {
10752 * "lastUpdated": "2021-09-14T09:13:51"
10753 * },
10754 * "resourceType": "Bundle",
10755 * "type": "collection",
10756 * "total": 0,
10757 * "link": {
10759 * "relation": "self",
10760 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
10766 * ),
10767 * @OA\Response(
10768 * response="400",
10769 * ref="#/components/responses/badrequest"
10770 * ),
10771 * @OA\Response(
10772 * response="401",
10773 * ref="#/components/responses/unauthorized"
10774 * ),
10775 * security={{"openemr_auth":{}}}
10778 "GET /fhir/Practitioner" => function (HttpRestRequest $request) {
10780 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10781 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10782 // I don't believe patients are assigned to a particular practitioner
10783 // should we allow just open api access to admin information? Should we restrict particular pieces
10784 // of data in the practitioner side (phone number, address information) based on a permission set?
10785 if (!$request->isPatientRequest()) {
10786 RestConfig::authorization_check("admin", "users");
10788 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
10789 RestConfig::apiLog($return);
10790 return $return;
10794 * @OA\Get(
10795 * path="/fhir/Practitioner/{uuid}",
10796 * description="Returns a single Practitioner resource.",
10797 * tags={"fhir"},
10798 * @OA\Parameter(
10799 * name="uuid",
10800 * in="path",
10801 * description="The uuid for the Practitioner resource.",
10802 * required=true,
10803 * @OA\Schema(
10804 * type="string"
10806 * ),
10807 * @OA\Response(
10808 * response="200",
10809 * description="Standard Response",
10810 * @OA\MediaType(
10811 * mediaType="application/json",
10812 * @OA\Schema(
10813 * @OA\Property(
10814 * property="json object",
10815 * description="FHIR Json object.",
10816 * type="object"
10817 * ),
10818 * example={
10819 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
10820 * "meta": {
10821 * "versionId": "1",
10822 * "lastUpdated": "2021-09-21T17:41:57+00:00"
10823 * },
10824 * "resourceType": "Practitioner",
10825 * "text": {
10826 * "status": "generated",
10827 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
10828 * },
10829 * "identifier": {
10831 * "system": "http://hl7.org/fhir/sid/us-npi",
10832 * "value": "11223344554543"
10834 * },
10835 * "active": true,
10836 * "name": {
10838 * "use": "official",
10839 * "family": "Smith",
10840 * "given": {
10841 * "Billy"
10848 * ),
10849 * @OA\Response(
10850 * response="400",
10851 * ref="#/components/responses/badrequest"
10852 * ),
10853 * @OA\Response(
10854 * response="401",
10855 * ref="#/components/responses/unauthorized"
10856 * ),
10857 * @OA\Response(
10858 * response="404",
10859 * ref="#/components/responses/uuidnotfound"
10860 * ),
10861 * security={{"openemr_auth":{}}}
10864 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
10865 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10866 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10867 // I don't believe patients are assigned to a particular practitioner
10868 // should we allow just open api access to admin information? Should we restrict particular pieces
10869 // of data in the practitioner side (phone number, address information) based on a permission set?
10870 if (!$request->isPatientRequest()) {
10871 RestConfig::authorization_check("admin", "users");
10873 $return = (new FhirPractitionerRestController())->getOne($uuid);
10874 RestConfig::apiLog($return);
10875 return $return;
10879 * @OA\Post(
10880 * path="/fhir/Practitioner",
10881 * description="Adds a Practitioner resources.",
10882 * tags={"fhir"},
10883 * @OA\RequestBody(
10884 * required=true,
10885 * @OA\MediaType(
10886 * mediaType="application/json",
10887 * @OA\Schema(
10888 * description="The json object for the Practitioner resource.",
10889 * type="object"
10892 * ),
10893 * @OA\Response(
10894 * response="200",
10895 * ref="#/components/responses/standard"
10896 * ),
10897 * @OA\Response(
10898 * response="400",
10899 * ref="#/components/responses/badrequest"
10900 * ),
10901 * @OA\Response(
10902 * response="401",
10903 * ref="#/components/responses/unauthorized"
10904 * ),
10905 * security={{"openemr_auth":{}}}
10909 * TODO
10910 * 1. Broken sql query.
10912 "POST /fhir/Practitioner" => function (HttpRestRequest $request) {
10913 RestConfig::authorization_check("admin", "users");
10914 $data = (array) (json_decode(file_get_contents("php://input"), true));
10915 $return = (new FhirPractitionerRestController())->post($data);
10916 RestConfig::apiLog($return, $data);
10917 return $return;
10921 * @OA\Put(
10922 * path="/fhir/Practitioner/{uuid}",
10923 * description="Modify a Practitioner resource.",
10924 * tags={"fhir"},
10925 * @OA\Parameter(
10926 * name="uuid",
10927 * in="path",
10928 * description="The uuid for the Practitioner resource.",
10929 * required=true,
10930 * @OA\Schema(
10931 * type="string"
10933 * ),
10934 * @OA\RequestBody(
10935 * required=true,
10936 * @OA\MediaType(
10937 * mediaType="application/json",
10938 * @OA\Schema(
10939 * description="The json object for the Practitioner resource.",
10940 * type="object"
10943 * ),
10944 * @OA\Response(
10945 * response="200",
10946 * ref="#/components/responses/standard"
10947 * ),
10948 * @OA\Response(
10949 * response="400",
10950 * ref="#/components/responses/badrequest"
10951 * ),
10952 * @OA\Response(
10953 * response="401",
10954 * ref="#/components/responses/unauthorized"
10955 * ),
10956 * security={{"openemr_auth":{}}}
10960 * TODO
10961 * 1. Broken sql query.
10963 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest $request) {
10964 RestConfig::authorization_check("admin", "users");
10965 $data = (array) (json_decode(file_get_contents("php://input"), true));
10966 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
10967 RestConfig::apiLog($return, $data);
10968 return $return;
10972 * @OA\Get(
10973 * path="/fhir/PractitionerRole",
10974 * description="Returns a list of PractitionerRole resources.",
10975 * tags={"fhir"},
10976 * @OA\Parameter(
10977 * name="specialty",
10978 * in="query",
10979 * description="The specialty of the PractitionerRole resource.",
10980 * required=false,
10981 * @OA\Schema(
10982 * type="string"
10984 * ),
10985 * @OA\Parameter(
10986 * name="practitioner",
10987 * in="query",
10988 * description="The practitioner of the PractitionerRole resource.",
10989 * required=false,
10990 * @OA\Schema(
10991 * type="string"
10993 * ),
10994 * @OA\Response(
10995 * response="200",
10996 * description="Standard Response",
10997 * @OA\MediaType(
10998 * mediaType="application/json",
10999 * @OA\Schema(
11000 * @OA\Property(
11001 * property="json object",
11002 * description="FHIR Json object.",
11003 * type="object"
11004 * ),
11005 * example={
11006 * "meta": {
11007 * "lastUpdated": "2021-09-14T09:13:51"
11008 * },
11009 * "resourceType": "Bundle",
11010 * "type": "collection",
11011 * "total": 0,
11012 * "link": {
11014 * "relation": "self",
11015 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11021 * ),
11022 * @OA\Response(
11023 * response="400",
11024 * ref="#/components/responses/badrequest"
11025 * ),
11026 * @OA\Response(
11027 * response="401",
11028 * ref="#/components/responses/unauthorized"
11029 * ),
11030 * security={{"openemr_auth":{}}}
11033 "GET /fhir/PractitionerRole" => function (HttpRestRequest $request) {
11034 RestConfig::authorization_check("admin", "users");
11035 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11036 RestConfig::apiLog($return);
11037 return $return;
11041 * @OA\Get(
11042 * path="/fhir/PractitionerRole/{uuid}",
11043 * description="Returns a single PractitionerRole resource.",
11044 * tags={"fhir"},
11045 * @OA\Parameter(
11046 * name="uuid",
11047 * in="path",
11048 * description="The uuid for the PractitionerRole resource.",
11049 * required=true,
11050 * @OA\Schema(
11051 * type="string"
11053 * ),
11054 * @OA\Response(
11055 * response="200",
11056 * ref="#/components/responses/standard"
11057 * ),
11058 * @OA\Response(
11059 * response="400",
11060 * ref="#/components/responses/badrequest"
11061 * ),
11062 * @OA\Response(
11063 * response="401",
11064 * ref="#/components/responses/unauthorized"
11065 * ),
11066 * @OA\Response(
11067 * response="404",
11068 * ref="#/components/responses/uuidnotfound"
11069 * ),
11070 * security={{"openemr_auth":{}}}
11074 * TODO
11075 * 1. Broken _id validation.
11077 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest $request) {
11078 RestConfig::authorization_check("admin", "users");
11079 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
11080 RestConfig::apiLog($return);
11081 return $return;
11085 * @OA\Get(
11086 * path="/fhir/Procedure",
11087 * description="Returns a list of Procedure resources.",
11088 * tags={"fhir"},
11089 * @OA\Parameter(
11090 * name="_id",
11091 * in="query",
11092 * description="The uuid for the Procedure resource.",
11093 * required=false,
11094 * @OA\Schema(
11095 * type="string"
11097 * ),
11098 * @OA\Parameter(
11099 * name="patient",
11100 * in="query",
11101 * description="The uuid for the patient.",
11102 * required=false,
11103 * @OA\Schema(
11104 * type="string"
11106 * ),
11107 * @OA\Parameter(
11108 * name="date",
11109 * in="query",
11110 * description="The datetime of the Procedure resource.",
11111 * required=false,
11112 * @OA\Schema(
11113 * type="string"
11115 * ),
11116 * @OA\Response(
11117 * response="200",
11118 * description="Standard Response",
11119 * @OA\MediaType(
11120 * mediaType="application/json",
11121 * @OA\Schema(
11122 * @OA\Property(
11123 * property="json object",
11124 * description="FHIR Json object.",
11125 * type="object"
11126 * ),
11127 * example={
11128 * "meta": {
11129 * "lastUpdated": "2021-09-14T09:13:51"
11130 * },
11131 * "resourceType": "Bundle",
11132 * "type": "collection",
11133 * "total": 0,
11134 * "link": {
11136 * "relation": "self",
11137 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
11143 * ),
11144 * @OA\Response(
11145 * response="400",
11146 * ref="#/components/responses/badrequest"
11147 * ),
11148 * @OA\Response(
11149 * response="401",
11150 * ref="#/components/responses/unauthorized"
11151 * ),
11152 * security={{"openemr_auth":{}}}
11156 * TODO
11157 * 1. Broken sql query.
11159 "GET /fhir/Procedure" => function (HttpRestRequest $request) {
11160 if ($request->isPatientRequest()) {
11161 // only allow access to data of binded patient
11162 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11163 } else {
11164 RestConfig::authorization_check("patients", "med");
11165 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
11167 RestConfig::apiLog($return);
11168 return $return;
11172 * @OA\Get(
11173 * path="/fhir/Procedure/{uuid}",
11174 * description="Returns a single Procedure resource.",
11175 * tags={"fhir"},
11176 * @OA\Parameter(
11177 * name="uuid",
11178 * in="path",
11179 * description="The uuid for the Procedure resource.",
11180 * required=true,
11181 * @OA\Schema(
11182 * type="string"
11184 * ),
11185 * @OA\Response(
11186 * response="200",
11187 * ref="#/components/responses/standard"
11188 * ),
11189 * @OA\Response(
11190 * response="400",
11191 * ref="#/components/responses/badrequest"
11192 * ),
11193 * @OA\Response(
11194 * response="401",
11195 * ref="#/components/responses/unauthorized"
11196 * ),
11197 * @OA\Response(
11198 * response="404",
11199 * ref="#/components/responses/uuidnotfound"
11200 * ),
11201 * security={{"openemr_auth":{}}}
11205 * TODO
11206 * 1. Broken sql query.
11208 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest $request) {
11209 if ($request->isPatientRequest()) {
11210 // only allow access to data of binded patient
11211 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
11212 } else {
11213 RestConfig::authorization_check("patients", "med");
11214 $return = (new FhirProcedureRestController())->getOne($uuid);
11216 RestConfig::apiLog($return);
11217 return $return;
11221 * @OA\Get(
11222 * path="/fhir/Provenance/{uuid}",
11223 * description="Returns a single Provenance resource.",
11224 * tags={"fhir"},
11225 * @OA\Parameter(
11226 * name="uuid",
11227 * in="path",
11228 * description="The uuid for the Provenance resource.",
11229 * required=true,
11230 * @OA\Schema(
11231 * type="string"
11233 * ),
11234 * @OA\Response(
11235 * response="200",
11236 * ref="#/components/responses/standard"
11237 * ),
11238 * @OA\Response(
11239 * response="400",
11240 * ref="#/components/responses/badrequest"
11241 * ),
11242 * @OA\Response(
11243 * response="401",
11244 * ref="#/components/responses/unauthorized"
11245 * ),
11246 * @OA\Response(
11247 * response="404",
11248 * ref="#/components/responses/uuidnotfound"
11249 * ),
11250 * security={{"openemr_auth":{}}}
11254 * TODO
11256 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest $request) {
11257 if ($request->isPatientRequest()) {
11258 // only allow access to data of binded patient
11259 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
11260 } else {
11261 RestConfig::authorization_check("admin", "super");
11262 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
11264 RestConfig::apiLog($return);
11265 return $return;
11269 * @OA\Get(
11270 * path="/fhir/Provenance",
11271 * description="Returns a list of Provenance resources.",
11272 * tags={"fhir"},
11273 * @OA\Parameter(
11274 * name="_id",
11275 * in="query",
11276 * description="The uuid for the Provenance resource.",
11277 * required=false,
11278 * @OA\Schema(
11279 * type="string"
11281 * ),
11282 * @OA\Response(
11283 * response="200",
11284 * description="Standard Response",
11285 * @OA\MediaType(
11286 * mediaType="application/json",
11287 * @OA\Schema(
11288 * @OA\Property(
11289 * property="json object",
11290 * description="FHIR Json object.",
11291 * type="object"
11292 * ),
11293 * example={
11294 * "meta": {
11295 * "lastUpdated": "2021-09-14T09:13:51"
11296 * },
11297 * "resourceType": "Bundle",
11298 * "type": "collection",
11299 * "total": 0,
11300 * "link": {
11302 * "relation": "self",
11303 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
11309 * ),
11310 * @OA\Response(
11311 * response="400",
11312 * ref="#/components/responses/badrequest"
11313 * ),
11314 * @OA\Response(
11315 * response="401",
11316 * ref="#/components/responses/unauthorized"
11317 * ),
11318 * security={{"openemr_auth":{}}}
11322 * TODO
11324 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
11325 // property to support which is why this endpoint exists.
11326 "GET /fhir/Provenance" => function (HttpRestRequest $request) {
11327 if ($request->isPatientRequest()) {
11328 // only allow access to data of binded patient
11329 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11330 } else {
11331 // TODO: it seems like regular users should be able to grab authorship / provenance information
11332 RestConfig::authorization_check("admin", "super");
11333 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
11335 RestConfig::apiLog($return);
11336 return $return;
11339 // other endpoints
11342 * @OA\Get(
11343 * path="/fhir/metadata",
11344 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
11345 * tags={"fhir"},
11346 * @OA\Response(
11347 * response="200",
11348 * description="Return CapabilityStatement resource of the fhir server"
11352 "GET /fhir/metadata" => function () {
11353 $return = (new FhirMetaDataRestController())->getMetaData();
11354 RestConfig::apiLog($return);
11355 return $return;
11359 * @OA\Get(
11360 * path="/fhir/.well-known/smart-configuration",
11361 * description="Returns smart configuration of the fhir server.",
11362 * tags={"fhir"},
11363 * @OA\Response(
11364 * response="200",
11365 * description="Return smart configuration of the fhir server"
11369 "GET /fhir/.well-known/smart-configuration" => function () {
11370 $authController = new \OpenEMR\RestControllers\AuthorizationController();
11371 $return = (new \OpenEMR\RestControllers\SMART\SMARTConfigurationController($authController))->getConfig();
11372 RestConfig::apiLog($return);
11373 return $return;
11376 // FHIR root level operations
11379 * @OA\Get(
11380 * path="/fhir/$export",
11381 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11382 * tags={"fhir"},
11383 * @OA\Response(
11384 * response="200",
11385 * ref="#/components/responses/standard"
11386 * ),
11387 * @OA\Response(
11388 * response="400",
11389 * ref="#/components/responses/badrequest"
11390 * ),
11391 * @OA\Response(
11392 * response="401",
11393 * ref="#/components/responses/unauthorized"
11394 * ),
11395 * security={{"openemr_auth":{}}}
11399 * TODO
11401 'GET /fhir/$export' => function (HttpRestRequest $request) {
11402 RestConfig::authorization_check("admin", "users");
11403 $fhirExportService = new FhirExportRestController($request);
11404 $return = $fhirExportService->processExport(
11405 $request->getQueryParams(),
11406 'System',
11407 $request->getHeader('Accept'),
11408 $request->getHeader('Prefer')
11410 RestConfig::apiLog($return);
11411 return $return;
11414 // these two operations are adopted based on the documentation used in the IBM FHIR Server
11415 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
11416 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
11419 * @OA\Get(
11420 * path="/fhir/$bulkdata-status",
11421 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11422 * tags={"fhir"},
11423 * @OA\Response(
11424 * response="200",
11425 * ref="#/components/responses/standard"
11426 * ),
11427 * @OA\Response(
11428 * response="400",
11429 * ref="#/components/responses/badrequest"
11430 * ),
11431 * @OA\Response(
11432 * response="401",
11433 * ref="#/components/responses/unauthorized"
11434 * ),
11435 * security={{"openemr_auth":{}}}
11439 * TODO
11441 'GET /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
11442 RestConfig::authorization_check("admin", "users");
11443 $jobUuidString = $request->getQueryParam('job');
11444 // if we were truly async we would return 202 here to say we are in progress with a JSON response
11445 // since OpenEMR data is so small we just return the JSON from the database
11446 $fhirExportService = new FhirExportRestController($request);
11447 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
11448 RestConfig::apiLog($return);
11449 return $return;
11453 * @OA\Delete(
11454 * path="/fhir/$bulkdata-status",
11455 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11456 * tags={"fhir"},
11457 * @OA\Response(
11458 * response="200",
11459 * ref="#/components/responses/standard"
11460 * ),
11461 * @OA\Response(
11462 * response="400",
11463 * ref="#/components/responses/badrequest"
11464 * ),
11465 * @OA\Response(
11466 * response="401",
11467 * ref="#/components/responses/unauthorized"
11468 * ),
11469 * security={{"openemr_auth":{}}}
11473 * TODO
11475 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest $request) {
11476 RestConfig::authorization_check("admin", "users");
11477 $job = $request->getQueryParam('job');
11478 $fhirExportService = new FhirExportRestController($request);
11479 $return = $fhirExportService->processDeleteExportForJob($job);
11480 RestConfig::apiLog($return);
11481 return $return;
11485 // Note that the portal (api) route is only for patient role
11486 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
11487 RestConfig::$PORTAL_ROUTE_MAP = array(
11489 * @OA\Get(
11490 * path="/portal/patient",
11491 * description="Returns the patient.",
11492 * tags={"standard-patient"},
11493 * @OA\Response(
11494 * response="200",
11495 * description="Standard response",
11496 * @OA\MediaType(
11497 * mediaType="application/json",
11498 * @OA\Schema(ref="#/components/schemas/api_patient_response")
11500 * ),
11501 * @OA\Response(
11502 * response="401",
11503 * ref="#/components/responses/unauthorized"
11504 * ),
11505 * security={{"openemr_auth":{}}}
11508 "GET /portal/patient" => function (HttpRestRequest $request) {
11509 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
11510 RestConfig::apiLog($return);
11511 return $return;
11515 * @OA\Get(
11516 * path="/portal/patient/encounter",
11517 * description="Returns encounters for the patient.",
11518 * tags={"standard-patient"},
11519 * @OA\Response(
11520 * response="200",
11521 * ref="#/components/responses/standard"
11522 * ),
11523 * @OA\Response(
11524 * response="400",
11525 * ref="#/components/responses/badrequest"
11526 * ),
11527 * @OA\Response(
11528 * response="401",
11529 * ref="#/components/responses/unauthorized"
11530 * ),
11531 * security={{"openemr_auth":{}}}
11534 "GET /portal/patient/encounter" => function (HttpRestRequest $request) {
11535 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
11536 RestConfig::apiLog($return);
11537 return $return;
11541 * @OA\Get(
11542 * path="/portal/patient/encounter/{euuid}",
11543 * description="Returns a selected encounter by its uuid.",
11544 * tags={"standard-patient"},
11545 * @OA\Parameter(
11546 * name="euuid",
11547 * in="path",
11548 * description="The uuid for the encounter.",
11549 * required=true,
11550 * @OA\Schema(
11551 * type="string"
11553 * ),
11554 * @OA\Response(
11555 * response="200",
11556 * ref="#/components/responses/standard"
11557 * ),
11558 * @OA\Response(
11559 * response="400",
11560 * ref="#/components/responses/badrequest"
11561 * ),
11562 * @OA\Response(
11563 * response="401",
11564 * ref="#/components/responses/unauthorized"
11565 * ),
11566 * security={{"openemr_auth":{}}}
11569 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest $request) {
11570 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
11571 RestConfig::apiLog($return);
11572 return $return;