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
21 * @OA\Info(title="OpenEMR API", version="7.0.0")
22 * @OA\Server(url="/apis/default/")
24 * securityScheme="openemr_auth",
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
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/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
40 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
41 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
42 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
43 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
44 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
45 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
46 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
47 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
48 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
49 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
50 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
51 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
52 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
53 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
54 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
55 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
56 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
57 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
58 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
59 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
60 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
61 * "system/Device.read": "Read all device resources in the system (api:fhir)",
62 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
63 * "system/Document.read": "Read all document resources in the system (api:fhir)",
64 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
65 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
66 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
67 * "system/Group.read": "Read all group resources in the system (api:fhir)",
68 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
69 * "system/Location.read": "Read all location resources in the system (api:fhir)",
70 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
71 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
72 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
73 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
74 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
75 * "system/Person.read": "Read all person resources in the system (api:fhir)",
76 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
77 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
78 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
79 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
80 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
81 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
82 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
83 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
84 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
85 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
86 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
87 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
88 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
89 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
90 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
91 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
92 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
93 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
94 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
95 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
96 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
97 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
98 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
99 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
100 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
101 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
102 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
103 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
104 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
105 * "api:oemr": "Standard OpenEMR API",
106 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
107 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
108 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
109 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
110 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
111 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
112 * "user/document.read": "Read documents the user has access to (api:oemr)",
113 * "user/document.write": "Write documents the user has access to (api:oemr)",
114 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
115 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
116 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
117 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
118 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
119 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
120 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
121 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
122 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
123 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
124 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
125 * "user/list.read": "Read lists the user has access to (api:oemr)",
126 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
127 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
128 * "user/medication.read": "Read medications the user has access to (api:oemr)",
129 * "user/medication.write": "Write medications the user has access to (api:oemr)",
130 * "user/message.write": "Read messages the user has access to (api:oemr)",
131 * "user/patient.read": "Read patients the user has access to (api:oemr)",
132 * "user/patient.write": "Write patients the user has access to (api:oemr)",
133 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
134 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
135 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
136 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
137 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
138 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
139 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
140 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
141 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
142 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
143 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
144 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
145 * "api:port": "Standard Patient Portal OpenEMR API",
146 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
147 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
153 * description="FHIR R4 API"
157 * description="Standard OpenEMR API"
160 * name="standard-patient",
161 * description="Standard Patient Portal OpenEMR API"
164 * response="standard",
165 * description="Standard Response",
167 * mediaType="application/json",
170 * property="validationErrors",
171 * description="Validation errors.",
178 * property="internalErrors",
179 * description="Internal errors.",
187 * description="Returned data.",
194 * "validationErrors": {},
195 * "error_description": {},
202 * response="badrequest",
203 * description="Bad Request",
205 * mediaType="application/json",
208 * property="validationErrors",
209 * description="Validation errors.",
213 * "validationErrors":
215 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
222 * response="unauthorized",
223 * description="Unauthorized",
225 * mediaType="application/json",
229 * description="The error.",
233 * property="error_description",
234 * description="The description of the error.",
239 * description="More specific information on the error.",
243 * property="message",
244 * description="Message regarding the error.",
248 * "error": "access_denied",
249 * "error_description": "The resource owner or authorization server denied the request.",
250 * "hint": "Missing ""Authorization"" header",
251 * "message": "The resource owner or authorization server denied the request."
257 * response="uuidnotfound",
258 * description="Not Found",
260 * mediaType="application/json",
264 * description="empty",
273 // Lets keep our controller classes with the routes.
275 use OpenEMR\Common\Acl\AccessDeniedException
;
276 use OpenEMR\Common\Http\HttpRestRequest
;
277 use OpenEMR\RestControllers\AllergyIntoleranceRestController
;
278 use OpenEMR\RestControllers\FacilityRestController
;
279 use OpenEMR\RestControllers\VersionRestController
;
280 use OpenEMR\RestControllers\ProductRegistrationRestController
;
281 use OpenEMR\RestControllers\PatientRestController
;
282 use OpenEMR\RestControllers\EncounterRestController
;
283 use OpenEMR\RestControllers\PractitionerRestController
;
284 use OpenEMR\RestControllers\ListRestController
;
285 use OpenEMR\RestControllers\InsuranceCompanyRestController
;
286 use OpenEMR\RestControllers\AppointmentRestController
;
287 use OpenEMR\RestControllers\ConditionRestController
;
288 use OpenEMR\RestControllers\ONoteRestController
;
289 use OpenEMR\RestControllers\DocumentRestController
;
290 use OpenEMR\RestControllers\DrugRestController
;
291 use OpenEMR\RestControllers\ImmunizationRestController
;
292 use OpenEMR\RestControllers\InsuranceRestController
;
293 use OpenEMR\RestControllers\MessageRestController
;
294 use OpenEMR\RestControllers\PrescriptionRestController
;
295 use OpenEMR\RestControllers\ProcedureRestController
;
296 use OpenEMR\RestControllers\TransactionRestController
;
298 // Note some Http clients may not send auth as json so a function
299 // is implemented to determine and parse encoding on auth route's.
301 // Note that the api route is only for users role
302 // (there is a mechanism in place to ensure only user role can access the api route)
303 RestConfig
::$ROUTE_MAP = array(
306 * path="/api/facility",
307 * description="Returns a single facility.",
312 * description="The name for the facility.",
319 * name="facility_npi",
321 * description="The facility_npi for the facility.",
330 * description="The phone for the facility.",
339 * description="The fax for the facility.",
348 * description="The street for the facility.",
357 * description="The city for the facility.",
366 * description="The state for the facility.",
373 * name="postal_code",
375 * description="The postal_code for the facility.",
382 * name="country_code",
384 * description="The country_code for the facility.",
391 * name="federal_ein",
393 * description="The federal_ein for the facility.",
402 * description="The website for the facility.",
411 * description="The email for the facility.",
418 * name="domain_identifier",
420 * description="The domain_identifier for the facility.",
427 * name="facility_taxonomy",
429 * description="The facility_taxonomy for the facility.",
436 * name="facility_code",
438 * description="The facility_code for the facility.",
445 * name="billing_location",
447 * description="The billing_location setting for the facility.",
454 * name="accepts_assignment",
456 * description="The accepts_assignment setting for the facility.",
465 * description="The oid for the facility.",
472 * name="service_location",
474 * description="The service_location setting for the facility.",
482 * ref="#/components/responses/standard"
486 * ref="#/components/responses/badrequest"
490 * ref="#/components/responses/unauthorized"
492 * security={{"openemr_auth":{}}}
495 "GET /api/facility" => function () {
496 RestConfig
::authorization_check("admin", "users");
497 $return = (new FacilityRestController())->getAll($_GET);
498 RestConfig
::apiLog($return);
504 * path="/api/facility/{fuuid}",
505 * description="Returns a single facility.",
510 * description="The uuid for the facility.",
518 * ref="#/components/responses/standard"
522 * ref="#/components/responses/badrequest"
526 * ref="#/components/responses/unauthorized"
528 * security={{"openemr_auth":{}}}
531 "GET /api/facility/:fuuid" => function ($fuuid) {
532 RestConfig
::authorization_check("admin", "users");
533 $return = (new FacilityRestController())->getOne($fuuid);
534 RestConfig
::apiLog($return);
540 * path="/api/facility",
541 * description="Creates a facility in the system",
546 * mediaType="application/json",
550 * description="The name for the facility.",
554 * property="facility_npi",
555 * description="The facility_npi for the facility.",
560 * description="The phone for the facility.",
565 * description="The fax for the facility.",
570 * description="The street for the facility.",
575 * description="The city for the facility.",
580 * description="The state for the facility.",
584 * property="postal_code",
585 * description="The postal_code for the facility.",
589 * property="country_code",
590 * description="The country_code for the facility.",
594 * property="federal_ein",
595 * description="The federal_ein for the facility.",
599 * property="website",
600 * description="The website for the facility.",
605 * description="The email for the facility.",
609 * property="domain_identifier",
610 * description="The domain_identifier for the facility.",
614 * property="facility_taxonomy",
615 * description="The facility_taxonomy for the facility.",
619 * property="facility_code",
620 * description="The facility_code for the facility.",
624 * property="billing_location",
625 * description="The billing_location setting for the facility.",
629 * property="accepts_assignment",
630 * description="The accepts_assignment setting for the facility.",
635 * description="The oid for the facility.",
639 * property="service_location",
640 * description="The service_location setting for the facility.",
643 * required={"name", "facility_npi"},
646 * "facility_npi": "123456789123",
647 * "phone": "808-606-3030",
648 * "fax": "808-606-3031",
649 * "street": "1337 Bit Shifter Ln",
650 * "city": "San Lorenzo",
652 * "postal_code": "54321",
653 * "country_code": "US",
654 * "federal_ein": "4343434",
655 * "website": "https://example.com",
656 * "email": "foo@bar.com",
657 * "domain_identifier": "",
658 * "facility_taxonomy": "",
659 * "facility_code": "",
660 * "billing_location": "1",
661 * "accepts_assignment": "1",
663 * "service_location": "1"
670 * ref="#/components/responses/standard"
674 * ref="#/components/responses/badrequest"
678 * ref="#/components/responses/unauthorized"
680 * security={{"openemr_auth":{}}}
683 "POST /api/facility" => function () {
684 RestConfig
::authorization_check("admin", "super");
685 $data = (array) (json_decode(file_get_contents("php://input")));
686 $return = (new FacilityRestController())->post($data);
687 RestConfig
::apiLog($return, $data);
693 * path="/api/facility/{fuuid}",
694 * description="Updates a facility in the system",
699 * description="The uuid for the facility.",
708 * mediaType="application/json",
712 * description="The name for the facility.",
716 * property="facility_npi",
717 * description="The facility_npi for the facility.",
722 * description="The phone for the facility.",
727 * description="The fax for the facility.",
732 * description="The street for the facility.",
737 * description="The city for the facility.",
742 * description="The state for the facility.",
746 * property="postal_code",
747 * description="The postal_code for the facility.",
751 * property="country_code",
752 * description="The country_code for the facility.",
756 * property="federal_ein",
757 * description="The federal_ein for the facility.",
761 * property="website",
762 * description="The website for the facility.",
767 * description="The email for the facility.",
771 * property="domain_identifier",
772 * description="The domain_identifier for the facility.",
776 * property="facility_taxonomy",
777 * description="The facility_taxonomy for the facility.",
781 * property="facility_code",
782 * description="The facility_code for the facility.",
786 * property="billing_location",
787 * description="The billing_location setting for the facility.",
791 * property="accepts_assignment",
792 * description="The accepts_assignment setting for the facility.",
797 * description="The oid for the facility.",
801 * property="service_location",
802 * description="The service_location setting for the facility.",
807 * "facility_npi": "123456789123",
808 * "phone": "808-606-3030",
809 * "fax": "808-606-3031",
810 * "street": "1337 Bit Shifter Ln",
811 * "city": "San Lorenzo",
813 * "postal_code": "54321",
814 * "country_code": "US",
815 * "federal_ein": "4343434",
816 * "website": "https://example.com",
817 * "email": "foo@bar.com",
818 * "domain_identifier": "",
819 * "facility_taxonomy": "",
820 * "facility_code": "",
821 * "billing_location": "1",
822 * "accepts_assignment": "1",
824 * "service_location": "1"
831 * ref="#/components/responses/standard"
835 * ref="#/components/responses/badrequest"
839 * ref="#/components/responses/unauthorized"
841 * security={{"openemr_auth":{}}}
844 "PUT /api/facility/:fuuid" => function ($fuuid) {
845 RestConfig
::authorization_check("admin", "super");
846 $data = (array) (json_decode(file_get_contents("php://input")));
847 $return = (new FacilityRestController())->patch($fuuid, $data);
848 RestConfig
::apiLog($return, $data);
854 * path="/api/patient",
855 * description="Retrieves a list of patients",
860 * description="The first name for the patient.",
869 * description="The last name for the patient.",
878 * description="The social security number for the patient.",
887 * description="The street for the patient.",
894 * name="postal_code",
896 * description="The postal code for the patient.",
905 * description="The city for the patient.",
914 * description="The state for the patient.",
923 * description="The home phone for the patient.",
932 * description="The business phone for the patient.",
941 * description="The cell phone for the patient.",
948 * name="postal_contact",
950 * description="The postal_contact for the patient.",
959 * description="The gender for the patient.",
966 * name="country_code",
968 * description="The country code for the patient.",
977 * description="The email for the patient.",
986 * description="The DOB for the patient.",
994 * ref="#/components/responses/standard"
998 * ref="#/components/responses/badrequest"
1002 * ref="#/components/responses/unauthorized"
1004 * security={{"openemr_auth":{}}}
1007 "GET /api/patient" => function () {
1008 RestConfig
::authorization_check("patients", "demo");
1009 $return = (new PatientRestController())->getAll($_GET);
1010 RestConfig
::apiLog($return);
1015 * Schema for the patient request
1018 * schema="api_patient_request",
1021 * description="The title of patient.",
1026 * description="The fname of patient.",
1031 * description="The mname of patient.",
1036 * description="The lname of patient.",
1040 * property="street",
1041 * description="The street address of patient.",
1045 * property="postal_code",
1046 * description="The postal code of patient.",
1051 * description="The city of patient.",
1056 * description="The state of patient.",
1060 * property="country_code",
1061 * description="The country code of patient.",
1065 * property="phone_contact",
1066 * description="The phone contact of patient.",
1071 * description="The DOB of patient.",
1076 * description="The lname of patient.",
1081 * description="The race of patient.",
1085 * property="ethnicity",
1086 * description="The ethnicity of patient.",
1089 * required={"fname", "lname", "DOB", "sex"},
1095 * "street": "456 Tree Lane",
1096 * "postal_code": "08642",
1097 * "city": "FooTown",
1099 * "country_code": "US",
1100 * "phone_contact": "123-456-7890",
1101 * "DOB": "1992-02-02",
1110 * path="/api/patient",
1111 * description="Creates a new patient",
1112 * tags={"standard"},
1116 * mediaType="application/json",
1117 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1122 * description="Standard response",
1124 * mediaType="application/json",
1127 * property="validationErrors",
1128 * description="Validation errors.",
1135 * property="internalErrors",
1136 * description="Internal errors.",
1144 * description="Returned data.",
1149 * description="patient pid",
1155 * "validationErrors": {},
1156 * "error_description": {},
1166 * ref="#/components/responses/unauthorized"
1168 * security={{"openemr_auth":{}}}
1171 "POST /api/patient" => function () {
1172 RestConfig
::authorization_check("patients", "demo");
1173 $data = (array) (json_decode(file_get_contents("php://input")));
1174 $return = (new PatientRestController())->post($data);
1175 RestConfig
::apiLog($return, $data);
1180 * Schema for the patient response
1183 * schema="api_patient_response",
1185 * property="validationErrors",
1186 * description="Validation errors.",
1193 * property="internalErrors",
1194 * description="Internal errors.",
1202 * description="Returned data.",
1207 * description="patient id",
1212 * description="patient pid",
1216 * property="pubpid",
1217 * description="patient public id",
1222 * description="patient title",
1227 * description="patient first name",
1232 * description="patient middle name",
1237 * description="patient last name",
1242 * description="patient social security number",
1246 * property="street",
1247 * description="patient street address",
1251 * property="postal_code",
1252 * description="patient postal code",
1257 * description="patient city",
1262 * description="patient state",
1266 * property="county",
1267 * description="patient county",
1271 * property="country_code",
1272 * description="patient country code",
1276 * property="drivers_license",
1277 * description="patient drivers license id",
1281 * property="contact_relationship",
1282 * description="patient contact relationship",
1286 * property="phone_contact",
1287 * description="patient phone contact",
1291 * property="phone_home",
1292 * description="patient home phone",
1296 * property="phone_biz",
1297 * description="patient work phone",
1301 * property="phone_cell",
1302 * description="patient mobile phone",
1307 * description="patient email",
1312 * description="patient DOB",
1317 * description="patient sex (gender)",
1322 * description="patient race",
1326 * property="ethnicity",
1327 * description="patient ethnicity",
1331 * property="status",
1332 * description="patient status",
1338 * "validationErrors": {},
1339 * "error_description": {},
1349 * "street": "456 Tree Lane",
1350 * "postal_code": "08642",
1351 * "city": "FooTown",
1354 * "country_code": "US",
1355 * "drivers_license": "",
1356 * "contact_relationship": "",
1357 * "phone_contact": "123-456-7890",
1362 * "DOB": "1992-02-03",
1373 * path="/api/patient/{puuid}",
1374 * description="Updates a patient",
1375 * tags={"standard"},
1379 * description="The uuid for the patient.",
1388 * mediaType="application/json",
1389 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1394 * description="Standard response",
1396 * mediaType="application/json",
1397 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1402 * ref="#/components/responses/unauthorized"
1404 * security={{"openemr_auth":{}}}
1407 "PUT /api/patient/:puuid" => function ($puuid) {
1408 RestConfig
::authorization_check("patients", "demo");
1409 $data = (array) (json_decode(file_get_contents("php://input")));
1410 $return = (new PatientRestController())->put($puuid, $data);
1411 RestConfig
::apiLog($return, $data);
1417 * path="/api/patient/{puuid}",
1418 * description="Retrieves a single patient by their uuid",
1419 * tags={"standard"},
1423 * description="The uuid for the patient.",
1431 * description="Standard response",
1433 * mediaType="application/json",
1434 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1439 * ref="#/components/responses/unauthorized"
1441 * security={{"openemr_auth":{}}}
1444 "GET /api/patient/:puuid" => function ($puuid) {
1445 RestConfig
::authorization_check("patients", "demo");
1446 $return = (new PatientRestController())->getOne($puuid);
1447 RestConfig
::apiLog($return);
1453 * path="/api/patient/{puuid}/encounter",
1454 * description="Retrieves a list of encounters for a single patient",
1455 * tags={"standard"},
1459 * description="The uuid for the patient.",
1467 * ref="#/components/responses/standard"
1471 * ref="#/components/responses/badrequest"
1475 * ref="#/components/responses/unauthorized"
1477 * security={{"openemr_auth":{}}}
1480 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1481 RestConfig
::authorization_check("encounters", "auth_a");
1482 $return = (new EncounterRestController())->getAll($puuid);
1483 RestConfig
::apiLog($return);
1488 * Schema for the encounter request
1491 * schema="api_encounter_request",
1494 * description="The date of encounter.",
1498 * property="onset_date",
1499 * description="The onset date of encounter.",
1503 * property="reason",
1504 * description="The reason of encounter.",
1508 * property="facility",
1509 * description="The facility of encounter.",
1513 * property="pc_catid",
1514 * description="The pc_catid of encounter.",
1518 * property="facility_id",
1519 * description="The facility id of encounter.",
1523 * property="billing_facility",
1524 * description="The billing facility id of encounter.",
1528 * property="sensitivity",
1529 * description="The sensitivity of encounter.",
1533 * property="referral_source",
1534 * description="The referral source of encounter.",
1538 * property="pos_code",
1539 * description="The pos_code of encounter.",
1543 * property="external_id",
1544 * description="The external id of encounter.",
1548 * property="provider_id",
1549 * description="The provider id of encounter.",
1553 * property="class_code",
1554 * description="The class_code of encounter.",
1557 * required={"pc_catid", "class_code"},
1559 * "date":"2020-11-10",
1561 * "reason": "Pregnancy Test",
1562 * "facility": "Owerri General Hospital",
1564 * "facility_id": "3",
1565 * "billing_facility": "3",
1566 * "sensitivity": "normal",
1567 * "referral_source": "",
1569 * "external_id": "",
1570 * "provider_id": "1",
1571 * "class_code" : "AMB"
1577 * path="/api/patient/{puuid}/encounter",
1578 * description="Creates a new encounter",
1579 * tags={"standard"},
1583 * description="The uuid for the patient.",
1592 * mediaType="application/json",
1593 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1598 * description="Standard response",
1600 * mediaType="application/json",
1603 * property="validationErrors",
1604 * description="Validation errors.",
1611 * property="internalErrors",
1612 * description="Internal errors.",
1620 * description="Returned data.",
1624 * property="encounter",
1625 * description="encounter id",
1630 * description="encounter uuid",
1636 * "validationErrors": {},
1637 * "error_description": {},
1640 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1648 * ref="#/components/responses/unauthorized"
1650 * security={{"openemr_auth":{}}}
1653 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1654 RestConfig
::authorization_check("encounters", "auth_a");
1655 $data = (array) (json_decode(file_get_contents("php://input")));
1656 $return = (new EncounterRestController())->post($puuid, $data);
1657 RestConfig
::apiLog($return, $data);
1662 * Schema for the encounter response
1665 * schema="api_encounter_response",
1667 * property="validationErrors",
1668 * description="Validation errors.",
1675 * property="internalErrors",
1676 * description="Internal errors.",
1684 * description="Returned data.",
1689 * description="encounter id",
1694 * description="encounter uuid",
1699 * description="encounter date",
1703 * property="reason",
1704 * description="encounter reason",
1708 * property="facility",
1709 * description="encounter facility name",
1713 * property="facility_id",
1714 * description="encounter facility id name",
1719 * description="encounter for patient pid",
1723 * property="onset_date",
1724 * description="encounter onset date",
1728 * property="sensitivity",
1729 * description="encounter sensitivity",
1733 * property="billing_note",
1734 * description="encounter billing note",
1738 * property="pc_catid",
1739 * description="encounter pc_catid",
1743 * property="last_level_billed",
1744 * description="encounter last_level_billed",
1748 * property="last_level_closed",
1749 * description="encounter last_level_closed",
1753 * property="last_stmt_date",
1754 * description="encounter last_stmt_date",
1758 * property="stmt_count",
1759 * description="encounter stmt_count",
1763 * property="provider_id",
1764 * description="provider id",
1768 * property="supervisor_id",
1769 * description="encounter supervisor id",
1773 * property="invoice_refno",
1774 * description="encounter invoice_refno",
1778 * property="referral_source",
1779 * description="encounter referral source",
1783 * property="billing_facility",
1784 * description="encounter billing facility id",
1788 * property="external_id",
1789 * description="encounter external id",
1793 * property="pos_code",
1794 * description="encounter pos_code",
1798 * property="class_code",
1799 * description="encounter class_code",
1803 * property="class_title",
1804 * description="encounter class_title",
1808 * property="pc_catname",
1809 * description="encounter pc_catname",
1813 * property="billing_facility_name",
1814 * description="encounter billing facility name",
1820 * "validationErrors": {},
1821 * "error_description": {},
1824 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1825 * "date": "2019-09-14 00:00:00",
1826 * "reason": "Pregnancy Test",
1827 * "facility": "Owerri General Hospital",
1828 * "facility_id": "3",
1830 * "onset_date": "2019-04-20 00:00:00",
1831 * "sensitivity": "normal",
1832 * "billing_note": null,
1834 * "last_level_billed": "0",
1835 * "last_level_closed": "0",
1836 * "last_stmt_date": null,
1837 * "stmt_count": "0",
1838 * "provider_id": "1",
1839 * "supervisor_id": "0",
1840 * "invoice_refno": "",
1841 * "referral_source": "",
1842 * "billing_facility": "3",
1843 * "external_id": "",
1845 * "class_code": "AMB",
1846 * "class_title": "ambulatory",
1847 * "pc_catname": "Office Visit",
1848 * "billing_facility_name": "Owerri General Hospital"
1855 * path="/api/patient/{puuid}/encounter/{euuid}",
1856 * description="Modify a encounter",
1857 * tags={"standard"},
1861 * description="The uuid for the patient.",
1870 * description="The uuid for the encounter.",
1879 * mediaType="application/json",
1880 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1885 * description="Standard response",
1887 * mediaType="application/json",
1888 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1893 * ref="#/components/responses/unauthorized"
1895 * security={{"openemr_auth":{}}}
1898 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1899 RestConfig
::authorization_check("encounters", "auth_a");
1900 $data = (array) (json_decode(file_get_contents("php://input")));
1901 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1902 RestConfig
::apiLog($return, $data);
1908 * path="/api/patient/{puuid}/encounter/{euuid}",
1909 * description="Retrieves a single encounter for a patient",
1910 * tags={"standard"},
1914 * description="The uuid for the patient.",
1923 * description="The uuid for the encounter.",
1931 * description="Standard response",
1933 * mediaType="application/json",
1934 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1939 * ref="#/components/responses/unauthorized"
1941 * security={{"openemr_auth":{}}}
1944 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1945 RestConfig
::authorization_check("encounters", "auth_a");
1946 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1947 RestConfig
::apiLog($return);
1953 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1954 * description="Retrieves soap notes from an encounter for a patient",
1955 * tags={"standard"},
1959 * description="The pid for the patient.",
1968 * description="The id for the encounter.",
1976 * ref="#/components/responses/standard"
1980 * ref="#/components/responses/badrequest"
1984 * ref="#/components/responses/unauthorized"
1986 * security={{"openemr_auth":{}}}
1989 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1990 RestConfig
::authorization_check("encounters", "notes");
1991 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1992 RestConfig
::apiLog($return);
1997 * Schema for the vital request
2000 * schema="api_vital_request",
2003 * description="The bps of vitals.",
2008 * description="The bpd of vitals.",
2012 * property="weight",
2013 * description="The weight of vitals. (unit is lb)",
2017 * property="height",
2018 * description="The height of vitals. (unit is inches)",
2022 * property="temperature",
2023 * description="The temperature of temperature. (unit is F)",
2027 * property="temp_method",
2028 * description="The temp_method of vitals.",
2033 * description="The pulse of vitals.",
2037 * property="respiration",
2038 * description="The respiration of vitals.",
2043 * description="The note (ie. comments) of vitals.",
2047 * property="waist_circ",
2048 * description="The waist circumference of vitals. (unit is inches)",
2052 * property="head_circ",
2053 * description="The head circumference of vitals. (unit is inches)",
2057 * property="oxygen_saturation",
2058 * description="The oxygen_saturation of vitals.",
2066 * "temperature": "98",
2067 * "temp_method": "Oral",
2069 * "respiration": "20",
2070 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2071 * "waist_circ": "37",
2072 * "head_circ": "22.2",
2073 * "oxygen_saturation": "96"
2079 * path="/api/patient/{pid}/encounter/{eid}/vital",
2080 * description="Submits a new vitals form",
2081 * tags={"standard"},
2085 * description="The id for the patient.",
2094 * description="The id for the encounter.",
2103 * mediaType="application/json",
2104 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2109 * ref="#/components/responses/standard"
2113 * ref="#/components/responses/badrequest"
2117 * ref="#/components/responses/unauthorized"
2119 * security={{"openemr_auth":{}}}
2122 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2123 RestConfig
::authorization_check("encounters", "notes");
2124 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2125 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2126 RestConfig
::apiLog($return, $data);
2132 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2133 * description="Edit a vitals form",
2134 * tags={"standard"},
2138 * description="The id for the patient.",
2147 * description="The id for the encounter.",
2156 * description="The id for the vitalss form.",
2165 * mediaType="application/json",
2166 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2171 * ref="#/components/responses/standard"
2175 * ref="#/components/responses/badrequest"
2179 * ref="#/components/responses/unauthorized"
2181 * security={{"openemr_auth":{}}}
2184 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2185 RestConfig
::authorization_check("encounters", "notes");
2186 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2187 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2188 RestConfig
::apiLog($return, $data);
2194 * path="/api/patient/{pid}/encounter/{eid}/vital",
2195 * description="Retrieves all vitals from an encounter for a patient",
2196 * tags={"standard"},
2200 * description="The pid for the patient.",
2209 * description="The id for the encounter.",
2217 * ref="#/components/responses/standard"
2221 * ref="#/components/responses/badrequest"
2225 * ref="#/components/responses/unauthorized"
2227 * security={{"openemr_auth":{}}}
2230 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2231 RestConfig
::authorization_check("encounters", "notes");
2232 $return = (new EncounterRestController())->getVitals($pid, $eid);
2233 RestConfig
::apiLog($return);
2239 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2240 * description="Retrieves a vitals form from an encounter for a patient",
2241 * tags={"standard"},
2245 * description="The pid for the patient.",
2254 * description="The id for the encounter.",
2263 * description="The id for the vitals form.",
2271 * ref="#/components/responses/standard"
2275 * ref="#/components/responses/badrequest"
2279 * ref="#/components/responses/unauthorized"
2281 * security={{"openemr_auth":{}}}
2284 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2285 RestConfig
::authorization_check("encounters", "notes");
2286 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2287 RestConfig
::apiLog($return);
2293 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2294 * description="Retrieves a soap note from an encounter for a patient",
2295 * tags={"standard"},
2299 * description="The pid for the patient.",
2308 * description="The id for the encounter.",
2317 * description="The id for the soap note.",
2325 * ref="#/components/responses/standard"
2329 * ref="#/components/responses/badrequest"
2333 * ref="#/components/responses/unauthorized"
2335 * security={{"openemr_auth":{}}}
2338 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2339 RestConfig
::authorization_check("encounters", "notes");
2340 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2341 RestConfig
::apiLog($return);
2346 * Schema for the soap_note request
2349 * schema="api_soap_note_request",
2351 * property="subjective",
2352 * description="The subjective of soap note.",
2356 * property="objective",
2357 * description="The objective of soap note.",
2361 * property="assessment",
2362 * description="The assessment of soap note.",
2367 * description="The plan of soap note.",
2371 * "subjective": "The patient with mechanical fall and cut finger.",
2372 * "objective": "The patient with finger laceration on exam.",
2373 * "assessment": "The patient with finger laceration requiring sutures.",
2374 * "plan": "Sutured finger laceration."
2380 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2381 * description="Submits a new soap note",
2382 * tags={"standard"},
2386 * description="The id for the patient.",
2395 * description="The id for the encounter.",
2404 * mediaType="application/json",
2405 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2410 * ref="#/components/responses/standard"
2414 * ref="#/components/responses/badrequest"
2418 * ref="#/components/responses/unauthorized"
2420 * security={{"openemr_auth":{}}}
2423 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2424 RestConfig
::authorization_check("encounters", "notes");
2425 $data = (array) (json_decode(file_get_contents("php://input")));
2426 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2427 RestConfig
::apiLog($return, $data);
2433 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2434 * description="Edit a soap note",
2435 * tags={"standard"},
2439 * description="The id for the patient.",
2448 * description="The id for the encounter.",
2457 * description="The id for the soap noted.",
2466 * mediaType="application/json",
2467 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2472 * ref="#/components/responses/standard"
2476 * ref="#/components/responses/badrequest"
2480 * ref="#/components/responses/unauthorized"
2482 * security={{"openemr_auth":{}}}
2485 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2486 RestConfig
::authorization_check("encounters", "notes");
2487 $data = (array) (json_decode(file_get_contents("php://input")));
2488 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2489 RestConfig
::apiLog($return, $data);
2496 * path="/api/practitioner",
2497 * description="Retrieves a list of practitioners",
2498 * tags={"standard"},
2502 * description="The title for the practitioner.",
2511 * description="The first name for the practitioner.",
2520 * description="The last name for the practitioner.",
2529 * description="The middle name for the practitioner.",
2536 * name="federaltaxid",
2538 * description="The federal tax id for the practitioner.",
2545 * name="federaldrugid",
2547 * description="The federal drug id for the practitioner.",
2556 * description="The upin for the practitioner.",
2563 * name="facility_id",
2565 * description="The facility id for the practitioner.",
2574 * description="The facility for the practitioner.",
2583 * description="The npi for the practitioner.",
2592 * description="The email for the practitioner.",
2601 * description="The specialty for the practitioner.",
2610 * description="The billname for the practitioner.",
2619 * description="The url for the practitioner.",
2628 * description="The assistant for the practitioner.",
2635 * name="organization",
2637 * description="The organization for the practitioner.",
2644 * name="valedictory",
2646 * description="The valedictory for the practitioner.",
2655 * description="The street for the practitioner.",
2664 * description="The street (line 2) for the practitioner.",
2673 * description="The city for the practitioner.",
2682 * description="The state for the practitioner.",
2691 * description="The zip for the practitioner.",
2700 * description="The phone for the practitioner.",
2709 * description="The fax for the practitioner.",
2718 * description="The phonew1 for the practitioner.",
2727 * description="The phonecell for the practitioner.",
2736 * description="The notes for the practitioner.",
2743 * name="state_license_number2",
2745 * description="The state license number for the practitioner.",
2754 * description="The username for the practitioner.",
2762 * ref="#/components/responses/standard"
2766 * ref="#/components/responses/badrequest"
2770 * ref="#/components/responses/unauthorized"
2772 * security={{"openemr_auth":{}}}
2775 "GET /api/practitioner" => function () {
2776 RestConfig
::authorization_check("admin", "users");
2777 $return = (new PractitionerRestController())->getAll($_GET);
2778 RestConfig
::apiLog($return);
2784 * path="/api/practitioner/{pruuid}",
2785 * description="Retrieves a single practitioner by their uuid",
2786 * tags={"standard"},
2790 * description="The uuid for the practitioner.",
2798 * ref="#/components/responses/standard"
2802 * ref="#/components/responses/badrequest"
2806 * ref="#/components/responses/unauthorized"
2808 * security={{"openemr_auth":{}}}
2811 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2812 RestConfig
::authorization_check("admin", "users");
2813 $return = (new PractitionerRestController())->getOne($pruuid);
2814 RestConfig
::apiLog($return);
2820 * path="/api/practitioner",
2821 * description="Submits a new practitioner",
2822 * tags={"standard"},
2826 * mediaType="application/json",
2830 * description="The title for the practitioner.",
2835 * description="The first name for the practitioner.",
2840 * description="The middle name for the practitioner.",
2845 * description="The last name for the practitioner.",
2849 * property="federaltaxid",
2850 * description="The federal tax id for the practitioner.",
2854 * property="federaldrugid",
2855 * description="The federal drug id for the practitioner.",
2860 * description="The upin for the practitioner.",
2864 * property="facility_id",
2865 * description="The facility_id for the practitioner.",
2869 * property="facility",
2870 * description="The facility name for the practitioner.",
2875 * description="The npi for the practitioner.",
2880 * description="The email for the practitioner.",
2884 * property="specialty",
2885 * description="The specialty for the practitioner.",
2889 * property="billname",
2890 * description="The billname for the practitioner.",
2895 * description="The url for the practitioner.",
2899 * property="assistant",
2900 * description="The assistant for the practitioner.",
2904 * property="valedictory",
2905 * description="The valedictory for the practitioner.",
2909 * property="street",
2910 * description="The street address for the practitioner.",
2914 * property="streetb",
2915 * description="The streetb address for the practitioner.",
2920 * description="The city for the practitioner.",
2925 * description="The state for the practitioner.",
2930 * description="The zip for the practitioner.",
2935 * description="The phone for the practitioner.",
2940 * description="The fax for the practitioner.",
2944 * property="phonew1",
2945 * description="The phonew1 for the practitioner.",
2949 * property="phonecell",
2950 * description="The phonecell for the practitioner.",
2955 * description="The notes for the practitioner.",
2959 * property="state_license_number",
2960 * description="The state license number for the practitioner.",
2964 * property="username",
2965 * description="The username for the practitioner.",
2968 * required={"fname", "lname", "npi"},
2971 * "fname": "Eduardo",
2974 * "federaltaxid": "",
2975 * "federaldrugid": "",
2977 * "facility_id": "3",
2978 * "facility": "Your Clinic Name Here",
2979 * "npi": "12345678901",
2980 * "email": "info@pennfirm.com",
2984 * "assistant": null,
2985 * "organization": null,
2986 * "valedictory": null,
2987 * "street": "789 Third Avenue",
2988 * "streetb": "123 Cannaut Street",
2989 * "city": "San Diego",
2992 * "phone": "(619) 555-9827",
2994 * "phonew1": "(619) 555-7822",
2995 * "phonecell": "(619) 555-7821",
2997 * "state_license_number": "123456",
2998 * "username": "eduardoperez"
3005 * description="Standard response",
3007 * mediaType="application/json",
3010 * property="validationErrors",
3011 * description="Validation errors.",
3018 * property="internalErrors",
3019 * description="Internal errors.",
3027 * description="Returned data.",
3032 * description="practitioner id",
3037 * description="practitioner uuid",
3043 * "validationErrors": {},
3044 * "error_description": {},
3047 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3055 * ref="#/components/responses/unauthorized"
3057 * security={{"openemr_auth":{}}}
3060 "POST /api/practitioner" => function () {
3061 RestConfig
::authorization_check("admin", "users");
3062 $data = (array) (json_decode(file_get_contents("php://input")));
3063 $return = (new PractitionerRestController())->post($data);
3064 RestConfig
::apiLog($return, $data);
3070 * path="/api/practitioner/{pruuid}",
3071 * description="Edit a practitioner",
3072 * tags={"standard"},
3076 * description="The uuid for the practitioner.",
3085 * mediaType="application/json",
3089 * description="The title for the practitioner.",
3094 * description="The first name for the practitioner.",
3099 * description="The middle name for the practitioner.",
3104 * description="The last name for the practitioner.",
3108 * property="federaltaxid",
3109 * description="The federal tax id for the practitioner.",
3113 * property="federaldrugid",
3114 * description="The federal drug id for the practitioner.",
3119 * description="The upin for the practitioner.",
3123 * property="facility_id",
3124 * description="The facility_id for the practitioner.",
3128 * property="facility",
3129 * description="The facility name for the practitioner.",
3134 * description="The npi for the practitioner.",
3139 * description="The email for the practitioner.",
3143 * property="specialty",
3144 * description="The specialty for the practitioner.",
3148 * property="billname",
3149 * description="The billname for the practitioner.",
3154 * description="The url for the practitioner.",
3158 * property="assistant",
3159 * description="The assistant for the practitioner.",
3163 * property="valedictory",
3164 * description="The valedictory for the practitioner.",
3168 * property="street",
3169 * description="The street address for the practitioner.",
3173 * property="streetb",
3174 * description="The streetb address for the practitioner.",
3179 * description="The city for the practitioner.",
3184 * description="The state for the practitioner.",
3189 * description="The zip for the practitioner.",
3194 * description="The phone for the practitioner.",
3199 * description="The fax for the practitioner.",
3203 * property="phonew1",
3204 * description="The phonew1 for the practitioner.",
3208 * property="phonecell",
3209 * description="The phonecell for the practitioner.",
3214 * description="The notes for the practitioner.",
3218 * property="state_license_number",
3219 * description="The state license number for the practitioner.",
3223 * property="username",
3224 * description="The username for the practitioner.",
3232 * "street": "456 Tree Lane",
3234 * "city": "FooTown",
3236 * "phone": "123-456-7890"
3243 * description="Standard response",
3245 * mediaType="application/json",
3248 * property="validationErrors",
3249 * description="Validation errors.",
3256 * property="internalErrors",
3257 * description="Internal errors.",
3265 * description="Returned data.",
3270 * description="practitioner id",
3275 * description="practitioner uuid",
3280 * description="practitioner title",
3285 * description="practitioner fname",
3290 * description="practitioner lname",
3295 * description="practitioner mname",
3299 * property="federaltaxid",
3300 * description="practitioner federaltaxid",
3304 * property="federaldrugid",
3305 * description="practitioner federaldrugid",
3310 * description="practitioner upin",
3314 * property="facility_id",
3315 * description="practitioner facility_id",
3319 * property="facility",
3320 * description="practitioner facility",
3325 * description="practitioner npi",
3330 * description="practitioner email",
3334 * property="active",
3335 * description="practitioner active setting",
3339 * property="specialty",
3340 * description="practitioner specialty",
3344 * property="billname",
3345 * description="practitioner billname",
3350 * description="practitioner url",
3354 * property="assistant",
3355 * description="practitioner assistant",
3359 * property="organization",
3360 * description="practitioner organization",
3364 * property="valedictory",
3365 * description="practitioner valedictory",
3369 * property="street",
3370 * description="practitioner street",
3374 * property="streetb",
3375 * description="practitioner streetb",
3380 * description="practitioner city",
3385 * description="practitioner state",
3390 * description="practitioner zip",
3395 * description="practitioner phone",
3400 * description="fax",
3404 * property="phonew1",
3405 * description="practitioner phonew1",
3409 * property="phonecell",
3410 * description="practitioner phonecell",
3415 * description="practitioner notes",
3419 * property="state_license_number",
3420 * description="practitioner state license number",
3424 * property="abook_title",
3425 * description="practitioner abook title",
3429 * property="physician_title",
3430 * description="practitioner physician title",
3434 * property="physician_code",
3435 * description="practitioner physician code",
3441 * "validationErrors": {},
3442 * "error_description": {},
3445 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3450 * "federaltaxid": "",
3451 * "federaldrugid": "",
3453 * "facility_id": "3",
3454 * "facility": "Your Clinic Name Here",
3455 * "npi": "0123456789",
3456 * "email": "info@pennfirm.com",
3462 * "organization": "",
3463 * "valedictory": "",
3464 * "street": "456 Tree Lane",
3465 * "streetb": "123 Cannaut Street",
3466 * "city": "FooTown",
3469 * "phone": "123-456-7890",
3471 * "phonew1": "(619) 555-7822",
3472 * "phonecell": "(619) 555-7821",
3474 * "state_license_number": "123456",
3475 * "abook_title": null,
3476 * "physician_title": null,
3477 * "physician_code": null
3485 * ref="#/components/responses/unauthorized"
3487 * security={{"openemr_auth":{}}}
3490 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3491 RestConfig
::authorization_check("admin", "users");
3492 $data = (array) (json_decode(file_get_contents("php://input")));
3493 $return = (new PractitionerRestController())->patch($pruuid, $data);
3494 RestConfig
::apiLog($return, $data);
3500 * path="/api/medical_problem",
3501 * description="Retrieves a list of medical problems",
3502 * tags={"standard"},
3506 * description="The uuid for the patient.",
3513 * name="condition_uuid",
3515 * description="The uuid for the medical problem.",
3524 * description="The title for the medical problem.",
3533 * description="The start date for the medical problem.",
3542 * description="The end date for the medical problem.",
3551 * description="The diagnosis for the medical problem.",
3559 * ref="#/components/responses/standard"
3563 * ref="#/components/responses/badrequest"
3567 * ref="#/components/responses/unauthorized"
3569 * security={{"openemr_auth":{}}}
3572 "GET /api/medical_problem" => function () {
3573 RestConfig
::authorization_check("encounters", "notes");
3574 $return = (new ConditionRestController())->getAll();
3575 RestConfig
::apiLog($return);
3581 * path="/api/medical_problem/{muuid}",
3582 * description="Retrieves a single medical problem by their uuid",
3583 * tags={"standard"},
3587 * description="The uuid for the medical problem.",
3595 * ref="#/components/responses/standard"
3599 * ref="#/components/responses/badrequest"
3603 * ref="#/components/responses/unauthorized"
3605 * security={{"openemr_auth":{}}}
3608 "GET /api/medical_problem/:muuid" => function ($muuid) {
3609 RestConfig
::authorization_check("encounters", "notes");
3610 $return = (new ConditionRestController())->getOne($muuid);
3611 RestConfig
::apiLog($return);
3617 * path="/api/patient/{puuid}/medical_problem",
3618 * description="Retrieves all medical problems for a patient",
3619 * tags={"standard"},
3623 * description="The uuid for the patient.",
3631 * ref="#/components/responses/standard"
3635 * ref="#/components/responses/badrequest"
3639 * ref="#/components/responses/unauthorized"
3641 * security={{"openemr_auth":{}}}
3644 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3645 RestConfig
::authorization_check("encounters", "notes");
3646 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3647 RestConfig
::apiLog($return);
3653 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3654 * description="Retrieves a medical problem for a patient",
3655 * tags={"standard"},
3659 * description="The uuid for the patient.",
3668 * description="The uuid for the medical problem.",
3676 * ref="#/components/responses/standard"
3680 * ref="#/components/responses/badrequest"
3684 * ref="#/components/responses/unauthorized"
3686 * security={{"openemr_auth":{}}}
3689 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3690 RestConfig
::authorization_check("patients", "med");
3691 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3692 RestConfig
::apiLog($return);
3697 * Schema for the medical_problem request
3700 * schema="api_medical_problem_request",
3703 * description="The title of medical problem.",
3707 * property="begdate",
3708 * description="The beginning date of medical problem.",
3712 * property="enddate",
3713 * description="The end date of medical problem.",
3717 * property="diagnosis",
3718 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3721 * required={"title", "begdate"},
3723 * "title": "Dermatochalasis",
3724 * "begdate": "2010-10-13",
3726 * "diagnosis": "ICD10:H02.839"
3732 * path="/api/patient/{puuid}/medical_problem",
3733 * description="Submits a new medical problem",
3734 * tags={"standard"},
3738 * description="The uuid for the patient.",
3747 * mediaType="application/json",
3748 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3753 * ref="#/components/responses/standard"
3757 * ref="#/components/responses/badrequest"
3761 * ref="#/components/responses/unauthorized"
3763 * security={{"openemr_auth":{}}}
3766 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3767 RestConfig
::authorization_check("patients", "med");
3768 $data = (array) (json_decode(file_get_contents("php://input")));
3769 $return = (new ConditionRestController())->post($puuid, $data);
3770 RestConfig
::apiLog($return, $data);
3776 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3777 * description="Edit a medical problem",
3778 * tags={"standard"},
3782 * description="The uuid for the patient.",
3791 * description="The uuid for the medical problem.",
3800 * mediaType="application/json",
3801 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3806 * ref="#/components/responses/standard"
3810 * ref="#/components/responses/badrequest"
3814 * ref="#/components/responses/unauthorized"
3816 * security={{"openemr_auth":{}}}
3819 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3820 RestConfig
::authorization_check("patients", "med");
3821 $data = (array) (json_decode(file_get_contents("php://input")));
3822 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3823 RestConfig
::apiLog($return, $data);
3829 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3830 * description="Delete a medical problem",
3831 * tags={"standard"},
3835 * description="The uuid for the patient.",
3844 * description="The uuid for the medical problem.",
3852 * ref="#/components/responses/standard"
3856 * ref="#/components/responses/badrequest"
3860 * ref="#/components/responses/unauthorized"
3862 * security={{"openemr_auth":{}}}
3865 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3866 RestConfig
::authorization_check("patients", "med");
3867 $return = (new ConditionRestController())->delete($puuid, $muuid);
3868 RestConfig
::apiLog($return);
3874 * path="/api/allergy",
3875 * description="Retrieves a list of allergies",
3876 * tags={"standard"},
3880 * description="The uuid for the patient.",
3889 * description="The uuid for the allergy.",
3898 * description="The title for the allergy.",
3907 * description="The start date for the allergy.",
3916 * description="The end date for the allergy.",
3925 * description="The diagnosis for the allergy.",
3933 * ref="#/components/responses/standard"
3937 * ref="#/components/responses/badrequest"
3941 * ref="#/components/responses/unauthorized"
3943 * security={{"openemr_auth":{}}}
3946 "GET /api/allergy" => function () {
3947 RestConfig
::authorization_check("patients", "med");
3948 $return = (new AllergyIntoleranceRestController())->getAll();
3949 RestConfig
::apiLog($return);
3955 * path="/api/allergy/{auuid}",
3956 * description="Retrieves a single allergy by their uuid",
3957 * tags={"standard"},
3961 * description="The uuid for the allergy.",
3969 * ref="#/components/responses/standard"
3973 * ref="#/components/responses/badrequest"
3977 * ref="#/components/responses/unauthorized"
3979 * security={{"openemr_auth":{}}}
3982 "GET /api/allergy/:auuid" => function ($auuid) {
3983 RestConfig
::authorization_check("patients", "med");
3984 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3985 RestConfig
::apiLog($return);
3991 * path="/api/patient/{puuid}/allergy",
3992 * description="Retrieves all allergies for a patient",
3993 * tags={"standard"},
3997 * description="The uuid for the patient.",
4005 * ref="#/components/responses/standard"
4009 * ref="#/components/responses/badrequest"
4013 * ref="#/components/responses/unauthorized"
4015 * security={{"openemr_auth":{}}}
4018 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4019 RestConfig
::authorization_check("patients", "med");
4020 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4021 RestConfig
::apiLog($return);
4027 * path="/api/patient/{puuid}/allergy/{auuid}",
4028 * description="Retrieves a allergy for a patient",
4029 * tags={"standard"},
4033 * description="The uuid for the patient.",
4042 * description="The uuid for the allergy.",
4050 * ref="#/components/responses/standard"
4054 * ref="#/components/responses/badrequest"
4058 * ref="#/components/responses/unauthorized"
4060 * security={{"openemr_auth":{}}}
4063 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4064 RestConfig
::authorization_check("patients", "med");
4065 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4066 RestConfig
::apiLog($return);
4071 * Schema for the allergy request
4074 * schema="api_allergy_request",
4077 * description="The title of allergy.",
4081 * property="begdate",
4082 * description="The beginning date of allergy.",
4086 * property="enddate",
4087 * description="The end date of allergy.",
4091 * property="diagnosis",
4092 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4095 * required={"title", "begdate"},
4097 * "title": "Iodine",
4098 * "begdate": "2010-10-13",
4105 * path="/api/patient/{puuid}/allergy",
4106 * description="Submits a new allergy",
4107 * tags={"standard"},
4111 * description="The uuid for the patient.",
4120 * mediaType="application/json",
4121 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4126 * ref="#/components/responses/standard"
4130 * ref="#/components/responses/badrequest"
4134 * ref="#/components/responses/unauthorized"
4136 * security={{"openemr_auth":{}}}
4139 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4140 RestConfig
::authorization_check("patients", "med");
4141 $data = (array) (json_decode(file_get_contents("php://input")));
4142 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4143 RestConfig
::apiLog($return, $data);
4149 * path="/api/patient/{puuid}/allergy/{auuid}",
4150 * description="Edit a allergy",
4151 * tags={"standard"},
4155 * description="The uuid for the patient.",
4164 * description="The uuid for the allergy.",
4173 * mediaType="application/json",
4174 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4179 * ref="#/components/responses/standard"
4183 * ref="#/components/responses/badrequest"
4187 * ref="#/components/responses/unauthorized"
4189 * security={{"openemr_auth":{}}}
4192 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4193 RestConfig
::authorization_check("patients", "med");
4194 $data = (array) (json_decode(file_get_contents("php://input")));
4195 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4196 RestConfig
::apiLog($return, $data);
4202 * path="/api/patient/{puuid}/allergy/{auuid}",
4203 * description="Delete a medical problem",
4204 * tags={"standard"},
4208 * description="The uuid for the patient.",
4217 * description="The uuid for the allergy.",
4225 * ref="#/components/responses/standard"
4229 * ref="#/components/responses/badrequest"
4233 * ref="#/components/responses/unauthorized"
4235 * security={{"openemr_auth":{}}}
4238 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4239 RestConfig
::authorization_check("patients", "med");
4240 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4241 RestConfig
::apiLog($return);
4247 * path="/api/patient/{pid}/medication",
4248 * description="Retrieves all medications for a patient",
4249 * tags={"standard"},
4253 * description="The pid for the patient.",
4261 * ref="#/components/responses/standard"
4265 * ref="#/components/responses/badrequest"
4269 * ref="#/components/responses/unauthorized"
4271 * security={{"openemr_auth":{}}}
4274 "GET /api/patient/:pid/medication" => function ($pid) {
4275 RestConfig
::authorization_check("patients", "med");
4276 $return = (new ListRestController())->getAll($pid, "medication");
4277 RestConfig
::apiLog($return);
4282 * Schema for the medication request
4285 * schema="api_medication_request",
4288 * description="The title of medication.",
4292 * property="begdate",
4293 * description="The beginning date of medication.",
4297 * property="enddate",
4298 * description="The end date of medication.",
4302 * property="diagnosis",
4303 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4306 * required={"title", "begdate"},
4308 * "title": "Norvasc",
4309 * "begdate": "2013-04-13",
4316 * path="/api/patient/{pid}/medication",
4317 * description="Submits a new medication",
4318 * tags={"standard"},
4322 * description="The pid for the patient.",
4331 * mediaType="application/json",
4332 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4337 * ref="#/components/responses/standard"
4341 * ref="#/components/responses/badrequest"
4345 * ref="#/components/responses/unauthorized"
4347 * security={{"openemr_auth":{}}}
4350 "POST /api/patient/:pid/medication" => function ($pid) {
4351 RestConfig
::authorization_check("patients", "med");
4352 $data = (array) (json_decode(file_get_contents("php://input")));
4353 $return = (new ListRestController())->post($pid, "medication", $data);
4354 RestConfig
::apiLog($return, $data);
4360 * path="/api/patient/{pid}/medication/{mid}",
4361 * description="Edit a medication",
4362 * tags={"standard"},
4366 * description="The pid for the patient.",
4375 * description="The id for the medication.",
4384 * mediaType="application/json",
4385 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4390 * ref="#/components/responses/standard"
4394 * ref="#/components/responses/badrequest"
4398 * ref="#/components/responses/unauthorized"
4400 * security={{"openemr_auth":{}}}
4403 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4404 RestConfig
::authorization_check("patients", "med");
4405 $data = (array) (json_decode(file_get_contents("php://input")));
4406 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4407 RestConfig
::apiLog($return, $data);
4413 * path="/api/patient/{pid}/medication/{mid}",
4414 * description="Retrieves a medication for a patient",
4415 * tags={"standard"},
4419 * description="The id for the patient.",
4428 * description="The id for the medication.",
4436 * ref="#/components/responses/standard"
4440 * ref="#/components/responses/badrequest"
4444 * ref="#/components/responses/unauthorized"
4446 * security={{"openemr_auth":{}}}
4449 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4450 RestConfig
::authorization_check("patients", "med");
4451 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4452 RestConfig
::apiLog($return);
4458 * path="/api/patient/{pid}/medication/{mid}",
4459 * description="Delete a medication",
4460 * tags={"standard"},
4464 * description="The id for the patient.",
4473 * description="The id for the medication.",
4481 * ref="#/components/responses/standard"
4485 * ref="#/components/responses/badrequest"
4489 * ref="#/components/responses/unauthorized"
4491 * security={{"openemr_auth":{}}}
4494 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4495 RestConfig
::authorization_check("patients", "med");
4496 $return = (new ListRestController())->delete($pid, $mid, "medication");
4497 RestConfig
::apiLog($return);
4503 * path="/api/patient/{pid}/surgery",
4504 * description="Retrieves all surgeries for a patient",
4505 * tags={"standard"},
4509 * description="The pid for the patient.",
4517 * ref="#/components/responses/standard"
4521 * ref="#/components/responses/badrequest"
4525 * ref="#/components/responses/unauthorized"
4527 * security={{"openemr_auth":{}}}
4530 "GET /api/patient/:pid/surgery" => function ($pid) {
4531 RestConfig
::authorization_check("patients", "med");
4532 $return = (new ListRestController())->getAll($pid, "surgery");
4533 RestConfig
::apiLog($return);
4539 * path="/api/patient/{pid}/surgery/{sid}",
4540 * description="Retrieves a surgery for a patient",
4541 * tags={"standard"},
4545 * description="The id for the patient.",
4554 * description="The id for the surgery.",
4562 * ref="#/components/responses/standard"
4566 * ref="#/components/responses/badrequest"
4570 * ref="#/components/responses/unauthorized"
4572 * security={{"openemr_auth":{}}}
4575 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4576 RestConfig
::authorization_check("patients", "med");
4577 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4578 RestConfig
::apiLog($return);
4584 * path="/api/patient/{pid}/surgery/{sid}",
4585 * description="Delete a surgery",
4586 * tags={"standard"},
4590 * description="The id for the patient.",
4599 * description="The id for the surgery.",
4607 * ref="#/components/responses/standard"
4611 * ref="#/components/responses/badrequest"
4615 * ref="#/components/responses/unauthorized"
4617 * security={{"openemr_auth":{}}}
4620 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4621 RestConfig
::authorization_check("patients", "med");
4622 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4623 RestConfig
::apiLog($return);
4628 * Schema for the surgery request
4631 * schema="api_surgery_request",
4634 * description="The title of surgery.",
4638 * property="begdate",
4639 * description="The beginning date of surgery.",
4643 * property="enddate",
4644 * description="The end date of surgery.",
4648 * property="diagnosis",
4649 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4652 * required={"title", "begdate"},
4654 * "title": "Blepharoplasty",
4655 * "begdate": "2013-10-14",
4657 * "diagnosis": "CPT4:15823-50"
4663 * path="/api/patient/{pid}/surgery",
4664 * description="Submits a new surgery",
4665 * tags={"standard"},
4669 * description="The pid for the patient.",
4678 * mediaType="application/json",
4679 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4684 * ref="#/components/responses/standard"
4688 * ref="#/components/responses/badrequest"
4692 * ref="#/components/responses/unauthorized"
4694 * security={{"openemr_auth":{}}}
4697 "POST /api/patient/:pid/surgery" => function ($pid) {
4698 RestConfig
::authorization_check("patients", "med");
4699 $data = (array) (json_decode(file_get_contents("php://input")));
4700 $return = (new ListRestController())->post($pid, "surgery", $data);
4701 RestConfig
::apiLog($return, $data);
4707 * path="/api/patient/{pid}/surgery/{sid}",
4708 * description="Edit a surgery",
4709 * tags={"standard"},
4713 * description="The pid for the patient.",
4722 * description="The id for the surgery.",
4731 * mediaType="application/json",
4732 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4737 * ref="#/components/responses/standard"
4741 * ref="#/components/responses/badrequest"
4745 * ref="#/components/responses/unauthorized"
4747 * security={{"openemr_auth":{}}}
4750 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4751 RestConfig
::authorization_check("patients", "med");
4752 $data = (array) (json_decode(file_get_contents("php://input")));
4753 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4754 RestConfig
::apiLog($return, $data);
4760 * path="/api/patient/{pid}/dental_issue",
4761 * description="Retrieves all dental issues for a patient",
4762 * tags={"standard"},
4766 * description="The pid for the patient.",
4774 * ref="#/components/responses/standard"
4778 * ref="#/components/responses/badrequest"
4782 * ref="#/components/responses/unauthorized"
4784 * security={{"openemr_auth":{}}}
4787 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4788 RestConfig
::authorization_check("patients", "med");
4789 $return = (new ListRestController())->getAll($pid, "dental");
4790 RestConfig
::apiLog($return);
4796 * path="/api/patient/{pid}/dental_issue/{did}",
4797 * description="Retrieves a dental issue for a patient",
4798 * tags={"standard"},
4802 * description="The id for the patient.",
4811 * description="The id for the dental issue.",
4819 * ref="#/components/responses/standard"
4823 * ref="#/components/responses/badrequest"
4827 * ref="#/components/responses/unauthorized"
4829 * security={{"openemr_auth":{}}}
4832 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4833 RestConfig
::authorization_check("patients", "med");
4834 $return = (new ListRestController())->getOne($pid, "dental", $did);
4835 RestConfig
::apiLog($return);
4841 * path="/api/patient/{pid}/dental_issue/{did}",
4842 * description="Delete a dental issue",
4843 * tags={"standard"},
4847 * description="The id for the patient.",
4856 * description="The id for the dental issue.",
4864 * ref="#/components/responses/standard"
4868 * ref="#/components/responses/badrequest"
4872 * ref="#/components/responses/unauthorized"
4874 * security={{"openemr_auth":{}}}
4877 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4878 RestConfig
::authorization_check("patients", "med");
4879 $return = (new ListRestController())->delete($pid, $did, "dental");
4880 RestConfig
::apiLog($return);
4885 * Schema for the dental_issue request
4888 * schema="api_dental_issue_request",
4891 * description="The title of dental issue.",
4895 * property="begdate",
4896 * description="The beginning date of dental issue.",
4900 * property="enddate",
4901 * description="The end date of dental issue.",
4905 * property="diagnosis",
4906 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4909 * required={"title", "begdate"},
4911 * "title": "Halitosis",
4912 * "begdate": "2015-03-17",
4919 * path="/api/patient/{pid}/dental_issue",
4920 * description="Submits a new dental issue",
4921 * tags={"standard"},
4925 * description="The pid for the patient.",
4934 * mediaType="application/json",
4935 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4940 * ref="#/components/responses/standard"
4944 * ref="#/components/responses/badrequest"
4948 * ref="#/components/responses/unauthorized"
4950 * security={{"openemr_auth":{}}}
4953 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4954 RestConfig
::authorization_check("patients", "med");
4955 $data = (array) (json_decode(file_get_contents("php://input")));
4956 $return = (new ListRestController())->post($pid, "dental", $data);
4957 RestConfig
::apiLog($return, $data);
4963 * path="/api/patient/{pid}/dental_issue/{did}",
4964 * description="Edit a dental issue",
4965 * tags={"standard"},
4969 * description="The pid for the patient.",
4978 * description="The id for the dental issue.",
4987 * mediaType="application/json",
4988 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4993 * ref="#/components/responses/standard"
4997 * ref="#/components/responses/badrequest"
5001 * ref="#/components/responses/unauthorized"
5003 * security={{"openemr_auth":{}}}
5006 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5007 RestConfig
::authorization_check("patients", "med");
5008 $data = (array) (json_decode(file_get_contents("php://input")));
5009 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5010 RestConfig
::apiLog($return, $data);
5016 * path="/api/patient/{pid}/appointment",
5017 * description="Retrieves all appointments for a patient",
5018 * tags={"standard"},
5022 * description="The pid for the patient.",
5030 * ref="#/components/responses/standard"
5034 * ref="#/components/responses/badrequest"
5038 * ref="#/components/responses/unauthorized"
5040 * security={{"openemr_auth":{}}}
5043 "GET /api/patient/:pid/appointment" => function ($pid) {
5044 RestConfig
::authorization_check("patients", "appt");
5045 $return = (new AppointmentRestController())->getAllForPatient($pid);
5046 RestConfig
::apiLog($return);
5052 * path="/api/patient/{pid}/appointment",
5053 * description="Submits a new appointment",
5054 * tags={"standard"},
5058 * description="The id for the patient.",
5067 * mediaType="application/json",
5070 * property="pc_catid",
5071 * description="The category of the appointment.",
5075 * property="pc_title",
5076 * description="The title of the appointment.",
5080 * property="pc_duration",
5081 * description="The duration of the appointment.",
5085 * property="pc_hometext",
5086 * description="Comments for the appointment.",
5090 * property="pc_apptstatus",
5091 * description="use an option from resource=/api/list/apptstat",
5095 * property="pc_eventDate",
5096 * description="The date of the appointment.",
5100 * property="pc_startTime",
5101 * description="The time of the appointment.",
5105 * property="pc_facility",
5106 * description="The facility id of the appointment.",
5110 * property="pc_billing_location",
5111 * description="The billinag location id of the appointment.",
5115 * property="pc_aid",
5116 * description="The provider id for the appointment.",
5119 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5122 * "pc_title": "Office Visit",
5123 * "pc_duration": "900",
5124 * "pc_hometext": "Test",
5125 * "pc_apptstatus": "-",
5126 * "pc_eventDate": "2018-10-19",
5127 * "pc_startTime": "09:00",
5128 * "pc_facility": "9",
5129 * "pc_billing_location": "10",
5137 * ref="#/components/responses/standard"
5141 * ref="#/components/responses/badrequest"
5145 * ref="#/components/responses/unauthorized"
5147 * security={{"openemr_auth":{}}}
5150 "POST /api/patient/:pid/appointment" => function ($pid) {
5151 RestConfig
::authorization_check("patients", "appt");
5152 $data = (array) (json_decode(file_get_contents("php://input")));
5153 $return = (new AppointmentRestController())->post($pid, $data);
5154 RestConfig
::apiLog($return, $data);
5160 * path="/api/appointment",
5161 * description="Retrieves all appointments",
5162 * tags={"standard"},
5165 * ref="#/components/responses/standard"
5169 * ref="#/components/responses/badrequest"
5173 * ref="#/components/responses/unauthorized"
5175 * security={{"openemr_auth":{}}}
5178 "GET /api/appointment" => function () {
5179 RestConfig
::authorization_check("patients", "appt");
5180 $return = (new AppointmentRestController())->getAll();
5181 RestConfig
::apiLog($return);
5187 * path="/api/appointment/{eid}",
5188 * description="Retrieves an appointment",
5189 * tags={"standard"},
5193 * description="The eid for the appointment.",
5201 * ref="#/components/responses/standard"
5205 * ref="#/components/responses/badrequest"
5209 * ref="#/components/responses/unauthorized"
5211 * security={{"openemr_auth":{}}}
5214 "GET /api/appointment/:eid" => function ($eid) {
5215 RestConfig
::authorization_check("patients", "appt");
5216 $return = (new AppointmentRestController())->getOne($eid);
5217 RestConfig
::apiLog($return);
5223 * path="/api/patient/{pid}/appointment/{eid}",
5224 * description="Delete a appointment",
5225 * tags={"standard"},
5229 * description="The id for the patient.",
5238 * description="The eid for the appointment.",
5246 * ref="#/components/responses/standard"
5250 * ref="#/components/responses/badrequest"
5254 * ref="#/components/responses/unauthorized"
5256 * security={{"openemr_auth":{}}}
5259 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5260 RestConfig
::authorization_check("patients", "appt");
5261 $return = (new AppointmentRestController())->delete($eid);
5262 RestConfig
::apiLog($return);
5268 * path="/api/patient/{pid}/appointment/{eid}",
5269 * description="Retrieves a appointment for a patient",
5270 * tags={"standard"},
5274 * description="The id for the patient.",
5283 * description="The eid for the appointment.",
5291 * ref="#/components/responses/standard"
5295 * ref="#/components/responses/badrequest"
5299 * ref="#/components/responses/unauthorized"
5301 * security={{"openemr_auth":{}}}
5304 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5305 RestConfig
::authorization_check("patients", "appt");
5306 $return = (new AppointmentRestController())->getOne($eid);
5307 RestConfig
::apiLog($return);
5313 * path="/api/list/{list_name}",
5314 * description="Retrieves a list",
5315 * tags={"standard"},
5319 * description="The list_id of the list.",
5327 * ref="#/components/responses/standard"
5331 * ref="#/components/responses/badrequest"
5335 * ref="#/components/responses/unauthorized"
5337 * security={{"openemr_auth":{}}}
5340 "GET /api/list/:list_name" => function ($list_name) {
5341 RestConfig
::authorization_check("lists", "default");
5342 $return = (new ListRestController())->getOptions($list_name);
5343 RestConfig
::apiLog($return);
5349 * path="/api/version",
5350 * description="Retrieves the OpenEMR version information",
5351 * tags={"standard"},
5354 * ref="#/components/responses/standard"
5358 * ref="#/components/responses/badrequest"
5362 * ref="#/components/responses/unauthorized"
5364 * security={{"openemr_auth":{}}}
5367 "GET /api/version" => function () {
5368 $return = (new VersionRestController())->getOne();
5369 RestConfig
::apiLog($return);
5375 * path="/api/product",
5376 * description="Retrieves the OpenEMR product registration information",
5377 * tags={"standard"},
5380 * ref="#/components/responses/standard"
5384 * ref="#/components/responses/badrequest"
5388 * ref="#/components/responses/unauthorized"
5390 * security={{"openemr_auth":{}}}
5393 "GET /api/product" => function () {
5394 $return = (new ProductRegistrationRestController())->getOne();
5395 RestConfig
::apiLog($return);
5401 * path="/api/insurance_company",
5402 * description="Retrieves all insurance companies",
5403 * tags={"standard"},
5406 * ref="#/components/responses/standard"
5410 * ref="#/components/responses/badrequest"
5414 * ref="#/components/responses/unauthorized"
5416 * security={{"openemr_auth":{}}}
5419 "GET /api/insurance_company" => function () {
5420 $return = (new InsuranceCompanyRestController())->getAll();
5421 RestConfig
::apiLog($return);
5427 * path="/api/insurance_company/{iid}",
5428 * description="Retrieves insurance company",
5429 * tags={"standard"},
5433 * description="The id of the insurance company.",
5441 * ref="#/components/responses/standard"
5445 * ref="#/components/responses/badrequest"
5449 * ref="#/components/responses/unauthorized"
5451 * security={{"openemr_auth":{}}}
5454 "GET /api/insurance_company/:iid" => function ($iid) {
5455 $return = (new InsuranceCompanyRestController())->getOne($iid);
5456 RestConfig
::apiLog($return);
5462 * path="/api/insurance_type",
5463 * description="Retrieves all insurance types",
5464 * tags={"standard"},
5467 * ref="#/components/responses/standard"
5471 * ref="#/components/responses/badrequest"
5475 * ref="#/components/responses/unauthorized"
5477 * security={{"openemr_auth":{}}}
5480 "GET /api/insurance_type" => function () {
5481 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5482 RestConfig
::apiLog($return);
5487 * Schema for the insurance_company request
5490 * schema="api_insurance_company_request",
5493 * description="The name of insurance company.",
5498 * description="The attn of insurance company.",
5502 * property="cms_id",
5503 * description="The cms id of insurance company.",
5507 * property="ins_type_code",
5508 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5512 * property="x12_receiver_id",
5513 * description="The x12 receiver id of insurance company.",
5517 * property="x12_default_partner_id",
5518 * description="The x12 default partner id of insurance company.",
5522 * property="alt_cms_id",
5523 * description="The alternate cms id of insurance company.",
5528 * description="The line1 address of insurance company.",
5533 * description="The line2 address of insurance company.",
5538 * description="The city of insurance company.",
5543 * description="The state of insurance company.",
5548 * description="The zip of insurance company.",
5552 * property="country",
5553 * description="The country of insurance company.",
5556 * required={"name"},
5558 * "name": "Cool Insurance Company",
5561 * "ins_type_code": "2",
5562 * "x12_receiver_id": null,
5563 * "x12_default_partner_id": null,
5565 * "line1": "123 Cool Lane",
5566 * "line2": "Suite 123",
5567 * "city": "Cooltown",
5576 * path="/api/insurance_company",
5577 * description="Submits a new insurance company",
5578 * tags={"standard"},
5582 * mediaType="application/json",
5583 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5588 * ref="#/components/responses/standard"
5592 * ref="#/components/responses/badrequest"
5596 * ref="#/components/responses/unauthorized"
5598 * security={{"openemr_auth":{}}}
5601 "POST /api/insurance_company" => function () {
5602 $data = (array) (json_decode(file_get_contents("php://input")));
5603 $return = (new InsuranceCompanyRestController())->post($data);
5604 RestConfig
::apiLog($return, $data);
5610 * path="/api/insurance_company/{iid}",
5611 * description="Edit a insurance company",
5612 * tags={"standard"},
5616 * description="The id for the insurance company.",
5625 * mediaType="application/json",
5626 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5631 * ref="#/components/responses/standard"
5635 * ref="#/components/responses/badrequest"
5639 * ref="#/components/responses/unauthorized"
5641 * security={{"openemr_auth":{}}}
5644 "PUT /api/insurance_company/:iid" => function ($iid) {
5645 $data = (array) (json_decode(file_get_contents("php://input")));
5646 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5647 RestConfig
::apiLog($return, $data);
5653 * path="/api/patient/{pid}/document",
5654 * description="Submits a new patient document",
5655 * tags={"standard"},
5659 * description="The pid for the patient.",
5668 * description="The category of the document.",
5677 * mediaType="multipart/form-data",
5680 * property="document",
5681 * description="document",
5690 * ref="#/components/responses/standard"
5694 * ref="#/components/responses/badrequest"
5698 * ref="#/components/responses/unauthorized"
5700 * security={{"openemr_auth":{}}}
5703 "POST /api/patient/:pid/document" => function ($pid) {
5704 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5705 RestConfig
::apiLog($return);
5711 * path="/api/patient/{pid}/document",
5712 * description="Retrieves all file information of documents from a category for a patient",
5713 * tags={"standard"},
5717 * description="The pid for the patient.",
5726 * description="The category of the documents.",
5734 * ref="#/components/responses/standard"
5738 * ref="#/components/responses/badrequest"
5742 * ref="#/components/responses/unauthorized"
5744 * security={{"openemr_auth":{}}}
5747 "GET /api/patient/:pid/document" => function ($pid) {
5748 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5749 RestConfig
::apiLog($return);
5755 * path="/api/patient/{pid}/document/{did}",
5756 * description="Retrieves a document for a patient",
5757 * tags={"standard"},
5761 * description="The pid for the patient.",
5770 * description="The id for the patient document.",
5778 * ref="#/components/responses/standard"
5782 * ref="#/components/responses/badrequest"
5786 * ref="#/components/responses/unauthorized"
5788 * security={{"openemr_auth":{}}}
5791 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5792 $return = (new DocumentRestController())->downloadFile($pid, $did);
5793 RestConfig
::apiLog($return);
5799 * path="/api/patient/{pid}/insurance",
5800 * description="Retrieves all insurances for a patient",
5801 * tags={"standard"},
5805 * description="The pid for the patient.",
5813 * ref="#/components/responses/standard"
5817 * ref="#/components/responses/badrequest"
5821 * ref="#/components/responses/unauthorized"
5823 * security={{"openemr_auth":{}}}
5826 "GET /api/patient/:pid/insurance" => function ($pid) {
5827 $return = (new InsuranceRestController())->getAll($pid);
5828 RestConfig
::apiLog($return);
5834 * path="/api/patient/{pid}/insurance/{type}",
5835 * description="Retrieves a insurance (by type) for a patient",
5836 * tags={"standard"},
5840 * description="The pid for the patient.",
5849 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5857 * ref="#/components/responses/standard"
5861 * ref="#/components/responses/badrequest"
5865 * ref="#/components/responses/unauthorized"
5867 * security={{"openemr_auth":{}}}
5870 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5871 $return = (new InsuranceRestController())->getOne($pid, $type);
5872 RestConfig
::apiLog($return);
5877 * Schema for the insurance request
5880 * schema="api_insurance_request",
5882 * property="provider",
5883 * description="The insurance company id.",
5887 * property="plan_name",
5888 * description="The plan name of insurance.",
5892 * property="policy_number",
5893 * description="The policy number of insurance.",
5897 * property="group_number",
5898 * description="The group number of insurance.",
5902 * property="subscriber_lname",
5903 * description="The subscriber last name of insurance.",
5907 * property="subscriber_mname",
5908 * description="The subscriber middle name of insurance.",
5912 * property="subscriber_fname",
5913 * description="The subscriber first name of insurance.",
5917 * property="subscriber_relationship",
5918 * description="The subscriber relationship of insurance.",
5922 * property="subscriber_ss",
5923 * description="The subscriber ss number of insurance.",
5927 * property="subscriber_DOB",
5928 * description="The subscriber DOB of insurance.",
5932 * property="subscriber_street",
5933 * description="The subscriber street address of insurance.",
5937 * property="subscriber_postal_code",
5938 * description="The subscriber postal code of insurance.",
5942 * property="subscriber_city",
5943 * description="The subscriber city of insurance.",
5947 * property="subscriber_state",
5948 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5952 * property="subscriber_country",
5953 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5957 * property="subscriber_phone",
5958 * description="The subscriber phone of insurance.",
5962 * property="subscriber_employer",
5963 * description="The subscriber employer of insurance.",
5967 * property="subscriber_employer_street",
5968 * description="The subscriber employer street of insurance.",
5972 * property="subscriber_employer_postal_code",
5973 * description="The subscriber employer postal code of insurance.",
5977 * property="subscriber_employer_state",
5978 * description="The subscriber employer state of insurance.",
5982 * property="subscriber_employer_country",
5983 * description="The subscriber employer country of insurance.",
5987 * property="subscriber_employer_city",
5988 * description="The subscriber employer city of insurance.",
5993 * description="The copay of insurance.",
5998 * description="The date of insurance.",
6002 * property="subscriber_sex",
6003 * description="The subscriber sex of insurance.",
6007 * property="accept_assignment",
6008 * description="The accept_assignment of insurance.",
6012 * property="policy_type",
6013 * description="The policy_type of insurance.",
6016 * 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"},
6019 * "plan_name": "Some Plan",
6020 * "policy_number": "12345",
6021 * "group_number": "252412",
6022 * "subscriber_lname": "Tester",
6023 * "subscriber_mname": "Xi",
6024 * "subscriber_fname": "Foo",
6025 * "subscriber_relationship": "other",
6026 * "subscriber_ss": "234231234",
6027 * "subscriber_DOB": "2018-10-03",
6028 * "subscriber_street": "183 Cool St",
6029 * "subscriber_postal_code": "23418",
6030 * "subscriber_city": "Cooltown",
6031 * "subscriber_state": "AZ",
6032 * "subscriber_country": "USA",
6033 * "subscriber_phone": "234-598-2123",
6034 * "subscriber_employer": "Some Employer",
6035 * "subscriber_employer_street": "123 Heather Lane",
6036 * "subscriber_employer_postal_code": "23415",
6037 * "subscriber_employer_state": "AZ",
6038 * "subscriber_employer_country": "USA",
6039 * "subscriber_employer_city": "Cooltown",
6041 * "date": "2018-10-15",
6042 * "subscriber_sex": "Female",
6043 * "accept_assignment": "TRUE",
6044 * "policy_type": "a"
6050 * path="/api/patient/{pid}/insurance/{type}",
6051 * description="Submits a new patient insurance (with type)",
6052 * tags={"standard"},
6056 * description="The pid for the patient.",
6065 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6074 * mediaType="application/json",
6075 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6080 * ref="#/components/responses/standard"
6084 * ref="#/components/responses/badrequest"
6088 * ref="#/components/responses/unauthorized"
6090 * security={{"openemr_auth":{}}}
6093 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6094 $data = (array) (json_decode(file_get_contents("php://input")));
6095 $return = (new InsuranceRestController())->post($pid, $type, $data);
6096 RestConfig
::apiLog($return, $data);
6102 * path="/api/patient/{pid}/insurance/{type}",
6103 * description="Edit a patient insurance (by type)",
6104 * tags={"standard"},
6108 * description="The pid for the patient.",
6117 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6126 * mediaType="application/json",
6127 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6132 * ref="#/components/responses/standard"
6136 * ref="#/components/responses/badrequest"
6140 * ref="#/components/responses/unauthorized"
6142 * security={{"openemr_auth":{}}}
6145 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6146 $data = (array) (json_decode(file_get_contents("php://input")));
6147 $return = (new InsuranceRestController())->put($pid, $type, $data);
6148 RestConfig
::apiLog($return, $data);
6153 * Schema for the message request
6156 * schema="api_message_request",
6159 * description="The body of message.",
6163 * property="groupname",
6164 * description="The group name (usually is 'Default').",
6169 * description="The sender of the message.",
6174 * description="The recipient of the message.",
6179 * description="use an option from resource=/api/list/note_type",
6183 * property="message_status",
6184 * description="use an option from resource=/api/list/message_status",
6187 * required={"body", "groupname", "from", "to", "title", "message_status"},
6189 * "body": "Test 456",
6190 * "groupname": "Default",
6191 * "from": "Matthew",
6194 * "message_status": "New"
6200 * path="/api/patient/{pid}/message",
6201 * description="Submits a pnote message",
6202 * tags={"standard"},
6206 * description="The id for the patient.",
6215 * mediaType="application/json",
6216 * @OA\Schema(ref="#/components/schemas/api_message_request")
6221 * ref="#/components/responses/standard"
6225 * ref="#/components/responses/badrequest"
6229 * ref="#/components/responses/unauthorized"
6231 * security={{"openemr_auth":{}}}
6234 "POST /api/patient/:pid/message" => function ($pid) {
6235 RestConfig
::authorization_check("patients", "notes");
6236 $data = (array) (json_decode(file_get_contents("php://input")));
6237 $return = (new MessageRestController())->post($pid, $data);
6238 RestConfig
::apiLog($return, $data);
6244 * path="/api/patient/{pid}/transaction",
6245 * description="Get Transactions for a patient",
6246 * tags={"standard"},
6250 * description="The pid for the patient",
6258 * ref="#/components/responses/standard"
6262 * ref="#/components/responses/badrequest"
6266 * ref="#/components/responses/unauthorized"
6268 * security={{"openemr_auth":{}}}
6272 "GET /api/patient/:pid/transaction" => function ($pid) {
6273 RestConfig
::authorization_check("patients", "trans");
6274 $cont = new TransactionRestController();
6275 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6276 RestConfig
::apiLog($return);
6281 * Schema for the transaction request
6284 * schema="api_transaction_request",
6286 * property="message",
6287 * description="The message of the transaction.",
6292 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6296 * property="groupname",
6297 * description="The group name (usually is 'Default').",
6301 * property="referByNpi",
6302 * description="NPI of the person creating the referral.",
6306 * property="referToNpi",
6307 * description="NPI of the person getting the referral.",
6311 * property="referDiagnosis",
6312 * description="The referral diagnosis.",
6316 * property="riskLevel",
6317 * description="The risk level. (Low, Medium, High)",
6321 * property="includeVitals",
6322 * description="Are vitals included (0,1)",
6326 * property="referralDate",
6327 * description="The date of the referral",
6331 * property="authorization",
6332 * description="The authorization for the referral",
6336 * property="visits",
6337 * description="The number of vists for the referral",
6341 * property="validFrom",
6342 * description="The date the referral is valid from",
6346 * property="validThrough",
6347 * description="The date the referral is valid through",
6350 * required={"message", "groupname", "title"},
6352 * "message": "Message",
6354 * "groupname": "Default",
6355 * "referByNpi":"9999999999",
6356 * "referToNpi":"9999999999",
6357 * "referDiagnosis":"Diag 1",
6358 * "riskLevel":"Low",
6359 * "includeVitals":"1",
6360 * "referralDate":"2022-01-01",
6361 * "authorization":"Auth_123",
6363 * "validFrom": "2022-01-02",
6364 * "validThrough": "2022-01-03",
6365 * "body": "Reason 1"
6371 * path="/api/patient/{pid}/transaction",
6372 * description="Submits a transaction",
6373 * tags={"standard"},
6377 * description="The pid for the patient.",
6386 * mediaType="application/json",
6387 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6392 * ref="#/components/responses/standard"
6396 * ref="#/components/responses/badrequest"
6400 * ref="#/components/responses/unauthorized"
6402 * security={{"openemr_auth":{}}}
6405 "POST /api/patient/:pid/transaction" => function ($pid) {
6406 RestConfig
::authorization_check("patients", "trans");
6407 $data = (array) (json_decode(file_get_contents("php://input")));
6408 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6409 RestConfig
::apiLog($return, $data);
6415 * path="/api/transaction/{tid}",
6416 * description="Updates a transaction",
6417 * tags={"standard"},
6421 * description="The id for the transaction.",
6430 * mediaType="application/json",
6431 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6436 * ref="#/components/responses/standard"
6440 * ref="#/components/responses/badrequest"
6444 * ref="#/components/responses/unauthorized"
6446 * security={{"openemr_auth":{}}}
6449 "PUT /api/transaction/:tid" => function ($tid) {
6450 RestConfig
::authorization_check("patients", "trans");
6451 $data = (array) (json_decode(file_get_contents("php://input")));
6452 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6453 RestConfig
::apiLog($return, $data);
6459 * path="/api/patient/{pid}/message/{mid}",
6460 * description="Edit a pnote message",
6461 * tags={"standard"},
6465 * description="The id for the patient.",
6474 * description="The id for the pnote message.",
6483 * mediaType="application/json",
6484 * @OA\Schema(ref="#/components/schemas/api_message_request")
6489 * ref="#/components/responses/standard"
6493 * ref="#/components/responses/badrequest"
6497 * ref="#/components/responses/unauthorized"
6499 * security={{"openemr_auth":{}}}
6502 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6503 RestConfig
::authorization_check("patients", "notes");
6504 $data = (array) (json_decode(file_get_contents("php://input")));
6505 $return = (new MessageRestController())->put($pid, $mid, $data);
6506 RestConfig
::apiLog($return, $data);
6512 * path="/api/patient/{pid}/message/{mid}",
6513 * description="Delete a pnote message",
6514 * tags={"standard"},
6518 * description="The id for the patient.",
6527 * description="The id for the pnote message.",
6535 * ref="#/components/responses/standard"
6539 * ref="#/components/responses/badrequest"
6543 * ref="#/components/responses/unauthorized"
6545 * security={{"openemr_auth":{}}}
6548 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6549 RestConfig
::authorization_check("patients", "notes");
6550 $return = (new MessageRestController())->delete($pid, $mid);
6551 RestConfig
::apiLog($return);
6557 * path="/api/immunization",
6558 * description="Retrieves a list of immunizations",
6559 * tags={"standard"},
6561 * name="patient_id",
6563 * description="The pid for the patient.",
6572 * description="The id for the immunization.",
6581 * description="The uuid for the immunization.",
6588 * name="administered_date",
6590 * description="The administered date for the immunization.",
6597 * name="immunization_id",
6599 * description="The immunization list_id for the immunization.",
6608 * description="The cvx code for the immunization.",
6615 * name="manufacturer",
6617 * description="The manufacturer for the immunization.",
6624 * name="lot_number",
6626 * description="The lot number for the immunization.",
6633 * name="administered_by_id",
6635 * description="The administered by id for the immunization.",
6642 * name="administered_by",
6644 * description="The administered by for the immunization.",
6651 * name="education_date",
6653 * description="The education date for the immunization.",
6662 * description="The vis date for the immunization.",
6671 * description="The note for the immunization.",
6678 * name="create_date",
6680 * description="The create date for the immunization.",
6687 * name="update_date",
6689 * description="The update date for the immunization.",
6696 * name="created_by",
6698 * description="The created_by for the immunization.",
6705 * name="updated_by",
6707 * description="The updated_by for the immunization.",
6714 * name="amount_administered",
6716 * description="The amount administered for the immunization.",
6723 * name="amount_administered_unit",
6725 * description="The amount administered unit for the immunization.",
6732 * name="expiration_date",
6734 * description="The expiration date for the immunization.",
6743 * description="The route for the immunization.",
6750 * name="administration_site",
6752 * description="The administration site for the immunization.",
6759 * name="added_erroneously",
6761 * description="The added_erroneously for the immunization.",
6768 * name="external_id",
6770 * description="The external_id for the immunization.",
6777 * name="completion_status",
6779 * description="The completion status for the immunization.",
6786 * name="information_source",
6788 * description="The information source for the immunization.",
6795 * name="refusal_reason",
6797 * description="The refusal reason for the immunization.",
6804 * name="ordering_provider",
6806 * description="The ordering provider for the immunization.",
6814 * ref="#/components/responses/standard"
6818 * ref="#/components/responses/badrequest"
6822 * ref="#/components/responses/unauthorized"
6824 * security={{"openemr_auth":{}}}
6827 "GET /api/immunization" => function () {
6828 RestConfig
::authorization_check("patients", "med");
6829 $return = (new ImmunizationRestController())->getAll($_GET);
6830 RestConfig
::apiLog($return);
6836 * path="/api/immunization/{uuid}",
6837 * description="Retrieves a immunization",
6838 * tags={"standard"},
6842 * description="The uuid for the immunization.",
6850 * ref="#/components/responses/standard"
6854 * ref="#/components/responses/badrequest"
6858 * ref="#/components/responses/unauthorized"
6860 * security={{"openemr_auth":{}}}
6863 "GET /api/immunization/:uuid" => function ($uuid) {
6864 RestConfig
::authorization_check("patients", "med");
6865 $return = (new ImmunizationRestController())->getOne($uuid);
6866 RestConfig
::apiLog($return);
6872 * path="/api/procedure",
6873 * description="Retrieves a list of all procedures",
6874 * tags={"standard"},
6877 * ref="#/components/responses/standard"
6881 * ref="#/components/responses/badrequest"
6885 * ref="#/components/responses/unauthorized"
6887 * security={{"openemr_auth":{}}}
6890 "GET /api/procedure" => function () {
6891 RestConfig
::authorization_check("patients", "med");
6892 $return = (new ProcedureRestController())->getAll();
6893 RestConfig
::apiLog($return);
6899 * path="/api/procedure/{uuid}",
6900 * description="Retrieves a procedure",
6901 * tags={"standard"},
6905 * description="The uuid for the procedure.",
6913 * ref="#/components/responses/standard"
6917 * ref="#/components/responses/badrequest"
6921 * ref="#/components/responses/unauthorized"
6923 * security={{"openemr_auth":{}}}
6926 "GET /api/procedure/:uuid" => function ($uuid) {
6927 RestConfig
::authorization_check("patients", "med");
6928 $return = (new ProcedureRestController())->getOne($uuid);
6929 RestConfig
::apiLog($return);
6936 * description="Retrieves a list of all drugs",
6937 * tags={"standard"},
6940 * ref="#/components/responses/standard"
6944 * ref="#/components/responses/badrequest"
6948 * ref="#/components/responses/unauthorized"
6950 * security={{"openemr_auth":{}}}
6953 "GET /api/drug" => function () {
6954 RestConfig
::authorization_check("patients", "med");
6955 $return = (new DrugRestController())->getAll();
6956 RestConfig
::apiLog($return);
6962 * path="/api/drug/{uuid}",
6963 * description="Retrieves a drug",
6964 * tags={"standard"},
6968 * description="The uuid for the drug.",
6976 * ref="#/components/responses/standard"
6980 * ref="#/components/responses/badrequest"
6984 * ref="#/components/responses/unauthorized"
6986 * security={{"openemr_auth":{}}}
6989 "GET /api/drug/:uuid" => function ($uuid) {
6990 RestConfig
::authorization_check("patients", "med");
6991 $return = (new DrugRestController())->getOne($uuid);
6992 RestConfig
::apiLog($return);
6998 * path="/api/prescription",
6999 * description="Retrieves a list of all prescriptions",
7000 * tags={"standard"},
7003 * ref="#/components/responses/standard"
7007 * ref="#/components/responses/badrequest"
7011 * ref="#/components/responses/unauthorized"
7013 * security={{"openemr_auth":{}}}
7016 "GET /api/prescription" => function () {
7017 RestConfig
::authorization_check("patients", "med");
7018 $return = (new PrescriptionRestController())->getAll();
7019 RestConfig
::apiLog($return);
7025 * path="/api/prescription/{uuid}",
7026 * description="Retrieves a prescription",
7027 * tags={"standard"},
7031 * description="The uuid for the prescription.",
7039 * ref="#/components/responses/standard"
7043 * ref="#/components/responses/badrequest"
7047 * ref="#/components/responses/unauthorized"
7049 * security={{"openemr_auth":{}}}
7052 "GET /api/prescription/:uuid" => function ($uuid) {
7053 RestConfig
::authorization_check("patients", "med");
7054 $return = (new PrescriptionRestController())->getOne($uuid);
7055 RestConfig
::apiLog($return);
7060 use OpenEMR\Common\Http\StatusCode
;
7061 use OpenEMR\Common\Http\Psr17Factory
;
7062 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController
;
7063 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController
;
7064 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController
;
7065 use OpenEMR\RestControllers\FHIR\FhirConditionRestController
;
7066 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController
;
7067 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController
;
7068 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController
;
7069 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController
;
7070 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController
;
7071 use OpenEMR\RestControllers\FHIR\FhirExportRestController
;
7072 use OpenEMR\RestControllers\FHIR\FhirObservationRestController
;
7073 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController
;
7074 use OpenEMR\RestControllers\FHIR\FhirGoalRestController
;
7075 use OpenEMR\RestControllers\FHIR\FhirGroupRestController
;
7076 use OpenEMR\RestControllers\FHIR\FhirLocationRestController
;
7077 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController
;
7078 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController
;
7079 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController
;
7080 use OpenEMR\RestControllers\FHIR\FhirPatientRestController
;
7081 use OpenEMR\RestControllers\FHIR\FhirPersonRestController
;
7082 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController
;
7083 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController
;
7084 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController
;
7085 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController
;
7086 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController
;
7088 // Note that the fhir route includes both user role and patient role
7089 // (there is a mechanism in place to ensure patient role is binded
7090 // to only see the data of the one patient)
7091 RestConfig
::$FHIR_ROUTE_MAP = array(
7094 * path="/fhir/AllergyIntolerance",
7095 * description="Returns a list of AllergyIntolerance resources.",
7100 * description="The uuid for the AllergyIntolerance resource.",
7109 * description="The uuid for the patient.",
7117 * description="Standard Response",
7119 * mediaType="application/json",
7122 * property="json object",
7123 * description="FHIR Json object.",
7128 * "lastUpdated": "2021-09-14T09:13:51"
7130 * "resourceType": "Bundle",
7131 * "type": "collection",
7135 * "relation": "self",
7136 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7145 * ref="#/components/responses/badrequest"
7149 * ref="#/components/responses/unauthorized"
7151 * security={{"openemr_auth":{}}}
7154 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest
$request) {
7155 $getParams = $request->getQueryParams();
7156 if ($request->isPatientRequest()) {
7157 // only allow access to data of binded patient
7158 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7160 RestConfig
::authorization_check("patients", "med");
7161 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7163 RestConfig
::apiLog($return);
7169 * path="/fhir/AllergyIntolerance/{uuid}",
7170 * description="Returns a single AllergyIntolerance resource.",
7175 * description="The uuid for the AllergyIntolerance resource.",
7183 * description="Standard Response",
7185 * mediaType="application/json",
7188 * property="json object",
7189 * description="FHIR Json object.",
7193 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7196 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7198 * "resourceType": "AllergyIntolerance",
7200 * "status": "additional",
7201 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7203 * "clinicalStatus": {
7206 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7208 * "display": "Active"
7212 * "verificationStatus": {
7215 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7216 * "code": "confirmed",
7217 * "display": "Confirmed"
7224 * "criticality": "low",
7228 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7229 * "code": "unknown",
7230 * "display": "Unknown"
7235 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7239 * "manifestation": {
7243 * "system": "http://snomed.info/sct",
7244 * "code": "422587007",
7245 * "display": "Nausea"
7259 * ref="#/components/responses/badrequest"
7263 * ref="#/components/responses/unauthorized"
7267 * ref="#/components/responses/uuidnotfound"
7269 * security={{"openemr_auth":{}}}
7272 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest
$request) {
7273 if ($request->isPatientRequest()) {
7274 // only allow access to data of binded patient
7275 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7277 RestConfig
::authorization_check("patients", "med");
7278 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7280 RestConfig
::apiLog($return);
7286 * path="/fhir/CarePlan",
7287 * description="Returns a list of CarePlan resources.",
7292 * description="The uuid for the CarePlan resource.",
7301 * description="The uuid for the patient.",
7310 * description="The category of the CarePlan resource.",
7318 * description="Standard Response",
7320 * mediaType="application/json",
7323 * property="json object",
7324 * description="FHIR Json object.",
7329 * "lastUpdated": "2021-09-14T09:13:51"
7331 * "resourceType": "Bundle",
7332 * "type": "collection",
7336 * "relation": "self",
7337 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7346 * ref="#/components/responses/badrequest"
7350 * ref="#/components/responses/unauthorized"
7352 * security={{"openemr_auth":{}}}
7355 "GET /fhir/CarePlan" => function (HttpRestRequest
$request) {
7356 $getParams = $request->getQueryParams();
7357 if ($request->isPatientRequest()) {
7358 // only allow access to data of binded patient
7359 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7361 RestConfig
::authorization_check("patients", "med");
7362 $return = (new FhirCarePlanRestController())->getAll($getParams);
7364 RestConfig
::apiLog($return);
7370 * path="/fhir/CarePlan/{uuid}",
7371 * description="Returns a single CarePlan resource.",
7376 * description="The uuid for the CarePlan resource.",
7384 * description="Standard Response",
7386 * mediaType="application/json",
7389 * property="json object",
7390 * description="FHIR Json object.",
7394 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7397 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7399 * "resourceType": "CarePlan",
7401 * "status": "generated",
7402 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7404 * "status": "active",
7410 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7411 * "code": "assess-plan"
7416 * "description": "Treat flu.",
7418 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7427 * ref="#/components/responses/badrequest"
7431 * ref="#/components/responses/unauthorized"
7435 * ref="#/components/responses/uuidnotfound"
7437 * security={{"openemr_auth":{}}}
7440 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest
$request) {
7441 if ($request->isPatientRequest()) {
7442 // only allow access to data of binded patient
7443 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7445 RestConfig
::authorization_check("patients", "med");
7446 $return = (new FhirCarePlanRestController())->getOne($uuid);
7448 RestConfig
::apiLog($return);
7454 * path="/fhir/CareTeam",
7455 * description="Returns a list of CareTeam resources.",
7460 * description="The uuid for the CareTeam resource.",
7469 * description="The uuid for the patient.",
7478 * description="The status of the CarePlan resource.",
7486 * description="Standard Response",
7488 * mediaType="application/json",
7491 * property="json object",
7492 * description="FHIR Json object.",
7497 * "lastUpdated": "2021-09-14T09:13:51"
7499 * "resourceType": "Bundle",
7500 * "type": "collection",
7504 * "relation": "self",
7505 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7514 * ref="#/components/responses/badrequest"
7518 * ref="#/components/responses/unauthorized"
7520 * security={{"openemr_auth":{}}}
7523 "GET /fhir/CareTeam" => function (HttpRestRequest
$request) {
7524 $getParams = $request->getQueryParams();
7525 if ($request->isPatientRequest()) {
7526 // only allow access to data of binded patient
7527 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7529 RestConfig
::authorization_check("patients", "med");
7530 $return = (new FhirCareTeamRestController())->getAll($getParams);
7532 RestConfig
::apiLog($return);
7538 * path="/fhir/CareTeam/{uuid}",
7539 * description="Returns a single CareTeam resource.",
7544 * description="The uuid for the CareTeam resource.",
7552 * description="Standard Response",
7554 * mediaType="application/json",
7557 * property="json object",
7558 * description="FHIR Json object.",
7562 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7565 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7567 * "resourceType": "CareTeam",
7568 * "status": "active",
7570 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7579 * "system": "http://nucc.org/provider-taxonomy",
7580 * "code": "102L00000X",
7581 * "display": "Psychoanalyst"
7587 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7588 * "type": "Practitioner"
7591 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7592 * "type": "Organization"
7600 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7601 * "code": "unknown",
7602 * "display": "Unknown"
7608 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7609 * "type": "Organization"
7619 * ref="#/components/responses/badrequest"
7623 * ref="#/components/responses/unauthorized"
7627 * ref="#/components/responses/uuidnotfound"
7629 * security={{"openemr_auth":{}}}
7632 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest
$request) {
7633 if ($request->isPatientRequest()) {
7634 // only allow access to data of binded patient
7635 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7637 RestConfig
::authorization_check("patients", "med");
7638 $return = (new FhirCareTeamRestController())->getOne($uuid);
7640 RestConfig
::apiLog($return);
7646 * path="/fhir/Condition",
7647 * description="Returns a list of Condition resources.",
7652 * description="The uuid for the Condition resource.",
7661 * description="The uuid for the patient.",
7669 * description="Standard Response",
7671 * mediaType="application/json",
7674 * property="json object",
7675 * description="FHIR Json object.",
7680 * "lastUpdated": "2021-09-14T09:13:51"
7682 * "resourceType": "Bundle",
7683 * "type": "collection",
7687 * "relation": "self",
7688 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7697 * ref="#/components/responses/badrequest"
7701 * ref="#/components/responses/unauthorized"
7703 * security={{"openemr_auth":{}}}
7706 "GET /fhir/Condition" => function (HttpRestRequest
$request) {
7707 $getParams = $request->getQueryParams();
7708 if ($request->isPatientRequest()) {
7709 // only allow access to data of binded patient
7710 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7712 RestConfig
::authorization_check("patients", "med");
7713 $return = (new FhirConditionRestController())->getAll($getParams);
7715 RestConfig
::apiLog($return);
7721 * path="/fhir/Condition/{uuid}",
7722 * description="Returns a single Condition resource.",
7727 * description="The uuid for the Condition resource.",
7735 * description="Standard Response",
7737 * mediaType="application/json",
7740 * property="json object",
7741 * description="FHIR Json object.",
7745 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7748 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7750 * "resourceType": "Condition",
7751 * "clinicalStatus": {
7754 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7755 * "code": "inactive",
7756 * "display": "Inactive"
7760 * "verificationStatus": {
7763 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7764 * "code": "unconfirmed",
7765 * "display": "Unconfirmed"
7773 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7774 * "code": "problem-list-item",
7775 * "display": "Problem List Item"
7783 * "system": "http://snomed.info/sct",
7784 * "code": "444814009",
7790 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7798 * ref="#/components/responses/badrequest"
7802 * ref="#/components/responses/unauthorized"
7806 * ref="#/components/responses/uuidnotfound"
7808 * security={{"openemr_auth":{}}}
7811 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest
$request) {
7812 if ($request->isPatientRequest()) {
7813 // only allow access to data of binded patient
7814 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7816 RestConfig
::authorization_check("patients", "med");
7817 $return = (new FhirConditionRestController())->getOne($uuid);
7819 RestConfig
::apiLog($return);
7825 * path="/fhir/Coverage",
7826 * description="Returns a list of Coverage resources.",
7831 * description="The uuid for the Coverage resource.",
7840 * description="The uuid for the patient.",
7849 * description="The payor of the Coverage resource.",
7857 * description="Standard Response",
7859 * mediaType="application/json",
7862 * property="json object",
7863 * description="FHIR Json object.",
7868 * "lastUpdated": "2021-09-14T09:13:51"
7870 * "resourceType": "Bundle",
7871 * "type": "collection",
7875 * "relation": "self",
7876 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7885 * ref="#/components/responses/badrequest"
7889 * ref="#/components/responses/unauthorized"
7891 * security={{"openemr_auth":{}}}
7894 "GET /fhir/Coverage" => function (HttpRestRequest
$request) {
7895 if ($request->isPatientRequest()) {
7896 // only allow access to data of binded patient
7897 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7899 RestConfig
::authorization_check("admin", "super");
7900 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7902 RestConfig
::apiLog($return);
7908 * path="/fhir/Coverage/{uuid}",
7909 * description="Returns a single Coverage resource.",
7914 * description="The uuid for the Coverage resource.",
7922 * description="Standard Response",
7924 * mediaType="application/json",
7927 * property="json object",
7928 * description="FHIR Json object.",
7932 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
7935 * "lastUpdated": "2022-04-14T07:58:45+00:00"
7937 * "resourceType": "Coverage",
7938 * "status": "active",
7940 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
7945 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
7956 * ref="#/components/responses/badrequest"
7960 * ref="#/components/responses/unauthorized"
7964 * ref="#/components/responses/uuidnotfound"
7966 * security={{"openemr_auth":{}}}
7969 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest
$request) {
7970 if ($request->isPatientRequest()) {
7971 // only allow access to data of binded patient
7972 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
7974 RestConfig
::authorization_check("admin", "super");
7975 $return = (new FhirCoverageRestController())->getOne($uuid);
7977 RestConfig
::apiLog($return);
7983 * path="/fhir/Device",
7984 * description="Returns a list of Device resources.",
7989 * description="The uuid for the Device resource.",
7998 * description="The uuid for the patient.",
8006 * description="Standard Response",
8008 * mediaType="application/json",
8011 * property="json object",
8012 * description="FHIR Json object.",
8017 * "lastUpdated": "2021-09-14T09:13:51"
8019 * "resourceType": "Bundle",
8020 * "type": "collection",
8024 * "relation": "self",
8025 * "url": "https://localhost:9300/apis/default/fhir/Device"
8034 * ref="#/components/responses/badrequest"
8038 * ref="#/components/responses/unauthorized"
8040 * security={{"openemr_auth":{}}}
8043 "GET /fhir/Device" => function (HttpRestRequest
$request) {
8044 if ($request->isPatientRequest()) {
8045 // only allow access to data of binded patient
8046 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8048 RestConfig
::authorization_check("admin", "super");
8049 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8051 RestConfig
::apiLog($return);
8057 * path="/fhir/Device/{uuid}",
8058 * description="Returns a single Device resource.",
8063 * description="The uuid for the Device resource.",
8071 * description="Standard Response",
8073 * mediaType="application/json",
8076 * property="json object",
8077 * description="FHIR Json object.",
8081 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8084 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8086 * "resourceType": "Device",
8089 * "deviceIdentifier": "08717648200274",
8090 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8093 * "distinctIdentifier": "A99971312345600",
8094 * "manufactureDate": "2013-02-01",
8095 * "expirationDate": "2014-02-01",
8096 * "lotNumber": "000000000000XYZ123",
8097 * "serialNumber": "000025",
8101 * "valueCode": "unknown",
8102 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8107 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8116 * ref="#/components/responses/badrequest"
8120 * ref="#/components/responses/unauthorized"
8124 * ref="#/components/responses/uuidnotfound"
8126 * security={{"openemr_auth":{}}}
8129 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest
$request) {
8130 if ($request->isPatientRequest()) {
8131 // only allow access to data of binded patient
8132 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8134 RestConfig
::authorization_check("admin", "super");
8135 $return = (new FhirDeviceRestController())->getOne($uuid);
8137 RestConfig
::apiLog($return);
8143 * path="/fhir/DiagnosticReport",
8144 * description="Returns a list of DiagnosticReport resources.",
8149 * description="The uuid for the DiagnosticReport resource.",
8158 * description="The uuid for the patient.",
8167 * description="The code of the DiagnosticReport resource.",
8176 * description="The category of the DiagnosticReport resource.",
8185 * description="The datetime of the DiagnosticReport resource.",
8193 * description="Standard Response",
8195 * mediaType="application/json",
8198 * property="json object",
8199 * description="FHIR Json object.",
8204 * "lastUpdated": "2021-09-14T09:13:51"
8206 * "resourceType": "Bundle",
8207 * "type": "collection",
8211 * "relation": "self",
8212 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8221 * ref="#/components/responses/badrequest"
8225 * ref="#/components/responses/unauthorized"
8227 * security={{"openemr_auth":{}}}
8230 "GET /fhir/DiagnosticReport" => function (HttpRestRequest
$request) {
8231 $getParams = $request->getQueryParams();
8232 if ($request->isPatientRequest()) {
8233 // only allow access to data of binded patient
8234 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8236 RestConfig
::authorization_check("admin", "super");
8237 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8239 RestConfig
::apiLog($return);
8245 * path="/fhir/DiagnosticReport/{uuid}",
8246 * description="Returns a single DiagnosticReport resource.",
8251 * description="The uuid for the DiagnosticReport resource.",
8259 * description="Standard Response",
8261 * mediaType="application/json",
8264 * property="json object",
8265 * description="FHIR Json object.",
8269 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8272 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8274 * "resourceType": "DiagnosticReport",
8275 * "status": "final",
8280 * "system": "http://loinc.org",
8281 * "code": "LP7839-6",
8282 * "display": "Pathology"
8290 * "system": "http://loinc.org",
8291 * "code": "11502-2",
8292 * "display": "Laboratory report"
8297 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8301 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8302 * "type": "Encounter"
8304 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8305 * "issued": "2015-06-22T00:00:00+00:00",
8308 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8309 * "type": "Organization"
8312 * "presentedForm": {
8314 * "contentType": "text/plain",
8315 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8324 * ref="#/components/responses/badrequest"
8328 * ref="#/components/responses/unauthorized"
8332 * ref="#/components/responses/uuidnotfound"
8334 * security={{"openemr_auth":{}}}
8337 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest
$request) {
8338 $getParams = $request->getQueryParams();
8339 if ($request->isPatientRequest()) {
8340 // only allow access to data of binded patient
8341 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8343 RestConfig
::authorization_check("admin", "super");
8344 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8346 RestConfig
::apiLog($return);
8352 * path="/fhir/DocumentReference",
8353 * description="Returns a list of DocumentReference resources.",
8358 * description="The uuid for the DocumentReference resource.",
8367 * description="The uuid for the patient.",
8376 * description="The type of the DocumentReference resource.",
8385 * description="The category of the DocumentReference resource.",
8394 * description="The datetime of the DocumentReference resource.",
8402 * description="Standard Response",
8404 * mediaType="application/json",
8407 * property="json object",
8408 * description="FHIR Json object.",
8413 * "lastUpdated": "2021-09-14T09:13:51"
8415 * "resourceType": "Bundle",
8416 * "type": "collection",
8420 * "relation": "self",
8421 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8430 * ref="#/components/responses/badrequest"
8434 * ref="#/components/responses/unauthorized"
8436 * security={{"openemr_auth":{}}}
8439 'GET /fhir/DocumentReference' => function (HttpRestRequest
$request) {
8440 $getParams = $request->getQueryParams();
8441 if ($request->isPatientRequest()) {
8442 // only allow access to data of binded patient
8443 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8445 RestConfig
::authorization_check("admin", "super");
8446 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8448 RestConfig
::apiLog($return);
8454 * path="/fhir/DocumentReference/{uuid}",
8455 * description="Returns a single DocumentReference resource.",
8460 * description="The uuid for the DocumentReference resource.",
8468 * description="Standard Response",
8470 * mediaType="application/json",
8473 * property="json object",
8474 * description="FHIR Json object.",
8478 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8481 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8483 * "resourceType": "DocumentReference",
8486 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8489 * "status": "current",
8493 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8495 * "display": "unknown"
8503 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8504 * "code": "openemr-document",
8505 * "display": "OpenEMR Document"
8511 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8514 * "date": "2021-09-19T03:15:56+00:00",
8521 * "contentType": "image/gif",
8522 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8525 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8526 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8527 * "display": "mimeType Sufficient"
8537 * ref="#/components/responses/badrequest"
8541 * ref="#/components/responses/unauthorized"
8545 * ref="#/components/responses/uuidnotfound"
8547 * security={{"openemr_auth":{}}}
8550 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest
$request) {
8551 $getParams = $request->getQueryParams();
8552 if ($request->isPatientRequest()) {
8553 // only allow access to data of binded patient
8554 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8556 RestConfig
::authorization_check("admin", "super");
8557 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8559 RestConfig
::apiLog($return);
8565 * path="/fhir/Document/{id}/Binary",
8566 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
8571 * description="The id for the Document.",
8579 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
8583 * ref="#/components/responses/badrequest"
8587 * ref="#/components/responses/unauthorized"
8589 * security={{"openemr_auth":{}}}
8592 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest
$request) {
8593 // currently only allow users with the same permissions as export to take a file out
8594 // this could be relaxed to allow other types of files ie such as patient access etc.
8595 RestConfig
::authorization_check("admin", "users");
8597 // Grab the document id
8598 $docController = new \OpenEMR\RestControllers\FHIR\
FhirDocumentRestController($request);
8599 $response = $docController->downloadDocument($documentId, $request->getRequestUserId());
8605 * path="/fhir/Encounter",
8606 * description="Returns a list of Encounter resources.",
8611 * description="The uuid for the Encounter resource.",
8620 * description="The uuid for the patient.",
8629 * description="The datetime of the Encounter resource.",
8637 * description="Standard Response",
8639 * mediaType="application/json",
8642 * property="json object",
8643 * description="FHIR Json object.",
8648 * "lastUpdated": "2021-09-14T09:13:51"
8650 * "resourceType": "Bundle",
8651 * "type": "collection",
8655 * "relation": "self",
8656 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8665 * ref="#/components/responses/badrequest"
8669 * ref="#/components/responses/unauthorized"
8671 * security={{"openemr_auth":{}}}
8674 "GET /fhir/Encounter" => function (HttpRestRequest
$request) {
8675 $getParams = $request->getQueryParams();
8676 if ($request->isPatientRequest()) {
8677 // only allow access to data of binded patient
8678 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8680 RestConfig
::authorization_check("encounters", "auth_a");
8681 $return = (new FhirEncounterRestController())->getAll($getParams);
8683 RestConfig
::apiLog($return);
8689 * path="/fhir/Encounter/{uuid}",
8690 * description="Returns a single Encounter resource.",
8695 * description="The uuid for the Encounter resource.",
8703 * description="Standard Response",
8705 * mediaType="application/json",
8708 * property="json object",
8709 * description="FHIR Json object.",
8713 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8716 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8718 * "resourceType": "Encounter",
8721 * "system": "urn:ietf:rfc:3986",
8722 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8725 * "status": "finished",
8727 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8729 * "display": "ambulatory"
8735 * "system": "http://snomed.info/sct",
8736 * "code": "185349003",
8737 * "display": "Encounter for check up (procedure)"
8743 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8752 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8754 * "display": "Primary Performer"
8760 * "start": "2012-08-13T00:00:00+00:00"
8763 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8764 * "type": "Practitioner"
8769 * "start": "2012-08-13T00:00:00+00:00"
8777 * ref="#/components/responses/badrequest"
8781 * ref="#/components/responses/unauthorized"
8785 * ref="#/components/responses/uuidnotfound"
8787 * security={{"openemr_auth":{}}}
8790 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest
$request) {
8791 if ($request->isPatientRequest()) {
8792 // only allow access to data of binded patient
8793 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8795 RestConfig
::authorization_check("admin", "super");
8796 $return = (new FhirEncounterRestController())->getOne($uuid);
8798 RestConfig
::apiLog($return);
8804 * path="/fhir/Goal",
8805 * description="Returns a list of Condition resources.",
8810 * description="The uuid for the Goal resource.",
8819 * description="The uuid for the patient.",
8827 * description="Standard Response",
8829 * mediaType="application/json",
8832 * property="json object",
8833 * description="FHIR Json object.",
8838 * "lastUpdated": "2021-09-14T09:13:51"
8840 * "resourceType": "Bundle",
8841 * "type": "collection",
8845 * "relation": "self",
8846 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8855 * ref="#/components/responses/badrequest"
8859 * ref="#/components/responses/unauthorized"
8861 * security={{"openemr_auth":{}}}
8864 "GET /fhir/Goal" => function (HttpRestRequest
$request) {
8865 $getParams = $request->getQueryParams();
8866 if ($request->isPatientRequest()) {
8867 // only allow access to data of binded patient
8868 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8870 RestConfig
::authorization_check("admin", "super");
8871 $return = (new FhirGoalRestController())->getAll($getParams);
8873 RestConfig
::apiLog($return);
8879 * path="/fhir/Goal/{uuid}",
8880 * description="Returns a single Goal resource.",
8885 * description="The uuid for the Goal resource.",
8893 * description="Standard Response",
8895 * mediaType="application/json",
8898 * property="json object",
8899 * description="FHIR Json object.",
8903 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8906 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8908 * "resourceType": "Goal",
8909 * "lifecycleStatus": "active",
8911 * "text": "Eating more vegetables."
8914 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8922 * "valueCode": "unknown",
8923 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8927 * "detailString": "Eating more vegetables.",
8928 * "dueDate": "2021-09-09"
8937 * ref="#/components/responses/badrequest"
8941 * ref="#/components/responses/unauthorized"
8945 * ref="#/components/responses/uuidnotfound"
8947 * security={{"openemr_auth":{}}}
8950 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest
$request) {
8951 if ($request->isPatientRequest()) {
8952 // only allow access to data of binded patient
8953 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
8955 RestConfig
::authorization_check("admin", "super");
8956 $return = (new FhirGoalRestController())->getOne($uuid);
8958 RestConfig
::apiLog($return);
8964 * path="/fhir/Group",
8965 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
8970 * description="The uuid for the Group resource.",
8979 * description="The uuid for the patient.",
8987 * description="Standard Response",
8989 * mediaType="application/json",
8992 * property="json object",
8993 * description="FHIR Json object.",
8998 * "lastUpdated": "2021-09-14T09:13:51"
9000 * "resourceType": "Bundle",
9001 * "type": "collection",
9005 * "relation": "self",
9006 * "url": "https://localhost:9300/apis/default/fhir/Group"
9015 * ref="#/components/responses/badrequest"
9019 * ref="#/components/responses/unauthorized"
9021 * security={{"openemr_auth":{}}}
9024 'GET /fhir/Group' => function (HttpRestRequest
$request) {
9025 RestConfig
::authorization_check("admin", "users");
9026 $getParams = $request->getQueryParams();
9027 if ($request->isPatientRequest()) {
9028 // only allow access to data of binded patient
9029 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9031 $return = (new FhirGroupRestController())->getAll($getParams);
9033 RestConfig
::apiLog($return);
9039 * path="/fhir/Group/{uuid}",
9040 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9045 * description="The uuid for the Group resource.",
9053 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9057 * ref="#/components/responses/badrequest"
9061 * ref="#/components/responses/unauthorized"
9065 * ref="#/components/responses/uuidnotfound"
9067 * security={{"openemr_auth":{}}}
9070 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest
$request) {
9071 RestConfig
::authorization_check("admin", "users");
9072 if ($request->isPatientRequest()) {
9073 // only allow access to data of binded patient
9074 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9076 $return = (new FhirGroupRestController())->getOne($uuid);
9078 RestConfig
::apiLog($return);
9084 * path="/fhir/Group/{id}/$export",
9085 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9089 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9093 * ref="#/components/responses/badrequest"
9097 * ref="#/components/responses/unauthorized"
9099 * security={{"openemr_auth":{}}}
9102 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest
$request) {
9103 RestConfig
::authorization_check("admin", "users");
9104 $fhirExportService = new FhirExportRestController($request);
9105 $exportParams = $request->getQueryParams();
9106 $exportParams['groupId'] = $groupId;
9107 $return = $fhirExportService->processExport(
9110 $request->getHeader('Accept'),
9111 $request->getHeader('Prefer')
9113 RestConfig
::apiLog($return);
9119 * path="/fhir/Immunization",
9120 * description="Returns a list of Immunization resources.",
9125 * description="The uuid for the Immunization resource.",
9134 * description="The uuid for the patient.",
9142 * description="Standard Response",
9144 * mediaType="application/json",
9147 * property="json object",
9148 * description="FHIR Json object.",
9153 * "lastUpdated": "2021-09-14T09:13:51"
9155 * "resourceType": "Bundle",
9156 * "type": "collection",
9160 * "relation": "self",
9161 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9170 * ref="#/components/responses/badrequest"
9174 * ref="#/components/responses/unauthorized"
9176 * security={{"openemr_auth":{}}}
9179 "GET /fhir/Immunization" => function (HttpRestRequest
$request) {
9180 $getParams = $request->getQueryParams();
9181 if ($request->isPatientRequest()) {
9182 // only allow access to data of binded patient
9183 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9185 RestConfig
::authorization_check("patients", "med");
9186 $return = (new FhirImmunizationRestController())->getAll($getParams);
9188 RestConfig
::apiLog($return);
9194 * path="/fhir/Immunization/{uuid}",
9195 * description="Returns a single Immunization resource.",
9200 * description="The uuid for the Immunization resource.",
9208 * description="Standard Response",
9210 * mediaType="application/json",
9213 * property="json object",
9214 * description="FHIR Json object.",
9218 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9221 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9223 * "resourceType": "Immunization",
9224 * "status": "completed",
9228 * "system": "http://hl7.org/fhir/sid/cvx",
9230 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9235 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9237 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9238 * "recorded": "2022-03-26T05:42:26+00:00",
9239 * "primarySource": false
9246 * ref="#/components/responses/badrequest"
9250 * ref="#/components/responses/unauthorized"
9254 * ref="#/components/responses/uuidnotfound"
9256 * security={{"openemr_auth":{}}}
9259 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest
$request) {
9260 if ($request->isPatientRequest()) {
9261 // only allow access to data of binded patient
9262 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9264 RestConfig
::authorization_check("patients", "med");
9265 $return = (new FhirImmunizationRestController())->getOne($uuid);
9267 RestConfig
::apiLog($return);
9273 * path="/fhir/Location",
9274 * description="Returns a list of Location resources.",
9279 * description="The uuid for the Location resource.",
9287 * description="Standard Response",
9289 * mediaType="application/json",
9292 * property="json object",
9293 * description="FHIR Json object.",
9298 * "lastUpdated": "2021-09-14T09:13:51"
9300 * "resourceType": "Bundle",
9301 * "type": "collection",
9305 * "relation": "self",
9306 * "url": "https://localhost:9300/apis/default/fhir/Location"
9315 * ref="#/components/responses/badrequest"
9319 * ref="#/components/responses/unauthorized"
9321 * security={{"openemr_auth":{}}}
9324 "GET /fhir/Location" => function (HttpRestRequest
$request) {
9325 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9326 RestConfig
::apiLog($return);
9332 * path="/fhir/Location/{uuid}",
9333 * description="Returns a single Location resource.",
9338 * description="The uuid for the Location resource.",
9346 * description="Standard Response",
9348 * mediaType="application/json",
9351 * property="json object",
9352 * description="FHIR Json object.",
9356 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9359 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9361 * "resourceType": "Location",
9362 * "status": "active",
9363 * "name": "Your Clinic Name Here",
9366 * "system": "phone",
9367 * "value": "000-000-0000"
9371 * "value": "000-000-0000"
9380 * ref="#/components/responses/badrequest"
9384 * ref="#/components/responses/unauthorized"
9388 * ref="#/components/responses/uuidnotfound"
9390 * security={{"openemr_auth":{}}}
9393 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest
$request) {
9394 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9395 RestConfig
::apiLog($return);
9401 * path="/fhir/Medication",
9402 * description="Returns a list of Medication resources.",
9406 * description="Standard Response",
9408 * mediaType="application/json",
9411 * property="json object",
9412 * description="FHIR Json object.",
9417 * "lastUpdated": "2021-09-14T09:13:51"
9419 * "resourceType": "Bundle",
9420 * "type": "collection",
9424 * "relation": "self",
9425 * "url": "https://localhost:9300/apis/default/fhir/Medication"
9434 * ref="#/components/responses/badrequest"
9438 * ref="#/components/responses/unauthorized"
9440 * security={{"openemr_auth":{}}}
9443 "GET /fhir/Medication" => function (HttpRestRequest
$request) {
9444 RestConfig
::authorization_check("patients", "med");
9445 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9446 RestConfig
::apiLog($return);
9452 * path="/fhir/Medication/{uuid}",
9453 * description="Returns a single Medication resource.",
9458 * description="The uuid for the Medication resource.",
9466 * description="Standard Response",
9468 * mediaType="application/json",
9471 * property="json object",
9472 * description="FHIR Json object.",
9476 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
9479 * "lastUpdated": "2022-04-19T23:42:14+00:00"
9481 * "resourceType": "Medication",
9485 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9490 * "status": "active",
9492 * "lotNumber": "132",
9493 * "expirationDate": "0000-00-00"
9501 * ref="#/components/responses/badrequest"
9505 * ref="#/components/responses/unauthorized"
9509 * ref="#/components/responses/uuidnotfound"
9511 * security={{"openemr_auth":{}}}
9514 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest
$request) {
9515 if ($request->isPatientRequest()) {
9516 // only allow access to data of binded patient
9517 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
9519 RestConfig
::authorization_check("patients", "med");
9520 $return = (new FhirMedicationRestController())->getOne($uuid);
9522 RestConfig
::apiLog($return);
9528 * path="/fhir/MedicationRequest",
9529 * description="Returns a list of MedicationRequest resources.",
9534 * description="The uuid for the MedicationRequest resource.",
9543 * description="The uuid for the patient.",
9552 * description="The intent of the MedicationRequest resource.",
9561 * description="The status of the MedicationRequest resource.",
9569 * description="Standard Response",
9571 * mediaType="application/json",
9574 * property="json object",
9575 * description="FHIR Json object.",
9580 * "lastUpdated": "2021-09-14T09:13:51"
9582 * "resourceType": "Bundle",
9583 * "type": "collection",
9587 * "relation": "self",
9588 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9597 * ref="#/components/responses/badrequest"
9601 * ref="#/components/responses/unauthorized"
9603 * security={{"openemr_auth":{}}}
9606 "GET /fhir/MedicationRequest" => function (HttpRestRequest
$request) {
9607 $getParams = $request->getQueryParams();
9608 if ($request->isPatientRequest()) {
9609 // only allow access to data of binded patient
9610 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9612 RestConfig
::authorization_check("patients", "med");
9613 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9615 RestConfig
::apiLog($return);
9621 * path="/fhir/MedicationRequest/{uuid}",
9622 * description="Returns a single MedicationRequest resource.",
9627 * description="The uuid for the MedicationRequest resource.",
9635 * description="Standard Response",
9637 * mediaType="application/json",
9640 * property="json object",
9641 * description="FHIR Json object.",
9645 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9648 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9650 * "resourceType": "MedicationRequest",
9651 * "status": "active",
9652 * "intent": "order",
9657 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9658 * "code": "community",
9659 * "display": "Home/Community"
9664 * "reportedBoolean": false,
9665 * "medicationCodeableConcept": {
9668 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9669 * "code": "1738139",
9670 * "display": "Acetaminophen 325 MG Oral Tablet"
9675 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9678 * "authoredOn": "2021-09-18T00:00:00+00:00",
9680 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9681 * "type": "Practitioner"
9689 * ref="#/components/responses/badrequest"
9693 * ref="#/components/responses/unauthorized"
9697 * ref="#/components/responses/uuidnotfound"
9699 * security={{"openemr_auth":{}}}
9702 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest
$request) {
9703 if ($request->isPatientRequest()) {
9704 // only allow access to data of binded patient
9705 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9707 RestConfig
::authorization_check("patients", "med");
9708 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9710 RestConfig
::apiLog($return);
9716 * path="/fhir/Observation",
9717 * description="Returns a list of Observation resources.",
9722 * description="The uuid for the Observation resource.",
9731 * description="The uuid for the patient.",
9740 * description="The code of the Observation resource.",
9749 * description="The category of the Observation resource.",
9758 * description="The datetime of the Observation resource.",
9766 * description="Standard Response",
9768 * mediaType="application/json",
9771 * property="json object",
9772 * description="FHIR Json object.",
9777 * "lastUpdated": "2021-09-14T09:13:51"
9779 * "resourceType": "Bundle",
9780 * "type": "collection",
9784 * "relation": "self",
9785 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9794 * ref="#/components/responses/badrequest"
9798 * ref="#/components/responses/unauthorized"
9800 * security={{"openemr_auth":{}}}
9803 "GET /fhir/Observation" => function (HttpRestRequest
$request) {
9804 $getParams = $request->getQueryParams();
9805 if ($request->isPatientRequest()) {
9806 // only allow access to data of binded patient
9807 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9809 RestConfig
::authorization_check("patients", "med");
9810 $return = (new FhirObservationRestController())->getAll($getParams);
9812 RestConfig
::apiLog($return);
9818 * path="/fhir/Observation/{uuid}",
9819 * description="Returns a single Observation resource.",
9824 * description="The uuid for the Observation resource.",
9832 * description="Standard Response",
9834 * mediaType="application/json",
9837 * property="json object",
9838 * description="FHIR Json object.",
9842 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9845 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9847 * "resourceType": "Observation",
9848 * "status": "final",
9853 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9854 * "code": "vital-signs"
9862 * "system": "http://loinc.org",
9863 * "code": "85354-9",
9864 * "display": "Blood pressure systolic and diastolic"
9869 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9872 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9878 * "system": "http://loinc.org",
9880 * "display": "Systolic blood pressure"
9884 * "valueQuantity": {
9887 * "system": "http://unitsofmeasure.org",
9895 * "system": "http://loinc.org",
9897 * "display": "Diastolic blood pressure"
9901 * "valueQuantity": {
9904 * "system": "http://unitsofmeasure.org",
9915 * ref="#/components/responses/badrequest"
9919 * ref="#/components/responses/unauthorized"
9923 * ref="#/components/responses/uuidnotfound"
9925 * security={{"openemr_auth":{}}}
9928 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest
$request) {
9929 if ($request->isPatientRequest()) {
9930 // only allow access to data of binded patient
9931 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
9933 RestConfig
::authorization_check("patients", "med");
9934 $return = (new FhirObservationRestController())->getOne($uuid);
9936 RestConfig
::apiLog($return);
9942 * path="/fhir/Organization",
9943 * description="Returns a list of Organization resources.",
9948 * description="The uuid for the Organization resource.",
9957 * description="The name of the Organization resource.",
9966 * description="The email of the Organization resource.",
9975 * description="The phone of the Organization resource.",
9984 * description="The telecom of the Organization resource.",
9993 * description="The address of the Organization resource.",
10000 * name="address-city",
10002 * description="The address-city of the Organization resource.",
10009 * name="address-postalcode",
10011 * description="The address-postalcode of the Organization resource.",
10018 * name="address-state",
10020 * description="The address-state of the Organization resource.",
10028 * description="Standard Response",
10030 * mediaType="application/json",
10033 * property="json object",
10034 * description="FHIR Json object.",
10039 * "lastUpdated": "2021-09-14T09:13:51"
10041 * "resourceType": "Bundle",
10042 * "type": "collection",
10046 * "relation": "self",
10047 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10056 * ref="#/components/responses/badrequest"
10060 * ref="#/components/responses/unauthorized"
10062 * security={{"openemr_auth":{}}}
10065 "GET /fhir/Organization" => function (HttpRestRequest
$request) {
10066 if (!$request->isPatientRequest()) {
10067 RestConfig
::authorization_check("admin", "users");
10069 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10070 RestConfig
::apiLog($return);
10076 * path="/fhir/Organization/{uuid}",
10077 * description="Returns a single Organization resource.",
10082 * description="The uuid for the Organization resource.",
10090 * description="Standard Response",
10092 * mediaType="application/json",
10095 * property="json object",
10096 * description="FHIR Json object.",
10100 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10102 * "versionId": "1",
10103 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10105 * "resourceType": "Organization",
10107 * "status": "generated",
10108 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10112 * "system": "http://hl7.org/fhir/sid/us-npi",
10113 * "value": "1234567890"
10121 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10123 * "display": "Healthcare Provider"
10128 * "name": "Your Clinic Name Here",
10131 * "system": "phone",
10132 * "value": "000-000-0000",
10137 * "value": "000-000-0000",
10150 * ref="#/components/responses/badrequest"
10154 * ref="#/components/responses/unauthorized"
10158 * ref="#/components/responses/uuidnotfound"
10160 * security={{"openemr_auth":{}}}
10163 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
10164 $patientUUID = null;
10165 if (!$request->isPatientRequest()) {
10166 RestConfig
::authorization_check("admin", "users");
10168 $patientUUID = $request->getPatientUUIDString();
10170 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10172 RestConfig
::apiLog($return);
10178 * path="/fhir/Organization",
10179 * description="Adds a Organization resource.",
10184 * mediaType="application/json",
10186 * description="The json object for the Organization resource.",
10190 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10192 * "versionId": "1",
10193 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10195 * "resourceType": "Organization",
10197 * "status": "generated",
10198 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10202 * "system": "http://hl7.org/fhir/sid/us-npi",
10203 * "value": "1234567890"
10211 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10213 * "display": "Healthcare Provider"
10218 * "name": "Your Clinic Name Here Hey",
10221 * "system": "phone",
10222 * "value": "000-000-0000",
10227 * "value": "000-000-0000",
10239 * description="Standard Response",
10241 * mediaType="application/json",
10244 * property="json object",
10245 * description="FHIR Json object.",
10249 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10251 * "versionId": "1",
10252 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10254 * "resourceType": "Organization",
10256 * "status": "generated",
10257 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10261 * "system": "http://hl7.org/fhir/sid/us-npi",
10262 * "value": "1234567890"
10270 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10272 * "display": "Healthcare Provider"
10277 * "name": "Your Clinic Name Here Now",
10280 * "system": "phone",
10281 * "value": "000-000-0000",
10286 * "value": "000-000-0000",
10299 * ref="#/components/responses/badrequest"
10303 * ref="#/components/responses/unauthorized"
10305 * security={{"openemr_auth":{}}}
10308 "POST /fhir/Organization" => function (HttpRestRequest
$request) {
10309 RestConfig
::authorization_check("admin", "super");
10310 $data = (array) (json_decode(file_get_contents("php://input"), true));
10311 $return = (new FhirOrganizationRestController())->post($data);
10312 RestConfig
::apiLog($return, $data);
10318 * path="/fhir/Organization/{uuid}",
10319 * description="Modifies a Organization resource.",
10324 * description="The uuid for the organization.",
10333 * mediaType="application/json",
10335 * description="The json object for the Organization resource.",
10339 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10341 * "versionId": "1",
10342 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10344 * "resourceType": "Organization",
10346 * "status": "generated",
10347 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10351 * "system": "http://hl7.org/fhir/sid/us-npi",
10352 * "value": "1234567890"
10360 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10362 * "display": "Healthcare Provider"
10367 * "name": "Your Clinic Name Here",
10370 * "system": "phone",
10371 * "value": "000-000-0000",
10376 * "value": "000-000-0000",
10388 * description="Standard Response",
10390 * mediaType="application/json",
10394 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
10401 * ref="#/components/responses/badrequest"
10405 * ref="#/components/responses/unauthorized"
10407 * security={{"openemr_auth":{}}}
10410 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
10411 RestConfig
::authorization_check("admin", "super");
10412 $data = (array) (json_decode(file_get_contents("php://input"), true));
10413 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
10414 RestConfig
::apiLog($return, $data);
10420 * path="/fhir/Patient",
10421 * description="Adds a Patient resource.",
10426 * mediaType="application/json",
10428 * description="The json object for the Patient resource.",
10432 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10434 * "versionId": "1",
10435 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10437 * "resourceType": "Patient",
10439 * "status": "generated",
10440 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10444 * "valueCode": "F",
10445 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10451 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10453 * "display": "Unknown"
10455 * "url": "ombCategory"
10458 * "valueString": "Unknown",
10462 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10467 * "use": "official",
10471 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10476 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10483 * "use": "official",
10484 * "family": "Smith",
10490 * "gender": "female",
10491 * "birthDate": "2017-03-10",
10492 * "communication": {
10497 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10498 * "code": "unknown",
10499 * "display": "Unknown"
10510 * description="Standard Response",
10512 * mediaType="application/json",
10515 * property="json object",
10516 * description="FHIR Json object.",
10520 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10522 * "versionId": "1",
10523 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10525 * "resourceType": "Patient",
10527 * "status": "generated",
10528 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10532 * "valueCode": "F",
10533 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10539 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10541 * "display": "Unknown"
10543 * "url": "ombCategory"
10546 * "valueString": "Unknown",
10550 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10555 * "use": "official",
10559 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10564 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10571 * "use": "official",
10572 * "family": "Smith",
10578 * "gender": "female",
10579 * "birthDate": "2017-03-10",
10580 * "communication": {
10585 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10586 * "code": "unknown",
10587 * "display": "Unknown"
10599 * ref="#/components/responses/badrequest"
10603 * ref="#/components/responses/unauthorized"
10605 * security={{"openemr_auth":{}}}
10608 "POST /fhir/Patient" => function (HttpRestRequest
$request) {
10609 RestConfig
::authorization_check("patients", "demo");
10610 $data = (array) (json_decode(file_get_contents("php://input"), true));
10611 $return = (new FhirPatientRestController())->post($data);
10612 RestConfig
::apiLog($return, $data);
10618 * path="/fhir/Patient/{uuid}",
10619 * description="Modifies a Patient resource.",
10624 * description="The uuid for the Patient resource.",
10633 * mediaType="application/json",
10635 * description="The json object for the Patient resource.",
10639 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
10641 * "versionId": "1",
10642 * "lastUpdated": "2022-03-31T02:48:28+00:00"
10644 * "resourceType": "Patient",
10646 * "status": "generated",
10647 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
10651 * "valueCode": "F",
10652 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10658 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
10660 * "display": "Unknown"
10662 * "url": "ombCategory"
10665 * "valueString": "Unknown",
10669 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10674 * "use": "official",
10678 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10683 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10690 * "use": "official",
10691 * "family": "Smith",
10697 * "gender": "female",
10698 * "birthDate": "2017-03-10",
10699 * "communication": {
10704 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10705 * "code": "unknown",
10706 * "display": "Unknown"
10717 * description="Standard Response",
10719 * mediaType="application/json",
10723 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
10730 * ref="#/components/responses/badrequest"
10734 * ref="#/components/responses/unauthorized"
10736 * security={{"openemr_auth":{}}}
10739 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
10740 RestConfig
::authorization_check("patients", "demo");
10741 $data = (array) (json_decode(file_get_contents("php://input"), true));
10742 $return = (new FhirPatientRestController())->put($uuid, $data);
10743 RestConfig
::apiLog($return, $data);
10749 * path="/fhir/Patient",
10750 * description="Returns a list of Patient resources.",
10755 * description="The uuid for the Patient resource.",
10762 * name="identifier",
10764 * description="The identifier of the Patient resource.",
10773 * description="The name of the Patient resource.",
10780 * name="birthdate",
10782 * description="The birthdate of the Patient resource.",
10791 * description="The gender of the Patient resource.",
10800 * description="The address of the Patient resource.",
10807 * name="address-city",
10809 * description="The address-city of the Patient resource.",
10816 * name="address-postalcode",
10818 * description="The address-postalcode of the Patient resource.",
10825 * name="address-state",
10827 * description="The address-state of the Patient resource.",
10836 * description="The email of the Patient resource.",
10845 * description="The family name of the Patient resource.",
10854 * description="The given name of the Patient resource.",
10863 * description="The phone number of the Patient resource.",
10872 * description="The fax number of the Patient resource.",
10880 * description="Standard Response",
10882 * mediaType="application/json",
10885 * property="json object",
10886 * description="FHIR Json object.",
10891 * "lastUpdated": "2021-09-14T09:13:51"
10893 * "resourceType": "Bundle",
10894 * "type": "collection",
10898 * "relation": "self",
10899 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10908 * ref="#/components/responses/badrequest"
10912 * ref="#/components/responses/unauthorized"
10914 * security={{"openemr_auth":{}}}
10917 "GET /fhir/Patient" => function (HttpRestRequest
$request) {
10918 $params = $request->getQueryParams();
10919 if ($request->isPatientRequest()) {
10920 // only allow access to data of binded patient
10921 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
10922 // need to use getAll rather than getOne)
10923 $params['_id'] = $request->getPatientUUIDString();
10924 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
10926 RestConfig
::authorization_check("patients", "demo");
10927 $return = (new FhirPatientRestController())->getAll($params);
10929 RestConfig
::apiLog($return);
10935 * path="/fhir/Patient/$export",
10936 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
10940 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
10944 * ref="#/components/responses/badrequest"
10948 * ref="#/components/responses/unauthorized"
10950 * security={{"openemr_auth":{}}}
10953 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
10954 'GET /fhir/Patient/$export' => function (HttpRestRequest
$request) {
10955 RestConfig
::authorization_check("admin", "users");
10956 $fhirExportService = new FhirExportRestController($request);
10957 $return = $fhirExportService->processExport(
10958 $request->getQueryParams(),
10960 $request->getHeader('Accept'),
10961 $request->getHeader('Prefer')
10963 RestConfig
::apiLog($return);
10969 * path="/fhir/Patient/{uuid}",
10970 * description="Returns a single Patient resource.",
10975 * description="The uuid for the Patient resource.",
10983 * description="Standard Response",
10985 * mediaType="application/json",
10988 * property="json object",
10989 * description="FHIR Json object.",
10993 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
10995 * "versionId": "1",
10996 * "lastUpdated": "2021-09-21T17:08:03+00:00"
10998 * "resourceType": "Patient",
11000 * "status": "generated",
11001 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11005 * "valueCode": "F",
11006 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11012 * "system": "urn:oid:2.16.840.1.113883.6.238",
11013 * "code": "1006-6",
11014 * "display": "Abenaki"
11016 * "url": "ombCategory"
11019 * "valueString": "Abenaki",
11023 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11028 * "valueString": "Declined To Specify",
11032 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11037 * "use": "official",
11041 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11046 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11053 * "use": "official",
11054 * "family": "Von197",
11060 * "gender": "female",
11061 * "birthDate": "1970-07-03",
11067 * "city": "Boston",
11068 * "state": "Massachusetts",
11069 * "postalCode": "02215",
11071 * "start": "2020-09-21T17:08:03.532+00:00"
11075 * "communication": {
11080 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11081 * "code": "unknown",
11082 * "display": "Unknown"
11094 * ref="#/components/responses/badrequest"
11098 * ref="#/components/responses/unauthorized"
11102 * ref="#/components/responses/uuidnotfound"
11104 * security={{"openemr_auth":{}}}
11107 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
11108 if ($request->isPatientRequest()) {
11109 // only allow access to data of binded patient
11110 if (empty($uuid) ||
($uuid != $request->getPatientUUIDString())) {
11111 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11113 $uuid = $request->getPatientUUIDString();
11115 RestConfig
::authorization_check("patients", "demo");
11117 $return = (new FhirPatientRestController())->getOne($uuid);
11118 RestConfig
::apiLog($return);
11124 * path="/fhir/Person",
11125 * description="Returns a list of Person resources.",
11130 * description="The name of the Person resource.",
11139 * description="The active status of the Person resource.",
11148 * description="The address of the Person resource.",
11155 * name="address-city",
11157 * description="The address-city of the Person resource.",
11164 * name="address-postalcode",
11166 * description="The address-postalcode of the Person resource.",
11173 * name="address-state",
11175 * description="The address-state of the Person resource.",
11184 * description="The email of the Person resource.",
11193 * description="The family name of the Person resource.",
11202 * description="The given name of the Person resource.",
11211 * description="The phone number of the Person resource.",
11220 * description="The fax number of the Person resource.",
11228 * description="Standard Response",
11230 * mediaType="application/json",
11233 * property="json object",
11234 * description="FHIR Json object.",
11239 * "lastUpdated": "2021-09-14T09:13:51"
11241 * "resourceType": "Bundle",
11242 * "type": "collection",
11246 * "relation": "self",
11247 * "url": "https://localhost:9300/apis/default/fhir/Person"
11256 * ref="#/components/responses/badrequest"
11260 * ref="#/components/responses/unauthorized"
11262 * security={{"openemr_auth":{}}}
11265 "GET /fhir/Person" => function (HttpRestRequest
$request) {
11266 RestConfig
::authorization_check("admin", "users");
11267 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11268 RestConfig
::apiLog($return);
11274 * path="/fhir/Person/{uuid}",
11275 * description="Returns a single Person resource.",
11280 * description="The uuid for the Person resource.",
11288 * description="Standard Response",
11290 * mediaType="application/json",
11293 * property="json object",
11294 * description="FHIR Json object.",
11298 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11300 * "versionId": "1",
11301 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11303 * "resourceType": "Person",
11305 * "status": "generated",
11306 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11310 * "use": "official",
11311 * "family": "Administrator",
11320 * "system": "phone",
11321 * "value": "1234567890",
11325 * "system": "phone",
11326 * "value": "1234567890",
11330 * "system": "phone",
11331 * "value": "1234567890",
11335 * "system": "email",
11336 * "value": "hey@hey.com",
11343 * "123 Lane Street"
11345 * "city": "Bellevue",
11348 * "start": "2021-04-13T08:57:32.146+00:00"
11359 * ref="#/components/responses/badrequest"
11363 * ref="#/components/responses/unauthorized"
11367 * ref="#/components/responses/uuidnotfound"
11369 * security={{"openemr_auth":{}}}
11372 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest
$request) {
11373 RestConfig
::authorization_check("admin", "users");
11374 $return = (new FhirPersonRestController())->getOne($uuid);
11375 RestConfig
::apiLog($return);
11381 * path="/fhir/Practitioner",
11382 * description="Returns a list of Practitioner resources.",
11387 * description="The uuid for the Practitioner resource.",
11396 * description="The name of the Practitioner resource.",
11405 * description="The active status of the Practitioner resource.",
11414 * description="The address of the Practitioner resource.",
11421 * name="address-city",
11423 * description="The address-city of the Practitioner resource.",
11430 * name="address-postalcode",
11432 * description="The address-postalcode of the Practitioner resource.",
11439 * name="address-state",
11441 * description="The address-state of the Practitioner resource.",
11450 * description="The email of the Practitioner resource.",
11459 * description="The family name of the Practitioner resource.",
11468 * description="The given name of the Practitioner resource.",
11477 * description="The phone number of the Practitioner resource.",
11486 * description="The fax number of the Practitioner resource.",
11494 * description="Standard Response",
11496 * mediaType="application/json",
11499 * property="json object",
11500 * description="FHIR Json object.",
11505 * "lastUpdated": "2021-09-14T09:13:51"
11507 * "resourceType": "Bundle",
11508 * "type": "collection",
11512 * "relation": "self",
11513 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
11522 * ref="#/components/responses/badrequest"
11526 * ref="#/components/responses/unauthorized"
11528 * security={{"openemr_auth":{}}}
11531 "GET /fhir/Practitioner" => function (HttpRestRequest
$request) {
11533 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11534 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11535 // I don't believe patients are assigned to a particular practitioner
11536 // should we allow just open api access to admin information? Should we restrict particular pieces
11537 // of data in the practitioner side (phone number, address information) based on a permission set?
11538 if (!$request->isPatientRequest()) {
11539 RestConfig
::authorization_check("admin", "users");
11541 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
11542 RestConfig
::apiLog($return);
11548 * path="/fhir/Practitioner/{uuid}",
11549 * description="Returns a single Practitioner resource.",
11554 * description="The uuid for the Practitioner resource.",
11562 * description="Standard Response",
11564 * mediaType="application/json",
11567 * property="json object",
11568 * description="FHIR Json object.",
11572 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11574 * "versionId": "1",
11575 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11577 * "resourceType": "Practitioner",
11579 * "status": "generated",
11580 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11584 * "system": "http://hl7.org/fhir/sid/us-npi",
11585 * "value": "11223344554543"
11591 * "use": "official",
11592 * "family": "Smith",
11604 * ref="#/components/responses/badrequest"
11608 * ref="#/components/responses/unauthorized"
11612 * ref="#/components/responses/uuidnotfound"
11614 * security={{"openemr_auth":{}}}
11617 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
11618 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
11619 // that is referenced in connected patient resources -- such as AllergyIntollerance.
11620 // I don't believe patients are assigned to a particular practitioner
11621 // should we allow just open api access to admin information? Should we restrict particular pieces
11622 // of data in the practitioner side (phone number, address information) based on a permission set?
11623 if (!$request->isPatientRequest()) {
11624 RestConfig
::authorization_check("admin", "users");
11626 $return = (new FhirPractitionerRestController())->getOne($uuid);
11627 RestConfig
::apiLog($return);
11633 * path="/fhir/Practitioner",
11634 * description="Adds a Practitioner resources.",
11639 * mediaType="application/json",
11641 * description="The json object for the Practitioner resource.",
11645 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11647 * "versionId": "1",
11648 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11650 * "resourceType": "Practitioner",
11652 * "status": "generated",
11653 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11657 * "system": "http://hl7.org/fhir/sid/us-npi",
11658 * "value": "11223344554543"
11664 * "use": "official",
11665 * "family": "Smith",
11676 * description="Standard Response",
11678 * mediaType="application/json",
11681 * property="json object",
11682 * description="FHIR Json object.",
11686 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11688 * "versionId": "1",
11689 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11691 * "resourceType": "Practitioner",
11693 * "status": "generated",
11694 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11698 * "system": "http://hl7.org/fhir/sid/us-npi",
11699 * "value": "11223344554543"
11705 * "use": "official",
11706 * "family": "Smith",
11718 * ref="#/components/responses/badrequest"
11722 * ref="#/components/responses/unauthorized"
11724 * security={{"openemr_auth":{}}}
11727 "POST /fhir/Practitioner" => function (HttpRestRequest
$request) {
11728 RestConfig
::authorization_check("admin", "users");
11729 $data = (array) (json_decode(file_get_contents("php://input"), true));
11730 $return = (new FhirPractitionerRestController())->post($data);
11731 RestConfig
::apiLog($return, $data);
11737 * path="/fhir/Practitioner/{uuid}",
11738 * description="Modify a Practitioner resource.",
11743 * description="The uuid for the Practitioner resource.",
11752 * mediaType="application/json",
11754 * description="The json object for the Practitioner resource.",
11758 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
11760 * "versionId": "1",
11761 * "lastUpdated": "2021-09-21T17:41:57+00:00"
11763 * "resourceType": "Practitioner",
11765 * "status": "generated",
11766 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
11770 * "system": "http://hl7.org/fhir/sid/us-npi",
11771 * "value": "11223344554543"
11777 * "use": "official",
11778 * "family": "Smith",
11789 * description="Standard Response",
11791 * mediaType="application/json",
11795 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
11802 * ref="#/components/responses/badrequest"
11806 * ref="#/components/responses/unauthorized"
11808 * security={{"openemr_auth":{}}}
11811 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
11812 RestConfig
::authorization_check("admin", "users");
11813 $data = (array) (json_decode(file_get_contents("php://input"), true));
11814 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
11815 RestConfig
::apiLog($return, $data);
11821 * path="/fhir/PractitionerRole",
11822 * description="Returns a list of PractitionerRole resources.",
11825 * name="specialty",
11827 * description="The specialty of the PractitionerRole resource.",
11834 * name="practitioner",
11836 * description="The practitioner of the PractitionerRole resource.",
11844 * description="Standard Response",
11846 * mediaType="application/json",
11849 * property="json object",
11850 * description="FHIR Json object.",
11855 * "lastUpdated": "2021-09-14T09:13:51"
11857 * "resourceType": "Bundle",
11858 * "type": "collection",
11862 * "relation": "self",
11863 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11872 * ref="#/components/responses/badrequest"
11876 * ref="#/components/responses/unauthorized"
11878 * security={{"openemr_auth":{}}}
11881 "GET /fhir/PractitionerRole" => function (HttpRestRequest
$request) {
11882 RestConfig
::authorization_check("admin", "users");
11883 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11884 RestConfig
::apiLog($return);
11890 * path="/fhir/PractitionerRole/{uuid}",
11891 * description="Returns a single PractitionerRole resource.",
11896 * description="The uuid for the PractitionerRole resource.",
11904 * description="Standard Response",
11906 * mediaType="application/json",
11909 * property="json object",
11910 * description="FHIR Json object.",
11914 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
11916 * "versionId": "1",
11917 * "lastUpdated": "2022-04-13T06:18:17+00:00"
11919 * "resourceType": "PractitionerRole",
11920 * "practitioner": {
11921 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
11922 * "display": "Administrator Administrator"
11924 * "organization": {
11925 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
11926 * "display": "Your Clinic Name Here"
11933 * "text": "Psychoanalyst"
11939 * "text": "Counselor"
11948 * ref="#/components/responses/badrequest"
11952 * ref="#/components/responses/unauthorized"
11956 * ref="#/components/responses/uuidnotfound"
11958 * security={{"openemr_auth":{}}}
11961 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest
$request) {
11962 RestConfig
::authorization_check("admin", "users");
11963 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
11964 RestConfig
::apiLog($return);
11970 * path="/fhir/Procedure",
11971 * description="Returns a list of Procedure resources.",
11976 * description="The uuid for the Procedure resource.",
11985 * description="The uuid for the patient.",
11994 * description="The datetime of the Procedure resource.",
12002 * description="Standard Response",
12004 * mediaType="application/json",
12007 * property="json object",
12008 * description="FHIR Json object.",
12013 * "lastUpdated": "2021-09-14T09:13:51"
12015 * "resourceType": "Bundle",
12016 * "type": "collection",
12020 * "relation": "self",
12021 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12030 * ref="#/components/responses/badrequest"
12034 * ref="#/components/responses/unauthorized"
12036 * security={{"openemr_auth":{}}}
12039 "GET /fhir/Procedure" => function (HttpRestRequest
$request) {
12040 if ($request->isPatientRequest()) {
12041 // only allow access to data of binded patient
12042 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12044 RestConfig
::authorization_check("patients", "med");
12045 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12047 RestConfig
::apiLog($return);
12053 * path="/fhir/Procedure/{uuid}",
12054 * description="Returns a single Procedure resource.",
12059 * description="The uuid for the Procedure resource.",
12067 * description="Standard Response",
12069 * mediaType="application/json",
12072 * property="json object",
12073 * description="FHIR Json object.",
12077 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12079 * "versionId": "1",
12080 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12082 * "resourceType": "Procedure",
12083 * "status": "in-progress",
12085 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12086 * "type": "Patient"
12094 * ref="#/components/responses/badrequest"
12098 * ref="#/components/responses/unauthorized"
12102 * ref="#/components/responses/uuidnotfound"
12104 * security={{"openemr_auth":{}}}
12107 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest
$request) {
12108 if ($request->isPatientRequest()) {
12109 // only allow access to data of binded patient
12110 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12112 RestConfig
::authorization_check("patients", "med");
12113 $return = (new FhirProcedureRestController())->getOne($uuid);
12115 RestConfig
::apiLog($return);
12121 * path="/fhir/Provenance/{uuid}",
12122 * description="Returns a single Provenance resource.",
12127 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12135 * description="Standard Response",
12137 * mediaType="application/json",
12140 * property="json object",
12141 * description="FHIR Json object.",
12145 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12146 * "resourceType": "Provenance",
12149 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12150 * "type": "AllergyIntolerance"
12153 * "recorded": "2022-03-26T22:43:30+00:00",
12159 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12160 * "code": "author",
12161 * "display": "Author"
12166 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12167 * "type": "Organization"
12170 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12171 * "type": "Organization"
12178 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12179 * "code": "transmitter",
12180 * "display": "Transmitter"
12186 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12187 * "type": "Organization"
12190 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12191 * "type": "Organization"
12200 * ref="#/components/responses/badrequest"
12204 * ref="#/components/responses/unauthorized"
12208 * ref="#/components/responses/uuidnotfound"
12210 * security={{"openemr_auth":{}}}
12213 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest
$request) {
12214 if ($request->isPatientRequest()) {
12215 // only allow access to data of binded patient
12216 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12218 RestConfig
::authorization_check("admin", "super");
12219 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12221 RestConfig
::apiLog($return);
12227 * path="/fhir/Provenance",
12228 * description="Returns a list of Provenance resources.",
12233 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12241 * description="Standard Response",
12243 * mediaType="application/json",
12246 * property="json object",
12247 * description="FHIR Json object.",
12252 * "lastUpdated": "2021-09-14T09:13:51"
12254 * "resourceType": "Bundle",
12255 * "type": "collection",
12259 * "relation": "self",
12260 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12269 * ref="#/components/responses/badrequest"
12273 * ref="#/components/responses/unauthorized"
12275 * security={{"openemr_auth":{}}}
12278 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12279 // property to support which is why this endpoint exists.
12280 "GET /fhir/Provenance" => function (HttpRestRequest
$request) {
12281 if ($request->isPatientRequest()) {
12282 // only allow access to data of binded patient
12283 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12285 // TODO: it seems like regular users should be able to grab authorship / provenance information
12286 RestConfig
::authorization_check("admin", "super");
12287 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12289 RestConfig
::apiLog($return);
12297 * path="/fhir/metadata",
12298 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12302 * description="Return CapabilityStatement resource of the fhir server"
12306 "GET /fhir/metadata" => function () {
12307 $return = (new FhirMetaDataRestController())->getMetaData();
12308 RestConfig
::apiLog($return);
12314 * path="/fhir/.well-known/smart-configuration",
12315 * description="Returns smart configuration of the fhir server.",
12319 * description="Return smart configuration of the fhir server"
12323 "GET /fhir/.well-known/smart-configuration" => function () {
12324 $authController = new \OpenEMR\RestControllers\
AuthorizationController();
12325 $return = (new \OpenEMR\RestControllers\SMART\
SMARTConfigurationController($authController))->getConfig();
12326 RestConfig
::apiLog($return);
12330 // FHIR root level operations
12334 * path="/fhir/$export",
12335 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12339 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12343 * ref="#/components/responses/badrequest"
12347 * ref="#/components/responses/unauthorized"
12349 * security={{"openemr_auth":{}}}
12352 'GET /fhir/$export' => function (HttpRestRequest
$request) {
12353 RestConfig
::authorization_check("admin", "users");
12354 $fhirExportService = new FhirExportRestController($request);
12355 $return = $fhirExportService->processExport(
12356 $request->getQueryParams(),
12358 $request->getHeader('Accept'),
12359 $request->getHeader('Prefer')
12361 RestConfig
::apiLog($return);
12365 // these two operations are adopted based on the documentation used in the IBM FHIR Server
12366 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
12367 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
12371 * path="/fhir/$bulkdata-status",
12372 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12376 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12380 * ref="#/components/responses/badrequest"
12384 * ref="#/components/responses/unauthorized"
12386 * security={{"openemr_auth":{}}}
12389 'GET /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
12390 RestConfig
::authorization_check("admin", "users");
12391 $jobUuidString = $request->getQueryParam('job');
12392 // if we were truly async we would return 202 here to say we are in progress with a JSON response
12393 // since OpenEMR data is so small we just return the JSON from the database
12394 $fhirExportService = new FhirExportRestController($request);
12395 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
12396 RestConfig
::apiLog($return);
12402 * path="/fhir/$bulkdata-status",
12403 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
12407 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
12411 * ref="#/components/responses/badrequest"
12415 * ref="#/components/responses/unauthorized"
12417 * security={{"openemr_auth":{}}}
12420 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
12421 RestConfig
::authorization_check("admin", "users");
12422 $job = $request->getQueryParam('job');
12423 $fhirExportService = new FhirExportRestController($request);
12424 $return = $fhirExportService->processDeleteExportForJob($job);
12425 RestConfig
::apiLog($return);
12430 // Note that the portal (api) route is only for patient role
12431 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
12432 RestConfig
::$PORTAL_ROUTE_MAP = array(
12435 * path="/portal/patient",
12436 * description="Returns the patient.",
12437 * tags={"standard-patient"},
12440 * description="Standard response",
12442 * mediaType="application/json",
12443 * @OA\Schema(ref="#/components/schemas/api_patient_response")
12448 * ref="#/components/responses/unauthorized"
12450 * security={{"openemr_auth":{}}}
12453 "GET /portal/patient" => function (HttpRestRequest
$request) {
12454 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
12455 RestConfig
::apiLog($return);
12461 * path="/portal/patient/encounter",
12462 * description="Returns encounters for the patient.",
12463 * tags={"standard-patient"},
12466 * ref="#/components/responses/standard"
12470 * ref="#/components/responses/badrequest"
12474 * ref="#/components/responses/unauthorized"
12476 * security={{"openemr_auth":{}}}
12479 "GET /portal/patient/encounter" => function (HttpRestRequest
$request) {
12480 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
12481 RestConfig
::apiLog($return);
12487 * path="/portal/patient/encounter/{euuid}",
12488 * description="Returns a selected encounter by its uuid.",
12489 * tags={"standard-patient"},
12493 * description="The uuid for the encounter.",
12501 * ref="#/components/responses/standard"
12505 * ref="#/components/responses/badrequest"
12509 * ref="#/components/responses/unauthorized"
12511 * security={{"openemr_auth":{}}}
12514 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest
$request) {
12515 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
12516 RestConfig
::apiLog($return);