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="6.1.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/Device.read": "Read device resources for the current patient (api:fhir)",
40 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
41 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
42 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
43 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
44 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
45 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
46 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
47 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
48 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
49 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
50 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
51 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
52 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
53 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
54 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
55 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
56 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
57 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
58 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
59 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
60 * "system/Device.read": "Read all device resources in the system (api:fhir)",
61 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
62 * "system/Document.read": "Read all document resources in the system (api:fhir)",
63 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
64 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
65 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
66 * "system/Group.read": "Read all group resources in the system (api:fhir)",
67 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
68 * "system/Location.read": "Read all location resources in the system (api:fhir)",
69 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
70 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
71 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
72 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
73 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
74 * "system/Person.read": "Read all person resources in the system (api:fhir)",
75 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
76 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
77 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
78 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
79 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
80 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
81 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
82 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
83 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
84 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
85 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
86 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
87 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
88 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
89 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
90 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
91 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
92 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
93 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
94 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
95 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
96 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
97 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
98 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
99 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
100 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
101 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
102 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
103 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
104 * "api:oemr": "Standard OpenEMR API",
105 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
106 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
107 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
108 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
109 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
110 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
111 * "user/document.read": "Read documents the user has access to (api:oemr)",
112 * "user/document.write": "Write documents the user has access to (api:oemr)",
113 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
114 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
115 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
116 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
117 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
118 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
119 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
120 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
121 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
122 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
123 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
124 * "user/list.read": "Read lists the user has access to (api:oemr)",
125 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
126 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
127 * "user/medication.read": "Read medications the user has access to (api:oemr)",
128 * "user/medication.write": "Write medications the user has access to (api:oemr)",
129 * "user/message.write": "Read messages the user has access to (api:oemr)",
130 * "user/patient.read": "Read patients the user has access to (api:oemr)",
131 * "user/patient.write": "Write patients the user has access to (api:oemr)",
132 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
133 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
134 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
135 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
136 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
137 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
138 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
139 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
140 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
141 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
142 * "api:port": "Standard Patient Portal OpenEMR API",
143 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
144 * "patient/patient.read": "Write encounters the patient has access to (api:port)"
150 * description="FHIR R4 API"
154 * description="Standard OpenEMR API"
157 * name="standard-patient",
158 * description="Standard Patient Portal OpenEMR API"
161 * response="standard",
162 * description="Standard Response",
164 * mediaType="application/json",
167 * property="validationErrors",
168 * description="Validation errors.",
175 * property="internalErrors",
176 * description="Internal errors.",
184 * description="Returned data.",
191 * "validationErrors": {},
192 * "error_description": {},
199 * response="badrequest",
200 * description="Bad Request",
202 * mediaType="application/json",
205 * property="validationErrors",
206 * description="Validation errors.",
210 * "validationErrors":
212 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
219 * response="unauthorized",
220 * description="Unauthorized",
222 * mediaType="application/json",
226 * description="The error.",
230 * property="error_description",
231 * description="The description of the error.",
236 * description="More specific information on the error.",
240 * property="message",
241 * description="Message regarding the error.",
245 * "error": "access_denied",
246 * "error_description": "The resource owner or authorization server denied the request.",
247 * "hint": "Missing ""Authorization"" header",
248 * "message": "The resource owner or authorization server denied the request."
254 * response="uuidnotfound",
255 * description="Not Found",
257 * mediaType="application/json",
261 * description="empty",
270 // Lets keep our controller classes with the routes.
272 use OpenEMR\Common\Acl\AccessDeniedException
;
273 use OpenEMR\Common\Http\HttpRestRequest
;
274 use OpenEMR\RestControllers\AllergyIntoleranceRestController
;
275 use OpenEMR\RestControllers\FacilityRestController
;
276 use OpenEMR\RestControllers\VersionRestController
;
277 use OpenEMR\RestControllers\ProductRegistrationRestController
;
278 use OpenEMR\RestControllers\PatientRestController
;
279 use OpenEMR\RestControllers\EncounterRestController
;
280 use OpenEMR\RestControllers\PractitionerRestController
;
281 use OpenEMR\RestControllers\ListRestController
;
282 use OpenEMR\RestControllers\InsuranceCompanyRestController
;
283 use OpenEMR\RestControllers\AppointmentRestController
;
284 use OpenEMR\RestControllers\ConditionRestController
;
285 use OpenEMR\RestControllers\ONoteRestController
;
286 use OpenEMR\RestControllers\DocumentRestController
;
287 use OpenEMR\RestControllers\DrugRestController
;
288 use OpenEMR\RestControllers\ImmunizationRestController
;
289 use OpenEMR\RestControllers\InsuranceRestController
;
290 use OpenEMR\RestControllers\MessageRestController
;
291 use OpenEMR\RestControllers\PrescriptionRestController
;
292 use OpenEMR\RestControllers\ProcedureRestController
;
294 // Note some Http clients may not send auth as json so a function
295 // is implemented to determine and parse encoding on auth route's.
297 // Note that the api route is only for users role
298 // (there is a mechanism in place to ensure only user role can access the api route)
299 RestConfig
::$ROUTE_MAP = array(
302 * path="/api/facility",
303 * description="Returns a single facility.",
308 * description="The name for the facility.",
315 * name="facility_npi",
317 * description="The facility_npi for the facility.",
326 * description="The phone for the facility.",
335 * description="The fax for the facility.",
344 * description="The street for the facility.",
353 * description="The city for the facility.",
362 * description="The state for the facility.",
369 * name="postal_code",
371 * description="The postal_code for the facility.",
378 * name="country_code",
380 * description="The country_code for the facility.",
387 * name="federal_ein",
389 * description="The federal_ein for the facility.",
398 * description="The website for the facility.",
407 * description="The email for the facility.",
414 * name="domain_identifier",
416 * description="The domain_identifier for the facility.",
423 * name="facility_taxonomy",
425 * description="The facility_taxonomy for the facility.",
432 * name="facility_code",
434 * description="The facility_code for the facility.",
441 * name="billing_location",
443 * description="The billing_location setting for the facility.",
450 * name="accepts_assignment",
452 * description="The accepts_assignment setting for the facility.",
461 * description="The oid for the facility.",
468 * name="service_location",
470 * description="The service_location setting for the facility.",
478 * ref="#/components/responses/standard"
482 * ref="#/components/responses/badrequest"
486 * ref="#/components/responses/unauthorized"
488 * security={{"openemr_auth":{}}}
491 "GET /api/facility" => function () {
492 RestConfig
::authorization_check("admin", "users");
493 $return = (new FacilityRestController())->getAll($_GET);
494 RestConfig
::apiLog($return);
500 * path="/api/facility/{fuuid}",
501 * description="Returns a single facility.",
506 * description="The uuid for the facility.",
514 * ref="#/components/responses/standard"
518 * ref="#/components/responses/badrequest"
522 * ref="#/components/responses/unauthorized"
524 * security={{"openemr_auth":{}}}
527 "GET /api/facility/:fuuid" => function ($fuuid) {
528 RestConfig
::authorization_check("admin", "users");
529 $return = (new FacilityRestController())->getOne($fuuid);
530 RestConfig
::apiLog($return);
536 * path="/api/facility",
537 * description="Creates a facility in the system",
542 * mediaType="application/json",
546 * description="The name for the facility.",
550 * property="facility_npi",
551 * description="The facility_npi for the facility.",
556 * description="The phone for the facility.",
561 * description="The fax for the facility.",
566 * description="The street for the facility.",
571 * description="The city for the facility.",
576 * description="The state for the facility.",
580 * property="postal_code",
581 * description="The postal_code for the facility.",
585 * property="country_code",
586 * description="The country_code for the facility.",
590 * property="federal_ein",
591 * description="The federal_ein for the facility.",
595 * property="website",
596 * description="The website for the facility.",
601 * description="The email for the facility.",
605 * property="domain_identifier",
606 * description="The domain_identifier for the facility.",
610 * property="facility_taxonomy",
611 * description="The facility_taxonomy for the facility.",
615 * property="facility_code",
616 * description="The facility_code for the facility.",
620 * property="billing_location",
621 * description="The billing_location setting for the facility.",
625 * property="accepts_assignment",
626 * description="The accepts_assignment setting for the facility.",
631 * description="The oid for the facility.",
635 * property="service_location",
636 * description="The service_location setting for the facility.",
639 * required={"name", "facility_npi"},
642 * "facility_npi": "123456789123",
643 * "phone": "808-606-3030",
644 * "fax": "808-606-3031",
645 * "street": "1337 Bit Shifter Ln",
646 * "city": "San Lorenzo",
648 * "postal_code": "54321",
649 * "country_code": "US",
650 * "federal_ein": "4343434",
651 * "website": "https://example.com",
652 * "email": "foo@bar.com",
653 * "domain_identifier": "",
654 * "facility_taxonomy": "",
655 * "facility_code": "",
656 * "billing_location": "1",
657 * "accepts_assignment": "1",
659 * "service_location": "1"
666 * ref="#/components/responses/standard"
670 * ref="#/components/responses/badrequest"
674 * ref="#/components/responses/unauthorized"
676 * security={{"openemr_auth":{}}}
679 "POST /api/facility" => function () {
680 RestConfig
::authorization_check("admin", "super");
681 $data = (array) (json_decode(file_get_contents("php://input")));
682 $return = (new FacilityRestController())->post($data);
683 RestConfig
::apiLog($return, $data);
689 * path="/api/facility/{fuuid}",
690 * description="Updates a facility in the system",
695 * description="The uuid for the facility.",
704 * mediaType="application/json",
708 * description="The name for the facility.",
712 * property="facility_npi",
713 * description="The facility_npi for the facility.",
718 * description="The phone for the facility.",
723 * description="The fax for the facility.",
728 * description="The street for the facility.",
733 * description="The city for the facility.",
738 * description="The state for the facility.",
742 * property="postal_code",
743 * description="The postal_code for the facility.",
747 * property="country_code",
748 * description="The country_code for the facility.",
752 * property="federal_ein",
753 * description="The federal_ein for the facility.",
757 * property="website",
758 * description="The website for the facility.",
763 * description="The email for the facility.",
767 * property="domain_identifier",
768 * description="The domain_identifier for the facility.",
772 * property="facility_taxonomy",
773 * description="The facility_taxonomy for the facility.",
777 * property="facility_code",
778 * description="The facility_code for the facility.",
782 * property="billing_location",
783 * description="The billing_location setting for the facility.",
787 * property="accepts_assignment",
788 * description="The accepts_assignment setting for the facility.",
793 * description="The oid for the facility.",
797 * property="service_location",
798 * description="The service_location setting for the facility.",
803 * "facility_npi": "123456789123",
804 * "phone": "808-606-3030",
805 * "fax": "808-606-3031",
806 * "street": "1337 Bit Shifter Ln",
807 * "city": "San Lorenzo",
809 * "postal_code": "54321",
810 * "country_code": "US",
811 * "federal_ein": "4343434",
812 * "website": "https://example.com",
813 * "email": "foo@bar.com",
814 * "domain_identifier": "",
815 * "facility_taxonomy": "",
816 * "facility_code": "",
817 * "billing_location": "1",
818 * "accepts_assignment": "1",
820 * "service_location": "1"
827 * ref="#/components/responses/standard"
831 * ref="#/components/responses/badrequest"
835 * ref="#/components/responses/unauthorized"
837 * security={{"openemr_auth":{}}}
840 "PUT /api/facility/:fuuid" => function ($fuuid) {
841 RestConfig
::authorization_check("admin", "super");
842 $data = (array) (json_decode(file_get_contents("php://input")));
843 $return = (new FacilityRestController())->patch($fuuid, $data);
844 RestConfig
::apiLog($return, $data);
850 * path="/api/patient",
851 * description="Retrieves a list of patients",
856 * description="The first name for the patient.",
865 * description="The last name for the patient.",
874 * description="The social security number for the patient.",
883 * description="The street for the patient.",
890 * name="postal_code",
892 * description="The postal code for the patient.",
901 * description="The city for the patient.",
910 * description="The state for the patient.",
919 * description="The home phone for the patient.",
928 * description="The business phone for the patient.",
937 * description="The cell phone for the patient.",
944 * name="postal_contact",
946 * description="The postal_contact for the patient.",
955 * description="The gender for the patient.",
962 * name="country_code",
964 * description="The country code for the patient.",
973 * description="The email for the patient.",
982 * description="The DOB for the patient.",
990 * ref="#/components/responses/standard"
994 * ref="#/components/responses/badrequest"
998 * ref="#/components/responses/unauthorized"
1000 * security={{"openemr_auth":{}}}
1003 "GET /api/patient" => function () {
1004 RestConfig
::authorization_check("patients", "demo");
1005 $return = (new PatientRestController())->getAll($_GET);
1006 RestConfig
::apiLog($return);
1011 * Schema for the patient request
1014 * schema="api_patient_request",
1017 * description="The title of patient.",
1022 * description="The fname of patient.",
1027 * description="The mname of patient.",
1032 * description="The lname of patient.",
1036 * property="street",
1037 * description="The street address of patient.",
1041 * property="postal_code",
1042 * description="The postal code of patient.",
1047 * description="The city of patient.",
1052 * description="The state of patient.",
1056 * property="country_code",
1057 * description="The country code of patient.",
1061 * property="phone_contact",
1062 * description="The phone contact of patient.",
1067 * description="The DOB of patient.",
1072 * description="The lname of patient.",
1077 * description="The race of patient.",
1081 * property="ethnicity",
1082 * description="The ethnicity of patient.",
1085 * required={"fname", "lname", "DOB", "sex"},
1091 * "street": "456 Tree Lane",
1092 * "postal_code": "08642",
1093 * "city": "FooTown",
1095 * "country_code": "US",
1096 * "phone_contact": "123-456-7890",
1097 * "DOB": "1992-02-02",
1106 * path="/api/patient",
1107 * description="Creates a new patient",
1108 * tags={"standard"},
1112 * mediaType="application/json",
1113 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1118 * description="Standard response",
1120 * mediaType="application/json",
1123 * property="validationErrors",
1124 * description="Validation errors.",
1131 * property="internalErrors",
1132 * description="Internal errors.",
1140 * description="Returned data.",
1145 * description="patient pid",
1151 * "validationErrors": {},
1152 * "error_description": {},
1162 * ref="#/components/responses/unauthorized"
1164 * security={{"openemr_auth":{}}}
1167 "POST /api/patient" => function () {
1168 RestConfig
::authorization_check("patients", "demo");
1169 $data = (array) (json_decode(file_get_contents("php://input")));
1170 $return = (new PatientRestController())->post($data);
1171 RestConfig
::apiLog($return, $data);
1176 * Schema for the patient response
1179 * schema="api_patient_response",
1181 * property="validationErrors",
1182 * description="Validation errors.",
1189 * property="internalErrors",
1190 * description="Internal errors.",
1198 * description="Returned data.",
1203 * description="patient id",
1208 * description="patient pid",
1212 * property="pubpid",
1213 * description="patient public id",
1218 * description="patient title",
1223 * description="patient first name",
1228 * description="patient middle name",
1233 * description="patient last name",
1238 * description="patient social security number",
1242 * property="street",
1243 * description="patient street address",
1247 * property="postal_code",
1248 * description="patient postal code",
1253 * description="patient city",
1258 * description="patient state",
1262 * property="county",
1263 * description="patient county",
1267 * property="country_code",
1268 * description="patient country code",
1272 * property="drivers_license",
1273 * description="patient drivers license id",
1277 * property="contact_relationship",
1278 * description="patient contact relationship",
1282 * property="phone_contact",
1283 * description="patient phone contact",
1287 * property="phone_home",
1288 * description="patient home phone",
1292 * property="phone_biz",
1293 * description="patient work phone",
1297 * property="phone_cell",
1298 * description="patient mobile phone",
1303 * description="patient email",
1308 * description="patient DOB",
1313 * description="patient sex (gender)",
1318 * description="patient race",
1322 * property="ethnicity",
1323 * description="patient ethnicity",
1327 * property="status",
1328 * description="patient status",
1334 * "validationErrors": {},
1335 * "error_description": {},
1345 * "street": "456 Tree Lane",
1346 * "postal_code": "08642",
1347 * "city": "FooTown",
1350 * "country_code": "US",
1351 * "drivers_license": "",
1352 * "contact_relationship": "",
1353 * "phone_contact": "123-456-7890",
1358 * "DOB": "1992-02-03",
1369 * path="/api/patient/{puuid}",
1370 * description="Updates a patient",
1371 * tags={"standard"},
1375 * description="The uuid for the patient.",
1384 * mediaType="application/json",
1385 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1390 * description="Standard response",
1392 * mediaType="application/json",
1393 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1398 * ref="#/components/responses/unauthorized"
1400 * security={{"openemr_auth":{}}}
1403 "PUT /api/patient/:puuid" => function ($puuid) {
1404 RestConfig
::authorization_check("patients", "demo");
1405 $data = (array) (json_decode(file_get_contents("php://input")));
1406 $return = (new PatientRestController())->put($puuid, $data);
1407 RestConfig
::apiLog($return, $data);
1413 * path="/api/patient/{puuid}",
1414 * description="Retrieves a single patient by their uuid",
1415 * tags={"standard"},
1419 * description="The uuid for the patient.",
1427 * description="Standard response",
1429 * mediaType="application/json",
1430 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1435 * ref="#/components/responses/unauthorized"
1437 * security={{"openemr_auth":{}}}
1440 "GET /api/patient/:puuid" => function ($puuid) {
1441 RestConfig
::authorization_check("patients", "demo");
1442 $return = (new PatientRestController())->getOne($puuid);
1443 RestConfig
::apiLog($return);
1449 * path="/api/patient/{puuid}/encounter",
1450 * description="Retrieves a list of encounters for a single patient",
1451 * tags={"standard"},
1455 * description="The uuid for the patient.",
1463 * ref="#/components/responses/standard"
1467 * ref="#/components/responses/badrequest"
1471 * ref="#/components/responses/unauthorized"
1473 * security={{"openemr_auth":{}}}
1476 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1477 RestConfig
::authorization_check("encounters", "auth_a");
1478 $return = (new EncounterRestController())->getAll($puuid);
1479 RestConfig
::apiLog($return);
1484 * Schema for the encounter request
1487 * schema="api_encounter_request",
1490 * description="The date of encounter.",
1494 * property="onset_date",
1495 * description="The onset date of encounter.",
1499 * property="reason",
1500 * description="The reason of encounter.",
1504 * property="facility",
1505 * description="The facility of encounter.",
1509 * property="pc_catid",
1510 * description="The pc_catid of encounter.",
1514 * property="facility_id",
1515 * description="The facility id of encounter.",
1519 * property="billing_facility",
1520 * description="The billing facility id of encounter.",
1524 * property="sensitivity",
1525 * description="The sensitivity of encounter.",
1529 * property="referral_source",
1530 * description="The referral source of encounter.",
1534 * property="pos_code",
1535 * description="The pos_code of encounter.",
1539 * property="external_id",
1540 * description="The external id of encounter.",
1544 * property="provider_id",
1545 * description="The provider id of encounter.",
1549 * property="class_code",
1550 * description="The class_code of encounter.",
1553 * required={"pc_catid", "class_code"},
1555 * "date":"2020-11-10",
1557 * "reason": "Pregnancy Test",
1558 * "facility": "Owerri General Hospital",
1560 * "facility_id": "3",
1561 * "billing_facility": "3",
1562 * "sensitivity": "normal",
1563 * "referral_source": "",
1565 * "external_id": "",
1566 * "provider_id": "1",
1567 * "class_code" : "AMB"
1573 * path="/api/patient/{puuid}/encounter",
1574 * description="Creates a new encounter",
1575 * tags={"standard"},
1579 * description="The uuid for the patient.",
1588 * mediaType="application/json",
1589 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1594 * description="Standard response",
1596 * mediaType="application/json",
1599 * property="validationErrors",
1600 * description="Validation errors.",
1607 * property="internalErrors",
1608 * description="Internal errors.",
1616 * description="Returned data.",
1620 * property="encounter",
1621 * description="encounter id",
1626 * description="encounter uuid",
1632 * "validationErrors": {},
1633 * "error_description": {},
1636 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1644 * ref="#/components/responses/unauthorized"
1646 * security={{"openemr_auth":{}}}
1649 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1650 RestConfig
::authorization_check("encounters", "auth_a");
1651 $data = (array) (json_decode(file_get_contents("php://input")));
1652 $return = (new EncounterRestController())->post($puuid, $data);
1653 RestConfig
::apiLog($return, $data);
1658 * Schema for the encounter response
1661 * schema="api_encounter_response",
1663 * property="validationErrors",
1664 * description="Validation errors.",
1671 * property="internalErrors",
1672 * description="Internal errors.",
1680 * description="Returned data.",
1685 * description="encounter id",
1690 * description="encounter uuid",
1695 * description="encounter date",
1699 * property="reason",
1700 * description="encounter reason",
1704 * property="facility",
1705 * description="encounter facility name",
1709 * property="facility_id",
1710 * description="encounter facility id name",
1715 * description="encounter for patient pid",
1719 * property="onset_date",
1720 * description="encounter onset date",
1724 * property="sensitivity",
1725 * description="encounter sensitivity",
1729 * property="billing_note",
1730 * description="encounter billing note",
1734 * property="pc_catid",
1735 * description="encounter pc_catid",
1739 * property="last_level_billed",
1740 * description="encounter last_level_billed",
1744 * property="last_level_closed",
1745 * description="encounter last_level_closed",
1749 * property="last_stmt_date",
1750 * description="encounter last_stmt_date",
1754 * property="stmt_count",
1755 * description="encounter stmt_count",
1759 * property="provider_id",
1760 * description="provider id",
1764 * property="supervisor_id",
1765 * description="encounter supervisor id",
1769 * property="invoice_refno",
1770 * description="encounter invoice_refno",
1774 * property="referral_source",
1775 * description="encounter referral source",
1779 * property="billing_facility",
1780 * description="encounter billing facility id",
1784 * property="external_id",
1785 * description="encounter external id",
1789 * property="pos_code",
1790 * description="encounter pos_code",
1794 * property="class_code",
1795 * description="encounter class_code",
1799 * property="class_title",
1800 * description="encounter class_title",
1804 * property="pc_catname",
1805 * description="encounter pc_catname",
1809 * property="billing_facility_name",
1810 * description="encounter billing facility name",
1816 * "validationErrors": {},
1817 * "error_description": {},
1820 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1821 * "date": "2019-09-14 00:00:00",
1822 * "reason": "Pregnancy Test",
1823 * "facility": "Owerri General Hospital",
1824 * "facility_id": "3",
1826 * "onset_date": "2019-04-20 00:00:00",
1827 * "sensitivity": "normal",
1828 * "billing_note": null,
1830 * "last_level_billed": "0",
1831 * "last_level_closed": "0",
1832 * "last_stmt_date": null,
1833 * "stmt_count": "0",
1834 * "provider_id": "1",
1835 * "supervisor_id": "0",
1836 * "invoice_refno": "",
1837 * "referral_source": "",
1838 * "billing_facility": "3",
1839 * "external_id": "",
1841 * "class_code": "AMB",
1842 * "class_title": "ambulatory",
1843 * "pc_catname": "Office Visit",
1844 * "billing_facility_name": "Owerri General Hospital"
1851 * path="/api/patient/{puuid}/encounter/{euuid}",
1852 * description="Modify a encounter",
1853 * tags={"standard"},
1857 * description="The uuid for the patient.",
1866 * description="The uuid for the encounter.",
1875 * mediaType="application/json",
1876 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1881 * description="Standard response",
1883 * mediaType="application/json",
1884 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1889 * ref="#/components/responses/unauthorized"
1891 * security={{"openemr_auth":{}}}
1894 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1895 RestConfig
::authorization_check("encounters", "auth_a");
1896 $data = (array) (json_decode(file_get_contents("php://input")));
1897 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1898 RestConfig
::apiLog($return, $data);
1904 * path="/api/patient/{puuid}/encounter/{euuid}",
1905 * description="Retrieves a single encounter for a patient",
1906 * tags={"standard"},
1910 * description="The uuid for the patient.",
1919 * description="The uuid for the encounter.",
1927 * description="Standard response",
1929 * mediaType="application/json",
1930 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1935 * ref="#/components/responses/unauthorized"
1937 * security={{"openemr_auth":{}}}
1940 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1941 RestConfig
::authorization_check("encounters", "auth_a");
1942 $return = (new EncounterRestController())->getOne($puuid, $euuid);
1943 RestConfig
::apiLog($return);
1949 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
1950 * description="Retrieves soap notes from an encounter for a patient",
1951 * tags={"standard"},
1955 * description="The pid for the patient.",
1964 * description="The id for the encounter.",
1972 * ref="#/components/responses/standard"
1976 * ref="#/components/responses/badrequest"
1980 * ref="#/components/responses/unauthorized"
1982 * security={{"openemr_auth":{}}}
1985 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
1986 RestConfig
::authorization_check("encounters", "notes");
1987 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
1988 RestConfig
::apiLog($return);
1993 * Schema for the vital request
1996 * schema="api_vital_request",
1999 * description="The bps of vitals.",
2004 * description="The bpd of vitals.",
2008 * property="weight",
2009 * description="The weight of vitals. (unit is lb)",
2013 * property="height",
2014 * description="The height of vitals. (unit is inches)",
2018 * property="temperature",
2019 * description="The temperature of temperature. (unit is F)",
2023 * property="temp_method",
2024 * description="The temp_method of vitals.",
2029 * description="The pulse of vitals.",
2033 * property="respiration",
2034 * description="The respiration of vitals.",
2039 * description="The note (ie. comments) of vitals.",
2043 * property="waist_circ",
2044 * description="The waist circumference of vitals. (unit is inches)",
2048 * property="head_circ",
2049 * description="The head circumference of vitals. (unit is inches)",
2053 * property="oxygen_saturation",
2054 * description="The oxygen_saturation of vitals.",
2062 * "temperature": "98",
2063 * "temp_method": "Oral",
2065 * "respiration": "20",
2066 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2067 * "waist_circ": "37",
2068 * "head_circ": "22.2",
2069 * "oxygen_saturation": "96"
2075 * path="/api/patient/{pid}/encounter/{eid}/vital",
2076 * description="Submits a new vitals form",
2077 * tags={"standard"},
2081 * description="The id for the patient.",
2090 * description="The id for the encounter.",
2099 * mediaType="application/json",
2100 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2105 * ref="#/components/responses/standard"
2109 * ref="#/components/responses/badrequest"
2113 * ref="#/components/responses/unauthorized"
2115 * security={{"openemr_auth":{}}}
2118 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2119 RestConfig
::authorization_check("encounters", "notes");
2120 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2121 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2122 RestConfig
::apiLog($return, $data);
2128 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2129 * description="Edit a vitals form",
2130 * tags={"standard"},
2134 * description="The id for the patient.",
2143 * description="The id for the encounter.",
2152 * description="The id for the vitalss form.",
2161 * mediaType="application/json",
2162 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2167 * ref="#/components/responses/standard"
2171 * ref="#/components/responses/badrequest"
2175 * ref="#/components/responses/unauthorized"
2177 * security={{"openemr_auth":{}}}
2180 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2181 RestConfig
::authorization_check("encounters", "notes");
2182 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2183 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2184 RestConfig
::apiLog($return, $data);
2190 * path="/api/patient/{pid}/encounter/{eid}/vital",
2191 * description="Retrieves all vitals from an encounter for a patient",
2192 * tags={"standard"},
2196 * description="The pid for the patient.",
2205 * description="The id for the encounter.",
2213 * ref="#/components/responses/standard"
2217 * ref="#/components/responses/badrequest"
2221 * ref="#/components/responses/unauthorized"
2223 * security={{"openemr_auth":{}}}
2226 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2227 RestConfig
::authorization_check("encounters", "notes");
2228 $return = (new EncounterRestController())->getVitals($pid, $eid);
2229 RestConfig
::apiLog($return);
2235 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2236 * description="Retrieves a vitals form from an encounter for a patient",
2237 * tags={"standard"},
2241 * description="The pid for the patient.",
2250 * description="The id for the encounter.",
2259 * description="The id for the vitals form.",
2267 * ref="#/components/responses/standard"
2271 * ref="#/components/responses/badrequest"
2275 * ref="#/components/responses/unauthorized"
2277 * security={{"openemr_auth":{}}}
2280 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2281 RestConfig
::authorization_check("encounters", "notes");
2282 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2283 RestConfig
::apiLog($return);
2289 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2290 * description="Retrieves a soap note from an encounter for a patient",
2291 * tags={"standard"},
2295 * description="The pid for the patient.",
2304 * description="The id for the encounter.",
2313 * description="The id for the soap note.",
2321 * ref="#/components/responses/standard"
2325 * ref="#/components/responses/badrequest"
2329 * ref="#/components/responses/unauthorized"
2331 * security={{"openemr_auth":{}}}
2334 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2335 RestConfig
::authorization_check("encounters", "notes");
2336 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2337 RestConfig
::apiLog($return);
2342 * Schema for the soap_note request
2345 * schema="api_soap_note_request",
2347 * property="subjective",
2348 * description="The subjective of soap note.",
2352 * property="objective",
2353 * description="The objective of soap note.",
2357 * property="assessment",
2358 * description="The assessment of soap note.",
2363 * description="The plan of soap note.",
2367 * "subjective": "The patient with mechanical fall and cut finger.",
2368 * "objective": "The patient with finger laceration on exam.",
2369 * "assessment": "The patient with finger laceration requiring sutures.",
2370 * "plan": "Sutured finger laceration."
2376 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2377 * description="Submits a new soap note",
2378 * tags={"standard"},
2382 * description="The id for the patient.",
2391 * description="The id for the encounter.",
2400 * mediaType="application/json",
2401 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2406 * ref="#/components/responses/standard"
2410 * ref="#/components/responses/badrequest"
2414 * ref="#/components/responses/unauthorized"
2416 * security={{"openemr_auth":{}}}
2419 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2420 RestConfig
::authorization_check("encounters", "notes");
2421 $data = (array) (json_decode(file_get_contents("php://input")));
2422 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2423 RestConfig
::apiLog($return, $data);
2429 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2430 * description="Edit a soap note",
2431 * tags={"standard"},
2435 * description="The id for the patient.",
2444 * description="The id for the encounter.",
2453 * description="The id for the soap noted.",
2462 * mediaType="application/json",
2463 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2468 * ref="#/components/responses/standard"
2472 * ref="#/components/responses/badrequest"
2476 * ref="#/components/responses/unauthorized"
2478 * security={{"openemr_auth":{}}}
2481 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2482 RestConfig
::authorization_check("encounters", "notes");
2483 $data = (array) (json_decode(file_get_contents("php://input")));
2484 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2485 RestConfig
::apiLog($return, $data);
2492 * path="/api/practitioner",
2493 * description="Retrieves a list of practitioners",
2494 * tags={"standard"},
2498 * description="The title for the practitioner.",
2507 * description="The first name for the practitioner.",
2516 * description="The last name for the practitioner.",
2525 * description="The middle name for the practitioner.",
2532 * name="federaltaxid",
2534 * description="The federal tax id for the practitioner.",
2541 * name="federaldrugid",
2543 * description="The federal drug id for the practitioner.",
2552 * description="The upin for the practitioner.",
2559 * name="facility_id",
2561 * description="The facility id for the practitioner.",
2570 * description="The facility for the practitioner.",
2579 * description="The npi for the practitioner.",
2588 * description="The email for the practitioner.",
2597 * description="The specialty for the practitioner.",
2606 * description="The billname for the practitioner.",
2615 * description="The url for the practitioner.",
2624 * description="The assistant for the practitioner.",
2631 * name="organization",
2633 * description="The organization for the practitioner.",
2640 * name="valedictory",
2642 * description="The valedictory for the practitioner.",
2651 * description="The street for the practitioner.",
2660 * description="The street (line 2) for the practitioner.",
2669 * description="The city for the practitioner.",
2678 * description="The state for the practitioner.",
2687 * description="The zip for the practitioner.",
2696 * description="The phone for the practitioner.",
2705 * description="The fax for the practitioner.",
2714 * description="The phonew1 for the practitioner.",
2723 * description="The phonecell for the practitioner.",
2732 * description="The notes for the practitioner.",
2739 * name="state_license_number2",
2741 * description="The state license number for the practitioner.",
2750 * description="The username for the practitioner.",
2758 * ref="#/components/responses/standard"
2762 * ref="#/components/responses/badrequest"
2766 * ref="#/components/responses/unauthorized"
2768 * security={{"openemr_auth":{}}}
2771 "GET /api/practitioner" => function () {
2772 RestConfig
::authorization_check("admin", "users");
2773 $return = (new PractitionerRestController())->getAll($_GET);
2774 RestConfig
::apiLog($return);
2780 * path="/api/practitioner/{pruuid}",
2781 * description="Retrieves a single practitioner by their uuid",
2782 * tags={"standard"},
2786 * description="The uuid for the practitioner.",
2794 * ref="#/components/responses/standard"
2798 * ref="#/components/responses/badrequest"
2802 * ref="#/components/responses/unauthorized"
2804 * security={{"openemr_auth":{}}}
2807 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2808 RestConfig
::authorization_check("admin", "users");
2809 $return = (new PractitionerRestController())->getOne($pruuid);
2810 RestConfig
::apiLog($return);
2816 * path="/api/practitioner",
2817 * description="Submits a new practitioner",
2818 * tags={"standard"},
2822 * mediaType="application/json",
2826 * description="The title for the practitioner.",
2831 * description="The first name for the practitioner.",
2836 * description="The middle name for the practitioner.",
2841 * description="The last name for the practitioner.",
2845 * property="federaltaxid",
2846 * description="The federal tax id for the practitioner.",
2850 * property="federaldrugid",
2851 * description="The federal drug id for the practitioner.",
2856 * description="The upin for the practitioner.",
2860 * property="facility_id",
2861 * description="The facility_id for the practitioner.",
2865 * property="facility",
2866 * description="The facility name for the practitioner.",
2871 * description="The npi for the practitioner.",
2876 * description="The email for the practitioner.",
2880 * property="specialty",
2881 * description="The specialty for the practitioner.",
2885 * property="billname",
2886 * description="The billname for the practitioner.",
2891 * description="The url for the practitioner.",
2895 * property="assistant",
2896 * description="The assistant for the practitioner.",
2900 * property="valedictory",
2901 * description="The valedictory for the practitioner.",
2905 * property="street",
2906 * description="The street address for the practitioner.",
2910 * property="streetb",
2911 * description="The streetb address for the practitioner.",
2916 * description="The city for the practitioner.",
2921 * description="The state for the practitioner.",
2926 * description="The zip for the practitioner.",
2931 * description="The phone for the practitioner.",
2936 * description="The fax for the practitioner.",
2940 * property="phonew1",
2941 * description="The phonew1 for the practitioner.",
2945 * property="phonecell",
2946 * description="The phonecell for the practitioner.",
2951 * description="The notes for the practitioner.",
2955 * property="state_license_number",
2956 * description="The state license number for the practitioner.",
2960 * property="username",
2961 * description="The username for the practitioner.",
2964 * required={"fname", "lname", "npi"},
2967 * "fname": "Eduardo",
2970 * "federaltaxid": "",
2971 * "federaldrugid": "",
2973 * "facility_id": "3",
2974 * "facility": "Your Clinic Name Here",
2975 * "npi": "12345678901",
2976 * "email": "info@pennfirm.com",
2980 * "assistant": null,
2981 * "organization": null,
2982 * "valedictory": null,
2983 * "street": "789 Third Avenue",
2984 * "streetb": "123 Cannaut Street",
2985 * "city": "San Diego",
2988 * "phone": "(619) 555-9827",
2990 * "phonew1": "(619) 555-7822",
2991 * "phonecell": "(619) 555-7821",
2993 * "state_license_number": "123456",
2994 * "username": "eduardoperez"
3001 * description="Standard response",
3003 * mediaType="application/json",
3006 * property="validationErrors",
3007 * description="Validation errors.",
3014 * property="internalErrors",
3015 * description="Internal errors.",
3023 * description="Returned data.",
3028 * description="practitioner id",
3033 * description="practitioner uuid",
3039 * "validationErrors": {},
3040 * "error_description": {},
3043 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3051 * ref="#/components/responses/unauthorized"
3053 * security={{"openemr_auth":{}}}
3056 "POST /api/practitioner" => function () {
3057 RestConfig
::authorization_check("admin", "users");
3058 $data = (array) (json_decode(file_get_contents("php://input")));
3059 $return = (new PractitionerRestController())->post($data);
3060 RestConfig
::apiLog($return, $data);
3066 * path="/api/practitioner/{pruuid}",
3067 * description="Edit a practitioner",
3068 * tags={"standard"},
3072 * description="The uuid for the practitioner.",
3081 * mediaType="application/json",
3085 * description="The title for the practitioner.",
3090 * description="The first name for the practitioner.",
3095 * description="The middle name for the practitioner.",
3100 * description="The last name for the practitioner.",
3104 * property="federaltaxid",
3105 * description="The federal tax id for the practitioner.",
3109 * property="federaldrugid",
3110 * description="The federal drug id for the practitioner.",
3115 * description="The upin for the practitioner.",
3119 * property="facility_id",
3120 * description="The facility_id for the practitioner.",
3124 * property="facility",
3125 * description="The facility name for the practitioner.",
3130 * description="The npi for the practitioner.",
3135 * description="The email for the practitioner.",
3139 * property="specialty",
3140 * description="The specialty for the practitioner.",
3144 * property="billname",
3145 * description="The billname for the practitioner.",
3150 * description="The url for the practitioner.",
3154 * property="assistant",
3155 * description="The assistant for the practitioner.",
3159 * property="valedictory",
3160 * description="The valedictory for the practitioner.",
3164 * property="street",
3165 * description="The street address for the practitioner.",
3169 * property="streetb",
3170 * description="The streetb address for the practitioner.",
3175 * description="The city for the practitioner.",
3180 * description="The state for the practitioner.",
3185 * description="The zip for the practitioner.",
3190 * description="The phone for the practitioner.",
3195 * description="The fax for the practitioner.",
3199 * property="phonew1",
3200 * description="The phonew1 for the practitioner.",
3204 * property="phonecell",
3205 * description="The phonecell for the practitioner.",
3210 * description="The notes for the practitioner.",
3214 * property="state_license_number",
3215 * description="The state license number for the practitioner.",
3219 * property="username",
3220 * description="The username for the practitioner.",
3228 * "street": "456 Tree Lane",
3230 * "city": "FooTown",
3232 * "phone": "123-456-7890"
3239 * description="Standard response",
3241 * mediaType="application/json",
3244 * property="validationErrors",
3245 * description="Validation errors.",
3252 * property="internalErrors",
3253 * description="Internal errors.",
3261 * description="Returned data.",
3266 * description="practitioner id",
3271 * description="practitioner uuid",
3276 * description="practitioner title",
3281 * description="practitioner fname",
3286 * description="practitioner lname",
3291 * description="practitioner mname",
3295 * property="federaltaxid",
3296 * description="practitioner federaltaxid",
3300 * property="federaldrugid",
3301 * description="practitioner federaldrugid",
3306 * description="practitioner upin",
3310 * property="facility_id",
3311 * description="practitioner facility_id",
3315 * property="facility",
3316 * description="practitioner facility",
3321 * description="practitioner npi",
3326 * description="practitioner email",
3330 * property="active",
3331 * description="practitioner active setting",
3335 * property="specialty",
3336 * description="practitioner specialty",
3340 * property="billname",
3341 * description="practitioner billname",
3346 * description="practitioner url",
3350 * property="assistant",
3351 * description="practitioner assistant",
3355 * property="organization",
3356 * description="practitioner organization",
3360 * property="valedictory",
3361 * description="practitioner valedictory",
3365 * property="street",
3366 * description="practitioner street",
3370 * property="streetb",
3371 * description="practitioner streetb",
3376 * description="practitioner city",
3381 * description="practitioner state",
3386 * description="practitioner zip",
3391 * description="practitioner phone",
3396 * description="fax",
3400 * property="phonew1",
3401 * description="practitioner phonew1",
3405 * property="phonecell",
3406 * description="practitioner phonecell",
3411 * description="practitioner notes",
3415 * property="state_license_number",
3416 * description="practitioner state license number",
3420 * property="abook_title",
3421 * description="practitioner abook title",
3425 * property="physician_title",
3426 * description="practitioner physician title",
3430 * property="physician_code",
3431 * description="practitioner physician code",
3437 * "validationErrors": {},
3438 * "error_description": {},
3441 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3446 * "federaltaxid": "",
3447 * "federaldrugid": "",
3449 * "facility_id": "3",
3450 * "facility": "Your Clinic Name Here",
3451 * "npi": "0123456789",
3452 * "email": "info@pennfirm.com",
3458 * "organization": "",
3459 * "valedictory": "",
3460 * "street": "456 Tree Lane",
3461 * "streetb": "123 Cannaut Street",
3462 * "city": "FooTown",
3465 * "phone": "123-456-7890",
3467 * "phonew1": "(619) 555-7822",
3468 * "phonecell": "(619) 555-7821",
3470 * "state_license_number": "123456",
3471 * "abook_title": null,
3472 * "physician_title": null,
3473 * "physician_code": null
3481 * ref="#/components/responses/unauthorized"
3483 * security={{"openemr_auth":{}}}
3486 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3487 RestConfig
::authorization_check("admin", "users");
3488 $data = (array) (json_decode(file_get_contents("php://input")));
3489 $return = (new PractitionerRestController())->patch($pruuid, $data);
3490 RestConfig
::apiLog($return, $data);
3496 * path="/api/medical_problem",
3497 * description="Retrieves a list of medical problems",
3498 * tags={"standard"},
3502 * description="The uuid for the patient.",
3509 * name="condition_uuid",
3511 * description="The uuid for the medical problem.",
3520 * description="The title for the medical problem.",
3529 * description="The start date for the medical problem.",
3538 * description="The end date for the medical problem.",
3547 * description="The diagnosis for the medical problem.",
3555 * ref="#/components/responses/standard"
3559 * ref="#/components/responses/badrequest"
3563 * ref="#/components/responses/unauthorized"
3565 * security={{"openemr_auth":{}}}
3568 "GET /api/medical_problem" => function () {
3569 RestConfig
::authorization_check("encounters", "notes");
3570 $return = (new ConditionRestController())->getAll();
3571 RestConfig
::apiLog($return);
3577 * path="/api/medical_problem/{muuid}",
3578 * description="Retrieves a single medical problem by their uuid",
3579 * tags={"standard"},
3583 * description="The uuid for the medical problem.",
3591 * ref="#/components/responses/standard"
3595 * ref="#/components/responses/badrequest"
3599 * ref="#/components/responses/unauthorized"
3601 * security={{"openemr_auth":{}}}
3604 "GET /api/medical_problem/:muuid" => function ($muuid) {
3605 RestConfig
::authorization_check("encounters", "notes");
3606 $return = (new ConditionRestController())->getOne($muuid);
3607 RestConfig
::apiLog($return);
3613 * path="/api/patient/{puuid}/medical_problem",
3614 * description="Retrieves all medical problems for a patient",
3615 * tags={"standard"},
3619 * description="The uuid for the patient.",
3627 * ref="#/components/responses/standard"
3631 * ref="#/components/responses/badrequest"
3635 * ref="#/components/responses/unauthorized"
3637 * security={{"openemr_auth":{}}}
3640 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3641 RestConfig
::authorization_check("encounters", "notes");
3642 $return = (new ConditionRestController())->getAll($puuid, "medical_problem");
3643 RestConfig
::apiLog($return);
3649 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3650 * description="Retrieves a medical problem for a patient",
3651 * tags={"standard"},
3655 * description="The uuid for the patient.",
3664 * description="The uuid for the medical problem.",
3672 * ref="#/components/responses/standard"
3676 * ref="#/components/responses/badrequest"
3680 * ref="#/components/responses/unauthorized"
3682 * security={{"openemr_auth":{}}}
3685 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3686 RestConfig
::authorization_check("patients", "med");
3687 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3688 RestConfig
::apiLog($return);
3693 * Schema for the medical_problem request
3696 * schema="api_medical_problem_request",
3699 * description="The title of medical problem.",
3703 * property="begdate",
3704 * description="The beginning date of medical problem.",
3708 * property="enddate",
3709 * description="The end date of medical problem.",
3713 * property="diagnosis",
3714 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3717 * required={"title", "begdate"},
3719 * "title": "Dermatochalasis",
3720 * "begdate": "2010-10-13",
3722 * "diagnosis": "ICD10:H02.839"
3728 * path="/api/patient/{puuid}/medical_problem",
3729 * description="Submits a new medical problem",
3730 * tags={"standard"},
3734 * description="The uuid for the patient.",
3743 * mediaType="application/json",
3744 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3749 * ref="#/components/responses/standard"
3753 * ref="#/components/responses/badrequest"
3757 * ref="#/components/responses/unauthorized"
3759 * security={{"openemr_auth":{}}}
3762 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3763 RestConfig
::authorization_check("patients", "med");
3764 $data = (array) (json_decode(file_get_contents("php://input")));
3765 $return = (new ConditionRestController())->post($puuid, $data);
3766 RestConfig
::apiLog($return, $data);
3772 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3773 * description="Edit a medical problem",
3774 * tags={"standard"},
3778 * description="The uuid for the patient.",
3787 * description="The uuid for the medical problem.",
3796 * mediaType="application/json",
3797 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3802 * ref="#/components/responses/standard"
3806 * ref="#/components/responses/badrequest"
3810 * ref="#/components/responses/unauthorized"
3812 * security={{"openemr_auth":{}}}
3815 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3816 RestConfig
::authorization_check("patients", "med");
3817 $data = (array) (json_decode(file_get_contents("php://input")));
3818 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3819 RestConfig
::apiLog($return, $data);
3825 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3826 * description="Delete a medical problem",
3827 * tags={"standard"},
3831 * description="The uuid for the patient.",
3840 * description="The uuid for the medical problem.",
3848 * ref="#/components/responses/standard"
3852 * ref="#/components/responses/badrequest"
3856 * ref="#/components/responses/unauthorized"
3858 * security={{"openemr_auth":{}}}
3861 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3862 RestConfig
::authorization_check("patients", "med");
3863 $return = (new ConditionRestController())->delete($puuid, $muuid);
3864 RestConfig
::apiLog($return);
3870 * path="/api/allergy",
3871 * description="Retrieves a list of allergies",
3872 * tags={"standard"},
3876 * description="The uuid for the patient.",
3885 * description="The uuid for the allergy.",
3894 * description="The title for the allergy.",
3903 * description="The start date for the allergy.",
3912 * description="The end date for the allergy.",
3921 * description="The diagnosis for the allergy.",
3929 * ref="#/components/responses/standard"
3933 * ref="#/components/responses/badrequest"
3937 * ref="#/components/responses/unauthorized"
3939 * security={{"openemr_auth":{}}}
3942 "GET /api/allergy" => function () {
3943 RestConfig
::authorization_check("patients", "med");
3944 $return = (new AllergyIntoleranceRestController())->getAll();
3945 RestConfig
::apiLog($return);
3951 * path="/api/allergy/{auuid}",
3952 * description="Retrieves a single allergy by their uuid",
3953 * tags={"standard"},
3957 * description="The uuid for the allergy.",
3965 * ref="#/components/responses/standard"
3969 * ref="#/components/responses/badrequest"
3973 * ref="#/components/responses/unauthorized"
3975 * security={{"openemr_auth":{}}}
3978 "GET /api/allergy/:auuid" => function ($auuid) {
3979 RestConfig
::authorization_check("patients", "med");
3980 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
3981 RestConfig
::apiLog($return);
3987 * path="/api/patient/{puuid}/allergy",
3988 * description="Retrieves all allergies for a patient",
3989 * tags={"standard"},
3993 * description="The uuid for the patient.",
4001 * ref="#/components/responses/standard"
4005 * ref="#/components/responses/badrequest"
4009 * ref="#/components/responses/unauthorized"
4011 * security={{"openemr_auth":{}}}
4014 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4015 RestConfig
::authorization_check("patients", "med");
4016 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4017 RestConfig
::apiLog($return);
4023 * path="/api/patient/{puuid}/allergy/{auuid}",
4024 * description="Retrieves a allergy for a patient",
4025 * tags={"standard"},
4029 * description="The uuid for the patient.",
4038 * description="The uuid for the allergy.",
4046 * ref="#/components/responses/standard"
4050 * ref="#/components/responses/badrequest"
4054 * ref="#/components/responses/unauthorized"
4056 * security={{"openemr_auth":{}}}
4059 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4060 RestConfig
::authorization_check("patients", "med");
4061 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4062 RestConfig
::apiLog($return);
4067 * Schema for the allergy request
4070 * schema="api_allergy_request",
4073 * description="The title of allergy.",
4077 * property="begdate",
4078 * description="The beginning date of allergy.",
4082 * property="enddate",
4083 * description="The end date of allergy.",
4087 * property="diagnosis",
4088 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4091 * required={"title", "begdate"},
4093 * "title": "Iodine",
4094 * "begdate": "2010-10-13",
4101 * path="/api/patient/{puuid}/allergy",
4102 * description="Submits a new allergy",
4103 * tags={"standard"},
4107 * description="The uuid for the patient.",
4116 * mediaType="application/json",
4117 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4122 * ref="#/components/responses/standard"
4126 * ref="#/components/responses/badrequest"
4130 * ref="#/components/responses/unauthorized"
4132 * security={{"openemr_auth":{}}}
4135 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4136 RestConfig
::authorization_check("patients", "med");
4137 $data = (array) (json_decode(file_get_contents("php://input")));
4138 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4139 RestConfig
::apiLog($return, $data);
4145 * path="/api/patient/{puuid}/allergy/{auuid}",
4146 * description="Edit a allergy",
4147 * tags={"standard"},
4151 * description="The uuid for the patient.",
4160 * description="The uuid for the allergy.",
4169 * mediaType="application/json",
4170 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4175 * ref="#/components/responses/standard"
4179 * ref="#/components/responses/badrequest"
4183 * ref="#/components/responses/unauthorized"
4185 * security={{"openemr_auth":{}}}
4188 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4189 RestConfig
::authorization_check("patients", "med");
4190 $data = (array) (json_decode(file_get_contents("php://input")));
4191 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4192 RestConfig
::apiLog($return, $data);
4198 * path="/api/patient/{puuid}/allergy/{auuid}",
4199 * description="Delete a medical problem",
4200 * tags={"standard"},
4204 * description="The uuid for the patient.",
4213 * description="The uuid for the allergy.",
4221 * ref="#/components/responses/standard"
4225 * ref="#/components/responses/badrequest"
4229 * ref="#/components/responses/unauthorized"
4231 * security={{"openemr_auth":{}}}
4234 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4235 RestConfig
::authorization_check("patients", "med");
4236 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4237 RestConfig
::apiLog($return);
4243 * path="/api/patient/{pid}/medication",
4244 * description="Retrieves all medications for a patient",
4245 * tags={"standard"},
4249 * description="The pid for the patient.",
4257 * ref="#/components/responses/standard"
4261 * ref="#/components/responses/badrequest"
4265 * ref="#/components/responses/unauthorized"
4267 * security={{"openemr_auth":{}}}
4270 "GET /api/patient/:pid/medication" => function ($pid) {
4271 RestConfig
::authorization_check("patients", "med");
4272 $return = (new ListRestController())->getAll($pid, "medication");
4273 RestConfig
::apiLog($return);
4278 * Schema for the medication request
4281 * schema="api_medication_request",
4284 * description="The title of medication.",
4288 * property="begdate",
4289 * description="The beginning date of medication.",
4293 * property="enddate",
4294 * description="The end date of medication.",
4298 * property="diagnosis",
4299 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4302 * required={"title", "begdate"},
4304 * "title": "Norvasc",
4305 * "begdate": "2013-04-13",
4312 * path="/api/patient/{pid}/medication",
4313 * description="Submits a new medication",
4314 * tags={"standard"},
4318 * description="The pid for the patient.",
4327 * mediaType="application/json",
4328 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4333 * ref="#/components/responses/standard"
4337 * ref="#/components/responses/badrequest"
4341 * ref="#/components/responses/unauthorized"
4343 * security={{"openemr_auth":{}}}
4346 "POST /api/patient/:pid/medication" => function ($pid) {
4347 RestConfig
::authorization_check("patients", "med");
4348 $data = (array) (json_decode(file_get_contents("php://input")));
4349 $return = (new ListRestController())->post($pid, "medication", $data);
4350 RestConfig
::apiLog($return, $data);
4356 * path="/api/patient/{pid}/medication/{mid}",
4357 * description="Edit a medication",
4358 * tags={"standard"},
4362 * description="The pid for the patient.",
4371 * description="The id for the medication.",
4380 * mediaType="application/json",
4381 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4386 * ref="#/components/responses/standard"
4390 * ref="#/components/responses/badrequest"
4394 * ref="#/components/responses/unauthorized"
4396 * security={{"openemr_auth":{}}}
4399 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4400 RestConfig
::authorization_check("patients", "med");
4401 $data = (array) (json_decode(file_get_contents("php://input")));
4402 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4403 RestConfig
::apiLog($return, $data);
4409 * path="/api/patient/{pid}/medication/{mid}",
4410 * description="Retrieves a medication for a patient",
4411 * tags={"standard"},
4415 * description="The id for the patient.",
4424 * description="The id for the medication.",
4432 * ref="#/components/responses/standard"
4436 * ref="#/components/responses/badrequest"
4440 * ref="#/components/responses/unauthorized"
4442 * security={{"openemr_auth":{}}}
4445 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4446 RestConfig
::authorization_check("patients", "med");
4447 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4448 RestConfig
::apiLog($return);
4454 * path="/api/patient/{pid}/medication/{mid}",
4455 * description="Delete a medication",
4456 * tags={"standard"},
4460 * description="The id for the patient.",
4469 * description="The id for the medication.",
4477 * ref="#/components/responses/standard"
4481 * ref="#/components/responses/badrequest"
4485 * ref="#/components/responses/unauthorized"
4487 * security={{"openemr_auth":{}}}
4490 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4491 RestConfig
::authorization_check("patients", "med");
4492 $return = (new ListRestController())->delete($pid, $mid, "medication");
4493 RestConfig
::apiLog($return);
4499 * path="/api/patient/{pid}/surgery",
4500 * description="Retrieves all surgeries for a patient",
4501 * tags={"standard"},
4505 * description="The pid for the patient.",
4513 * ref="#/components/responses/standard"
4517 * ref="#/components/responses/badrequest"
4521 * ref="#/components/responses/unauthorized"
4523 * security={{"openemr_auth":{}}}
4526 "GET /api/patient/:pid/surgery" => function ($pid) {
4527 RestConfig
::authorization_check("patients", "med");
4528 $return = (new ListRestController())->getAll($pid, "surgery");
4529 RestConfig
::apiLog($return);
4535 * path="/api/patient/{pid}/surgery/{sid}",
4536 * description="Retrieves a surgery for a patient",
4537 * tags={"standard"},
4541 * description="The id for the patient.",
4550 * description="The id for the surgery.",
4558 * ref="#/components/responses/standard"
4562 * ref="#/components/responses/badrequest"
4566 * ref="#/components/responses/unauthorized"
4568 * security={{"openemr_auth":{}}}
4571 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4572 RestConfig
::authorization_check("patients", "med");
4573 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4574 RestConfig
::apiLog($return);
4580 * path="/api/patient/{pid}/surgery/{sid}",
4581 * description="Delete a surgery",
4582 * tags={"standard"},
4586 * description="The id for the patient.",
4595 * description="The id for the surgery.",
4603 * ref="#/components/responses/standard"
4607 * ref="#/components/responses/badrequest"
4611 * ref="#/components/responses/unauthorized"
4613 * security={{"openemr_auth":{}}}
4616 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4617 RestConfig
::authorization_check("patients", "med");
4618 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4619 RestConfig
::apiLog($return);
4624 * Schema for the surgery request
4627 * schema="api_surgery_request",
4630 * description="The title of surgery.",
4634 * property="begdate",
4635 * description="The beginning date of surgery.",
4639 * property="enddate",
4640 * description="The end date of surgery.",
4644 * property="diagnosis",
4645 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4648 * required={"title", "begdate"},
4650 * "title": "Blepharoplasty",
4651 * "begdate": "2013-10-14",
4653 * "diagnosis": "CPT4:15823-50"
4659 * path="/api/patient/{pid}/surgery",
4660 * description="Submits a new surgery",
4661 * tags={"standard"},
4665 * description="The pid for the patient.",
4674 * mediaType="application/json",
4675 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4680 * ref="#/components/responses/standard"
4684 * ref="#/components/responses/badrequest"
4688 * ref="#/components/responses/unauthorized"
4690 * security={{"openemr_auth":{}}}
4693 "POST /api/patient/:pid/surgery" => function ($pid) {
4694 RestConfig
::authorization_check("patients", "med");
4695 $data = (array) (json_decode(file_get_contents("php://input")));
4696 $return = (new ListRestController())->post($pid, "surgery", $data);
4697 RestConfig
::apiLog($return, $data);
4703 * path="/api/patient/{pid}/surgery/{sid}",
4704 * description="Edit a surgery",
4705 * tags={"standard"},
4709 * description="The pid for the patient.",
4718 * description="The id for the surgery.",
4727 * mediaType="application/json",
4728 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4733 * ref="#/components/responses/standard"
4737 * ref="#/components/responses/badrequest"
4741 * ref="#/components/responses/unauthorized"
4743 * security={{"openemr_auth":{}}}
4746 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4747 RestConfig
::authorization_check("patients", "med");
4748 $data = (array) (json_decode(file_get_contents("php://input")));
4749 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4750 RestConfig
::apiLog($return, $data);
4756 * path="/api/patient/{pid}/dental_issue",
4757 * description="Retrieves all dental issues for a patient",
4758 * tags={"standard"},
4762 * description="The pid for the patient.",
4770 * ref="#/components/responses/standard"
4774 * ref="#/components/responses/badrequest"
4778 * ref="#/components/responses/unauthorized"
4780 * security={{"openemr_auth":{}}}
4783 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4784 RestConfig
::authorization_check("patients", "med");
4785 $return = (new ListRestController())->getAll($pid, "dental");
4786 RestConfig
::apiLog($return);
4792 * path="/api/patient/{pid}/dental_issue/{did}",
4793 * description="Retrieves a dental issue for a patient",
4794 * tags={"standard"},
4798 * description="The id for the patient.",
4807 * description="The id for the dental issue.",
4815 * ref="#/components/responses/standard"
4819 * ref="#/components/responses/badrequest"
4823 * ref="#/components/responses/unauthorized"
4825 * security={{"openemr_auth":{}}}
4828 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4829 RestConfig
::authorization_check("patients", "med");
4830 $return = (new ListRestController())->getOne($pid, "dental", $did);
4831 RestConfig
::apiLog($return);
4837 * path="/api/patient/{pid}/dental_issue/{did}",
4838 * description="Delete a dental issue",
4839 * tags={"standard"},
4843 * description="The id for the patient.",
4852 * description="The id for the dental issue.",
4860 * ref="#/components/responses/standard"
4864 * ref="#/components/responses/badrequest"
4868 * ref="#/components/responses/unauthorized"
4870 * security={{"openemr_auth":{}}}
4873 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4874 RestConfig
::authorization_check("patients", "med");
4875 $return = (new ListRestController())->delete($pid, $did, "dental");
4876 RestConfig
::apiLog($return);
4881 * Schema for the dental_issue request
4884 * schema="api_dental_issue_request",
4887 * description="The title of dental issue.",
4891 * property="begdate",
4892 * description="The beginning date of dental issue.",
4896 * property="enddate",
4897 * description="The end date of dental issue.",
4901 * property="diagnosis",
4902 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4905 * required={"title", "begdate"},
4907 * "title": "Halitosis",
4908 * "begdate": "2015-03-17",
4915 * path="/api/patient/{pid}/dental_issue",
4916 * description="Submits a new dental issue",
4917 * tags={"standard"},
4921 * description="The pid for the patient.",
4930 * mediaType="application/json",
4931 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4936 * ref="#/components/responses/standard"
4940 * ref="#/components/responses/badrequest"
4944 * ref="#/components/responses/unauthorized"
4946 * security={{"openemr_auth":{}}}
4949 "POST /api/patient/:pid/dental_issue" => function ($pid) {
4950 RestConfig
::authorization_check("patients", "med");
4951 $data = (array) (json_decode(file_get_contents("php://input")));
4952 $return = (new ListRestController())->post($pid, "dental", $data);
4953 RestConfig
::apiLog($return, $data);
4959 * path="/api/patient/{pid}/dental_issue/{did}",
4960 * description="Edit a dental issue",
4961 * tags={"standard"},
4965 * description="The pid for the patient.",
4974 * description="The id for the dental issue.",
4983 * mediaType="application/json",
4984 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
4989 * ref="#/components/responses/standard"
4993 * ref="#/components/responses/badrequest"
4997 * ref="#/components/responses/unauthorized"
4999 * security={{"openemr_auth":{}}}
5002 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5003 RestConfig
::authorization_check("patients", "med");
5004 $data = (array) (json_decode(file_get_contents("php://input")));
5005 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5006 RestConfig
::apiLog($return, $data);
5012 * path="/api/patient/{pid}/appointment",
5013 * description="Retrieves all appointments for a patient",
5014 * tags={"standard"},
5018 * description="The pid for the patient.",
5026 * ref="#/components/responses/standard"
5030 * ref="#/components/responses/badrequest"
5034 * ref="#/components/responses/unauthorized"
5036 * security={{"openemr_auth":{}}}
5039 "GET /api/patient/:pid/appointment" => function ($pid) {
5040 RestConfig
::authorization_check("patients", "appt");
5041 $return = (new AppointmentRestController())->getAllForPatient($pid);
5042 RestConfig
::apiLog($return);
5048 * path="/api/patient/{pid}/appointment",
5049 * description="Submits a new appointment",
5050 * tags={"standard"},
5054 * description="The id for the patient.",
5063 * mediaType="application/json",
5066 * property="pc_catid",
5067 * description="The category of the appointment.",
5071 * property="pc_title",
5072 * description="The title of the appointment.",
5076 * property="pc_duration",
5077 * description="The duration of the appointment.",
5081 * property="pc_hometext",
5082 * description="Comments for the appointment.",
5086 * property="pc_apptstatus",
5087 * description="use an option from resource=/api/list/apptstat",
5091 * property="pc_eventDate",
5092 * description="The date of the appointment.",
5096 * property="pc_startTime",
5097 * description="The time of the appointment.",
5101 * property="pc_facility",
5102 * description="The facility id of the appointment.",
5106 * property="pc_billing_location",
5107 * description="The billinag location id of the appointment.",
5111 * property="pc_aid",
5112 * description="The provider id for the appointment.",
5115 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5118 * "pc_title": "Office Visit",
5119 * "pc_duration": "900",
5120 * "pc_hometext": "Test",
5121 * "pc_apptstatus": "-",
5122 * "pc_eventDate": "2018-10-19",
5123 * "pc_startTime": "09:00",
5124 * "pc_facility": "9",
5125 * "pc_billing_location": "10",
5133 * ref="#/components/responses/standard"
5137 * ref="#/components/responses/badrequest"
5141 * ref="#/components/responses/unauthorized"
5143 * security={{"openemr_auth":{}}}
5146 "POST /api/patient/:pid/appointment" => function ($pid) {
5147 RestConfig
::authorization_check("patients", "appt");
5148 $data = (array) (json_decode(file_get_contents("php://input")));
5149 $return = (new AppointmentRestController())->post($pid, $data);
5150 RestConfig
::apiLog($return, $data);
5156 * path="/api/appointment",
5157 * description="Retrieves all appointments",
5158 * tags={"standard"},
5161 * ref="#/components/responses/standard"
5165 * ref="#/components/responses/badrequest"
5169 * ref="#/components/responses/unauthorized"
5171 * security={{"openemr_auth":{}}}
5174 "GET /api/appointment" => function () {
5175 RestConfig
::authorization_check("patients", "appt");
5176 $return = (new AppointmentRestController())->getAll();
5177 RestConfig
::apiLog($return);
5183 * path="/api/appointment/{eid}",
5184 * description="Retrieves an appointment",
5185 * tags={"standard"},
5189 * description="The eid for the appointment.",
5197 * ref="#/components/responses/standard"
5201 * ref="#/components/responses/badrequest"
5205 * ref="#/components/responses/unauthorized"
5207 * security={{"openemr_auth":{}}}
5210 "GET /api/appointment/:eid" => function ($eid) {
5211 RestConfig
::authorization_check("patients", "appt");
5212 $return = (new AppointmentRestController())->getOne($eid);
5213 RestConfig
::apiLog($return);
5219 * path="/api/patient/{pid}/appointment/{eid}",
5220 * description="Delete a appointment",
5221 * tags={"standard"},
5225 * description="The id for the patient.",
5234 * description="The eid for the appointment.",
5242 * ref="#/components/responses/standard"
5246 * ref="#/components/responses/badrequest"
5250 * ref="#/components/responses/unauthorized"
5252 * security={{"openemr_auth":{}}}
5255 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5256 RestConfig
::authorization_check("patients", "appt");
5257 $return = (new AppointmentRestController())->delete($eid);
5258 RestConfig
::apiLog($return);
5264 * path="/api/patient/{pid}/appointment/{eid}",
5265 * description="Retrieves a appointment for a patient",
5266 * tags={"standard"},
5270 * description="The id for the patient.",
5279 * description="The eid for the appointment.",
5287 * ref="#/components/responses/standard"
5291 * ref="#/components/responses/badrequest"
5295 * ref="#/components/responses/unauthorized"
5297 * security={{"openemr_auth":{}}}
5300 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5301 RestConfig
::authorization_check("patients", "appt");
5302 $return = (new AppointmentRestController())->getOne($eid);
5303 RestConfig
::apiLog($return);
5309 * path="/api/list/{list_name}",
5310 * description="Retrieves a list",
5311 * tags={"standard"},
5315 * description="The list_id of the list.",
5323 * ref="#/components/responses/standard"
5327 * ref="#/components/responses/badrequest"
5331 * ref="#/components/responses/unauthorized"
5333 * security={{"openemr_auth":{}}}
5336 "GET /api/list/:list_name" => function ($list_name) {
5337 RestConfig
::authorization_check("lists", "default");
5338 $return = (new ListRestController())->getOptions($list_name);
5339 RestConfig
::apiLog($return);
5345 * path="/api/version",
5346 * description="Retrieves the OpenEMR version information",
5347 * tags={"standard"},
5350 * ref="#/components/responses/standard"
5354 * ref="#/components/responses/badrequest"
5358 * ref="#/components/responses/unauthorized"
5360 * security={{"openemr_auth":{}}}
5363 "GET /api/version" => function () {
5364 $return = (new VersionRestController())->getOne();
5365 RestConfig
::apiLog($return);
5371 * path="/api/product",
5372 * description="Retrieves the OpenEMR product registration information",
5373 * tags={"standard"},
5376 * ref="#/components/responses/standard"
5380 * ref="#/components/responses/badrequest"
5384 * ref="#/components/responses/unauthorized"
5386 * security={{"openemr_auth":{}}}
5389 "GET /api/product" => function () {
5390 $return = (new ProductRegistrationRestController())->getOne();
5391 RestConfig
::apiLog($return);
5397 * path="/api/insurance_company",
5398 * description="Retrieves all insurance companies",
5399 * tags={"standard"},
5402 * ref="#/components/responses/standard"
5406 * ref="#/components/responses/badrequest"
5410 * ref="#/components/responses/unauthorized"
5412 * security={{"openemr_auth":{}}}
5415 "GET /api/insurance_company" => function () {
5416 $return = (new InsuranceCompanyRestController())->getAll();
5417 RestConfig
::apiLog($return);
5423 * path="/api/insurance_company/{iid}",
5424 * description="Retrieves insurance company",
5425 * tags={"standard"},
5429 * description="The id of the insurance company.",
5437 * ref="#/components/responses/standard"
5441 * ref="#/components/responses/badrequest"
5445 * ref="#/components/responses/unauthorized"
5447 * security={{"openemr_auth":{}}}
5450 "GET /api/insurance_company/:iid" => function ($iid) {
5451 $return = (new InsuranceCompanyRestController())->getOne($iid);
5452 RestConfig
::apiLog($return);
5458 * path="/api/insurance_type",
5459 * description="Retrieves all insurance types",
5460 * tags={"standard"},
5463 * ref="#/components/responses/standard"
5467 * ref="#/components/responses/badrequest"
5471 * ref="#/components/responses/unauthorized"
5473 * security={{"openemr_auth":{}}}
5476 "GET /api/insurance_type" => function () {
5477 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5478 RestConfig
::apiLog($return);
5483 * Schema for the insurance_company request
5486 * schema="api_insurance_company_request",
5489 * description="The name of insurance company.",
5494 * description="The attn of insurance company.",
5498 * property="cms_id",
5499 * description="The cms id of insurance company.",
5503 * property="ins_type_code",
5504 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5508 * property="x12_receiver_id",
5509 * description="The x12 receiver id of insurance company.",
5513 * property="x12_default_partner_id",
5514 * description="The x12 default partner id of insurance company.",
5518 * property="alt_cms_id",
5519 * description="The alternate cms id of insurance company.",
5524 * description="The line1 address of insurance company.",
5529 * description="The line2 address of insurance company.",
5534 * description="The city of insurance company.",
5539 * description="The state of insurance company.",
5544 * description="The zip of insurance company.",
5548 * property="country",
5549 * description="The country of insurance company.",
5552 * required={"name"},
5554 * "name": "Cool Insurance Company",
5557 * "ins_type_code": "2",
5558 * "x12_receiver_id": null,
5559 * "x12_default_partner_id": null,
5561 * "line1": "123 Cool Lane",
5562 * "line2": "Suite 123",
5563 * "city": "Cooltown",
5572 * path="/api/insurance_company",
5573 * description="Submits a new insurance company",
5574 * tags={"standard"},
5578 * mediaType="application/json",
5579 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5584 * ref="#/components/responses/standard"
5588 * ref="#/components/responses/badrequest"
5592 * ref="#/components/responses/unauthorized"
5594 * security={{"openemr_auth":{}}}
5597 "POST /api/insurance_company" => function () {
5598 $data = (array) (json_decode(file_get_contents("php://input")));
5599 $return = (new InsuranceCompanyRestController())->post($data);
5600 RestConfig
::apiLog($return, $data);
5606 * path="/api/insurance_company/{iid}",
5607 * description="Edit a insurance company",
5608 * tags={"standard"},
5612 * description="The id for the insurance company.",
5621 * mediaType="application/json",
5622 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5627 * ref="#/components/responses/standard"
5631 * ref="#/components/responses/badrequest"
5635 * ref="#/components/responses/unauthorized"
5637 * security={{"openemr_auth":{}}}
5640 "PUT /api/insurance_company/:iid" => function ($iid) {
5641 $data = (array) (json_decode(file_get_contents("php://input")));
5642 $return = (new InsuranceCompanyRestController())->put($iid, $data);
5643 RestConfig
::apiLog($return, $data);
5649 * path="/api/patient/{pid}/document",
5650 * description="Submits a new patient document",
5651 * tags={"standard"},
5655 * description="The pid for the patient.",
5664 * description="The category of the document.",
5673 * mediaType="multipart/form-data",
5676 * property="document",
5677 * description="document",
5686 * ref="#/components/responses/standard"
5690 * ref="#/components/responses/badrequest"
5694 * ref="#/components/responses/unauthorized"
5696 * security={{"openemr_auth":{}}}
5699 "POST /api/patient/:pid/document" => function ($pid) {
5700 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
5701 RestConfig
::apiLog($return);
5707 * path="/api/patient/{pid}/document",
5708 * description="Retrieves all file information of documents from a category for a patient",
5709 * tags={"standard"},
5713 * description="The pid for the patient.",
5722 * description="The category of the documents.",
5730 * ref="#/components/responses/standard"
5734 * ref="#/components/responses/badrequest"
5738 * ref="#/components/responses/unauthorized"
5740 * security={{"openemr_auth":{}}}
5743 "GET /api/patient/:pid/document" => function ($pid) {
5744 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
5745 RestConfig
::apiLog($return);
5751 * path="/api/patient/{pid}/document/{did}",
5752 * description="Retrieves a document for a patient",
5753 * tags={"standard"},
5757 * description="The pid for the patient.",
5766 * description="The id for the patient document.",
5774 * ref="#/components/responses/standard"
5778 * ref="#/components/responses/badrequest"
5782 * ref="#/components/responses/unauthorized"
5784 * security={{"openemr_auth":{}}}
5787 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
5788 $return = (new DocumentRestController())->downloadFile($pid, $did);
5789 RestConfig
::apiLog($return);
5795 * path="/api/patient/{pid}/insurance",
5796 * description="Retrieves all insurances for a patient",
5797 * tags={"standard"},
5801 * description="The pid for the patient.",
5809 * ref="#/components/responses/standard"
5813 * ref="#/components/responses/badrequest"
5817 * ref="#/components/responses/unauthorized"
5819 * security={{"openemr_auth":{}}}
5822 "GET /api/patient/:pid/insurance" => function ($pid) {
5823 $return = (new InsuranceRestController())->getAll($pid);
5824 RestConfig
::apiLog($return);
5830 * path="/api/patient/{pid}/insurance/{type}",
5831 * description="Retrieves a insurance (by type) for a patient",
5832 * tags={"standard"},
5836 * description="The pid for the patient.",
5845 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
5853 * ref="#/components/responses/standard"
5857 * ref="#/components/responses/badrequest"
5861 * ref="#/components/responses/unauthorized"
5863 * security={{"openemr_auth":{}}}
5866 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
5867 $return = (new InsuranceRestController())->getOne($pid, $type);
5868 RestConfig
::apiLog($return);
5873 * Schema for the insurance request
5876 * schema="api_insurance_request",
5878 * property="provider",
5879 * description="The insurance company id.",
5883 * property="plan_name",
5884 * description="The plan name of insurance.",
5888 * property="policy_number",
5889 * description="The policy number of insurance.",
5893 * property="group_number",
5894 * description="The group number of insurance.",
5898 * property="subscriber_lname",
5899 * description="The subscriber last name of insurance.",
5903 * property="subscriber_mname",
5904 * description="The subscriber middle name of insurance.",
5908 * property="subscriber_fname",
5909 * description="The subscriber first name of insurance.",
5913 * property="subscriber_relationship",
5914 * description="The subscriber relationship of insurance.",
5918 * property="subscriber_ss",
5919 * description="The subscriber ss number of insurance.",
5923 * property="subscriber_DOB",
5924 * description="The subscriber DOB of insurance.",
5928 * property="subscriber_street",
5929 * description="The subscriber street address of insurance.",
5933 * property="subscriber_postal_code",
5934 * description="The subscriber postal code of insurance.",
5938 * property="subscriber_city",
5939 * description="The subscriber city of insurance.",
5943 * property="subscriber_state",
5944 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
5948 * property="subscriber_country",
5949 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
5953 * property="subscriber_phone",
5954 * description="The subscriber phone of insurance.",
5958 * property="subscriber_employer",
5959 * description="The subscriber employer of insurance.",
5963 * property="subscriber_employer_street",
5964 * description="The subscriber employer street of insurance.",
5968 * property="subscriber_employer_postal_code",
5969 * description="The subscriber employer postal code of insurance.",
5973 * property="subscriber_employer_state",
5974 * description="The subscriber employer state of insurance.",
5978 * property="subscriber_employer_country",
5979 * description="The subscriber employer country of insurance.",
5983 * property="subscriber_employer_city",
5984 * description="The subscriber employer city of insurance.",
5989 * description="The copay of insurance.",
5994 * description="The date of insurance.",
5998 * property="subscriber_sex",
5999 * description="The subscriber sex of insurance.",
6003 * property="accept_assignment",
6004 * description="The accept_assignment of insurance.",
6008 * property="policy_type",
6009 * description="The policy_type of insurance.",
6012 * 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"},
6015 * "plan_name": "Some Plan",
6016 * "policy_number": "12345",
6017 * "group_number": "252412",
6018 * "subscriber_lname": "Tester",
6019 * "subscriber_mname": "Xi",
6020 * "subscriber_fname": "Foo",
6021 * "subscriber_relationship": "other",
6022 * "subscriber_ss": "234231234",
6023 * "subscriber_DOB": "2018-10-03",
6024 * "subscriber_street": "183 Cool St",
6025 * "subscriber_postal_code": "23418",
6026 * "subscriber_city": "Cooltown",
6027 * "subscriber_state": "AZ",
6028 * "subscriber_country": "USA",
6029 * "subscriber_phone": "234-598-2123",
6030 * "subscriber_employer": "Some Employer",
6031 * "subscriber_employer_street": "123 Heather Lane",
6032 * "subscriber_employer_postal_code": "23415",
6033 * "subscriber_employer_state": "AZ",
6034 * "subscriber_employer_country": "USA",
6035 * "subscriber_employer_city": "Cooltown",
6037 * "date": "2018-10-15",
6038 * "subscriber_sex": "Female",
6039 * "accept_assignment": "TRUE",
6040 * "policy_type": "a"
6046 * path="/api/patient/{pid}/insurance/{type}",
6047 * description="Submits a new patient insurance (with type)",
6048 * tags={"standard"},
6052 * description="The pid for the patient.",
6061 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6070 * mediaType="application/json",
6071 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6076 * ref="#/components/responses/standard"
6080 * ref="#/components/responses/badrequest"
6084 * ref="#/components/responses/unauthorized"
6086 * security={{"openemr_auth":{}}}
6089 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6090 $data = (array) (json_decode(file_get_contents("php://input")));
6091 $return = (new InsuranceRestController())->post($pid, $type, $data);
6092 RestConfig
::apiLog($return, $data);
6098 * path="/api/patient/{pid}/insurance/{type}",
6099 * description="Edit a patient insurance (by type)",
6100 * tags={"standard"},
6104 * description="The pid for the patient.",
6113 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6122 * mediaType="application/json",
6123 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6128 * ref="#/components/responses/standard"
6132 * ref="#/components/responses/badrequest"
6136 * ref="#/components/responses/unauthorized"
6138 * security={{"openemr_auth":{}}}
6141 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6142 $data = (array) (json_decode(file_get_contents("php://input")));
6143 $return = (new InsuranceRestController())->put($pid, $type, $data);
6144 RestConfig
::apiLog($return, $data);
6149 * Schema for the message request
6152 * schema="api_message_request",
6155 * description="The body of message.",
6159 * property="groupname",
6160 * description="The group name (usually is 'Default').",
6165 * description="The sender of the message.",
6170 * description="The recipient of the message.",
6175 * description="use an option from resource=/api/list/note_type",
6179 * property="message_status",
6180 * description="use an option from resource=/api/list/message_status",
6183 * required={"body", "groupname", "from", "to", "title", "message_status"},
6185 * "body": "Test 456",
6186 * "groupname": "Default",
6187 * "from": "Matthew",
6190 * "message_status": "New"
6196 * path="/api/patient/{pid}/message",
6197 * description="Submits a pnote message",
6198 * tags={"standard"},
6202 * description="The id for the patient.",
6211 * mediaType="application/json",
6212 * @OA\Schema(ref="#/components/schemas/api_message_request")
6217 * ref="#/components/responses/standard"
6221 * ref="#/components/responses/badrequest"
6225 * ref="#/components/responses/unauthorized"
6227 * security={{"openemr_auth":{}}}
6230 "POST /api/patient/:pid/message" => function ($pid) {
6231 RestConfig
::authorization_check("patients", "notes");
6232 $data = (array) (json_decode(file_get_contents("php://input")));
6233 $return = (new MessageRestController())->post($pid, $data);
6234 RestConfig
::apiLog($return, $data);
6241 * path="/api/patient/{pid}/message/{mid}",
6242 * description="Edit a pnote message",
6243 * tags={"standard"},
6247 * description="The id for the patient.",
6256 * description="The id for the pnote message.",
6265 * mediaType="application/json",
6266 * @OA\Schema(ref="#/components/schemas/api_message_request")
6271 * ref="#/components/responses/standard"
6275 * ref="#/components/responses/badrequest"
6279 * ref="#/components/responses/unauthorized"
6281 * security={{"openemr_auth":{}}}
6284 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6285 RestConfig
::authorization_check("patients", "notes");
6286 $data = (array) (json_decode(file_get_contents("php://input")));
6287 $return = (new MessageRestController())->put($pid, $mid, $data);
6288 RestConfig
::apiLog($return, $data);
6294 * path="/api/patient/{pid}/message/{mid}",
6295 * description="Delete a pnote message",
6296 * tags={"standard"},
6300 * description="The id for the patient.",
6309 * description="The id for the pnote message.",
6317 * ref="#/components/responses/standard"
6321 * ref="#/components/responses/badrequest"
6325 * ref="#/components/responses/unauthorized"
6327 * security={{"openemr_auth":{}}}
6330 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6331 RestConfig
::authorization_check("patients", "notes");
6332 $return = (new MessageRestController())->delete($pid, $mid);
6333 RestConfig
::apiLog($return);
6339 * path="/api/immunization",
6340 * description="Retrieves a list of immunizations",
6341 * tags={"standard"},
6343 * name="patient_id",
6345 * description="The pid for the patient.",
6354 * description="The id for the immunization.",
6363 * description="The uuid for the immunization.",
6370 * name="administered_date",
6372 * description="The administered date for the immunization.",
6379 * name="immunization_id",
6381 * description="The immunization list_id for the immunization.",
6390 * description="The cvx code for the immunization.",
6397 * name="manufacturer",
6399 * description="The manufacturer for the immunization.",
6406 * name="lot_number",
6408 * description="The lot number for the immunization.",
6415 * name="administered_by_id",
6417 * description="The administered by id for the immunization.",
6424 * name="administered_by",
6426 * description="The administered by for the immunization.",
6433 * name="education_date",
6435 * description="The education date for the immunization.",
6444 * description="The vis date for the immunization.",
6453 * description="The note for the immunization.",
6460 * name="create_date",
6462 * description="The create date for the immunization.",
6469 * name="update_date",
6471 * description="The update date for the immunization.",
6478 * name="created_by",
6480 * description="The created_by for the immunization.",
6487 * name="updated_by",
6489 * description="The updated_by for the immunization.",
6496 * name="amount_administered",
6498 * description="The amount administered for the immunization.",
6505 * name="amount_administered_unit",
6507 * description="The amount administered unit for the immunization.",
6514 * name="expiration_date",
6516 * description="The expiration date for the immunization.",
6525 * description="The route for the immunization.",
6532 * name="administration_site",
6534 * description="The administration site for the immunization.",
6541 * name="added_erroneously",
6543 * description="The added_erroneously for the immunization.",
6550 * name="external_id",
6552 * description="The external_id for the immunization.",
6559 * name="completion_status",
6561 * description="The completion status for the immunization.",
6568 * name="information_source",
6570 * description="The information source for the immunization.",
6577 * name="refusal_reason",
6579 * description="The refusal reason for the immunization.",
6586 * name="ordering_provider",
6588 * description="The ordering provider for the immunization.",
6596 * ref="#/components/responses/standard"
6600 * ref="#/components/responses/badrequest"
6604 * ref="#/components/responses/unauthorized"
6606 * security={{"openemr_auth":{}}}
6609 "GET /api/immunization" => function () {
6610 RestConfig
::authorization_check("patients", "med");
6611 $return = (new ImmunizationRestController())->getAll($_GET);
6612 RestConfig
::apiLog($return);
6618 * path="/api/immunization/{uuid}",
6619 * description="Retrieves a immunization",
6620 * tags={"standard"},
6624 * description="The uuid for the immunization.",
6632 * ref="#/components/responses/standard"
6636 * ref="#/components/responses/badrequest"
6640 * ref="#/components/responses/unauthorized"
6642 * security={{"openemr_auth":{}}}
6645 "GET /api/immunization/:uuid" => function ($uuid) {
6646 RestConfig
::authorization_check("patients", "med");
6647 $return = (new ImmunizationRestController())->getOne($uuid);
6648 RestConfig
::apiLog($return);
6654 * path="/api/procedure",
6655 * description="Retrieves a list of all procedures",
6656 * tags={"standard"},
6659 * ref="#/components/responses/standard"
6663 * ref="#/components/responses/badrequest"
6667 * ref="#/components/responses/unauthorized"
6669 * security={{"openemr_auth":{}}}
6672 "GET /api/procedure" => function () {
6673 RestConfig
::authorization_check("patients", "med");
6674 $return = (new ProcedureRestController())->getAll();
6675 RestConfig
::apiLog($return);
6681 * path="/api/procedure/{uuid}",
6682 * description="Retrieves a procedure",
6683 * tags={"standard"},
6687 * description="The uuid for the procedure.",
6695 * ref="#/components/responses/standard"
6699 * ref="#/components/responses/badrequest"
6703 * ref="#/components/responses/unauthorized"
6705 * security={{"openemr_auth":{}}}
6708 "GET /api/procedure/:uuid" => function ($uuid) {
6709 RestConfig
::authorization_check("patients", "med");
6710 $return = (new ProcedureRestController())->getOne($uuid);
6711 RestConfig
::apiLog($return);
6718 * description="Retrieves a list of all drugs",
6719 * tags={"standard"},
6722 * ref="#/components/responses/standard"
6726 * ref="#/components/responses/badrequest"
6730 * ref="#/components/responses/unauthorized"
6732 * security={{"openemr_auth":{}}}
6735 "GET /api/drug" => function () {
6736 RestConfig
::authorization_check("patients", "med");
6737 $return = (new DrugRestController())->getAll();
6738 RestConfig
::apiLog($return);
6744 * path="/api/drug/{uuid}",
6745 * description="Retrieves a drug",
6746 * tags={"standard"},
6750 * description="The uuid for the drug.",
6758 * ref="#/components/responses/standard"
6762 * ref="#/components/responses/badrequest"
6766 * ref="#/components/responses/unauthorized"
6768 * security={{"openemr_auth":{}}}
6771 "GET /api/drug/:uuid" => function ($uuid) {
6772 RestConfig
::authorization_check("patients", "med");
6773 $return = (new DrugRestController())->getOne($uuid);
6774 RestConfig
::apiLog($return);
6780 * path="/api/prescription",
6781 * description="Retrieves a list of all prescriptions",
6782 * tags={"standard"},
6785 * ref="#/components/responses/standard"
6789 * ref="#/components/responses/badrequest"
6793 * ref="#/components/responses/unauthorized"
6795 * security={{"openemr_auth":{}}}
6798 "GET /api/prescription" => function () {
6799 RestConfig
::authorization_check("patients", "med");
6800 $return = (new PrescriptionRestController())->getAll();
6801 RestConfig
::apiLog($return);
6807 * path="/api/prescription/{uuid}",
6808 * description="Retrieves a prescription",
6809 * tags={"standard"},
6813 * description="The uuid for the prescription.",
6821 * ref="#/components/responses/standard"
6825 * ref="#/components/responses/badrequest"
6829 * ref="#/components/responses/unauthorized"
6831 * security={{"openemr_auth":{}}}
6834 "GET /api/prescription/:uuid" => function ($uuid) {
6835 RestConfig
::authorization_check("patients", "med");
6836 $return = (new PrescriptionRestController())->getOne($uuid);
6837 RestConfig
::apiLog($return);
6842 use OpenEMR\Common\Http\StatusCode
;
6843 use OpenEMR\Common\Http\Psr17Factory
;
6844 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController
;
6845 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController
;
6846 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController
;
6847 use OpenEMR\RestControllers\FHIR\FhirConditionRestController
;
6848 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController
;
6849 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController
;
6850 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController
;
6851 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController
;
6852 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController
;
6853 use OpenEMR\RestControllers\FHIR\FhirExportRestController
;
6854 use OpenEMR\RestControllers\FHIR\FhirObservationRestController
;
6855 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController
;
6856 use OpenEMR\RestControllers\FHIR\FhirGoalRestController
;
6857 use OpenEMR\RestControllers\FHIR\FhirGroupRestController
;
6858 use OpenEMR\RestControllers\FHIR\FhirLocationRestController
;
6859 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController
;
6860 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController
;
6861 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController
;
6862 use OpenEMR\RestControllers\FHIR\FhirPatientRestController
;
6863 use OpenEMR\RestControllers\FHIR\FhirPersonRestController
;
6864 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController
;
6865 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController
;
6866 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController
;
6867 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController
;
6868 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController
;
6870 // Note that the fhir route includes both user role and patient role
6871 // (there is a mechanism in place to ensure patient role is binded
6872 // to only see the data of the one patient)
6873 RestConfig
::$FHIR_ROUTE_MAP = array(
6876 * path="/fhir/AllergyIntolerance",
6877 * description="Returns a list of AllergyIntolerance resources.",
6882 * description="The uuid for the AllergyIntolerance resource.",
6891 * description="The uuid for the patient.",
6899 * description="Standard Response",
6901 * mediaType="application/json",
6904 * property="json object",
6905 * description="FHIR Json object.",
6910 * "lastUpdated": "2021-09-14T09:13:51"
6912 * "resourceType": "Bundle",
6913 * "type": "collection",
6917 * "relation": "self",
6918 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
6927 * ref="#/components/responses/badrequest"
6931 * ref="#/components/responses/unauthorized"
6933 * security={{"openemr_auth":{}}}
6936 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest
$request) {
6937 $getParams = $request->getQueryParams();
6938 if ($request->isPatientRequest()) {
6939 // only allow access to data of binded patient
6940 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
6942 RestConfig
::authorization_check("patients", "med");
6943 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
6945 RestConfig
::apiLog($return);
6951 * path="/fhir/AllergyIntolerance/{uuid}",
6952 * description="Returns a single AllergyIntolerance resource.",
6957 * description="The uuid for the AllergyIntolerance resource.",
6965 * description="Standard Response",
6967 * mediaType="application/json",
6970 * property="json object",
6971 * description="FHIR Json object.",
6975 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
6978 * "lastUpdated": "2021-09-16T00:27:32+00:00"
6980 * "resourceType": "AllergyIntolerance",
6982 * "status": "additional",
6983 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
6985 * "clinicalStatus": {
6988 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
6990 * "display": "Active"
6994 * "verificationStatus": {
6997 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
6998 * "code": "confirmed",
6999 * "display": "Confirmed"
7006 * "criticality": "low",
7010 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7011 * "code": "unknown",
7012 * "display": "Unknown"
7017 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7021 * "manifestation": {
7025 * "system": "http://snomed.info/sct",
7026 * "code": "422587007",
7027 * "display": "Nausea"
7041 * ref="#/components/responses/badrequest"
7045 * ref="#/components/responses/unauthorized"
7049 * ref="#/components/responses/uuidnotfound"
7051 * security={{"openemr_auth":{}}}
7054 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest
$request) {
7055 if ($request->isPatientRequest()) {
7056 // only allow access to data of binded patient
7057 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7059 RestConfig
::authorization_check("patients", "med");
7060 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7062 RestConfig
::apiLog($return);
7068 * path="/fhir/CarePlan",
7069 * description="Returns a list of CarePlan resources.",
7074 * description="The uuid for the CarePlan resource.",
7083 * description="The uuid for the patient.",
7092 * description="The category of the CarePlan resource.",
7100 * description="Standard Response",
7102 * mediaType="application/json",
7105 * property="json object",
7106 * description="FHIR Json object.",
7111 * "lastUpdated": "2021-09-14T09:13:51"
7113 * "resourceType": "Bundle",
7114 * "type": "collection",
7118 * "relation": "self",
7119 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7128 * ref="#/components/responses/badrequest"
7132 * ref="#/components/responses/unauthorized"
7134 * security={{"openemr_auth":{}}}
7137 "GET /fhir/CarePlan" => function (HttpRestRequest
$request) {
7138 $getParams = $request->getQueryParams();
7139 if ($request->isPatientRequest()) {
7140 // only allow access to data of binded patient
7141 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7143 RestConfig
::authorization_check("patients", "med");
7144 $return = (new FhirCarePlanRestController())->getAll($getParams);
7146 RestConfig
::apiLog($return);
7152 * path="/fhir/CarePlan/{uuid}",
7153 * description="Returns a single CarePlan resource.",
7158 * description="The uuid for the CarePlan resource.",
7166 * description="Standard Response",
7168 * mediaType="application/json",
7171 * property="json object",
7172 * description="FHIR Json object.",
7176 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7179 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7181 * "resourceType": "CarePlan",
7183 * "status": "generated",
7184 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7186 * "status": "active",
7192 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7193 * "code": "assess-plan"
7198 * "description": "Treat flu.",
7200 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7209 * ref="#/components/responses/badrequest"
7213 * ref="#/components/responses/unauthorized"
7217 * ref="#/components/responses/uuidnotfound"
7219 * security={{"openemr_auth":{}}}
7222 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest
$request) {
7223 if ($request->isPatientRequest()) {
7224 // only allow access to data of binded patient
7225 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7227 RestConfig
::authorization_check("patients", "med");
7228 $return = (new FhirCarePlanRestController())->getOne($uuid);
7230 RestConfig
::apiLog($return);
7236 * path="/fhir/CareTeam",
7237 * description="Returns a list of CareTeam resources.",
7242 * description="The uuid for the CareTeam resource.",
7251 * description="The uuid for the patient.",
7260 * description="The status of the CarePlan resource.",
7268 * description="Standard Response",
7270 * mediaType="application/json",
7273 * property="json object",
7274 * description="FHIR Json object.",
7279 * "lastUpdated": "2021-09-14T09:13:51"
7281 * "resourceType": "Bundle",
7282 * "type": "collection",
7286 * "relation": "self",
7287 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
7296 * ref="#/components/responses/badrequest"
7300 * ref="#/components/responses/unauthorized"
7302 * security={{"openemr_auth":{}}}
7305 "GET /fhir/CareTeam" => function (HttpRestRequest
$request) {
7306 $getParams = $request->getQueryParams();
7307 if ($request->isPatientRequest()) {
7308 // only allow access to data of binded patient
7309 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
7311 RestConfig
::authorization_check("patients", "med");
7312 $return = (new FhirCareTeamRestController())->getAll($getParams);
7314 RestConfig
::apiLog($return);
7320 * path="/fhir/CareTeam/{uuid}",
7321 * description="Returns a single CareTeam resource.",
7326 * description="The uuid for the CareTeam resource.",
7334 * description="Standard Response",
7336 * mediaType="application/json",
7339 * property="json object",
7340 * description="FHIR Json object.",
7344 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
7347 * "lastUpdated": "2021-09-16T01:07:22+00:00"
7349 * "resourceType": "CareTeam",
7350 * "status": "active",
7352 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7361 * "system": "http://nucc.org/provider-taxonomy",
7362 * "code": "102L00000X",
7363 * "display": "Psychoanalyst"
7369 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
7370 * "type": "Practitioner"
7373 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7374 * "type": "Organization"
7382 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7383 * "code": "unknown",
7384 * "display": "Unknown"
7390 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
7391 * "type": "Organization"
7401 * ref="#/components/responses/badrequest"
7405 * ref="#/components/responses/unauthorized"
7409 * ref="#/components/responses/uuidnotfound"
7411 * security={{"openemr_auth":{}}}
7414 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest
$request) {
7415 if ($request->isPatientRequest()) {
7416 // only allow access to data of binded patient
7417 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
7419 RestConfig
::authorization_check("patients", "med");
7420 $return = (new FhirCareTeamRestController())->getOne($uuid);
7422 RestConfig
::apiLog($return);
7428 * path="/fhir/Condition",
7429 * description="Returns a list of Condition resources.",
7434 * description="The uuid for the Condition resource.",
7443 * description="The uuid for the patient.",
7451 * description="Standard Response",
7453 * mediaType="application/json",
7456 * property="json object",
7457 * description="FHIR Json object.",
7462 * "lastUpdated": "2021-09-14T09:13:51"
7464 * "resourceType": "Bundle",
7465 * "type": "collection",
7469 * "relation": "self",
7470 * "url": "https://localhost:9300/apis/default/fhir/Condition"
7479 * ref="#/components/responses/badrequest"
7483 * ref="#/components/responses/unauthorized"
7485 * security={{"openemr_auth":{}}}
7488 "GET /fhir/Condition" => function (HttpRestRequest
$request) {
7489 $getParams = $request->getQueryParams();
7490 if ($request->isPatientRequest()) {
7491 // only allow access to data of binded patient
7492 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
7494 RestConfig
::authorization_check("patients", "med");
7495 $return = (new FhirConditionRestController())->getAll($getParams);
7497 RestConfig
::apiLog($return);
7503 * path="/fhir/Condition/{uuid}",
7504 * description="Returns a single Condition resource.",
7509 * description="The uuid for the Condition resource.",
7517 * description="Standard Response",
7519 * mediaType="application/json",
7522 * property="json object",
7523 * description="FHIR Json object.",
7527 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
7530 * "lastUpdated": "2021-09-16T02:41:53+00:00"
7532 * "resourceType": "Condition",
7533 * "clinicalStatus": {
7536 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
7537 * "code": "inactive",
7538 * "display": "Inactive"
7542 * "verificationStatus": {
7545 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
7546 * "code": "unconfirmed",
7547 * "display": "Unconfirmed"
7555 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
7556 * "code": "problem-list-item",
7557 * "display": "Problem List Item"
7565 * "system": "http://snomed.info/sct",
7566 * "code": "444814009",
7572 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
7580 * ref="#/components/responses/badrequest"
7584 * ref="#/components/responses/unauthorized"
7588 * ref="#/components/responses/uuidnotfound"
7590 * security={{"openemr_auth":{}}}
7593 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest
$request) {
7594 if ($request->isPatientRequest()) {
7595 // only allow access to data of binded patient
7596 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
7598 RestConfig
::authorization_check("patients", "med");
7599 $return = (new FhirConditionRestController())->getOne($uuid);
7601 RestConfig
::apiLog($return);
7607 * path="/fhir/Coverage",
7608 * description="Returns a list of Coverage resources.",
7613 * description="The uuid for the Coverage resource.",
7622 * description="The uuid for the patient.",
7631 * description="The payor of the Coverage resource.",
7639 * description="Standard Response",
7641 * mediaType="application/json",
7644 * property="json object",
7645 * description="FHIR Json object.",
7650 * "lastUpdated": "2021-09-14T09:13:51"
7652 * "resourceType": "Bundle",
7653 * "type": "collection",
7657 * "relation": "self",
7658 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
7667 * ref="#/components/responses/badrequest"
7671 * ref="#/components/responses/unauthorized"
7673 * security={{"openemr_auth":{}}}
7678 * 1. Broken when trying to search with parameters.
7680 "GET /fhir/Coverage" => function (HttpRestRequest
$request) {
7681 RestConfig
::authorization_check("admin", "super");
7682 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
7683 RestConfig
::apiLog($return);
7689 * path="/fhir/Coverage/{uuid}",
7690 * description="Returns a single Coverage resource.",
7695 * description="The uuid for the Coverage resource.",
7703 * ref="#/components/responses/standard"
7707 * ref="#/components/responses/badrequest"
7711 * ref="#/components/responses/unauthorized"
7715 * ref="#/components/responses/uuidnotfound"
7717 * security={{"openemr_auth":{}}}
7722 * 1. Broken. Fix and then add standard response example.
7724 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest
$request) {
7725 RestConfig
::authorization_check("admin", "super");
7726 $return = (new FhirCoverageRestController())->getOne($uuid);
7727 RestConfig
::apiLog($return);
7733 * path="/fhir/Device",
7734 * description="Returns a list of Device resources.",
7739 * description="The uuid for the Device resource.",
7748 * description="The uuid for the patient.",
7756 * description="Standard Response",
7758 * mediaType="application/json",
7761 * property="json object",
7762 * description="FHIR Json object.",
7767 * "lastUpdated": "2021-09-14T09:13:51"
7769 * "resourceType": "Bundle",
7770 * "type": "collection",
7774 * "relation": "self",
7775 * "url": "https://localhost:9300/apis/default/fhir/Device"
7784 * ref="#/components/responses/badrequest"
7788 * ref="#/components/responses/unauthorized"
7790 * security={{"openemr_auth":{}}}
7793 "GET /fhir/Device" => function (HttpRestRequest
$request) {
7794 if ($request->isPatientRequest()) {
7795 // only allow access to data of binded patient
7796 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
7798 RestConfig
::authorization_check("admin", "super");
7799 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
7801 RestConfig
::apiLog($return);
7807 * path="/fhir/Device/{uuid}",
7808 * description="Returns a single Device resource.",
7813 * description="The uuid for the Device resource.",
7821 * description="Standard Response",
7823 * mediaType="application/json",
7826 * property="json object",
7827 * description="FHIR Json object.",
7831 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
7834 * "lastUpdated": "2021-09-18T19:28:59+00:00"
7836 * "resourceType": "Device",
7839 * "deviceIdentifier": "08717648200274",
7840 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
7843 * "distinctIdentifier": "A99971312345600",
7844 * "manufactureDate": "2013-02-01",
7845 * "expirationDate": "2014-02-01",
7846 * "lotNumber": "000000000000XYZ123",
7847 * "serialNumber": "000025",
7851 * "valueCode": "unknown",
7852 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
7857 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
7866 * ref="#/components/responses/badrequest"
7870 * ref="#/components/responses/unauthorized"
7874 * ref="#/components/responses/uuidnotfound"
7876 * security={{"openemr_auth":{}}}
7879 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest
$request) {
7880 if ($request->isPatientRequest()) {
7881 // only allow access to data of binded patient
7882 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
7884 RestConfig
::authorization_check("admin", "super");
7885 $return = (new FhirDeviceRestController())->getOne($uuid);
7887 RestConfig
::apiLog($return);
7893 * path="/fhir/DiagnosticReport",
7894 * description="Returns a list of DiagnosticReport resources.",
7899 * description="The uuid for the DiagnosticReport resource.",
7908 * description="The uuid for the patient.",
7917 * description="The code of the DiagnosticReport resource.",
7926 * description="The category of the DiagnosticReport resource.",
7935 * description="The datetime of the DiagnosticReport resource.",
7943 * description="Standard Response",
7945 * mediaType="application/json",
7948 * property="json object",
7949 * description="FHIR Json object.",
7954 * "lastUpdated": "2021-09-14T09:13:51"
7956 * "resourceType": "Bundle",
7957 * "type": "collection",
7961 * "relation": "self",
7962 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
7971 * ref="#/components/responses/badrequest"
7975 * ref="#/components/responses/unauthorized"
7977 * security={{"openemr_auth":{}}}
7980 "GET /fhir/DiagnosticReport" => function (HttpRestRequest
$request) {
7981 $getParams = $request->getQueryParams();
7982 if ($request->isPatientRequest()) {
7983 // only allow access to data of binded patient
7984 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
7986 RestConfig
::authorization_check("admin", "super");
7987 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
7989 RestConfig
::apiLog($return);
7995 * path="/fhir/DiagnosticReport/{uuid}",
7996 * description="Returns a single DiagnosticReport resource.",
8001 * description="The uuid for the DiagnosticReport resource.",
8009 * description="Standard Response",
8011 * mediaType="application/json",
8014 * property="json object",
8015 * description="FHIR Json object.",
8019 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8022 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8024 * "resourceType": "DiagnosticReport",
8025 * "status": "final",
8030 * "system": "http://loinc.org",
8031 * "code": "LP7839-6",
8032 * "display": "Pathology"
8040 * "system": "http://loinc.org",
8041 * "code": "11502-2",
8042 * "display": "Laboratory report"
8047 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8051 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8052 * "type": "Encounter"
8054 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8055 * "issued": "2015-06-22T00:00:00+00:00",
8058 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8059 * "type": "Organization"
8062 * "presentedForm": {
8064 * "contentType": "text/plain",
8065 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8074 * ref="#/components/responses/badrequest"
8078 * ref="#/components/responses/unauthorized"
8082 * ref="#/components/responses/uuidnotfound"
8084 * security={{"openemr_auth":{}}}
8087 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest
$request) {
8088 $getParams = $request->getQueryParams();
8089 if ($request->isPatientRequest()) {
8090 // only allow access to data of binded patient
8091 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8093 RestConfig
::authorization_check("admin", "super");
8094 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8096 RestConfig
::apiLog($return);
8102 * path="/fhir/DocumentReference",
8103 * description="Returns a list of DocumentReference resources.",
8108 * description="The uuid for the DocumentReference resource.",
8117 * description="The uuid for the patient.",
8126 * description="The type of the DocumentReference resource.",
8135 * description="The category of the DocumentReference resource.",
8144 * description="The datetime of the DocumentReference resource.",
8152 * description="Standard Response",
8154 * mediaType="application/json",
8157 * property="json object",
8158 * description="FHIR Json object.",
8163 * "lastUpdated": "2021-09-14T09:13:51"
8165 * "resourceType": "Bundle",
8166 * "type": "collection",
8170 * "relation": "self",
8171 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8180 * ref="#/components/responses/badrequest"
8184 * ref="#/components/responses/unauthorized"
8186 * security={{"openemr_auth":{}}}
8189 'GET /fhir/DocumentReference' => function (HttpRestRequest
$request) {
8190 $getParams = $request->getQueryParams();
8191 if ($request->isPatientRequest()) {
8192 // only allow access to data of binded patient
8193 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8195 RestConfig
::authorization_check("admin", "super");
8196 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8198 RestConfig
::apiLog($return);
8204 * path="/fhir/DocumentReference/{uuid}",
8205 * description="Returns a single DocumentReference resource.",
8210 * description="The uuid for the DocumentReference resource.",
8218 * description="Standard Response",
8220 * mediaType="application/json",
8223 * property="json object",
8224 * description="FHIR Json object.",
8228 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
8231 * "lastUpdated": "2021-09-19T03:17:51+00:00"
8233 * "resourceType": "DocumentReference",
8236 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
8239 * "status": "current",
8243 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
8245 * "display": "unknown"
8253 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
8254 * "code": "openemr-document",
8255 * "display": "OpenEMR Document"
8261 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8264 * "date": "2021-09-19T03:15:56+00:00",
8271 * "contentType": "image/gif",
8272 * "url": "https://localhost:9300/apis/default/fhir/Document/7/Binary"
8275 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
8276 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
8277 * "display": "mimeType Sufficient"
8287 * ref="#/components/responses/badrequest"
8291 * ref="#/components/responses/unauthorized"
8295 * ref="#/components/responses/uuidnotfound"
8297 * security={{"openemr_auth":{}}}
8300 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest
$request) {
8301 $getParams = $request->getQueryParams();
8302 if ($request->isPatientRequest()) {
8303 // only allow access to data of binded patient
8304 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
8306 RestConfig
::authorization_check("admin", "super");
8307 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
8309 RestConfig
::apiLog($return);
8315 * path="/fhir/Document/{id}/Binary",
8316 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8321 * description="The id for the Document.",
8329 * ref="#/components/responses/standard"
8333 * ref="#/components/responses/badrequest"
8337 * ref="#/components/responses/unauthorized"
8339 * security={{"openemr_auth":{}}}
8345 'GET /fhir/Document/:id/Binary' => function ($documentId, HttpRestRequest
$request) {
8346 // currently only allow users with the same permissions as export to take a file out
8347 // this could be relaxed to allow other types of files ie such as patient access etc.
8348 RestConfig
::authorization_check("admin", "users");
8350 // Grab the document id
8351 $docController = new \OpenEMR\RestControllers\FHIR\
FhirDocumentRestController($request);
8352 $response = $docController->downloadDocument($documentId, $request->getRequestUserId());
8358 * path="/fhir/Encounter",
8359 * description="Returns a list of Encounter resources.",
8364 * description="The uuid for the Encounter resource.",
8373 * description="The uuid for the patient.",
8382 * description="The datetime of the Encounter resource.",
8390 * description="Standard Response",
8392 * mediaType="application/json",
8395 * property="json object",
8396 * description="FHIR Json object.",
8401 * "lastUpdated": "2021-09-14T09:13:51"
8403 * "resourceType": "Bundle",
8404 * "type": "collection",
8408 * "relation": "self",
8409 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
8418 * ref="#/components/responses/badrequest"
8422 * ref="#/components/responses/unauthorized"
8424 * security={{"openemr_auth":{}}}
8427 "GET /fhir/Encounter" => function (HttpRestRequest
$request) {
8428 $getParams = $request->getQueryParams();
8429 if ($request->isPatientRequest()) {
8430 // only allow access to data of binded patient
8431 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
8433 RestConfig
::authorization_check("encounters", "auth_a");
8434 $return = (new FhirEncounterRestController())->getAll($getParams);
8436 RestConfig
::apiLog($return);
8442 * path="/fhir/Encounter/{uuid}",
8443 * description="Returns a single Encounter resource.",
8448 * description="The uuid for the Encounter resource.",
8456 * description="Standard Response",
8458 * mediaType="application/json",
8461 * property="json object",
8462 * description="FHIR Json object.",
8466 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
8469 * "lastUpdated": "2021-09-19T06:27:41+00:00"
8471 * "resourceType": "Encounter",
8474 * "system": "urn:ietf:rfc:3986",
8475 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
8478 * "status": "finished",
8480 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
8482 * "display": "ambulatory"
8488 * "system": "http://snomed.info/sct",
8489 * "code": "185349003",
8490 * "display": "Encounter for check up (procedure)"
8496 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
8505 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
8507 * "display": "Primary Performer"
8513 * "start": "2012-08-13T00:00:00+00:00"
8516 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
8517 * "type": "Practitioner"
8522 * "start": "2012-08-13T00:00:00+00:00"
8530 * ref="#/components/responses/badrequest"
8534 * ref="#/components/responses/unauthorized"
8538 * ref="#/components/responses/uuidnotfound"
8540 * security={{"openemr_auth":{}}}
8543 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest
$request) {
8544 if ($request->isPatientRequest()) {
8545 // only allow access to data of binded patient
8546 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
8548 RestConfig
::authorization_check("admin", "super");
8549 $return = (new FhirEncounterRestController())->getOne($uuid);
8551 RestConfig
::apiLog($return);
8557 * path="/fhir/Goal",
8558 * description="Returns a list of Condition resources.",
8563 * description="The uuid for the Goal resource.",
8572 * description="The uuid for the patient.",
8580 * description="Standard Response",
8582 * mediaType="application/json",
8585 * property="json object",
8586 * description="FHIR Json object.",
8591 * "lastUpdated": "2021-09-14T09:13:51"
8593 * "resourceType": "Bundle",
8594 * "type": "collection",
8598 * "relation": "self",
8599 * "url": "https://localhost:9300/apis/default/fhir/Goal"
8608 * ref="#/components/responses/badrequest"
8612 * ref="#/components/responses/unauthorized"
8614 * security={{"openemr_auth":{}}}
8617 "GET /fhir/Goal" => function (HttpRestRequest
$request) {
8618 $getParams = $request->getQueryParams();
8619 if ($request->isPatientRequest()) {
8620 // only allow access to data of binded patient
8621 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
8623 RestConfig
::authorization_check("admin", "super");
8624 $return = (new FhirGoalRestController())->getAll($getParams);
8626 RestConfig
::apiLog($return);
8632 * path="/fhir/Goal/{uuid}",
8633 * description="Returns a single Goal resource.",
8638 * description="The uuid for the Goal resource.",
8646 * description="Standard Response",
8648 * mediaType="application/json",
8651 * property="json object",
8652 * description="FHIR Json object.",
8656 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
8659 * "lastUpdated": "2021-09-19T06:45:58+00:00"
8661 * "resourceType": "Goal",
8662 * "lifecycleStatus": "active",
8664 * "text": "Eating more vegetables."
8667 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8675 * "valueCode": "unknown",
8676 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8680 * "detailString": "Eating more vegetables.",
8681 * "dueDate": "2021-09-09"
8690 * ref="#/components/responses/badrequest"
8694 * ref="#/components/responses/unauthorized"
8698 * ref="#/components/responses/uuidnotfound"
8700 * security={{"openemr_auth":{}}}
8703 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest
$request) {
8704 if ($request->isPatientRequest()) {
8705 // only allow access to data of binded patient
8706 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
8708 RestConfig
::authorization_check("admin", "super");
8709 $return = (new FhirGoalRestController())->getOne($uuid);
8711 RestConfig
::apiLog($return);
8717 * path="/fhir/Group",
8718 * description="Returns a list of Group resources.",
8723 * description="The uuid for the Group resource.",
8732 * description="The uuid for the patient.",
8740 * description="Standard Response",
8742 * mediaType="application/json",
8745 * property="json object",
8746 * description="FHIR Json object.",
8751 * "lastUpdated": "2021-09-14T09:13:51"
8753 * "resourceType": "Bundle",
8754 * "type": "collection",
8758 * "relation": "self",
8759 * "url": "https://localhost:9300/apis/default/fhir/Group"
8768 * ref="#/components/responses/badrequest"
8772 * ref="#/components/responses/unauthorized"
8774 * security={{"openemr_auth":{}}}
8780 'GET /fhir/Group' => function (HttpRestRequest
$request) {
8781 RestConfig
::authorization_check("admin", "users");
8782 $getParams = $request->getQueryParams();
8783 if ($request->isPatientRequest()) {
8784 // only allow access to data of binded patient
8785 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
8787 $return = (new FhirGroupRestController())->getAll($getParams);
8789 RestConfig
::apiLog($return);
8795 * path="/fhir/Group/{uuid}",
8796 * description="Returns a single Group resource.",
8801 * description="The uuid for the Group resource.",
8809 * ref="#/components/responses/standard"
8813 * ref="#/components/responses/badrequest"
8817 * ref="#/components/responses/unauthorized"
8821 * ref="#/components/responses/uuidnotfound"
8823 * security={{"openemr_auth":{}}}
8829 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest
$request) {
8830 RestConfig
::authorization_check("admin", "users");
8831 if ($request->isPatientRequest()) {
8832 // only allow access to data of binded patient
8833 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
8835 $return = (new FhirGroupRestController())->getOne($uuid);
8837 RestConfig
::apiLog($return);
8843 * path="/fhir/Group/{id}/$export",
8844 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
8848 * ref="#/components/responses/standard"
8852 * ref="#/components/responses/badrequest"
8856 * ref="#/components/responses/unauthorized"
8858 * security={{"openemr_auth":{}}}
8864 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest
$request) {
8865 RestConfig
::authorization_check("admin", "users");
8866 $fhirExportService = new FhirExportRestController($request);
8867 $exportParams = $request->getQueryParams();
8868 $exportParams['groupId'] = $groupId;
8869 $return = $fhirExportService->processExport(
8872 $request->getHeader('Accept'),
8873 $request->getHeader('Prefer')
8875 RestConfig
::apiLog($return);
8881 * path="/fhir/Immunization",
8882 * description="Returns a list of Immunization resources.",
8887 * description="The uuid for the Immunization resource.",
8896 * description="The uuid for the patient.",
8904 * description="Standard Response",
8906 * mediaType="application/json",
8909 * property="json object",
8910 * description="FHIR Json object.",
8915 * "lastUpdated": "2021-09-14T09:13:51"
8917 * "resourceType": "Bundle",
8918 * "type": "collection",
8922 * "relation": "self",
8923 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
8932 * ref="#/components/responses/badrequest"
8936 * ref="#/components/responses/unauthorized"
8938 * security={{"openemr_auth":{}}}
8943 * 1. Broken sql query.
8945 "GET /fhir/Immunization" => function (HttpRestRequest
$request) {
8946 $getParams = $request->getQueryParams();
8947 if ($request->isPatientRequest()) {
8948 // only allow access to data of binded patient
8949 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
8951 RestConfig
::authorization_check("patients", "med");
8952 $return = (new FhirImmunizationRestController())->getAll($getParams);
8954 RestConfig
::apiLog($return);
8960 * path="/fhir/Immunization/{uuid}",
8961 * description="Returns a single Immunization resource.",
8966 * description="The uuid for the Immunization resource.",
8974 * ref="#/components/responses/standard"
8978 * ref="#/components/responses/badrequest"
8982 * ref="#/components/responses/unauthorized"
8986 * ref="#/components/responses/uuidnotfound"
8988 * security={{"openemr_auth":{}}}
8993 * 1. Broken sql query.
8995 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest
$request) {
8996 if ($request->isPatientRequest()) {
8997 // only allow access to data of binded patient
8998 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9000 RestConfig
::authorization_check("patients", "med");
9001 $return = (new FhirImmunizationRestController())->getOne($uuid);
9003 RestConfig
::apiLog($return);
9009 * path="/fhir/Location",
9010 * description="Returns a list of Location resources.",
9015 * description="The uuid for the Location resource.",
9023 * description="Standard Response",
9025 * mediaType="application/json",
9028 * property="json object",
9029 * description="FHIR Json object.",
9034 * "lastUpdated": "2021-09-14T09:13:51"
9036 * "resourceType": "Bundle",
9037 * "type": "collection",
9041 * "relation": "self",
9042 * "url": "https://localhost:9300/apis/default/fhir/Location"
9051 * ref="#/components/responses/badrequest"
9055 * ref="#/components/responses/unauthorized"
9057 * security={{"openemr_auth":{}}}
9060 "GET /fhir/Location" => function (HttpRestRequest
$request) {
9061 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9062 RestConfig
::apiLog($return);
9068 * path="/fhir/Location/{uuid}",
9069 * description="Returns a single Location resource.",
9074 * description="The uuid for the Location resource.",
9082 * description="Standard Response",
9084 * mediaType="application/json",
9087 * property="json object",
9088 * description="FHIR Json object.",
9092 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9095 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9097 * "resourceType": "Location",
9098 * "status": "active",
9099 * "name": "Your Clinic Name Here",
9102 * "system": "phone",
9103 * "value": "000-000-0000"
9107 * "value": "000-000-0000"
9116 * ref="#/components/responses/badrequest"
9120 * ref="#/components/responses/unauthorized"
9124 * ref="#/components/responses/uuidnotfound"
9126 * security={{"openemr_auth":{}}}
9129 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest
$request) {
9130 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
9131 RestConfig
::apiLog($return);
9137 * path="/fhir/Medication",
9138 * description="Returns a list of Medication resources.",
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/Medication"
9170 * ref="#/components/responses/badrequest"
9174 * ref="#/components/responses/unauthorized"
9176 * security={{"openemr_auth":{}}}
9179 "GET /fhir/Medication" => function (HttpRestRequest
$request) {
9180 RestConfig
::authorization_check("patients", "med");
9181 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
9182 RestConfig
::apiLog($return);
9188 * path="/fhir/Medication/{uuid}",
9189 * description="Returns a single Medication resource.",
9194 * description="The uuid for the Medication resource.",
9202 * ref="#/components/responses/standard"
9206 * ref="#/components/responses/badrequest"
9210 * ref="#/components/responses/unauthorized"
9214 * ref="#/components/responses/uuidnotfound"
9216 * security={{"openemr_auth":{}}}
9221 * 1. Broken uuid validation.
9223 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest
$request) {
9224 RestConfig
::authorization_check("patients", "med");
9225 $return = (new FhirMedicationRestController())->getOne($uuid);
9226 RestConfig
::apiLog($return);
9232 * path="/fhir/MedicationRequest",
9233 * description="Returns a list of MedicationRequest resources.",
9238 * description="The uuid for the MedicationRequest resource.",
9247 * description="The uuid for the patient.",
9256 * description="The intent of the MedicationRequest resource.",
9265 * description="The status of the MedicationRequest resource.",
9273 * description="Standard Response",
9275 * mediaType="application/json",
9278 * property="json object",
9279 * description="FHIR Json object.",
9284 * "lastUpdated": "2021-09-14T09:13:51"
9286 * "resourceType": "Bundle",
9287 * "type": "collection",
9291 * "relation": "self",
9292 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
9301 * ref="#/components/responses/badrequest"
9305 * ref="#/components/responses/unauthorized"
9307 * security={{"openemr_auth":{}}}
9310 "GET /fhir/MedicationRequest" => function (HttpRestRequest
$request) {
9311 $getParams = $request->getQueryParams();
9312 if ($request->isPatientRequest()) {
9313 // only allow access to data of binded patient
9314 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
9316 RestConfig
::authorization_check("patients", "med");
9317 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
9319 RestConfig
::apiLog($return);
9325 * path="/fhir/MedicationRequest/{uuid}",
9326 * description="Returns a single MedicationRequest resource.",
9331 * description="The uuid for the MedicationRequest resource.",
9339 * description="Standard Response",
9341 * mediaType="application/json",
9344 * property="json object",
9345 * description="FHIR Json object.",
9349 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
9352 * "lastUpdated": "2021-09-20T04:03:14+00:00"
9354 * "resourceType": "MedicationRequest",
9355 * "status": "active",
9356 * "intent": "order",
9361 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
9362 * "code": "community",
9363 * "display": "Home/Community"
9368 * "reportedBoolean": false,
9369 * "medicationCodeableConcept": {
9372 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9373 * "code": "1738139",
9374 * "display": "Acetaminophen 325 MG Oral Tablet"
9379 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
9382 * "authoredOn": "2021-09-18T00:00:00+00:00",
9384 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9385 * "type": "Practitioner"
9393 * ref="#/components/responses/badrequest"
9397 * ref="#/components/responses/unauthorized"
9401 * ref="#/components/responses/uuidnotfound"
9403 * security={{"openemr_auth":{}}}
9406 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest
$request) {
9407 if ($request->isPatientRequest()) {
9408 // only allow access to data of binded patient
9409 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
9411 RestConfig
::authorization_check("patients", "med");
9412 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
9414 RestConfig
::apiLog($return);
9420 * path="/fhir/Observation",
9421 * description="Returns a list of Observation resources.",
9426 * description="The uuid for the Observation resource.",
9435 * description="The uuid for the patient.",
9444 * description="The code of the Observation resource.",
9453 * description="The category of the Observation resource.",
9462 * description="The datetime of the Observation resource.",
9470 * description="Standard Response",
9472 * mediaType="application/json",
9475 * property="json object",
9476 * description="FHIR Json object.",
9481 * "lastUpdated": "2021-09-14T09:13:51"
9483 * "resourceType": "Bundle",
9484 * "type": "collection",
9488 * "relation": "self",
9489 * "url": "https://localhost:9300/apis/default/fhir/Observation"
9498 * ref="#/components/responses/badrequest"
9502 * ref="#/components/responses/unauthorized"
9504 * security={{"openemr_auth":{}}}
9507 "GET /fhir/Observation" => function (HttpRestRequest
$request) {
9508 $getParams = $request->getQueryParams();
9509 if ($request->isPatientRequest()) {
9510 // only allow access to data of binded patient
9511 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
9513 RestConfig
::authorization_check("patients", "med");
9514 $return = (new FhirObservationRestController())->getAll($getParams);
9516 RestConfig
::apiLog($return);
9522 * path="/fhir/Observation/{uuid}",
9523 * description="Returns a single Observation resource.",
9528 * description="The uuid for the Observation resource.",
9536 * description="Standard Response",
9538 * mediaType="application/json",
9541 * property="json object",
9542 * description="FHIR Json object.",
9546 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
9549 * "lastUpdated": "2021-09-20T04:12:16+00:00"
9551 * "resourceType": "Observation",
9552 * "status": "final",
9557 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
9558 * "code": "vital-signs"
9566 * "system": "http://loinc.org",
9567 * "code": "85354-9",
9568 * "display": "Blood pressure systolic and diastolic"
9573 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9576 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
9582 * "system": "http://loinc.org",
9584 * "display": "Systolic blood pressure"
9588 * "valueQuantity": {
9591 * "system": "http://unitsofmeasure.org",
9599 * "system": "http://loinc.org",
9601 * "display": "Diastolic blood pressure"
9605 * "valueQuantity": {
9608 * "system": "http://unitsofmeasure.org",
9619 * ref="#/components/responses/badrequest"
9623 * ref="#/components/responses/unauthorized"
9627 * ref="#/components/responses/uuidnotfound"
9629 * security={{"openemr_auth":{}}}
9632 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest
$request) {
9633 if ($request->isPatientRequest()) {
9634 // only allow access to data of binded patient
9635 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
9637 RestConfig
::authorization_check("patients", "med");
9638 $return = (new FhirObservationRestController())->getOne($uuid);
9640 RestConfig
::apiLog($return);
9646 * path="/fhir/Organization",
9647 * description="Returns a list of Organization resources.",
9652 * description="The uuid for the Organization resource.",
9661 * description="The name of the Organization resource.",
9670 * description="The email of the Organization resource.",
9679 * description="The phone of the Organization resource.",
9688 * description="The telecom of the Organization resource.",
9697 * description="The address of the Organization resource.",
9704 * name="address-city",
9706 * description="The address-city of the Organization resource.",
9713 * name="address-postalcode",
9715 * description="The address-postalcode of the Organization resource.",
9722 * name="address-state",
9724 * description="The address-state of the Organization resource.",
9732 * description="Standard Response",
9734 * mediaType="application/json",
9737 * property="json object",
9738 * description="FHIR Json object.",
9743 * "lastUpdated": "2021-09-14T09:13:51"
9745 * "resourceType": "Bundle",
9746 * "type": "collection",
9750 * "relation": "self",
9751 * "url": "https://localhost:9300/apis/default/fhir/Organization"
9760 * ref="#/components/responses/badrequest"
9764 * ref="#/components/responses/unauthorized"
9766 * security={{"openemr_auth":{}}}
9769 "GET /fhir/Organization" => function (HttpRestRequest
$request) {
9770 if (!$request->isPatientRequest()) {
9771 RestConfig
::authorization_check("admin", "users");
9773 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
9774 RestConfig
::apiLog($return);
9780 * path="/fhir/Organization/{uuid}",
9781 * description="Returns a single Organization resource.",
9786 * description="The uuid for the Organization resource.",
9794 * description="Standard Response",
9796 * mediaType="application/json",
9799 * property="json object",
9800 * description="FHIR Json object.",
9804 * "id": "946da616-fae2-409d-b24d-56425bfb3316",
9807 * "lastUpdated": "2021-09-21T16:47:36+00:00"
9809 * "resourceType": "Organization",
9811 * "status": "generated",
9812 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Your Clinic Name Here</p></div>"
9819 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
9821 * "display": "Healthcare Provider"
9826 * "name": "Your Clinic Name Here",
9829 * "system": "phone",
9830 * "value": "000-000-0000",
9835 * "value": "000-000-0000",
9848 * ref="#/components/responses/badrequest"
9852 * ref="#/components/responses/unauthorized"
9856 * ref="#/components/responses/uuidnotfound"
9858 * security={{"openemr_auth":{}}}
9861 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
9862 $patientUUID = null;
9863 if (!$request->isPatientRequest()) {
9864 RestConfig
::authorization_check("admin", "users");
9866 $patientUUID = $request->getPatientUUIDString();
9868 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
9870 RestConfig
::apiLog($return);
9876 * path="/fhir/Organization",
9877 * description="Adds a Organization resource.",
9882 * mediaType="application/json",
9884 * description="The json object for the Organization resource.",
9891 * ref="#/components/responses/standard"
9895 * ref="#/components/responses/badrequest"
9899 * ref="#/components/responses/unauthorized"
9901 * security={{"openemr_auth":{}}}
9907 "POST /fhir/Organization" => function (HttpRestRequest
$request) {
9908 RestConfig
::authorization_check("admin", "super");
9909 $data = (array) (json_decode(file_get_contents("php://input"), true));
9910 $return = (new FhirOrganizationRestController())->post($data);
9911 RestConfig
::apiLog($return, $data);
9917 * path="/fhir/Organization/{uuid}",
9918 * description="Modifies a Organization resource.",
9923 * description="The uuid for the organization.",
9932 * mediaType="application/json",
9934 * description="The json object for the Organization resource.",
9941 * ref="#/components/responses/standard"
9945 * ref="#/components/responses/badrequest"
9949 * ref="#/components/responses/unauthorized"
9951 * security={{"openemr_auth":{}}}
9957 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
9958 RestConfig
::authorization_check("admin", "super");
9959 $data = (array) (json_decode(file_get_contents("php://input"), true));
9960 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
9961 RestConfig
::apiLog($return, $data);
9967 * path="/fhir/Patient",
9968 * description="Adds a Patient resource.",
9973 * mediaType="application/json",
9975 * description="The json object for the Patient resource.",
9982 * ref="#/components/responses/standard"
9986 * ref="#/components/responses/badrequest"
9990 * ref="#/components/responses/unauthorized"
9992 * security={{"openemr_auth":{}}}
9998 "POST /fhir/Patient" => function (HttpRestRequest
$request) {
9999 RestConfig
::authorization_check("patients", "demo");
10000 $data = (array) (json_decode(file_get_contents("php://input"), true));
10001 $return = (new FhirPatientRestController())->post($data);
10002 RestConfig
::apiLog($return, $data);
10008 * path="/fhir/Patient/{uuid}",
10009 * description="Modifies a Patient resource.",
10014 * description="The uuid for the Patient resource.",
10023 * mediaType="application/json",
10025 * description="The json object for the Patient resource.",
10032 * ref="#/components/responses/standard"
10036 * ref="#/components/responses/badrequest"
10040 * ref="#/components/responses/unauthorized"
10042 * security={{"openemr_auth":{}}}
10048 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
10049 RestConfig
::authorization_check("patients", "demo");
10050 $data = (array) (json_decode(file_get_contents("php://input"), true));
10051 $return = (new FhirPatientRestController())->put($uuid, $data);
10052 RestConfig
::apiLog($return, $data);
10058 * path="/fhir/Patient",
10059 * description="Returns a list of Patient resources.",
10064 * description="The uuid for the Patient resource.",
10071 * name="identifier",
10073 * description="The identifier of the Patient resource.",
10082 * description="The name of the Patient resource.",
10089 * name="birthdate",
10091 * description="The birthdate of the Patient resource.",
10100 * description="The gender of the Patient resource.",
10109 * description="The address of the Patient resource.",
10116 * name="address-city",
10118 * description="The address-city of the Patient resource.",
10125 * name="address-postalcode",
10127 * description="The address-postalcode of the Patient resource.",
10134 * name="address-state",
10136 * description="The address-state of the Patient resource.",
10145 * description="The email of the Patient resource.",
10154 * description="The family name of the Patient resource.",
10163 * description="The given name of the Patient resource.",
10172 * description="The phone number of the Patient resource.",
10181 * description="The fax number of the Patient resource.",
10189 * description="Standard Response",
10191 * mediaType="application/json",
10194 * property="json object",
10195 * description="FHIR Json object.",
10200 * "lastUpdated": "2021-09-14T09:13:51"
10202 * "resourceType": "Bundle",
10203 * "type": "collection",
10207 * "relation": "self",
10208 * "url": "https://localhost:9300/apis/default/fhir/Patient"
10217 * ref="#/components/responses/badrequest"
10221 * ref="#/components/responses/unauthorized"
10223 * security={{"openemr_auth":{}}}
10226 "GET /fhir/Patient" => function (HttpRestRequest
$request) {
10227 $params = $request->getQueryParams();
10228 if ($request->isPatientRequest()) {
10229 // only allow access to data of binded patient
10230 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
10231 // need to use getAll rather than getOne)
10232 $params['_id'] = $request->getPatientUUIDString();
10233 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
10235 RestConfig
::authorization_check("patients", "demo");
10236 $return = (new FhirPatientRestController())->getAll($params);
10238 RestConfig
::apiLog($return);
10244 * path="/fhir/Patient/$export",
10245 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
10249 * ref="#/components/responses/standard"
10253 * ref="#/components/responses/badrequest"
10257 * ref="#/components/responses/unauthorized"
10259 * security={{"openemr_auth":{}}}
10265 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
10266 'GET /fhir/Patient/$export' => function (HttpRestRequest
$request) {
10267 RestConfig
::authorization_check("admin", "users");
10268 $fhirExportService = new FhirExportRestController($request);
10269 $return = $fhirExportService->processExport(
10270 $request->getQueryParams(),
10272 $request->getHeader('Accept'),
10273 $request->getHeader('Prefer')
10275 RestConfig
::apiLog($return);
10281 * path="/fhir/Patient/{uuid}",
10282 * description="Returns a single Patient resource.",
10287 * description="The uuid for the Patient resource.",
10295 * description="Standard Response",
10297 * mediaType="application/json",
10300 * property="json object",
10301 * description="FHIR Json object.",
10305 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
10307 * "versionId": "1",
10308 * "lastUpdated": "2021-09-21T17:08:03+00:00"
10310 * "resourceType": "Patient",
10312 * "status": "generated",
10313 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
10317 * "valueCode": "F",
10318 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
10324 * "system": "urn:oid:2.16.840.1.113883.6.238",
10325 * "code": "1006-6",
10326 * "display": "Abenaki"
10328 * "url": "ombCategory"
10331 * "valueString": "Abenaki",
10335 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
10340 * "valueString": "Declined To Specify",
10344 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
10349 * "use": "official",
10353 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10358 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
10365 * "use": "official",
10366 * "family": "Von197",
10372 * "gender": "female",
10373 * "birthDate": "1970-07-03",
10379 * "city": "Boston",
10380 * "state": "Massachusetts",
10381 * "postalCode": "02215",
10383 * "start": "2020-09-21T17:08:03.532+00:00"
10387 * "communication": {
10392 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
10393 * "code": "unknown",
10394 * "display": "Unknown"
10406 * ref="#/components/responses/badrequest"
10410 * ref="#/components/responses/unauthorized"
10414 * ref="#/components/responses/uuidnotfound"
10416 * security={{"openemr_auth":{}}}
10419 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
10420 if ($request->isPatientRequest()) {
10421 // only allow access to data of binded patient
10422 if (empty($id) ||
($id != $request->getPatientUUIDString())) {
10423 throw new AccessDeniedException("patients", "demo", "patient id invalid");
10425 $id = $request->getPatientUUIDString();
10427 RestConfig
::authorization_check("patients", "demo");
10429 $return = (new FhirPatientRestController())->getOne($uuid);
10430 RestConfig
::apiLog($return);
10436 * path="/fhir/Person",
10437 * description="Returns a list of Person resources.",
10442 * description="The name of the Person resource.",
10451 * description="The active status of the Person resource.",
10460 * description="The address of the Person resource.",
10467 * name="address-city",
10469 * description="The address-city of the Person resource.",
10476 * name="address-postalcode",
10478 * description="The address-postalcode of the Person resource.",
10485 * name="address-state",
10487 * description="The address-state of the Person resource.",
10496 * description="The email of the Person resource.",
10505 * description="The family name of the Person resource.",
10514 * description="The given name of the Person resource.",
10523 * description="The phone number of the Person resource.",
10532 * description="The fax number of the Person resource.",
10540 * description="Standard Response",
10542 * mediaType="application/json",
10545 * property="json object",
10546 * description="FHIR Json object.",
10551 * "lastUpdated": "2021-09-14T09:13:51"
10553 * "resourceType": "Bundle",
10554 * "type": "collection",
10558 * "relation": "self",
10559 * "url": "https://localhost:9300/apis/default/fhir/Person"
10568 * ref="#/components/responses/badrequest"
10572 * ref="#/components/responses/unauthorized"
10574 * security={{"openemr_auth":{}}}
10579 * 1. Broken sql query.
10581 "GET /fhir/Person" => function (HttpRestRequest
$request) {
10582 RestConfig
::authorization_check("admin", "users");
10583 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
10584 RestConfig
::apiLog($return);
10590 * path="/fhir/Person/{uuid}",
10591 * description="Returns a single Person resource.",
10596 * description="The uuid for the Person resource.",
10604 * ref="#/components/responses/standard"
10608 * ref="#/components/responses/badrequest"
10612 * ref="#/components/responses/unauthorized"
10616 * ref="#/components/responses/uuidnotfound"
10618 * security={{"openemr_auth":{}}}
10623 * 1. Broken sql query.
10625 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest
$request) {
10626 RestConfig
::authorization_check("admin", "users");
10627 $return = (new FhirPersonRestController())->getOne($uuid);
10628 RestConfig
::apiLog($return);
10634 * path="/fhir/Practitioner",
10635 * description="Returns a list of Practitioner resources.",
10640 * description="The uuid for the Practitioner resource.",
10649 * description="The name of the Practitioner resource.",
10658 * description="The active status of the Practitioner resource.",
10667 * description="The address of the Practitioner resource.",
10674 * name="address-city",
10676 * description="The address-city of the Practitioner resource.",
10683 * name="address-postalcode",
10685 * description="The address-postalcode of the Practitioner resource.",
10692 * name="address-state",
10694 * description="The address-state of the Practitioner resource.",
10703 * description="The email of the Practitioner resource.",
10712 * description="The family name of the Practitioner resource.",
10721 * description="The given name of the Practitioner resource.",
10730 * description="The phone number of the Practitioner resource.",
10739 * description="The fax number of the Practitioner resource.",
10747 * description="Standard Response",
10749 * mediaType="application/json",
10752 * property="json object",
10753 * description="FHIR Json object.",
10758 * "lastUpdated": "2021-09-14T09:13:51"
10760 * "resourceType": "Bundle",
10761 * "type": "collection",
10765 * "relation": "self",
10766 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
10775 * ref="#/components/responses/badrequest"
10779 * ref="#/components/responses/unauthorized"
10781 * security={{"openemr_auth":{}}}
10784 "GET /fhir/Practitioner" => function (HttpRestRequest
$request) {
10786 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10787 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10788 // I don't believe patients are assigned to a particular practitioner
10789 // should we allow just open api access to admin information? Should we restrict particular pieces
10790 // of data in the practitioner side (phone number, address information) based on a permission set?
10791 if (!$request->isPatientRequest()) {
10792 RestConfig
::authorization_check("admin", "users");
10794 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
10795 RestConfig
::apiLog($return);
10801 * path="/fhir/Practitioner/{uuid}",
10802 * description="Returns a single Practitioner resource.",
10807 * description="The uuid for the Practitioner resource.",
10815 * description="Standard Response",
10817 * mediaType="application/json",
10820 * property="json object",
10821 * description="FHIR Json object.",
10825 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
10827 * "versionId": "1",
10828 * "lastUpdated": "2021-09-21T17:41:57+00:00"
10830 * "resourceType": "Practitioner",
10832 * "status": "generated",
10833 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
10837 * "system": "http://hl7.org/fhir/sid/us-npi",
10838 * "value": "11223344554543"
10844 * "use": "official",
10845 * "family": "Smith",
10857 * ref="#/components/responses/badrequest"
10861 * ref="#/components/responses/unauthorized"
10865 * ref="#/components/responses/uuidnotfound"
10867 * security={{"openemr_auth":{}}}
10870 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
10871 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
10872 // that is referenced in connected patient resources -- such as AllergyIntollerance.
10873 // I don't believe patients are assigned to a particular practitioner
10874 // should we allow just open api access to admin information? Should we restrict particular pieces
10875 // of data in the practitioner side (phone number, address information) based on a permission set?
10876 if (!$request->isPatientRequest()) {
10877 RestConfig
::authorization_check("admin", "users");
10879 $return = (new FhirPractitionerRestController())->getOne($uuid);
10880 RestConfig
::apiLog($return);
10886 * path="/fhir/Practitioner",
10887 * description="Adds a Practitioner resources.",
10892 * mediaType="application/json",
10894 * description="The json object for the Practitioner resource.",
10901 * ref="#/components/responses/standard"
10905 * ref="#/components/responses/badrequest"
10909 * ref="#/components/responses/unauthorized"
10911 * security={{"openemr_auth":{}}}
10916 * 1. Broken sql query.
10918 "POST /fhir/Practitioner" => function (HttpRestRequest
$request) {
10919 RestConfig
::authorization_check("admin", "users");
10920 $data = (array) (json_decode(file_get_contents("php://input"), true));
10921 $return = (new FhirPractitionerRestController())->post($data);
10922 RestConfig
::apiLog($return, $data);
10928 * path="/fhir/Practitioner/{uuid}",
10929 * description="Modify a Practitioner resource.",
10934 * description="The uuid for the Practitioner resource.",
10943 * mediaType="application/json",
10945 * description="The json object for the Practitioner resource.",
10952 * ref="#/components/responses/standard"
10956 * ref="#/components/responses/badrequest"
10960 * ref="#/components/responses/unauthorized"
10962 * security={{"openemr_auth":{}}}
10967 * 1. Broken sql query.
10969 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
10970 RestConfig
::authorization_check("admin", "users");
10971 $data = (array) (json_decode(file_get_contents("php://input"), true));
10972 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
10973 RestConfig
::apiLog($return, $data);
10979 * path="/fhir/PractitionerRole",
10980 * description="Returns a list of PractitionerRole resources.",
10983 * name="specialty",
10985 * description="The specialty of the PractitionerRole resource.",
10992 * name="practitioner",
10994 * description="The practitioner of the PractitionerRole resource.",
11002 * description="Standard Response",
11004 * mediaType="application/json",
11007 * property="json object",
11008 * description="FHIR Json object.",
11013 * "lastUpdated": "2021-09-14T09:13:51"
11015 * "resourceType": "Bundle",
11016 * "type": "collection",
11020 * "relation": "self",
11021 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
11030 * ref="#/components/responses/badrequest"
11034 * ref="#/components/responses/unauthorized"
11036 * security={{"openemr_auth":{}}}
11039 "GET /fhir/PractitionerRole" => function (HttpRestRequest
$request) {
11040 RestConfig
::authorization_check("admin", "users");
11041 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
11042 RestConfig
::apiLog($return);
11048 * path="/fhir/PractitionerRole/{uuid}",
11049 * description="Returns a single PractitionerRole resource.",
11054 * description="The uuid for the PractitionerRole resource.",
11062 * ref="#/components/responses/standard"
11066 * ref="#/components/responses/badrequest"
11070 * ref="#/components/responses/unauthorized"
11074 * ref="#/components/responses/uuidnotfound"
11076 * security={{"openemr_auth":{}}}
11081 * 1. Broken _id validation.
11083 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest
$request) {
11084 RestConfig
::authorization_check("admin", "users");
11085 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
11086 RestConfig
::apiLog($return);
11092 * path="/fhir/Procedure",
11093 * description="Returns a list of Procedure resources.",
11098 * description="The uuid for the Procedure resource.",
11107 * description="The uuid for the patient.",
11116 * description="The datetime of the Procedure resource.",
11124 * description="Standard Response",
11126 * mediaType="application/json",
11129 * property="json object",
11130 * description="FHIR Json object.",
11135 * "lastUpdated": "2021-09-14T09:13:51"
11137 * "resourceType": "Bundle",
11138 * "type": "collection",
11142 * "relation": "self",
11143 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
11152 * ref="#/components/responses/badrequest"
11156 * ref="#/components/responses/unauthorized"
11158 * security={{"openemr_auth":{}}}
11163 * 1. Broken sql query.
11165 "GET /fhir/Procedure" => function (HttpRestRequest
$request) {
11166 if ($request->isPatientRequest()) {
11167 // only allow access to data of binded patient
11168 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11170 RestConfig
::authorization_check("patients", "med");
11171 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
11173 RestConfig
::apiLog($return);
11179 * path="/fhir/Procedure/{uuid}",
11180 * description="Returns a single Procedure resource.",
11185 * description="The uuid for the Procedure resource.",
11193 * ref="#/components/responses/standard"
11197 * ref="#/components/responses/badrequest"
11201 * ref="#/components/responses/unauthorized"
11205 * ref="#/components/responses/uuidnotfound"
11207 * security={{"openemr_auth":{}}}
11212 * 1. Broken sql query.
11214 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest
$request) {
11215 if ($request->isPatientRequest()) {
11216 // only allow access to data of binded patient
11217 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
11219 RestConfig
::authorization_check("patients", "med");
11220 $return = (new FhirProcedureRestController())->getOne($uuid);
11222 RestConfig
::apiLog($return);
11228 * path="/fhir/Provenance/{uuid}",
11229 * description="Returns a single Provenance resource.",
11234 * description="The uuid for the Provenance resource.",
11242 * ref="#/components/responses/standard"
11246 * ref="#/components/responses/badrequest"
11250 * ref="#/components/responses/unauthorized"
11254 * ref="#/components/responses/uuidnotfound"
11256 * security={{"openemr_auth":{}}}
11262 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest
$request) {
11263 if ($request->isPatientRequest()) {
11264 // only allow access to data of binded patient
11265 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
11267 RestConfig
::authorization_check("admin", "super");
11268 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
11270 RestConfig
::apiLog($return);
11276 * path="/fhir/Provenance",
11277 * description="Returns a list of Provenance resources.",
11282 * description="The uuid for the Provenance resource.",
11290 * description="Standard Response",
11292 * mediaType="application/json",
11295 * property="json object",
11296 * description="FHIR Json object.",
11301 * "lastUpdated": "2021-09-14T09:13:51"
11303 * "resourceType": "Bundle",
11304 * "type": "collection",
11308 * "relation": "self",
11309 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
11318 * ref="#/components/responses/badrequest"
11322 * ref="#/components/responses/unauthorized"
11324 * security={{"openemr_auth":{}}}
11330 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
11331 // property to support which is why this endpoint exists.
11332 "GET /fhir/Provenance" => function (HttpRestRequest
$request) {
11333 if ($request->isPatientRequest()) {
11334 // only allow access to data of binded patient
11335 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
11337 // TODO: it seems like regular users should be able to grab authorship / provenance information
11338 RestConfig
::authorization_check("admin", "super");
11339 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
11341 RestConfig
::apiLog($return);
11349 * path="/fhir/metadata",
11350 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
11354 * description="Return CapabilityStatement resource of the fhir server"
11358 "GET /fhir/metadata" => function () {
11359 $return = (new FhirMetaDataRestController())->getMetaData();
11360 RestConfig
::apiLog($return);
11366 * path="/fhir/.well-known/smart-configuration",
11367 * description="Returns smart configuration of the fhir server.",
11371 * description="Return smart configuration of the fhir server"
11375 "GET /fhir/.well-known/smart-configuration" => function () {
11376 $authController = new \OpenEMR\RestControllers\
AuthorizationController();
11377 $return = (new \OpenEMR\RestControllers\SMART\
SMARTConfigurationController($authController))->getConfig();
11378 RestConfig
::apiLog($return);
11382 // FHIR root level operations
11386 * path="/fhir/$export",
11387 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11391 * ref="#/components/responses/standard"
11395 * ref="#/components/responses/badrequest"
11399 * ref="#/components/responses/unauthorized"
11401 * security={{"openemr_auth":{}}}
11407 'GET /fhir/$export' => function (HttpRestRequest
$request) {
11408 RestConfig
::authorization_check("admin", "users");
11409 $fhirExportService = new FhirExportRestController($request);
11410 $return = $fhirExportService->processExport(
11411 $request->getQueryParams(),
11413 $request->getHeader('Accept'),
11414 $request->getHeader('Prefer')
11416 RestConfig
::apiLog($return);
11420 // these two operations are adopted based on the documentation used in the IBM FHIR Server
11421 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
11422 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
11426 * path="/fhir/$bulkdata-status",
11427 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11431 * ref="#/components/responses/standard"
11435 * ref="#/components/responses/badrequest"
11439 * ref="#/components/responses/unauthorized"
11441 * security={{"openemr_auth":{}}}
11447 'GET /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
11448 RestConfig
::authorization_check("admin", "users");
11449 $jobUuidString = $request->getQueryParam('job');
11450 // if we were truly async we would return 202 here to say we are in progress with a JSON response
11451 // since OpenEMR data is so small we just return the JSON from the database
11452 $fhirExportService = new FhirExportRestController($request);
11453 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
11454 RestConfig
::apiLog($return);
11460 * path="/fhir/$bulkdata-status",
11461 * description="THIS ENDPOINT DOCUMENTATION IS UNDER CONSTRUCTION.",
11465 * ref="#/components/responses/standard"
11469 * ref="#/components/responses/badrequest"
11473 * ref="#/components/responses/unauthorized"
11475 * security={{"openemr_auth":{}}}
11481 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
11482 RestConfig
::authorization_check("admin", "users");
11483 $job = $request->getQueryParam('job');
11484 $fhirExportService = new FhirExportRestController($request);
11485 $return = $fhirExportService->processDeleteExportForJob($job);
11486 RestConfig
::apiLog($return);
11491 // Note that the portal (api) route is only for patient role
11492 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
11493 RestConfig
::$PORTAL_ROUTE_MAP = array(
11496 * path="/portal/patient",
11497 * description="Returns the patient.",
11498 * tags={"standard-patient"},
11501 * description="Standard response",
11503 * mediaType="application/json",
11504 * @OA\Schema(ref="#/components/schemas/api_patient_response")
11509 * ref="#/components/responses/unauthorized"
11511 * security={{"openemr_auth":{}}}
11514 "GET /portal/patient" => function (HttpRestRequest
$request) {
11515 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
11516 RestConfig
::apiLog($return);
11522 * path="/portal/patient/encounter",
11523 * description="Returns encounters for the patient.",
11524 * tags={"standard-patient"},
11527 * ref="#/components/responses/standard"
11531 * ref="#/components/responses/badrequest"
11535 * ref="#/components/responses/unauthorized"
11537 * security={{"openemr_auth":{}}}
11540 "GET /portal/patient/encounter" => function (HttpRestRequest
$request) {
11541 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
11542 RestConfig
::apiLog($return);
11548 * path="/portal/patient/encounter/{euuid}",
11549 * description="Returns a selected encounter by its uuid.",
11550 * tags={"standard-patient"},
11554 * description="The uuid for the encounter.",
11562 * ref="#/components/responses/standard"
11566 * ref="#/components/responses/badrequest"
11570 * ref="#/components/responses/unauthorized"
11572 * security={{"openemr_auth":{}}}
11575 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest
$request) {
11576 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
11577 RestConfig
::apiLog($return);