8 * @link http://www.open-emr.org
9 * @author Matthew Vita <matthewvita48@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @author Yash Raj Bothra <yashrajbothra786@gmail.com>
13 * @author Stephen Nielson <snielson@discoverandchange.com>
14 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
15 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
16 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
17 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
18 * @copyright Copyright (c) 2024 Care Management Solutions, Inc. <stephen.waite@cmsvt.com>
19 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
23 * @OA\Info(title="OpenEMR API", version="7.0.3")
24 * @OA\Server(url="/apis/default/")
26 * securityScheme="openemr_auth",
29 * authorizationUrl="/oauth2/default/authorize",
30 * tokenUrl="/oauth2/default/token",
31 * refreshUrl="/oauth2/default/token",
32 * flow="authorizationCode",
34 * "openid": "Generic mandatory scope",
35 * "offline_access": "Will signal server to provide a refresh token",
36 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
37 * "api:fhir": "FHIR R4 API",
38 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
39 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
40 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
41 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
42 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
43 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
44 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
45 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
46 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
47 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
48 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
49 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
50 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
51 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
52 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
53 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
54 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
55 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
56 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
57 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
58 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
59 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
60 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
61 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
62 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
63 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
64 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
65 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
66 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
67 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
68 * "system/Device.read": "Read all device resources in the system (api:fhir)",
69 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
70 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
71 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
72 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
73 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
74 * "system/Group.read": "Read all group resources in the system (api:fhir)",
75 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
76 * "system/Location.read": "Read all location resources in the system (api:fhir)",
77 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
78 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
79 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
80 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
81 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
82 * "system/Person.read": "Read all person resources in the system (api:fhir)",
83 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
84 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
85 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
86 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
87 * "system/ValueSet.read": "Read all valueSet resources in the system (api:fhir)",
88 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
89 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
90 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
91 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
92 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
93 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
94 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
95 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
96 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
97 * "user/DocumentReference.$docref" : "Generate a document for any patient the user has access to or returns the most current Clinical Summary of Care Document (CCD) (api:fhir)",
98 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
99 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
100 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
101 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
102 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
103 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
104 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
105 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
106 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
107 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
108 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
109 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
110 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
111 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
112 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
113 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
114 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
115 * "user/ValueSet.read": "Read all valueSet resources the user has access to (api:fhir)",
116 * "api:oemr": "Standard OpenEMR API",
117 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
118 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
119 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
120 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
121 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
122 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
123 * "user/document.read": "Read documents the user has access to (api:oemr)",
124 * "user/document.write": "Write documents the user has access to (api:oemr)",
125 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
126 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
127 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
128 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
129 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
130 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
131 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
132 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
133 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
134 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
135 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
136 * "user/list.read": "Read lists the user has access to (api:oemr)",
137 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
138 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
139 * "user/medication.read": "Read medications the user has access to (api:oemr)",
140 * "user/medication.write": "Write medications the user has access to (api:oemr)",
141 * "user/message.write": "Read messages the user has access to (api:oemr)",
142 * "user/patient.read": "Read patients the user has access to (api:oemr)",
143 * "user/patient.write": "Write patients the user has access to (api:oemr)",
144 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
145 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
146 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
147 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
148 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
149 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
150 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
151 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
152 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
153 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
154 * "user/user.read": "Read users the current user has access to (api:oemr)",
155 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
156 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
157 * "api:port": "Standard Patient Portal OpenEMR API",
158 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
159 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
160 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
166 * description="FHIR R4 API"
170 * description="Standard OpenEMR API"
173 * name="standard-patient",
174 * description="Standard Patient Portal OpenEMR API"
180 * description="The sort criteria specified in comma separated order with Descending order being specified by a dash before the search parameter name. (Example: name,-category)",
187 * name="_lastUpdated",
189 * parameter="_lastUpdated",
190 * description="The date the resource was last updated.",
197 * response="standard",
198 * description="Standard Response",
200 * mediaType="application/json",
203 * property="validationErrors",
204 * description="Validation errors.",
211 * property="internalErrors",
212 * description="Internal errors.",
220 * description="Returned data.",
227 * "validationErrors": {},
228 * "error_description": {},
235 * response="badrequest",
236 * description="Bad Request",
238 * mediaType="application/json",
241 * property="validationErrors",
242 * description="Validation errors.",
246 * "validationErrors":
248 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
255 * response="unauthorized",
256 * description="Unauthorized",
258 * mediaType="application/json",
262 * description="The error.",
266 * property="error_description",
267 * description="The description of the error.",
272 * description="More specific information on the error.",
276 * property="message",
277 * description="Message regarding the error.",
281 * "error": "access_denied",
282 * "error_description": "The resource owner or authorization server denied the request.",
283 * "hint": "Missing ""Authorization"" header",
284 * "message": "The resource owner or authorization server denied the request."
290 * response="uuidnotfound",
291 * description="Not Found",
293 * mediaType="application/json",
297 * description="empty",
306 // Lets keep our controller classes with the routes.
308 use OpenEMR\Common\Acl\AccessDeniedException
;
309 use OpenEMR\Common\Http\HttpRestRequest
;
310 use OpenEMR\RestControllers\AllergyIntoleranceRestController
;
311 use OpenEMR\RestControllers\FacilityRestController
;
312 use OpenEMR\RestControllers\VersionRestController
;
313 use OpenEMR\RestControllers\ProductRegistrationRestController
;
314 use OpenEMR\RestControllers\PatientRestController
;
315 use OpenEMR\RestControllers\EncounterRestController
;
316 use OpenEMR\RestControllers\PractitionerRestController
;
317 use OpenEMR\RestControllers\ListRestController
;
318 use OpenEMR\RestControllers\InsuranceCompanyRestController
;
319 use OpenEMR\RestControllers\AppointmentRestController
;
320 use OpenEMR\RestControllers\ConditionRestController
;
321 use OpenEMR\RestControllers\ONoteRestController
;
322 use OpenEMR\RestControllers\DocumentRestController
;
323 use OpenEMR\RestControllers\DrugRestController
;
324 use OpenEMR\RestControllers\EmployerRestController
;
325 use OpenEMR\RestControllers\ImmunizationRestController
;
326 use OpenEMR\RestControllers\InsuranceRestController
;
327 use OpenEMR\RestControllers\MessageRestController
;
328 use OpenEMR\RestControllers\PrescriptionRestController
;
329 use OpenEMR\RestControllers\ProcedureRestController
;
330 use OpenEMR\RestControllers\TransactionRestController
;
331 use OpenEMR\RestControllers\UserRestController
;
332 use OpenEMR\Services\Search\SearchQueryConfig
;
334 // Note some Http clients may not send auth as json so a function
335 // is implemented to determine and parse encoding on auth route's.
337 // Note that the api route is only for users role
338 // (there is a mechanism in place to ensure only user role can access the api route)
339 RestConfig
::$ROUTE_MAP = array(
342 * path="/api/facility",
343 * description="Returns a single facility.",
348 * description="The name for the facility.",
355 * name="facility_npi",
357 * description="The facility_npi for the facility.",
366 * description="The phone for the facility.",
375 * description="The fax for the facility.",
384 * description="The street for the facility.",
393 * description="The city for the facility.",
402 * description="The state for the facility.",
409 * name="postal_code",
411 * description="The postal_code for the facility.",
418 * name="country_code",
420 * description="The country_code for the facility.",
427 * name="federal_ein",
429 * description="The federal_ein for the facility.",
438 * description="The website for the facility.",
447 * description="The email for the facility.",
454 * name="domain_identifier",
456 * description="The domain_identifier for the facility.",
463 * name="facility_taxonomy",
465 * description="The facility_taxonomy for the facility.",
472 * name="facility_code",
474 * description="The facility_code for the facility.",
481 * name="billing_location",
483 * description="The billing_location setting for the facility.",
490 * name="accepts_assignment",
492 * description="The accepts_assignment setting for the facility.",
501 * description="The oid for the facility.",
508 * name="service_location",
510 * description="The service_location setting for the facility.",
518 * ref="#/components/responses/standard"
522 * ref="#/components/responses/badrequest"
526 * ref="#/components/responses/unauthorized"
528 * security={{"openemr_auth":{}}}
531 "GET /api/facility" => function () {
532 RestConfig
::authorization_check("admin", "users");
533 $return = (new FacilityRestController())->getAll($_GET);
534 RestConfig
::apiLog($return);
540 * path="/api/facility/{fuuid}",
541 * description="Returns a single facility.",
546 * description="The uuid for the facility.",
554 * ref="#/components/responses/standard"
558 * ref="#/components/responses/badrequest"
562 * ref="#/components/responses/unauthorized"
564 * security={{"openemr_auth":{}}}
567 "GET /api/facility/:fuuid" => function ($fuuid) {
568 RestConfig
::authorization_check("admin", "users");
569 $return = (new FacilityRestController())->getOne($fuuid);
570 RestConfig
::apiLog($return);
576 * path="/api/facility",
577 * description="Creates a facility in the system",
582 * mediaType="application/json",
586 * description="The name for the facility.",
590 * property="facility_npi",
591 * description="The facility_npi for the facility.",
596 * description="The phone for the facility.",
601 * description="The fax for the facility.",
606 * description="The street for the facility.",
611 * description="The city for the facility.",
616 * description="The state for the facility.",
620 * property="postal_code",
621 * description="The postal_code for the facility.",
625 * property="country_code",
626 * description="The country_code for the facility.",
630 * property="federal_ein",
631 * description="The federal_ein for the facility.",
635 * property="website",
636 * description="The website for the facility.",
641 * description="The email for the facility.",
645 * property="domain_identifier",
646 * description="The domain_identifier for the facility.",
650 * property="facility_taxonomy",
651 * description="The facility_taxonomy for the facility.",
655 * property="facility_code",
656 * description="The facility_code for the facility.",
660 * property="billing_location",
661 * description="The billing_location setting for the facility.",
665 * property="accepts_assignment",
666 * description="The accepts_assignment setting for the facility.",
671 * description="The oid for the facility.",
675 * property="service_location",
676 * description="The service_location setting for the facility.",
679 * required={"name", "facility_npi"},
682 * "facility_npi": "123456789123",
683 * "phone": "808-606-3030",
684 * "fax": "808-606-3031",
685 * "street": "1337 Bit Shifter Ln",
686 * "city": "San Lorenzo",
688 * "postal_code": "54321",
689 * "country_code": "US",
690 * "federal_ein": "4343434",
691 * "website": "https://example.com",
692 * "email": "foo@bar.com",
693 * "domain_identifier": "",
694 * "facility_taxonomy": "",
695 * "facility_code": "",
696 * "billing_location": "1",
697 * "accepts_assignment": "1",
699 * "service_location": "1"
706 * ref="#/components/responses/standard"
710 * ref="#/components/responses/badrequest"
714 * ref="#/components/responses/unauthorized"
716 * security={{"openemr_auth":{}}}
719 "POST /api/facility" => function () {
720 RestConfig
::authorization_check("admin", "super");
721 $data = (array) (json_decode(file_get_contents("php://input")));
722 $return = (new FacilityRestController())->post($data);
723 RestConfig
::apiLog($return, $data);
729 * path="/api/facility/{fuuid}",
730 * description="Updates a facility in the system",
735 * description="The uuid for the facility.",
744 * mediaType="application/json",
748 * description="The name for the facility.",
752 * property="facility_npi",
753 * description="The facility_npi for the facility.",
758 * description="The phone for the facility.",
763 * description="The fax for the facility.",
768 * description="The street for the facility.",
773 * description="The city for the facility.",
778 * description="The state for the facility.",
782 * property="postal_code",
783 * description="The postal_code for the facility.",
787 * property="country_code",
788 * description="The country_code for the facility.",
792 * property="federal_ein",
793 * description="The federal_ein for the facility.",
797 * property="website",
798 * description="The website for the facility.",
803 * description="The email for the facility.",
807 * property="domain_identifier",
808 * description="The domain_identifier for the facility.",
812 * property="facility_taxonomy",
813 * description="The facility_taxonomy for the facility.",
817 * property="facility_code",
818 * description="The facility_code for the facility.",
822 * property="billing_location",
823 * description="The billing_location setting for the facility.",
827 * property="accepts_assignment",
828 * description="The accepts_assignment setting for the facility.",
833 * description="The oid for the facility.",
837 * property="service_location",
838 * description="The service_location setting for the facility.",
843 * "facility_npi": "123456789123",
844 * "phone": "808-606-3030",
845 * "fax": "808-606-3031",
846 * "street": "1337 Bit Shifter Ln",
847 * "city": "San Lorenzo",
849 * "postal_code": "54321",
850 * "country_code": "US",
851 * "federal_ein": "4343434",
852 * "website": "https://example.com",
853 * "email": "foo@bar.com",
854 * "domain_identifier": "",
855 * "facility_taxonomy": "",
856 * "facility_code": "",
857 * "billing_location": "1",
858 * "accepts_assignment": "1",
860 * "service_location": "1"
867 * ref="#/components/responses/standard"
871 * ref="#/components/responses/badrequest"
875 * ref="#/components/responses/unauthorized"
877 * security={{"openemr_auth":{}}}
880 "PUT /api/facility/:fuuid" => function ($fuuid) {
881 RestConfig
::authorization_check("admin", "super");
882 $data = (array) (json_decode(file_get_contents("php://input")));
883 $return = (new FacilityRestController())->patch($fuuid, $data);
884 RestConfig
::apiLog($return, $data);
890 * path="/api/patient",
891 * description="Retrieves a list of patients",
894 * ref="#/components/parameters/_sort"
899 * description="The first name for the patient.",
908 * description="The last name for the patient.",
917 * description="The social security number for the patient.",
926 * description="The street for the patient.",
933 * name="postal_code",
935 * description="The postal code for the patient.",
944 * description="The city for the patient.",
953 * description="The state for the patient.",
962 * description="The home phone for the patient.",
971 * description="The business phone for the patient.",
980 * description="The cell phone for the patient.",
987 * name="postal_contact",
989 * description="The postal_contact for the patient.",
998 * description="The gender for the patient.",
1005 * name="country_code",
1007 * description="The country code for the patient.",
1016 * description="The email for the patient.",
1025 * description="The DOB for the patient.",
1034 * description="The date this patient resource was last modified.",
1043 * description="The number of records to offset from this index in the search result.",
1052 * description="The maximum number of resources to return in the result set. 0 means unlimited.",
1062 * ref="#/components/responses/standard"
1066 * ref="#/components/responses/badrequest"
1070 * ref="#/components/responses/unauthorized"
1072 * security={{"openemr_auth":{}}}
1075 "GET /api/patient" => function () {
1076 RestConfig
::authorization_check("patients", "demo");
1077 $config = SearchQueryConfig
::createConfigFromQueryParams($_GET);
1078 $return = (new PatientRestController())->getAll($_GET, $config);
1079 RestConfig
::apiLog($return);
1084 * Schema for the patient request
1087 * schema="api_patient_request",
1090 * description="The title of patient.",
1095 * description="The fname of patient.",
1100 * description="The mname of patient.",
1105 * description="The lname of patient.",
1109 * property="street",
1110 * description="The street address of patient.",
1114 * property="postal_code",
1115 * description="The postal code of patient.",
1120 * description="The city of patient.",
1125 * description="The state of patient.",
1129 * property="country_code",
1130 * description="The country code of patient.",
1134 * property="phone_contact",
1135 * description="The phone contact of patient.",
1140 * description="The DOB of patient.",
1145 * description="The lname of patient.",
1150 * description="The race of patient.",
1154 * property="ethnicity",
1155 * description="The ethnicity of patient.",
1158 * required={"fname", "lname", "DOB", "sex"},
1164 * "street": "456 Tree Lane",
1165 * "postal_code": "08642",
1166 * "city": "FooTown",
1168 * "country_code": "US",
1169 * "phone_contact": "123-456-7890",
1170 * "DOB": "1992-02-02",
1179 * path="/api/patient",
1180 * description="Creates a new patient",
1181 * tags={"standard"},
1185 * mediaType="application/json",
1186 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1191 * description="Standard response",
1193 * mediaType="application/json",
1196 * property="validationErrors",
1197 * description="Validation errors.",
1204 * property="internalErrors",
1205 * description="Internal errors.",
1213 * description="Returned data.",
1218 * description="patient pid",
1224 * "validationErrors": {},
1225 * "error_description": {},
1235 * ref="#/components/responses/unauthorized"
1237 * security={{"openemr_auth":{}}}
1240 "POST /api/patient" => function () {
1241 RestConfig
::authorization_check("patients", "demo");
1242 $data = (array) (json_decode(file_get_contents("php://input")));
1243 $return = (new PatientRestController())->post($data);
1244 RestConfig
::apiLog($return, $data);
1249 * Schema for the patient response
1252 * schema="api_patient_response",
1254 * property="validationErrors",
1255 * description="Validation errors.",
1262 * property="internalErrors",
1263 * description="Internal errors.",
1271 * description="Returned data.",
1276 * description="patient id",
1281 * description="patient pid",
1285 * property="pubpid",
1286 * description="patient public id",
1291 * description="patient title",
1296 * description="patient first name",
1301 * description="patient middle name",
1306 * description="patient last name",
1311 * description="patient social security number",
1315 * property="street",
1316 * description="patient street address",
1320 * property="postal_code",
1321 * description="patient postal code",
1326 * description="patient city",
1331 * description="patient state",
1335 * property="county",
1336 * description="patient county",
1340 * property="country_code",
1341 * description="patient country code",
1345 * property="drivers_license",
1346 * description="patient drivers license id",
1350 * property="contact_relationship",
1351 * description="patient contact relationship",
1355 * property="phone_contact",
1356 * description="patient phone contact",
1360 * property="phone_home",
1361 * description="patient home phone",
1365 * property="phone_biz",
1366 * description="patient work phone",
1370 * property="phone_cell",
1371 * description="patient mobile phone",
1376 * description="patient email",
1381 * description="patient DOB",
1386 * description="patient sex (gender)",
1391 * description="patient race",
1395 * property="ethnicity",
1396 * description="patient ethnicity",
1400 * property="status",
1401 * description="patient status",
1407 * "validationErrors": {},
1408 * "error_description": {},
1418 * "street": "456 Tree Lane",
1419 * "postal_code": "08642",
1420 * "city": "FooTown",
1423 * "country_code": "US",
1424 * "drivers_license": "",
1425 * "contact_relationship": "",
1426 * "phone_contact": "123-456-7890",
1431 * "DOB": "1992-02-03",
1442 * path="/api/patient/{puuid}",
1443 * description="Updates a patient",
1444 * tags={"standard"},
1448 * description="The uuid for the patient.",
1457 * mediaType="application/json",
1458 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1463 * description="Standard response",
1465 * mediaType="application/json",
1466 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1471 * ref="#/components/responses/unauthorized"
1473 * security={{"openemr_auth":{}}}
1476 "PUT /api/patient/:puuid" => function ($puuid) {
1477 RestConfig
::authorization_check("patients", "demo");
1478 $data = (array) (json_decode(file_get_contents("php://input")));
1479 $return = (new PatientRestController())->put($puuid, $data);
1480 RestConfig
::apiLog($return, $data);
1486 * path="/api/patient/{puuid}",
1487 * description="Retrieves a single patient by their uuid",
1488 * tags={"standard"},
1492 * description="The uuid for the patient.",
1500 * description="Standard response",
1502 * mediaType="application/json",
1503 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1508 * ref="#/components/responses/unauthorized"
1510 * security={{"openemr_auth":{}}}
1513 "GET /api/patient/:puuid" => function ($puuid) {
1514 RestConfig
::authorization_check("patients", "demo");
1515 $return = (new PatientRestController())->getOne($puuid);
1516 RestConfig
::apiLog($return);
1522 * path="/api/patient/{puuid}/encounter",
1523 * description="Retrieves a list of encounters for a single patient",
1524 * tags={"standard"},
1528 * description="The uuid for the patient.",
1536 * ref="#/components/responses/standard"
1540 * ref="#/components/responses/badrequest"
1544 * ref="#/components/responses/unauthorized"
1546 * security={{"openemr_auth":{}}}
1549 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1550 RestConfig
::authorization_check("encounters", "auth_a");
1551 $return = (new EncounterRestController())->getAll($puuid);
1552 RestConfig
::apiLog($return);
1557 * Schema for the encounter request
1560 * schema="api_encounter_request",
1563 * description="The date of encounter.",
1567 * property="onset_date",
1568 * description="The onset date of encounter.",
1572 * property="reason",
1573 * description="The reason of encounter.",
1577 * property="facility",
1578 * description="The facility of encounter.",
1582 * property="pc_catid",
1583 * description="The pc_catid of encounter.",
1587 * property="facility_id",
1588 * description="The facility id of encounter.",
1592 * property="billing_facility",
1593 * description="The billing facility id of encounter.",
1597 * property="sensitivity",
1598 * description="The sensitivity of encounter.",
1602 * property="referral_source",
1603 * description="The referral source of encounter.",
1607 * property="pos_code",
1608 * description="The pos_code of encounter.",
1612 * property="external_id",
1613 * description="The external id of encounter.",
1617 * property="provider_id",
1618 * description="The provider id of encounter.",
1622 * property="class_code",
1623 * description="The class_code of encounter.",
1626 * required={"pc_catid", "class_code"},
1628 * "date":"2020-11-10",
1630 * "reason": "Pregnancy Test",
1631 * "facility": "Owerri General Hospital",
1633 * "facility_id": "3",
1634 * "billing_facility": "3",
1635 * "sensitivity": "normal",
1636 * "referral_source": "",
1638 * "external_id": "",
1639 * "provider_id": "1",
1640 * "class_code" : "AMB"
1646 * path="/api/patient/{puuid}/encounter",
1647 * description="Creates a new encounter",
1648 * tags={"standard"},
1652 * description="The uuid for the patient.",
1661 * mediaType="application/json",
1662 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1667 * description="Standard response",
1669 * mediaType="application/json",
1672 * property="validationErrors",
1673 * description="Validation errors.",
1680 * property="internalErrors",
1681 * description="Internal errors.",
1689 * description="Returned data.",
1693 * property="encounter",
1694 * description="encounter id",
1699 * description="encounter uuid",
1705 * "validationErrors": {},
1706 * "error_description": {},
1709 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1717 * ref="#/components/responses/unauthorized"
1719 * security={{"openemr_auth":{}}}
1722 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1723 RestConfig
::authorization_check("encounters", "auth_a");
1724 $data = (array) (json_decode(file_get_contents("php://input")));
1725 $return = (new EncounterRestController())->post($puuid, $data);
1726 RestConfig
::apiLog($return, $data);
1731 * Schema for the encounter response
1734 * schema="api_encounter_response",
1736 * property="validationErrors",
1737 * description="Validation errors.",
1744 * property="internalErrors",
1745 * description="Internal errors.",
1753 * description="Returned data.",
1758 * description="encounter id",
1763 * description="encounter uuid",
1768 * description="encounter date",
1772 * property="reason",
1773 * description="encounter reason",
1777 * property="facility",
1778 * description="encounter facility name",
1782 * property="facility_id",
1783 * description="encounter facility id name",
1788 * description="encounter for patient pid",
1792 * property="onset_date",
1793 * description="encounter onset date",
1797 * property="sensitivity",
1798 * description="encounter sensitivity",
1802 * property="billing_note",
1803 * description="encounter billing note",
1807 * property="pc_catid",
1808 * description="encounter pc_catid",
1812 * property="last_level_billed",
1813 * description="encounter last_level_billed",
1817 * property="last_level_closed",
1818 * description="encounter last_level_closed",
1822 * property="last_stmt_date",
1823 * description="encounter last_stmt_date",
1827 * property="stmt_count",
1828 * description="encounter stmt_count",
1832 * property="provider_id",
1833 * description="provider id",
1837 * property="supervisor_id",
1838 * description="encounter supervisor id",
1842 * property="invoice_refno",
1843 * description="encounter invoice_refno",
1847 * property="referral_source",
1848 * description="encounter referral source",
1852 * property="billing_facility",
1853 * description="encounter billing facility id",
1857 * property="external_id",
1858 * description="encounter external id",
1862 * property="pos_code",
1863 * description="encounter pos_code",
1867 * property="class_code",
1868 * description="encounter class_code",
1872 * property="class_title",
1873 * description="encounter class_title",
1877 * property="pc_catname",
1878 * description="encounter pc_catname",
1882 * property="billing_facility_name",
1883 * description="encounter billing facility name",
1889 * "validationErrors": {},
1890 * "error_description": {},
1893 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1894 * "date": "2019-09-14 00:00:00",
1895 * "reason": "Pregnancy Test",
1896 * "facility": "Owerri General Hospital",
1897 * "facility_id": "3",
1899 * "onset_date": "2019-04-20 00:00:00",
1900 * "sensitivity": "normal",
1901 * "billing_note": null,
1903 * "last_level_billed": "0",
1904 * "last_level_closed": "0",
1905 * "last_stmt_date": null,
1906 * "stmt_count": "0",
1907 * "provider_id": "1",
1908 * "supervisor_id": "0",
1909 * "invoice_refno": "",
1910 * "referral_source": "",
1911 * "billing_facility": "3",
1912 * "external_id": "",
1914 * "class_code": "AMB",
1915 * "class_title": "ambulatory",
1916 * "pc_catname": "Office Visit",
1917 * "billing_facility_name": "Owerri General Hospital"
1924 * path="/api/patient/{puuid}/encounter/{euuid}",
1925 * description="Modify a encounter",
1926 * tags={"standard"},
1930 * description="The uuid for the patient.",
1939 * description="The uuid for the encounter.",
1948 * mediaType="application/json",
1949 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1954 * description="Standard response",
1956 * mediaType="application/json",
1957 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1962 * ref="#/components/responses/unauthorized"
1964 * security={{"openemr_auth":{}}}
1967 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1968 RestConfig
::authorization_check("encounters", "auth_a");
1969 $data = (array) (json_decode(file_get_contents("php://input")));
1970 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1971 RestConfig
::apiLog($return, $data);
1977 * path="/api/patient/{puuid}/encounter/{euuid}",
1978 * description="Retrieves a single encounter for a patient",
1979 * tags={"standard"},
1983 * description="The uuid for the patient.",
1992 * description="The uuid for the encounter.",
2000 * description="Standard response",
2002 * mediaType="application/json",
2003 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
2008 * ref="#/components/responses/unauthorized"
2010 * security={{"openemr_auth":{}}}
2013 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
2014 RestConfig
::authorization_check("encounters", "auth_a");
2015 $return = (new EncounterRestController())->getOne($puuid, $euuid);
2016 RestConfig
::apiLog($return);
2022 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2023 * description="Retrieves soap notes from an encounter for a patient",
2024 * tags={"standard"},
2028 * description="The pid for the patient.",
2037 * description="The id for the encounter.",
2045 * ref="#/components/responses/standard"
2049 * ref="#/components/responses/badrequest"
2053 * ref="#/components/responses/unauthorized"
2055 * security={{"openemr_auth":{}}}
2058 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2059 RestConfig
::authorization_check("encounters", "notes");
2060 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2061 RestConfig
::apiLog($return);
2066 * Schema for the vital request
2069 * schema="api_vital_request",
2072 * description="The bps of vitals.",
2077 * description="The bpd of vitals.",
2081 * property="weight",
2082 * description="The weight of vitals. (unit is lb)",
2086 * property="height",
2087 * description="The height of vitals. (unit is inches)",
2091 * property="temperature",
2092 * description="The temperature of temperature. (unit is F)",
2096 * property="temp_method",
2097 * description="The temp_method of vitals.",
2102 * description="The pulse of vitals.",
2106 * property="respiration",
2107 * description="The respiration of vitals.",
2112 * description="The note (ie. comments) of vitals.",
2116 * property="waist_circ",
2117 * description="The waist circumference of vitals. (unit is inches)",
2121 * property="head_circ",
2122 * description="The head circumference of vitals. (unit is inches)",
2126 * property="oxygen_saturation",
2127 * description="The oxygen_saturation of vitals.",
2135 * "temperature": "98",
2136 * "temp_method": "Oral",
2138 * "respiration": "20",
2139 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2140 * "waist_circ": "37",
2141 * "head_circ": "22.2",
2142 * "oxygen_saturation": "96"
2148 * path="/api/patient/{pid}/encounter/{eid}/vital",
2149 * description="Submits a new vitals form",
2150 * tags={"standard"},
2154 * description="The id for the patient.",
2163 * description="The id for the encounter.",
2172 * mediaType="application/json",
2173 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2178 * ref="#/components/responses/standard"
2182 * ref="#/components/responses/badrequest"
2186 * ref="#/components/responses/unauthorized"
2188 * security={{"openemr_auth":{}}}
2191 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2192 RestConfig
::authorization_check("encounters", "notes");
2193 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2194 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2195 RestConfig
::apiLog($return, $data);
2201 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2202 * description="Edit a vitals form",
2203 * tags={"standard"},
2207 * description="The id for the patient.",
2216 * description="The id for the encounter.",
2225 * description="The id for the vitalss form.",
2234 * mediaType="application/json",
2235 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2240 * ref="#/components/responses/standard"
2244 * ref="#/components/responses/badrequest"
2248 * ref="#/components/responses/unauthorized"
2250 * security={{"openemr_auth":{}}}
2253 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2254 RestConfig
::authorization_check("encounters", "notes");
2255 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2256 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2257 RestConfig
::apiLog($return, $data);
2263 * path="/api/patient/{pid}/encounter/{eid}/vital",
2264 * description="Retrieves all vitals from an encounter for a patient",
2265 * tags={"standard"},
2269 * description="The pid for the patient.",
2278 * description="The id for the encounter.",
2286 * ref="#/components/responses/standard"
2290 * ref="#/components/responses/badrequest"
2294 * ref="#/components/responses/unauthorized"
2296 * security={{"openemr_auth":{}}}
2299 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2300 RestConfig
::authorization_check("encounters", "notes");
2301 $return = (new EncounterRestController())->getVitals($pid, $eid);
2302 RestConfig
::apiLog($return);
2308 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2309 * description="Retrieves a vitals form from an encounter for a patient",
2310 * tags={"standard"},
2314 * description="The pid for the patient.",
2323 * description="The id for the encounter.",
2332 * description="The id for the vitals form.",
2340 * ref="#/components/responses/standard"
2344 * ref="#/components/responses/badrequest"
2348 * ref="#/components/responses/unauthorized"
2350 * security={{"openemr_auth":{}}}
2353 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2354 RestConfig
::authorization_check("encounters", "notes");
2355 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2356 RestConfig
::apiLog($return);
2362 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2363 * description="Retrieves a soap note from an encounter for a patient",
2364 * tags={"standard"},
2368 * description="The pid for the patient.",
2377 * description="The id for the encounter.",
2386 * description="The id for the soap note.",
2394 * ref="#/components/responses/standard"
2398 * ref="#/components/responses/badrequest"
2402 * ref="#/components/responses/unauthorized"
2404 * security={{"openemr_auth":{}}}
2407 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2408 RestConfig
::authorization_check("encounters", "notes");
2409 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2410 RestConfig
::apiLog($return);
2415 * Schema for the soap_note request
2418 * schema="api_soap_note_request",
2420 * property="subjective",
2421 * description="The subjective of soap note.",
2425 * property="objective",
2426 * description="The objective of soap note.",
2430 * property="assessment",
2431 * description="The assessment of soap note.",
2436 * description="The plan of soap note.",
2440 * "subjective": "The patient with mechanical fall and cut finger.",
2441 * "objective": "The patient with finger laceration on exam.",
2442 * "assessment": "The patient with finger laceration requiring sutures.",
2443 * "plan": "Sutured finger laceration."
2449 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2450 * description="Submits a new soap note",
2451 * tags={"standard"},
2455 * description="The id for the patient.",
2464 * description="The id for the encounter.",
2473 * mediaType="application/json",
2474 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2479 * ref="#/components/responses/standard"
2483 * ref="#/components/responses/badrequest"
2487 * ref="#/components/responses/unauthorized"
2489 * security={{"openemr_auth":{}}}
2492 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2493 RestConfig
::authorization_check("encounters", "notes");
2494 $data = (array) (json_decode(file_get_contents("php://input")));
2495 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2496 RestConfig
::apiLog($return, $data);
2502 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2503 * description="Edit a soap note",
2504 * tags={"standard"},
2508 * description="The id for the patient.",
2517 * description="The id for the encounter.",
2526 * description="The id for the soap noted.",
2535 * mediaType="application/json",
2536 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2541 * ref="#/components/responses/standard"
2545 * ref="#/components/responses/badrequest"
2549 * ref="#/components/responses/unauthorized"
2551 * security={{"openemr_auth":{}}}
2554 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2555 RestConfig
::authorization_check("encounters", "notes");
2556 $data = (array) (json_decode(file_get_contents("php://input")));
2557 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2558 RestConfig
::apiLog($return, $data);
2565 * path="/api/practitioner",
2566 * description="Retrieves a list of practitioners",
2567 * tags={"standard"},
2571 * description="The title for the practitioner.",
2580 * description="The first name for the practitioner.",
2589 * description="The last name for the practitioner.",
2598 * description="The middle name for the practitioner.",
2605 * name="federaltaxid",
2607 * description="The federal tax id for the practitioner.",
2614 * name="federaldrugid",
2616 * description="The federal drug id for the practitioner.",
2625 * description="The upin for the practitioner.",
2632 * name="facility_id",
2634 * description="The facility id for the practitioner.",
2643 * description="The facility for the practitioner.",
2652 * description="The npi for the practitioner.",
2661 * description="The email for the practitioner.",
2670 * description="The specialty for the practitioner.",
2679 * description="The billname for the practitioner.",
2688 * description="The url for the practitioner.",
2697 * description="The assistant for the practitioner.",
2704 * name="organization",
2706 * description="The organization for the practitioner.",
2713 * name="valedictory",
2715 * description="The valedictory for the practitioner.",
2724 * description="The street for the practitioner.",
2733 * description="The street (line 2) for the practitioner.",
2742 * description="The city for the practitioner.",
2751 * description="The state for the practitioner.",
2760 * description="The zip for the practitioner.",
2769 * description="The phone for the practitioner.",
2778 * description="The fax for the practitioner.",
2787 * description="The phonew1 for the practitioner.",
2796 * description="The phonecell for the practitioner.",
2805 * description="The notes for the practitioner.",
2812 * name="state_license_number2",
2814 * description="The state license number for the practitioner.",
2823 * description="The username for the practitioner.",
2831 * ref="#/components/responses/standard"
2835 * ref="#/components/responses/badrequest"
2839 * ref="#/components/responses/unauthorized"
2841 * security={{"openemr_auth":{}}}
2844 "GET /api/practitioner" => function () {
2845 RestConfig
::authorization_check("admin", "users");
2846 $return = (new PractitionerRestController())->getAll($_GET);
2847 RestConfig
::apiLog($return);
2853 * path="/api/practitioner/{pruuid}",
2854 * description="Retrieves a single practitioner by their uuid",
2855 * tags={"standard"},
2859 * description="The uuid for the practitioner.",
2867 * ref="#/components/responses/standard"
2871 * ref="#/components/responses/badrequest"
2875 * ref="#/components/responses/unauthorized"
2877 * security={{"openemr_auth":{}}}
2880 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2881 RestConfig
::authorization_check("admin", "users");
2882 $return = (new PractitionerRestController())->getOne($pruuid);
2883 RestConfig
::apiLog($return);
2889 * path="/api/practitioner",
2890 * description="Submits a new practitioner",
2891 * tags={"standard"},
2895 * mediaType="application/json",
2899 * description="The title for the practitioner.",
2904 * description="The first name for the practitioner.",
2909 * description="The middle name for the practitioner.",
2914 * description="The last name for the practitioner.",
2918 * property="federaltaxid",
2919 * description="The federal tax id for the practitioner.",
2923 * property="federaldrugid",
2924 * description="The federal drug id for the practitioner.",
2929 * description="The upin for the practitioner.",
2933 * property="facility_id",
2934 * description="The facility_id for the practitioner.",
2938 * property="facility",
2939 * description="The facility name for the practitioner.",
2944 * description="The npi for the practitioner.",
2949 * description="The email for the practitioner.",
2953 * property="specialty",
2954 * description="The specialty for the practitioner.",
2958 * property="billname",
2959 * description="The billname for the practitioner.",
2964 * description="The url for the practitioner.",
2968 * property="assistant",
2969 * description="The assistant for the practitioner.",
2973 * property="valedictory",
2974 * description="The valedictory for the practitioner.",
2978 * property="street",
2979 * description="The street address for the practitioner.",
2983 * property="streetb",
2984 * description="The streetb address for the practitioner.",
2989 * description="The city for the practitioner.",
2994 * description="The state for the practitioner.",
2999 * description="The zip for the practitioner.",
3004 * description="The phone for the practitioner.",
3009 * description="The fax for the practitioner.",
3013 * property="phonew1",
3014 * description="The phonew1 for the practitioner.",
3018 * property="phonecell",
3019 * description="The phonecell for the practitioner.",
3024 * description="The notes for the practitioner.",
3028 * property="state_license_number",
3029 * description="The state license number for the practitioner.",
3033 * property="username",
3034 * description="The username for the practitioner.",
3037 * required={"fname", "lname", "npi"},
3040 * "fname": "Eduardo",
3043 * "federaltaxid": "",
3044 * "federaldrugid": "",
3046 * "facility_id": "3",
3047 * "facility": "Your Clinic Name Here",
3048 * "npi": "12345678901",
3049 * "email": "info@pennfirm.com",
3053 * "assistant": null,
3054 * "organization": null,
3055 * "valedictory": null,
3056 * "street": "789 Third Avenue",
3057 * "streetb": "123 Cannaut Street",
3058 * "city": "San Diego",
3061 * "phone": "(619) 555-9827",
3063 * "phonew1": "(619) 555-7822",
3064 * "phonecell": "(619) 555-7821",
3066 * "state_license_number": "123456",
3067 * "username": "eduardoperez"
3074 * description="Standard response",
3076 * mediaType="application/json",
3079 * property="validationErrors",
3080 * description="Validation errors.",
3087 * property="internalErrors",
3088 * description="Internal errors.",
3096 * description="Returned data.",
3101 * description="practitioner id",
3106 * description="practitioner uuid",
3112 * "validationErrors": {},
3113 * "error_description": {},
3116 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3124 * ref="#/components/responses/unauthorized"
3126 * security={{"openemr_auth":{}}}
3129 "POST /api/practitioner" => function () {
3130 RestConfig
::authorization_check("admin", "users");
3131 $data = (array) (json_decode(file_get_contents("php://input")));
3132 $return = (new PractitionerRestController())->post($data);
3133 RestConfig
::apiLog($return, $data);
3139 * path="/api/practitioner/{pruuid}",
3140 * description="Edit a practitioner",
3141 * tags={"standard"},
3145 * description="The uuid for the practitioner.",
3154 * mediaType="application/json",
3158 * description="The title for the practitioner.",
3163 * description="The first name for the practitioner.",
3168 * description="The middle name for the practitioner.",
3173 * description="The last name for the practitioner.",
3177 * property="federaltaxid",
3178 * description="The federal tax id for the practitioner.",
3182 * property="federaldrugid",
3183 * description="The federal drug id for the practitioner.",
3188 * description="The upin for the practitioner.",
3192 * property="facility_id",
3193 * description="The facility_id for the practitioner.",
3197 * property="facility",
3198 * description="The facility name for the practitioner.",
3203 * description="The npi for the practitioner.",
3208 * description="The email for the practitioner.",
3212 * property="specialty",
3213 * description="The specialty for the practitioner.",
3217 * property="billname",
3218 * description="The billname for the practitioner.",
3223 * description="The url for the practitioner.",
3227 * property="assistant",
3228 * description="The assistant for the practitioner.",
3232 * property="valedictory",
3233 * description="The valedictory for the practitioner.",
3237 * property="street",
3238 * description="The street address for the practitioner.",
3242 * property="streetb",
3243 * description="The streetb address for the practitioner.",
3248 * description="The city for the practitioner.",
3253 * description="The state for the practitioner.",
3258 * description="The zip for the practitioner.",
3263 * description="The phone for the practitioner.",
3268 * description="The fax for the practitioner.",
3272 * property="phonew1",
3273 * description="The phonew1 for the practitioner.",
3277 * property="phonecell",
3278 * description="The phonecell for the practitioner.",
3283 * description="The notes for the practitioner.",
3287 * property="state_license_number",
3288 * description="The state license number for the practitioner.",
3292 * property="username",
3293 * description="The username for the practitioner.",
3301 * "street": "456 Tree Lane",
3303 * "city": "FooTown",
3305 * "phone": "123-456-7890"
3312 * description="Standard response",
3314 * mediaType="application/json",
3317 * property="validationErrors",
3318 * description="Validation errors.",
3325 * property="internalErrors",
3326 * description="Internal errors.",
3334 * description="Returned data.",
3339 * description="practitioner id",
3344 * description="practitioner uuid",
3349 * description="practitioner title",
3354 * description="practitioner fname",
3359 * description="practitioner lname",
3364 * description="practitioner mname",
3368 * property="federaltaxid",
3369 * description="practitioner federaltaxid",
3373 * property="federaldrugid",
3374 * description="practitioner federaldrugid",
3379 * description="practitioner upin",
3383 * property="facility_id",
3384 * description="practitioner facility_id",
3388 * property="facility",
3389 * description="practitioner facility",
3394 * description="practitioner npi",
3399 * description="practitioner email",
3403 * property="active",
3404 * description="practitioner active setting",
3408 * property="specialty",
3409 * description="practitioner specialty",
3413 * property="billname",
3414 * description="practitioner billname",
3419 * description="practitioner url",
3423 * property="assistant",
3424 * description="practitioner assistant",
3428 * property="organization",
3429 * description="practitioner organization",
3433 * property="valedictory",
3434 * description="practitioner valedictory",
3438 * property="street",
3439 * description="practitioner street",
3443 * property="streetb",
3444 * description="practitioner streetb",
3449 * description="practitioner city",
3454 * description="practitioner state",
3459 * description="practitioner zip",
3464 * description="practitioner phone",
3469 * description="fax",
3473 * property="phonew1",
3474 * description="practitioner phonew1",
3478 * property="phonecell",
3479 * description="practitioner phonecell",
3484 * description="practitioner notes",
3488 * property="state_license_number",
3489 * description="practitioner state license number",
3493 * property="abook_title",
3494 * description="practitioner abook title",
3498 * property="physician_title",
3499 * description="practitioner physician title",
3503 * property="physician_code",
3504 * description="practitioner physician code",
3510 * "validationErrors": {},
3511 * "error_description": {},
3514 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3519 * "federaltaxid": "",
3520 * "federaldrugid": "",
3522 * "facility_id": "3",
3523 * "facility": "Your Clinic Name Here",
3524 * "npi": "0123456789",
3525 * "email": "info@pennfirm.com",
3531 * "organization": "",
3532 * "valedictory": "",
3533 * "street": "456 Tree Lane",
3534 * "streetb": "123 Cannaut Street",
3535 * "city": "FooTown",
3538 * "phone": "123-456-7890",
3540 * "phonew1": "(619) 555-7822",
3541 * "phonecell": "(619) 555-7821",
3543 * "state_license_number": "123456",
3544 * "abook_title": null,
3545 * "physician_title": null,
3546 * "physician_code": null
3554 * ref="#/components/responses/unauthorized"
3556 * security={{"openemr_auth":{}}}
3559 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3560 RestConfig
::authorization_check("admin", "users");
3561 $data = (array) (json_decode(file_get_contents("php://input")));
3562 $return = (new PractitionerRestController())->patch($pruuid, $data);
3563 RestConfig
::apiLog($return, $data);
3569 * path="/api/medical_problem",
3570 * description="Retrieves a list of medical problems",
3571 * tags={"standard"},
3575 * description="The uuid for the patient.",
3582 * name="condition_uuid",
3584 * description="The uuid for the medical problem.",
3593 * description="The title for the medical problem.",
3602 * description="The start date for the medical problem.",
3611 * description="The end date for the medical problem.",
3620 * description="The diagnosis for the medical problem.",
3628 * ref="#/components/responses/standard"
3632 * ref="#/components/responses/badrequest"
3636 * ref="#/components/responses/unauthorized"
3638 * security={{"openemr_auth":{}}}
3641 "GET /api/medical_problem" => function () {
3642 RestConfig
::authorization_check("encounters", "notes");
3643 $return = (new ConditionRestController())->getAll();
3644 RestConfig
::apiLog($return);
3650 * path="/api/medical_problem/{muuid}",
3651 * description="Retrieves a single medical problem by their uuid",
3652 * tags={"standard"},
3656 * description="The uuid for the medical problem.",
3664 * ref="#/components/responses/standard"
3668 * ref="#/components/responses/badrequest"
3672 * ref="#/components/responses/unauthorized"
3674 * security={{"openemr_auth":{}}}
3677 "GET /api/medical_problem/:muuid" => function ($muuid) {
3678 RestConfig
::authorization_check("encounters", "notes");
3679 $return = (new ConditionRestController())->getOne($muuid);
3680 RestConfig
::apiLog($return);
3686 * path="/api/patient/{puuid}/medical_problem",
3687 * description="Retrieves all medical problems for a patient",
3688 * tags={"standard"},
3692 * description="The uuid for the patient.",
3700 * ref="#/components/responses/standard"
3704 * ref="#/components/responses/badrequest"
3708 * ref="#/components/responses/unauthorized"
3710 * security={{"openemr_auth":{}}}
3713 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3714 RestConfig
::authorization_check("encounters", "notes");
3715 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3716 RestConfig
::apiLog($return);
3722 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3723 * description="Retrieves a medical problem for a patient",
3724 * tags={"standard"},
3728 * description="The uuid for the patient.",
3737 * description="The uuid for the medical problem.",
3745 * ref="#/components/responses/standard"
3749 * ref="#/components/responses/badrequest"
3753 * ref="#/components/responses/unauthorized"
3755 * security={{"openemr_auth":{}}}
3758 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3759 RestConfig
::authorization_check("patients", "med");
3760 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3761 RestConfig
::apiLog($return);
3766 * Schema for the medical_problem request
3769 * schema="api_medical_problem_request",
3772 * description="The title of medical problem.",
3776 * property="begdate",
3777 * description="The beginning date of medical problem.",
3781 * property="enddate",
3782 * description="The end date of medical problem.",
3786 * property="diagnosis",
3787 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3790 * required={"title", "begdate"},
3792 * "title": "Dermatochalasis",
3793 * "begdate": "2010-10-13",
3795 * "diagnosis": "ICD10:H02.839"
3801 * path="/api/patient/{puuid}/medical_problem",
3802 * description="Submits a new medical problem",
3803 * tags={"standard"},
3807 * description="The uuid for the patient.",
3816 * mediaType="application/json",
3817 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3822 * ref="#/components/responses/standard"
3826 * ref="#/components/responses/badrequest"
3830 * ref="#/components/responses/unauthorized"
3832 * security={{"openemr_auth":{}}}
3835 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3836 RestConfig
::authorization_check("patients", "med");
3837 $data = (array) (json_decode(file_get_contents("php://input")));
3838 $return = (new ConditionRestController())->post($puuid, $data);
3839 RestConfig
::apiLog($return, $data);
3845 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3846 * description="Edit a medical problem",
3847 * tags={"standard"},
3851 * description="The uuid for the patient.",
3860 * description="The uuid for the medical problem.",
3869 * mediaType="application/json",
3870 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3875 * ref="#/components/responses/standard"
3879 * ref="#/components/responses/badrequest"
3883 * ref="#/components/responses/unauthorized"
3885 * security={{"openemr_auth":{}}}
3888 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3889 RestConfig
::authorization_check("patients", "med");
3890 $data = (array) (json_decode(file_get_contents("php://input")));
3891 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3892 RestConfig
::apiLog($return, $data);
3898 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3899 * description="Delete a medical problem",
3900 * tags={"standard"},
3904 * description="The uuid for the patient.",
3913 * description="The uuid for the medical problem.",
3921 * ref="#/components/responses/standard"
3925 * ref="#/components/responses/badrequest"
3929 * ref="#/components/responses/unauthorized"
3931 * security={{"openemr_auth":{}}}
3934 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3935 RestConfig
::authorization_check("patients", "med");
3936 $return = (new ConditionRestController())->delete($puuid, $muuid);
3937 RestConfig
::apiLog($return);
3943 * path="/api/allergy",
3944 * description="Retrieves a list of allergies",
3945 * tags={"standard"},
3949 * description="The uuid for the patient.",
3958 * description="The uuid for the allergy.",
3967 * description="The title for the allergy.",
3976 * description="The start date for the allergy.",
3985 * description="The end date for the allergy.",
3994 * description="The diagnosis for the allergy.",
4002 * ref="#/components/responses/standard"
4006 * ref="#/components/responses/badrequest"
4010 * ref="#/components/responses/unauthorized"
4012 * security={{"openemr_auth":{}}}
4015 "GET /api/allergy" => function () {
4016 RestConfig
::authorization_check("patients", "med");
4017 $return = (new AllergyIntoleranceRestController())->getAll();
4018 RestConfig
::apiLog($return);
4024 * path="/api/allergy/{auuid}",
4025 * description="Retrieves a single allergy by their uuid",
4026 * tags={"standard"},
4030 * description="The uuid for the allergy.",
4038 * ref="#/components/responses/standard"
4042 * ref="#/components/responses/badrequest"
4046 * ref="#/components/responses/unauthorized"
4048 * security={{"openemr_auth":{}}}
4051 "GET /api/allergy/:auuid" => function ($auuid) {
4052 RestConfig
::authorization_check("patients", "med");
4053 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
4054 RestConfig
::apiLog($return);
4060 * path="/api/patient/{puuid}/allergy",
4061 * description="Retrieves all allergies for a patient",
4062 * tags={"standard"},
4066 * description="The uuid for the patient.",
4074 * ref="#/components/responses/standard"
4078 * ref="#/components/responses/badrequest"
4082 * ref="#/components/responses/unauthorized"
4084 * security={{"openemr_auth":{}}}
4087 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4088 RestConfig
::authorization_check("patients", "med");
4089 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4090 RestConfig
::apiLog($return);
4096 * path="/api/patient/{puuid}/allergy/{auuid}",
4097 * description="Retrieves a allergy for a patient",
4098 * tags={"standard"},
4102 * description="The uuid for the patient.",
4111 * description="The uuid for the allergy.",
4119 * ref="#/components/responses/standard"
4123 * ref="#/components/responses/badrequest"
4127 * ref="#/components/responses/unauthorized"
4129 * security={{"openemr_auth":{}}}
4132 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4133 RestConfig
::authorization_check("patients", "med");
4134 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4135 RestConfig
::apiLog($return);
4140 * Schema for the allergy request
4143 * schema="api_allergy_request",
4146 * description="The title of allergy.",
4150 * property="begdate",
4151 * description="The beginning date of allergy.",
4155 * property="enddate",
4156 * description="The end date of allergy.",
4160 * property="diagnosis",
4161 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4164 * required={"title", "begdate"},
4166 * "title": "Iodine",
4167 * "begdate": "2010-10-13",
4174 * path="/api/patient/{puuid}/allergy",
4175 * description="Submits a new allergy",
4176 * tags={"standard"},
4180 * description="The uuid for the patient.",
4189 * mediaType="application/json",
4190 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4195 * ref="#/components/responses/standard"
4199 * ref="#/components/responses/badrequest"
4203 * ref="#/components/responses/unauthorized"
4205 * security={{"openemr_auth":{}}}
4208 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4209 RestConfig
::authorization_check("patients", "med");
4210 $data = (array) (json_decode(file_get_contents("php://input")));
4211 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4212 RestConfig
::apiLog($return, $data);
4218 * path="/api/patient/{puuid}/allergy/{auuid}",
4219 * description="Edit a allergy",
4220 * tags={"standard"},
4224 * description="The uuid for the patient.",
4233 * description="The uuid for the allergy.",
4242 * mediaType="application/json",
4243 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4248 * ref="#/components/responses/standard"
4252 * ref="#/components/responses/badrequest"
4256 * ref="#/components/responses/unauthorized"
4258 * security={{"openemr_auth":{}}}
4261 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4262 RestConfig
::authorization_check("patients", "med");
4263 $data = (array) (json_decode(file_get_contents("php://input")));
4264 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4265 RestConfig
::apiLog($return, $data);
4271 * path="/api/patient/{puuid}/allergy/{auuid}",
4272 * description="Delete a medical problem",
4273 * tags={"standard"},
4277 * description="The uuid for the patient.",
4286 * description="The uuid for the allergy.",
4294 * ref="#/components/responses/standard"
4298 * ref="#/components/responses/badrequest"
4302 * ref="#/components/responses/unauthorized"
4304 * security={{"openemr_auth":{}}}
4307 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4308 RestConfig
::authorization_check("patients", "med");
4309 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4310 RestConfig
::apiLog($return);
4316 * path="/api/patient/{pid}/medication",
4317 * description="Retrieves all medications for a patient",
4318 * tags={"standard"},
4322 * description="The pid for the patient.",
4330 * ref="#/components/responses/standard"
4334 * ref="#/components/responses/badrequest"
4338 * ref="#/components/responses/unauthorized"
4340 * security={{"openemr_auth":{}}}
4343 "GET /api/patient/:pid/medication" => function ($pid) {
4344 RestConfig
::authorization_check("patients", "med");
4345 $return = (new ListRestController())->getAll($pid, "medication");
4346 RestConfig
::apiLog($return);
4351 * Schema for the medication request
4354 * schema="api_medication_request",
4357 * description="The title of medication.",
4361 * property="begdate",
4362 * description="The beginning date of medication.",
4366 * property="enddate",
4367 * description="The end date of medication.",
4371 * property="diagnosis",
4372 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4375 * required={"title", "begdate"},
4377 * "title": "Norvasc",
4378 * "begdate": "2013-04-13",
4385 * path="/api/patient/{pid}/medication",
4386 * description="Submits a new medication",
4387 * tags={"standard"},
4391 * description="The pid for the patient.",
4400 * mediaType="application/json",
4401 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4406 * ref="#/components/responses/standard"
4410 * ref="#/components/responses/badrequest"
4414 * ref="#/components/responses/unauthorized"
4416 * security={{"openemr_auth":{}}}
4419 "POST /api/patient/:pid/medication" => function ($pid) {
4420 RestConfig
::authorization_check("patients", "med");
4421 $data = (array) (json_decode(file_get_contents("php://input")));
4422 $return = (new ListRestController())->post($pid, "medication", $data);
4423 RestConfig
::apiLog($return, $data);
4429 * path="/api/patient/{pid}/medication/{mid}",
4430 * description="Edit a medication",
4431 * tags={"standard"},
4435 * description="The pid for the patient.",
4444 * description="The id for the medication.",
4453 * mediaType="application/json",
4454 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4459 * ref="#/components/responses/standard"
4463 * ref="#/components/responses/badrequest"
4467 * ref="#/components/responses/unauthorized"
4469 * security={{"openemr_auth":{}}}
4472 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4473 RestConfig
::authorization_check("patients", "med");
4474 $data = (array) (json_decode(file_get_contents("php://input")));
4475 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4476 RestConfig
::apiLog($return, $data);
4482 * path="/api/patient/{pid}/medication/{mid}",
4483 * description="Retrieves a medication for a patient",
4484 * tags={"standard"},
4488 * description="The id for the patient.",
4497 * description="The id for the medication.",
4505 * ref="#/components/responses/standard"
4509 * ref="#/components/responses/badrequest"
4513 * ref="#/components/responses/unauthorized"
4515 * security={{"openemr_auth":{}}}
4518 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4519 RestConfig
::authorization_check("patients", "med");
4520 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4521 RestConfig
::apiLog($return);
4527 * path="/api/patient/{pid}/medication/{mid}",
4528 * description="Delete a medication",
4529 * tags={"standard"},
4533 * description="The id for the patient.",
4542 * description="The id for the medication.",
4550 * ref="#/components/responses/standard"
4554 * ref="#/components/responses/badrequest"
4558 * ref="#/components/responses/unauthorized"
4560 * security={{"openemr_auth":{}}}
4563 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4564 RestConfig
::authorization_check("patients", "med");
4565 $return = (new ListRestController())->delete($pid, $mid, "medication");
4566 RestConfig
::apiLog($return);
4572 * path="/api/patient/{pid}/surgery",
4573 * description="Retrieves all surgeries for a patient",
4574 * tags={"standard"},
4578 * description="The pid for the patient.",
4586 * ref="#/components/responses/standard"
4590 * ref="#/components/responses/badrequest"
4594 * ref="#/components/responses/unauthorized"
4596 * security={{"openemr_auth":{}}}
4599 "GET /api/patient/:pid/surgery" => function ($pid) {
4600 RestConfig
::authorization_check("patients", "med");
4601 $return = (new ListRestController())->getAll($pid, "surgery");
4602 RestConfig
::apiLog($return);
4608 * path="/api/patient/{pid}/surgery/{sid}",
4609 * description="Retrieves a surgery for a patient",
4610 * tags={"standard"},
4614 * description="The id for the patient.",
4623 * description="The id for the surgery.",
4631 * ref="#/components/responses/standard"
4635 * ref="#/components/responses/badrequest"
4639 * ref="#/components/responses/unauthorized"
4641 * security={{"openemr_auth":{}}}
4644 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4645 RestConfig
::authorization_check("patients", "med");
4646 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4647 RestConfig
::apiLog($return);
4653 * path="/api/patient/{pid}/surgery/{sid}",
4654 * description="Delete a surgery",
4655 * tags={"standard"},
4659 * description="The id for the patient.",
4668 * description="The id for the surgery.",
4676 * ref="#/components/responses/standard"
4680 * ref="#/components/responses/badrequest"
4684 * ref="#/components/responses/unauthorized"
4686 * security={{"openemr_auth":{}}}
4689 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4690 RestConfig
::authorization_check("patients", "med");
4691 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4692 RestConfig
::apiLog($return);
4697 * Schema for the surgery request
4700 * schema="api_surgery_request",
4703 * description="The title of surgery.",
4707 * property="begdate",
4708 * description="The beginning date of surgery.",
4712 * property="enddate",
4713 * description="The end date of surgery.",
4717 * property="diagnosis",
4718 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4721 * required={"title", "begdate"},
4723 * "title": "Blepharoplasty",
4724 * "begdate": "2013-10-14",
4726 * "diagnosis": "CPT4:15823-50"
4732 * path="/api/patient/{pid}/surgery",
4733 * description="Submits a new surgery",
4734 * tags={"standard"},
4738 * description="The pid for the patient.",
4747 * mediaType="application/json",
4748 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4753 * ref="#/components/responses/standard"
4757 * ref="#/components/responses/badrequest"
4761 * ref="#/components/responses/unauthorized"
4763 * security={{"openemr_auth":{}}}
4766 "POST /api/patient/:pid/surgery" => function ($pid) {
4767 RestConfig
::authorization_check("patients", "med");
4768 $data = (array) (json_decode(file_get_contents("php://input")));
4769 $return = (new ListRestController())->post($pid, "surgery", $data);
4770 RestConfig
::apiLog($return, $data);
4776 * path="/api/patient/{pid}/surgery/{sid}",
4777 * description="Edit a surgery",
4778 * tags={"standard"},
4782 * description="The pid for the patient.",
4791 * description="The id for the surgery.",
4800 * mediaType="application/json",
4801 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4806 * ref="#/components/responses/standard"
4810 * ref="#/components/responses/badrequest"
4814 * ref="#/components/responses/unauthorized"
4816 * security={{"openemr_auth":{}}}
4819 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4820 RestConfig
::authorization_check("patients", "med");
4821 $data = (array) (json_decode(file_get_contents("php://input")));
4822 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4823 RestConfig
::apiLog($return, $data);
4829 * path="/api/patient/{pid}/dental_issue",
4830 * description="Retrieves all dental issues for a patient",
4831 * tags={"standard"},
4835 * description="The pid for the patient.",
4843 * ref="#/components/responses/standard"
4847 * ref="#/components/responses/badrequest"
4851 * ref="#/components/responses/unauthorized"
4853 * security={{"openemr_auth":{}}}
4856 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4857 RestConfig
::authorization_check("patients", "med");
4858 $return = (new ListRestController())->getAll($pid, "dental");
4859 RestConfig
::apiLog($return);
4865 * path="/api/patient/{pid}/dental_issue/{did}",
4866 * description="Retrieves a dental issue for a patient",
4867 * tags={"standard"},
4871 * description="The id for the patient.",
4880 * description="The id for the dental issue.",
4888 * ref="#/components/responses/standard"
4892 * ref="#/components/responses/badrequest"
4896 * ref="#/components/responses/unauthorized"
4898 * security={{"openemr_auth":{}}}
4901 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4902 RestConfig
::authorization_check("patients", "med");
4903 $return = (new ListRestController())->getOne($pid, "dental", $did);
4904 RestConfig
::apiLog($return);
4910 * path="/api/patient/{pid}/dental_issue/{did}",
4911 * description="Delete a dental issue",
4912 * tags={"standard"},
4916 * description="The id for the patient.",
4925 * description="The id for the dental issue.",
4933 * ref="#/components/responses/standard"
4937 * ref="#/components/responses/badrequest"
4941 * ref="#/components/responses/unauthorized"
4943 * security={{"openemr_auth":{}}}
4946 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4947 RestConfig
::authorization_check("patients", "med");
4948 $return = (new ListRestController())->delete($pid, $did, "dental");
4949 RestConfig
::apiLog($return);
4954 * Schema for the dental_issue request
4957 * schema="api_dental_issue_request",
4960 * description="The title of dental issue.",
4964 * property="begdate",
4965 * description="The beginning date of dental issue.",
4969 * property="enddate",
4970 * description="The end date of dental issue.",
4974 * property="diagnosis",
4975 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4978 * required={"title", "begdate"},
4980 * "title": "Halitosis",
4981 * "begdate": "2015-03-17",
4988 * path="/api/patient/{pid}/dental_issue",
4989 * description="Submits a new dental issue",
4990 * tags={"standard"},
4994 * description="The pid for the patient.",
5003 * mediaType="application/json",
5004 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5009 * ref="#/components/responses/standard"
5013 * ref="#/components/responses/badrequest"
5017 * ref="#/components/responses/unauthorized"
5019 * security={{"openemr_auth":{}}}
5022 "POST /api/patient/:pid/dental_issue" => function ($pid) {
5023 RestConfig
::authorization_check("patients", "med");
5024 $data = (array) (json_decode(file_get_contents("php://input")));
5025 $return = (new ListRestController())->post($pid, "dental", $data);
5026 RestConfig
::apiLog($return, $data);
5032 * path="/api/patient/{pid}/dental_issue/{did}",
5033 * description="Edit a dental issue",
5034 * tags={"standard"},
5038 * description="The pid for the patient.",
5047 * description="The id for the dental issue.",
5056 * mediaType="application/json",
5057 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5062 * ref="#/components/responses/standard"
5066 * ref="#/components/responses/badrequest"
5070 * ref="#/components/responses/unauthorized"
5072 * security={{"openemr_auth":{}}}
5075 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5076 RestConfig
::authorization_check("patients", "med");
5077 $data = (array) (json_decode(file_get_contents("php://input")));
5078 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5079 RestConfig
::apiLog($return, $data);
5085 * path="/api/patient/{pid}/appointment",
5086 * description="Retrieves all appointments for a patient",
5087 * tags={"standard"},
5091 * description="The pid for the patient.",
5099 * ref="#/components/responses/standard"
5103 * ref="#/components/responses/badrequest"
5107 * ref="#/components/responses/unauthorized"
5109 * security={{"openemr_auth":{}}}
5112 "GET /api/patient/:pid/appointment" => function ($pid) {
5113 RestConfig
::authorization_check("patients", "appt");
5114 $return = (new AppointmentRestController())->getAllForPatient($pid);
5115 RestConfig
::apiLog($return);
5121 * path="/api/patient/{pid}/appointment",
5122 * description="Submits a new appointment",
5123 * tags={"standard"},
5127 * description="The id for the patient.",
5136 * mediaType="application/json",
5139 * property="pc_catid",
5140 * description="The category of the appointment.",
5144 * property="pc_title",
5145 * description="The title of the appointment.",
5149 * property="pc_duration",
5150 * description="The duration of the appointment.",
5154 * property="pc_hometext",
5155 * description="Comments for the appointment.",
5159 * property="pc_apptstatus",
5160 * description="use an option from resource=/api/list/apptstat",
5164 * property="pc_eventDate",
5165 * description="The date of the appointment.",
5169 * property="pc_startTime",
5170 * description="The time of the appointment.",
5174 * property="pc_facility",
5175 * description="The facility id of the appointment.",
5179 * property="pc_billing_location",
5180 * description="The billinag location id of the appointment.",
5184 * property="pc_aid",
5185 * description="The provider id for the appointment.",
5188 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5191 * "pc_title": "Office Visit",
5192 * "pc_duration": "900",
5193 * "pc_hometext": "Test",
5194 * "pc_apptstatus": "-",
5195 * "pc_eventDate": "2018-10-19",
5196 * "pc_startTime": "09:00",
5197 * "pc_facility": "9",
5198 * "pc_billing_location": "10",
5206 * ref="#/components/responses/standard"
5210 * ref="#/components/responses/badrequest"
5214 * ref="#/components/responses/unauthorized"
5216 * security={{"openemr_auth":{}}}
5219 "POST /api/patient/:pid/appointment" => function ($pid) {
5220 RestConfig
::authorization_check("patients", "appt");
5221 $data = (array) (json_decode(file_get_contents("php://input")));
5222 $return = (new AppointmentRestController())->post($pid, $data);
5223 RestConfig
::apiLog($return, $data);
5229 * path="/api/appointment",
5230 * description="Retrieves all appointments",
5231 * tags={"standard"},
5234 * ref="#/components/responses/standard"
5238 * ref="#/components/responses/badrequest"
5242 * ref="#/components/responses/unauthorized"
5244 * security={{"openemr_auth":{}}}
5247 "GET /api/appointment" => function () {
5248 RestConfig
::authorization_check("patients", "appt");
5249 $return = (new AppointmentRestController())->getAll();
5250 RestConfig
::apiLog($return);
5256 * path="/api/appointment/{eid}",
5257 * description="Retrieves an appointment",
5258 * tags={"standard"},
5262 * description="The eid for the appointment.",
5270 * ref="#/components/responses/standard"
5274 * ref="#/components/responses/badrequest"
5278 * ref="#/components/responses/unauthorized"
5280 * security={{"openemr_auth":{}}}
5283 "GET /api/appointment/:eid" => function ($eid) {
5284 RestConfig
::authorization_check("patients", "appt");
5285 $return = (new AppointmentRestController())->getOne($eid);
5286 RestConfig
::apiLog($return);
5292 * path="/api/patient/{pid}/appointment/{eid}",
5293 * description="Delete a appointment",
5294 * tags={"standard"},
5298 * description="The id for the patient.",
5307 * description="The eid for the appointment.",
5315 * ref="#/components/responses/standard"
5319 * ref="#/components/responses/badrequest"
5323 * ref="#/components/responses/unauthorized"
5325 * security={{"openemr_auth":{}}}
5328 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5329 RestConfig
::authorization_check("patients", "appt");
5330 $return = (new AppointmentRestController())->delete($eid);
5331 RestConfig
::apiLog($return);
5337 * path="/api/patient/{pid}/appointment/{eid}",
5338 * description="Retrieves a appointment for a patient",
5339 * tags={"standard"},
5343 * description="The id for the patient.",
5352 * description="The eid for the appointment.",
5360 * ref="#/components/responses/standard"
5364 * ref="#/components/responses/badrequest"
5368 * ref="#/components/responses/unauthorized"
5370 * security={{"openemr_auth":{}}}
5373 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5374 RestConfig
::authorization_check("patients", "appt");
5375 $return = (new AppointmentRestController())->getOne($eid);
5376 RestConfig
::apiLog($return);
5382 * path="/api/list/{list_name}",
5383 * description="Retrieves a list",
5384 * tags={"standard"},
5388 * description="The list_id of the list.",
5396 * ref="#/components/responses/standard"
5400 * ref="#/components/responses/badrequest"
5404 * ref="#/components/responses/unauthorized"
5406 * security={{"openemr_auth":{}}}
5409 "GET /api/list/:list_name" => function ($list_name) {
5410 RestConfig
::authorization_check("lists", "default");
5411 $return = (new ListRestController())->getOptions($list_name);
5412 RestConfig
::apiLog($return);
5419 * description="Retrieves a list of users",
5420 * tags={"standard"},
5424 * description="The id for the user.",
5433 * description="The title for the user.",
5442 * description="The first name for the user.",
5451 * description="The last name for the user.",
5460 * description="The middle name for the user.",
5467 * name="federaltaxid",
5469 * description="The federal tax id for the user.",
5476 * name="federaldrugid",
5478 * description="The federal drug id for the user.",
5487 * description="The upin for the user.",
5494 * name="facility_id",
5496 * description="The facility id for the user.",
5505 * description="The facility for the user.",
5514 * description="The npi for the user.",
5523 * description="The email for the user.",
5532 * description="The specialty for the user.",
5541 * description="The billname for the user.",
5550 * description="The url for the user.",
5559 * description="The assistant for the user.",
5566 * name="organization",
5568 * description="The organization for the user.",
5575 * name="valedictory",
5577 * description="The valedictory for the user.",
5586 * description="The street for the user.",
5595 * description="The street (line 2) for the user.",
5604 * description="The city for the user.",
5613 * description="The state for the user.",
5622 * description="The zip for the user.",
5631 * description="The phone for the user.",
5640 * description="The fax for the user.",
5649 * description="The phonew1 for the user.",
5658 * description="The phonecell for the user.",
5667 * description="The notes for the user.",
5674 * name="state_license_number2",
5676 * description="The state license number for the user.",
5685 * description="The username for the user.",
5693 * ref="#/components/responses/standard"
5697 * ref="#/components/responses/badrequest"
5701 * ref="#/components/responses/unauthorized"
5703 * security={{"openemr_auth":{}}}
5706 "GET /api/user" => function () {
5707 RestConfig
::authorization_check("admin", "users");
5708 $return = (new UserRestController())->getAll($_GET);
5709 RestConfig
::apiLog($return);
5715 * path="/api/user/{uuid}",
5716 * description="Retrieves a single user by their uuid",
5717 * tags={"standard"},
5721 * description="The uuid for the user.",
5729 * ref="#/components/responses/standard"
5733 * ref="#/components/responses/badrequest"
5737 * ref="#/components/responses/unauthorized"
5739 * security={{"openemr_auth":{}}}
5742 "GET /api/user/:uuid" => function ($uuid) {
5743 RestConfig
::authorization_check("admin", "users");
5744 $return = (new UserRestController())->getOne($uuid);
5745 RestConfig
::apiLog($return);
5751 * path="/api/version",
5752 * description="Retrieves the OpenEMR version information",
5753 * tags={"standard"},
5756 * ref="#/components/responses/standard"
5760 * ref="#/components/responses/badrequest"
5764 * ref="#/components/responses/unauthorized"
5766 * security={{"openemr_auth":{}}}
5769 "GET /api/version" => function () {
5770 $return = (new VersionRestController())->getOne();
5771 RestConfig
::apiLog($return);
5777 * path="/api/product",
5778 * description="Retrieves the OpenEMR product registration information",
5779 * tags={"standard"},
5782 * ref="#/components/responses/standard"
5786 * ref="#/components/responses/badrequest"
5790 * ref="#/components/responses/unauthorized"
5792 * security={{"openemr_auth":{}}}
5795 "GET /api/product" => function () {
5796 $return = (new ProductRegistrationRestController())->getOne();
5797 RestConfig
::apiLog($return);
5803 * path="/api/insurance_company",
5804 * description="Retrieves all insurance companies",
5805 * tags={"standard"},
5808 * ref="#/components/responses/standard"
5812 * ref="#/components/responses/badrequest"
5816 * ref="#/components/responses/unauthorized"
5818 * security={{"openemr_auth":{}}}
5821 "GET /api/insurance_company" => function () {
5822 $return = (new InsuranceCompanyRestController())->getAll();
5823 RestConfig
::apiLog($return);
5829 * path="/api/insurance_company/{iid}",
5830 * description="Retrieves insurance company",
5831 * tags={"standard"},
5835 * description="The id of the insurance company.",
5843 * ref="#/components/responses/standard"
5847 * ref="#/components/responses/badrequest"
5851 * ref="#/components/responses/unauthorized"
5853 * security={{"openemr_auth":{}}}
5856 "GET /api/insurance_company/:iid" => function ($iid) {
5857 $return = (new InsuranceCompanyRestController())->getOne($iid);
5858 RestConfig
::apiLog($return);
5864 * path="/api/insurance_type",
5865 * description="Retrieves all insurance types",
5866 * tags={"standard"},
5869 * ref="#/components/responses/standard"
5873 * ref="#/components/responses/badrequest"
5877 * ref="#/components/responses/unauthorized"
5879 * security={{"openemr_auth":{}}}
5882 "GET /api/insurance_type" => function () {
5883 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5884 RestConfig
::apiLog($return);
5889 * Schema for the insurance_company request
5892 * schema="api_insurance_company_request",
5895 * description="The name of insurance company.",
5900 * description="The attn of insurance company.",
5904 * property="cms_id",
5905 * description="The cms id of insurance company.",
5909 * property="ins_type_code",
5910 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5914 * property="x12_receiver_id",
5915 * description="The x12 receiver id of insurance company.",
5919 * property="x12_default_partner_id",
5920 * description="The x12 default partner id of insurance company.",
5924 * property="alt_cms_id",
5925 * description="The alternate cms id of insurance company.",
5930 * description="The line1 address of insurance company.",
5935 * description="The line2 address of insurance company.",
5940 * description="The city of insurance company.",
5945 * description="The state of insurance company.",
5950 * description="The zip of insurance company.",
5954 * property="country",
5955 * description="The country of insurance company.",
5958 * required={"name"},
5960 * "name": "Cool Insurance Company",
5963 * "ins_type_code": "2",
5964 * "x12_receiver_id": null,
5965 * "x12_default_partner_id": null,
5967 * "line1": "123 Cool Lane",
5968 * "line2": "Suite 123",
5969 * "city": "Cooltown",
5978 * path="/api/insurance_company",
5979 * description="Submits a new insurance company",
5980 * tags={"standard"},
5984 * mediaType="application/json",
5985 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5990 * ref="#/components/responses/standard"
5994 * ref="#/components/responses/badrequest"
5998 * ref="#/components/responses/unauthorized"
6000 * security={{"openemr_auth":{}}}
6003 "POST /api/insurance_company" => function () {
6004 $data = (array) (json_decode(file_get_contents("php://input")));
6005 $return = (new InsuranceCompanyRestController())->post($data);
6006 RestConfig
::apiLog($return, $data);
6012 * path="/api/insurance_company/{iid}",
6013 * description="Edit a insurance company",
6014 * tags={"standard"},
6018 * description="The id for the insurance company.",
6027 * mediaType="application/json",
6028 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
6033 * ref="#/components/responses/standard"
6037 * ref="#/components/responses/badrequest"
6041 * ref="#/components/responses/unauthorized"
6043 * security={{"openemr_auth":{}}}
6046 "PUT /api/insurance_company/:iid" => function ($iid) {
6047 $data = (array) (json_decode(file_get_contents("php://input")));
6048 $return = (new InsuranceCompanyRestController())->put($iid, $data);
6049 RestConfig
::apiLog($return, $data);
6055 * path="/api/patient/{pid}/document",
6056 * description="Submits a new patient document",
6057 * tags={"standard"},
6061 * description="The pid for the patient.",
6070 * description="The category of the document.",
6079 * mediaType="multipart/form-data",
6082 * property="document",
6083 * description="document",
6092 * ref="#/components/responses/standard"
6096 * ref="#/components/responses/badrequest"
6100 * ref="#/components/responses/unauthorized"
6102 * security={{"openemr_auth":{}}}
6105 "POST /api/patient/:pid/document" => function ($pid) {
6106 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6107 RestConfig
::apiLog($return);
6113 * path="/api/patient/{pid}/document",
6114 * description="Retrieves all file information of documents from a category for a patient",
6115 * tags={"standard"},
6119 * description="The pid for the patient.",
6128 * description="The category of the documents.",
6136 * ref="#/components/responses/standard"
6140 * ref="#/components/responses/badrequest"
6144 * ref="#/components/responses/unauthorized"
6146 * security={{"openemr_auth":{}}}
6149 "GET /api/patient/:pid/document" => function ($pid) {
6150 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6151 RestConfig
::apiLog($return);
6157 * path="/api/patient/{pid}/document/{did}",
6158 * description="Retrieves a document for a patient",
6159 * tags={"standard"},
6163 * description="The pid for the patient.",
6172 * description="The id for the patient document.",
6180 * ref="#/components/responses/standard"
6184 * ref="#/components/responses/badrequest"
6188 * ref="#/components/responses/unauthorized"
6190 * security={{"openemr_auth":{}}}
6193 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6194 $return = (new DocumentRestController())->downloadFile($pid, $did);
6195 RestConfig
::apiLog($return);
6201 * path="/api/patient/{puuid}/employer",
6202 * description="Retrieves all the employer data for a patient. Returns an array of the employer data for the patient.",
6203 * tags={"standard"},
6207 * description="The uuid for the patient.",
6215 * ref="#/components/responses/standard"
6219 * ref="#/components/responses/badrequest"
6223 * ref="#/components/responses/unauthorized"
6225 * security={{"openemr_auth":{}}}
6228 "GET /api/patient/:puuid/employer" => function ($puuid, HttpRestRequest
$request) {
6229 $searchParams = $request->getQueryParams();
6230 $searchParams['puuid'] = $puuid;
6231 if ($request->isPatientRequest()) {
6232 $searchParams['puuid'] = $request->getPatientUUIDString();
6234 $return = (new EmployerRestController())->getAll($searchParams);
6235 RestConfig
::apiLog($return);
6241 * path="/api/patient/{puuid}/insurance",
6242 * description="Retrieves all insurances for a patient",
6243 * tags={"standard"},
6247 * description="The uuid for the patient.",
6255 * ref="#/components/responses/standard"
6259 * ref="#/components/responses/badrequest"
6263 * ref="#/components/responses/unauthorized"
6265 * security={{"openemr_auth":{}}}
6268 "GET /api/patient/:puuid/insurance" => function ($puuid, HttpRestRequest
$request) {
6269 $searchParams = $request->getQueryParams();
6270 $searchParams['puuid'] = $puuid;
6271 if ($request->isPatientRequest()) {
6272 $searchParams['puuid'] = $request->getPatientUUIDString();
6274 $return = (new InsuranceRestController())->getAll($searchParams);
6275 RestConfig
::apiLog($return);
6281 * path="/api/patient/{puuid}/insurance/$swap-insurance",
6282 * description="Updates the insurance for the passed in uuid to be a policy of type `type` and updates (if one exists) the current or most recent insurance for the passed in `type` for a patient to be the `type` of the insurance for the given `uuid`. Validations on the swap operation are performed to make sure the effective `date` of the src and target policies being swapped can be received in each given policy `type` as a policy `type` and `date` must together be unique per patient.",
6283 * tags={"standard"},
6287 * description="The uuid for the patient.",
6296 * description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'.",
6305 * description="The insurance uuid that will be swapped into the list of insurances for the type query parameter",
6313 * ref="#/components/responses/standard"
6317 * ref="#/components/responses/badrequest"
6321 * ref="#/components/responses/unauthorized"
6323 * security={{"openemr_auth":{}}}
6326 'GET /api/patient/:puuid/insurance/$swap-insurance' => function ($puuid, HttpRestRequest
$request) {
6327 if ($request->isPatientRequest()) {
6328 $puuid = $request->getPatientUUIDString();
6330 $type = $request->getQueryParam('type');
6331 $insuranceUuid = $request->getQueryParam('uuid');
6333 $return = (new InsuranceRestController())->operationSwapInsurance($puuid, $type, $insuranceUuid);
6334 RestConfig
::apiLog($return);
6340 * path="/api/patient/{puuid}/insurance/{uuid}",
6341 * description="Retrieves all insurances for a patient",
6342 * tags={"standard"},
6346 * description="The uuid for the patient.",
6354 * ref="#/components/responses/standard"
6358 * ref="#/components/responses/badrequest"
6362 * ref="#/components/responses/unauthorized"
6364 * security={{"openemr_auth":{}}}
6367 "GET /api/patient/:puuid/insurance/:uuid" => function ($puuid, $uuid, HttpRestRequest
$request) {
6368 if ($request->isPatientRequest()) {
6369 $puuid = $request->getPatientUUIDString();
6371 $return = (new InsuranceRestController())->getOne($uuid, $puuid);
6372 RestConfig
::apiLog($return);
6377 * Schema for the insurance request. Note the following additional validation checks on the request.
6378 * If the subscriber_relationship value is of type 'self' then the subscriber_fname and subscriber_lname fields
6379 * must match the patient's first and last name or a patient's previous first and last name.
6381 * If the subscriber_relationship value is of type 'self' then the subscriber_ss field must match the patient's
6382 * social security number.
6384 * If the subscriber_relationship value is not of type 'self' then the subscriber_ss field MUST not be the current patient's social security number.
6386 * If the system's global configuration permits only a single insurance type option then any insurance rquest where the type is NOT 'primary' will fail.
6388 * An insurance is considered the current policy for the policy type if the policy date_end field is null. Only one of these records per policy type can exist for a patient.
6390 * schema="api_insurance_request",
6392 * property="provider",
6393 * description="The insurance company id.",
6397 * property="plan_name",
6398 * description="The plan name of insurance. (2-255 characters)",
6402 * property="policy_number",
6403 * description="The policy number of insurance. (2-255 characters)",
6407 * property="group_number",
6408 * description="The group number of insurance.(2-255 characters)",
6412 * property="subscriber_lname",
6413 * description="The subscriber last name of insurance.(2-255 characters).",
6417 * property="subscriber_mname",
6418 * description="The subscriber middle name of insurance.",
6422 * property="subscriber_fname",
6423 * description="The subscriber first name of insurance.",
6427 * property="subscriber_relationship",
6428 * description="The subscriber relationship of insurance. `subscriber_relationship` can be found by querying `resource=/api/list/subscriber_relationship`",
6432 * property="subscriber_ss",
6433 * description="The subscriber ss number of insurance.",
6437 * property="subscriber_DOB",
6438 * description="The subscriber DOB of insurance.",
6442 * property="subscriber_street",
6443 * description="The subscriber street address of insurance.",
6447 * property="subscriber_postal_code",
6448 * description="The subscriber postal code of insurance.",
6452 * property="subscriber_city",
6453 * description="The subscriber city of insurance.",
6457 * property="subscriber_state",
6458 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6462 * property="subscriber_country",
6463 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6467 * property="subscriber_phone",
6468 * description="The subscriber phone of insurance.",
6472 * property="subscriber_employer",
6473 * description="The subscriber employer of insurance.",
6477 * property="subscriber_employer_street",
6478 * description="The subscriber employer street of insurance.",
6482 * property="subscriber_employer_postal_code",
6483 * description="The subscriber employer postal code of insurance.",
6487 * property="subscriber_employer_state",
6488 * description="The subscriber employer state of insurance.",
6492 * property="subscriber_employer_country",
6493 * description="The subscriber employer country of insurance.",
6497 * property="subscriber_employer_city",
6498 * description="The subscriber employer city of insurance.",
6503 * description="The copay of insurance.",
6508 * description="The effective date of insurance in YYYY-MM-DD format. This value cannot be after the date_end property and cannot be the same date as any other insurance policy for the same insurance type ('primary, 'secondary', etc).",
6512 * property="date_end",
6513 * description="The effective end date of insurance in YYYY-MM-DD format. This value cannot be before the date property. If it is null then this policy is the current policy for this policy type for the patient. There can only be one current policy per type and the request will fail if there is already a current policy for this type.",
6517 * property="subscriber_sex",
6518 * description="The subscriber sex of insurance.",
6522 * property="accept_assignment",
6523 * description="The accept_assignment of insurance.",
6527 * property="policy_type",
6528 * description="The 837p list of policy types for an insurance. See src/Billing/InsurancePolicyType.php for the list of valid values.",
6533 * description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'. If this field is missing it will default to 'primary'.",
6536 * required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_sex", "accept_assignment"},
6539 * "plan_name": "Some Plan",
6540 * "policy_number": "12345",
6541 * "group_number": "252412",
6542 * "subscriber_lname": "Tester",
6543 * "subscriber_mname": "Xi",
6544 * "subscriber_fname": "Foo",
6545 * "subscriber_relationship": "other",
6546 * "subscriber_ss": "234231234",
6547 * "subscriber_DOB": "2018-10-03",
6548 * "subscriber_street": "183 Cool St",
6549 * "subscriber_postal_code": "23418",
6550 * "subscriber_city": "Cooltown",
6551 * "subscriber_state": "AZ",
6552 * "subscriber_country": "USA",
6553 * "subscriber_phone": "234-598-2123",
6554 * "subscriber_employer": "Some Employer",
6555 * "subscriber_employer_street": "123 Heather Lane",
6556 * "subscriber_employer_postal_code": "23415",
6557 * "subscriber_employer_state": "AZ",
6558 * "subscriber_employer_country": "USA",
6559 * "subscriber_employer_city": "Cooltown",
6561 * "date": "2018-10-15",
6562 * "subscriber_sex": "Female",
6563 * "accept_assignment": "TRUE",
6564 * "policy_type": "a",
6572 * path="/api/patient/{puuid}/insurance/{insuranceUuid}",
6573 * description="Edit a specific patient insurance policy. Requires the patients/demo/write ACL to call. This method is the preferred method for updating a patient insurance policy. The {insuranceId} can be found by querying /api/patient/{pid}/insurance",
6574 * tags={"standard"},
6578 * description="The uuid for the patient.",
6585 * name="insuranceUuid",
6587 * description="The insurance policy uuid for the patient.",
6596 * mediaType="application/json",
6597 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6602 * ref="#/components/responses/standard"
6606 * ref="#/components/responses/badrequest"
6610 * ref="#/components/responses/unauthorized"
6612 * security={{"openemr_auth":{}}}
6615 "PUT /api/patient/:puuid/insurance/:insuranceUuid" => function ($puuid, $insuranceUuid, HttpRestRequest
$request) {
6616 RestConfig
::authorization_check("patients", "demo", '', 'write');
6617 $data = (array) (json_decode(file_get_contents("php://input")));
6618 $return = (new InsuranceRestController())->put($puuid, $insuranceUuid, $data);
6619 RestConfig
::apiLog($return, $data);
6625 * path="/api/patient/{puuid}/insurance",
6626 * description="Submits a new patient insurance.",
6627 * tags={"standard"},
6631 * description="The uuid for the patient.",
6640 * mediaType="application/json",
6641 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6646 * ref="#/components/responses/standard"
6650 * ref="#/components/responses/badrequest"
6654 * ref="#/components/responses/unauthorized"
6656 * security={{"openemr_auth":{}}}
6659 "POST /api/patient/:puuid/insurance" => function ($puuid) {
6660 RestConfig
::authorization_check("patients", "demo", '', ['write','addonly']);
6661 $data = (array) (json_decode(file_get_contents("php://input")));
6662 $return = (new InsuranceRestController())->post($puuid, $data);
6663 RestConfig
::apiLog($return, $data);
6667 * Schema for the message request
6670 * schema="api_message_request",
6673 * description="The body of message.",
6677 * property="groupname",
6678 * description="The group name (usually is 'Default').",
6683 * description="The sender of the message.",
6688 * description="The recipient of the message.",
6693 * description="use an option from resource=/api/list/note_type",
6697 * property="message_status",
6698 * description="use an option from resource=/api/list/message_status",
6701 * required={"body", "groupname", "from", "to", "title", "message_status"},
6703 * "body": "Test 456",
6704 * "groupname": "Default",
6705 * "from": "Matthew",
6708 * "message_status": "New"
6714 * path="/api/patient/{pid}/message",
6715 * description="Submits a pnote message",
6716 * tags={"standard"},
6720 * description="The id for the patient.",
6729 * mediaType="application/json",
6730 * @OA\Schema(ref="#/components/schemas/api_message_request")
6735 * ref="#/components/responses/standard"
6739 * ref="#/components/responses/badrequest"
6743 * ref="#/components/responses/unauthorized"
6745 * security={{"openemr_auth":{}}}
6748 "POST /api/patient/:pid/message" => function ($pid) {
6749 RestConfig
::authorization_check("patients", "notes");
6750 $data = (array) (json_decode(file_get_contents("php://input")));
6751 $return = (new MessageRestController())->post($pid, $data);
6752 RestConfig
::apiLog($return, $data);
6758 * path="/api/patient/{pid}/transaction",
6759 * description="Get Transactions for a patient",
6760 * tags={"standard"},
6764 * description="The pid for the patient",
6772 * ref="#/components/responses/standard"
6776 * ref="#/components/responses/badrequest"
6780 * ref="#/components/responses/unauthorized"
6782 * security={{"openemr_auth":{}}}
6786 "GET /api/patient/:pid/transaction" => function ($pid) {
6787 RestConfig
::authorization_check("patients", "trans");
6788 $cont = new TransactionRestController();
6789 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6790 RestConfig
::apiLog($return);
6795 * Schema for the transaction request
6798 * schema="api_transaction_request",
6800 * property="message",
6801 * description="The message of the transaction.",
6806 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6810 * property="groupname",
6811 * description="The group name (usually is 'Default').",
6815 * property="referByNpi",
6816 * description="NPI of the person creating the referral.",
6820 * property="referToNpi",
6821 * description="NPI of the person getting the referral.",
6825 * property="referDiagnosis",
6826 * description="The referral diagnosis.",
6830 * property="riskLevel",
6831 * description="The risk level. (Low, Medium, High)",
6835 * property="includeVitals",
6836 * description="Are vitals included (0,1)",
6840 * property="referralDate",
6841 * description="The date of the referral",
6845 * property="authorization",
6846 * description="The authorization for the referral",
6850 * property="visits",
6851 * description="The number of vists for the referral",
6855 * property="validFrom",
6856 * description="The date the referral is valid from",
6860 * property="validThrough",
6861 * description="The date the referral is valid through",
6864 * required={"message", "groupname", "title"},
6866 * "message": "Message",
6868 * "groupname": "Default",
6869 * "referByNpi":"9999999999",
6870 * "referToNpi":"9999999999",
6871 * "referDiagnosis":"Diag 1",
6872 * "riskLevel":"Low",
6873 * "includeVitals":"1",
6874 * "referralDate":"2022-01-01",
6875 * "authorization":"Auth_123",
6877 * "validFrom": "2022-01-02",
6878 * "validThrough": "2022-01-03",
6879 * "body": "Reason 1"
6885 * path="/api/patient/{pid}/transaction",
6886 * description="Submits a transaction",
6887 * tags={"standard"},
6891 * description="The pid for the patient.",
6900 * mediaType="application/json",
6901 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6906 * ref="#/components/responses/standard"
6910 * ref="#/components/responses/badrequest"
6914 * ref="#/components/responses/unauthorized"
6916 * security={{"openemr_auth":{}}}
6919 "POST /api/patient/:pid/transaction" => function ($pid) {
6920 RestConfig
::authorization_check("patients", "trans");
6921 $data = (array) (json_decode(file_get_contents("php://input")));
6922 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6923 RestConfig
::apiLog($return, $data);
6929 * path="/api/transaction/{tid}",
6930 * description="Updates a transaction",
6931 * tags={"standard"},
6935 * description="The id for the transaction.",
6944 * mediaType="application/json",
6945 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6950 * ref="#/components/responses/standard"
6954 * ref="#/components/responses/badrequest"
6958 * ref="#/components/responses/unauthorized"
6960 * security={{"openemr_auth":{}}}
6963 "PUT /api/transaction/:tid" => function ($tid) {
6964 RestConfig
::authorization_check("patients", "trans");
6965 $data = (array) (json_decode(file_get_contents("php://input")));
6966 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6967 RestConfig
::apiLog($return, $data);
6973 * path="/api/patient/{pid}/message/{mid}",
6974 * description="Edit a pnote message",
6975 * tags={"standard"},
6979 * description="The id for the patient.",
6988 * description="The id for the pnote message.",
6997 * mediaType="application/json",
6998 * @OA\Schema(ref="#/components/schemas/api_message_request")
7003 * ref="#/components/responses/standard"
7007 * ref="#/components/responses/badrequest"
7011 * ref="#/components/responses/unauthorized"
7013 * security={{"openemr_auth":{}}}
7016 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
7017 RestConfig
::authorization_check("patients", "notes");
7018 $data = (array) (json_decode(file_get_contents("php://input")));
7019 $return = (new MessageRestController())->put($pid, $mid, $data);
7020 RestConfig
::apiLog($return, $data);
7026 * path="/api/patient/{pid}/message/{mid}",
7027 * description="Delete a pnote message",
7028 * tags={"standard"},
7032 * description="The id for the patient.",
7041 * description="The id for the pnote message.",
7049 * ref="#/components/responses/standard"
7053 * ref="#/components/responses/badrequest"
7057 * ref="#/components/responses/unauthorized"
7059 * security={{"openemr_auth":{}}}
7062 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
7063 RestConfig
::authorization_check("patients", "notes");
7064 $return = (new MessageRestController())->delete($pid, $mid);
7065 RestConfig
::apiLog($return);
7071 * path="/api/immunization",
7072 * description="Retrieves a list of immunizations",
7073 * tags={"standard"},
7075 * name="patient_id",
7077 * description="The pid for the patient.",
7086 * description="The id for the immunization.",
7095 * description="The uuid for the immunization.",
7102 * name="administered_date",
7104 * description="The administered date for the immunization.",
7111 * name="immunization_id",
7113 * description="The immunization list_id for the immunization.",
7122 * description="The cvx code for the immunization.",
7129 * name="manufacturer",
7131 * description="The manufacturer for the immunization.",
7138 * name="lot_number",
7140 * description="The lot number for the immunization.",
7147 * name="administered_by_id",
7149 * description="The administered by id for the immunization.",
7156 * name="administered_by",
7158 * description="The administered by for the immunization.",
7165 * name="education_date",
7167 * description="The education date for the immunization.",
7176 * description="The vis date for the immunization.",
7185 * description="The note for the immunization.",
7192 * name="create_date",
7194 * description="The create date for the immunization.",
7201 * name="update_date",
7203 * description="The update date for the immunization.",
7210 * name="created_by",
7212 * description="The created_by for the immunization.",
7219 * name="updated_by",
7221 * description="The updated_by for the immunization.",
7228 * name="amount_administered",
7230 * description="The amount administered for the immunization.",
7237 * name="amount_administered_unit",
7239 * description="The amount administered unit for the immunization.",
7246 * name="expiration_date",
7248 * description="The expiration date for the immunization.",
7257 * description="The route for the immunization.",
7264 * name="administration_site",
7266 * description="The administration site for the immunization.",
7273 * name="added_erroneously",
7275 * description="The added_erroneously for the immunization.",
7282 * name="external_id",
7284 * description="The external_id for the immunization.",
7291 * name="completion_status",
7293 * description="The completion status for the immunization.",
7300 * name="information_source",
7302 * description="The information source for the immunization.",
7309 * name="refusal_reason",
7311 * description="The refusal reason for the immunization.",
7318 * name="ordering_provider",
7320 * description="The ordering provider for the immunization.",
7328 * ref="#/components/responses/standard"
7332 * ref="#/components/responses/badrequest"
7336 * ref="#/components/responses/unauthorized"
7338 * security={{"openemr_auth":{}}}
7341 "GET /api/immunization" => function () {
7342 RestConfig
::authorization_check("patients", "med");
7343 $return = (new ImmunizationRestController())->getAll($_GET);
7344 RestConfig
::apiLog($return);
7350 * path="/api/immunization/{uuid}",
7351 * description="Retrieves a immunization",
7352 * tags={"standard"},
7356 * description="The uuid for the immunization.",
7364 * ref="#/components/responses/standard"
7368 * ref="#/components/responses/badrequest"
7372 * ref="#/components/responses/unauthorized"
7374 * security={{"openemr_auth":{}}}
7377 "GET /api/immunization/:uuid" => function ($uuid) {
7378 RestConfig
::authorization_check("patients", "med");
7379 $return = (new ImmunizationRestController())->getOne($uuid);
7380 RestConfig
::apiLog($return);
7386 * path="/api/procedure",
7387 * description="Retrieves a list of all procedures",
7388 * tags={"standard"},
7391 * ref="#/components/responses/standard"
7395 * ref="#/components/responses/badrequest"
7399 * ref="#/components/responses/unauthorized"
7401 * security={{"openemr_auth":{}}}
7404 "GET /api/procedure" => function () {
7405 RestConfig
::authorization_check("patients", "med");
7406 $return = (new ProcedureRestController())->getAll();
7407 RestConfig
::apiLog($return);
7413 * path="/api/procedure/{uuid}",
7414 * description="Retrieves a procedure",
7415 * tags={"standard"},
7419 * description="The uuid for the procedure.",
7427 * ref="#/components/responses/standard"
7431 * ref="#/components/responses/badrequest"
7435 * ref="#/components/responses/unauthorized"
7437 * security={{"openemr_auth":{}}}
7440 "GET /api/procedure/:uuid" => function ($uuid) {
7441 RestConfig
::authorization_check("patients", "med");
7442 $return = (new ProcedureRestController())->getOne($uuid);
7443 RestConfig
::apiLog($return);
7450 * description="Retrieves a list of all drugs",
7451 * tags={"standard"},
7454 * ref="#/components/responses/standard"
7458 * ref="#/components/responses/badrequest"
7462 * ref="#/components/responses/unauthorized"
7464 * security={{"openemr_auth":{}}}
7467 "GET /api/drug" => function () {
7468 RestConfig
::authorization_check("patients", "med");
7469 $return = (new DrugRestController())->getAll();
7470 RestConfig
::apiLog($return);
7476 * path="/api/drug/{uuid}",
7477 * description="Retrieves a drug",
7478 * tags={"standard"},
7482 * description="The uuid for the drug.",
7490 * ref="#/components/responses/standard"
7494 * ref="#/components/responses/badrequest"
7498 * ref="#/components/responses/unauthorized"
7500 * security={{"openemr_auth":{}}}
7503 "GET /api/drug/:uuid" => function ($uuid) {
7504 RestConfig
::authorization_check("patients", "med");
7505 $return = (new DrugRestController())->getOne($uuid);
7506 RestConfig
::apiLog($return);
7512 * path="/api/prescription",
7513 * description="Retrieves a list of all prescriptions",
7514 * tags={"standard"},
7517 * ref="#/components/responses/standard"
7521 * ref="#/components/responses/badrequest"
7525 * ref="#/components/responses/unauthorized"
7527 * security={{"openemr_auth":{}}}
7530 "GET /api/prescription" => function () {
7531 RestConfig
::authorization_check("patients", "med");
7532 $return = (new PrescriptionRestController())->getAll();
7533 RestConfig
::apiLog($return);
7539 * path="/api/prescription/{uuid}",
7540 * description="Retrieves a prescription",
7541 * tags={"standard"},
7545 * description="The uuid for the prescription.",
7553 * ref="#/components/responses/standard"
7557 * ref="#/components/responses/badrequest"
7561 * ref="#/components/responses/unauthorized"
7563 * security={{"openemr_auth":{}}}
7566 "GET /api/prescription/:uuid" => function ($uuid) {
7567 RestConfig
::authorization_check("patients", "med");
7568 $return = (new PrescriptionRestController())->getOne($uuid);
7569 RestConfig
::apiLog($return);
7574 use OpenEMR\Common\Http\StatusCode
;
7575 use OpenEMR\Common\Http\Psr17Factory
;
7576 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController
;
7577 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController
;
7578 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController
;
7579 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController
;
7580 use OpenEMR\RestControllers\FHIR\FhirConditionRestController
;
7581 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController
;
7582 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController
;
7583 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController
;
7584 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController
;
7585 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController
;
7586 use OpenEMR\RestControllers\FHIR\FhirObservationRestController
;
7587 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController
;
7588 use OpenEMR\RestControllers\FHIR\FhirGoalRestController
;
7589 use OpenEMR\RestControllers\FHIR\FhirGroupRestController
;
7590 use OpenEMR\RestControllers\FHIR\FhirLocationRestController
;
7591 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController
;
7592 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController
;
7593 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController
;
7594 use OpenEMR\RestControllers\FHIR\FhirPatientRestController
;
7595 use OpenEMR\RestControllers\FHIR\FhirPersonRestController
;
7596 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController
;
7597 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController
;
7598 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController
;
7599 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController
;
7600 use OpenEMR\RestControllers\FHIR\FhirValueSetRestController
;
7601 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController
;
7602 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController
;
7603 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController
;
7604 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController
;
7606 // Note that the fhir route includes both user role and patient role
7607 // (there is a mechanism in place to ensure patient role is binded
7608 // to only see the data of the one patient)
7609 RestConfig
::$FHIR_ROUTE_MAP = array(
7612 * path="/fhir/AllergyIntolerance",
7613 * description="Returns a list of AllergyIntolerance resources.",
7618 * description="The uuid for the AllergyIntolerance resource.",
7625 * name="_lastUpdated",
7627 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
7636 * description="The uuid for the patient.",
7644 * description="Standard Response",
7646 * mediaType="application/json",
7649 * property="json object",
7650 * description="FHIR Json object.",
7655 * "lastUpdated": "2021-09-14T09:13:51"
7657 * "resourceType": "Bundle",
7658 * "type": "collection",
7662 * "relation": "self",
7663 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7672 * ref="#/components/responses/badrequest"
7676 * ref="#/components/responses/unauthorized"
7678 * security={{"openemr_auth":{}}}
7681 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest
$request) {
7682 $getParams = $request->getQueryParams();
7683 if ($request->isPatientRequest()) {
7684 // only allow access to data of binded patient
7685 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7687 RestConfig
::authorization_check("patients", "med");
7688 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7690 RestConfig
::apiLog($return);
7696 * path="/fhir/AllergyIntolerance/{uuid}",
7697 * description="Returns a single AllergyIntolerance resource.",
7702 * description="The uuid for the AllergyIntolerance resource.",
7710 * description="Standard Response",
7712 * mediaType="application/json",
7715 * property="json object",
7716 * description="FHIR Json object.",
7720 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7723 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7725 * "resourceType": "AllergyIntolerance",
7727 * "status": "additional",
7728 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7730 * "clinicalStatus": {
7733 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7735 * "display": "Active"
7739 * "verificationStatus": {
7742 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7743 * "code": "confirmed",
7744 * "display": "Confirmed"
7751 * "criticality": "low",
7755 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7756 * "code": "unknown",
7757 * "display": "Unknown"
7762 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7766 * "manifestation": {
7770 * "system": "http://snomed.info/sct",
7771 * "code": "422587007",
7772 * "display": "Nausea"
7786 * ref="#/components/responses/badrequest"
7790 * ref="#/components/responses/unauthorized"
7794 * ref="#/components/responses/uuidnotfound"
7796 * security={{"openemr_auth":{}}}
7799 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest
$request) {
7800 if ($request->isPatientRequest()) {
7801 // only allow access to data of binded patient
7802 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7804 RestConfig
::authorization_check("patients", "med");
7805 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7807 RestConfig
::apiLog($return);
7813 * path="/fhir/Appointment",
7814 * description="Returns a list of Appointment resources.",
7819 * description="The uuid for the Appointment resource.",
7826 * name="_lastUpdated",
7828 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
7837 * description="The uuid for the patient.",
7845 * description="Standard Response",
7847 * mediaType="application/json",
7850 * property="json object",
7851 * description="FHIR Json object.",
7856 * "lastUpdated": "2021-09-14T09:13:51"
7858 * "resourceType": "Bundle",
7859 * "type": "collection",
7863 * "relation": "self",
7864 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7873 * ref="#/components/responses/badrequest"
7877 * ref="#/components/responses/unauthorized"
7879 * security={{"openemr_auth":{}}}
7882 "GET /fhir/Appointment" => function (HttpRestRequest
$request) {
7883 $getParams = $request->getQueryParams();
7884 if ($request->isPatientRequest()) {
7885 // only allow access to data of binded patient
7886 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7888 RestConfig
::authorization_check("patients", "appt");
7889 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7891 RestConfig
::apiLog($return);
7897 * path="/fhir/Appointment/{uuid}",
7898 * description="Returns a single Appointment resource.",
7903 * description="The uuid for the Appointment resource.",
7911 * description="Standard Response",
7913 * mediaType="application/json",
7916 * property="json object",
7917 * description="FHIR Json object.",
7926 * ref="#/components/responses/badrequest"
7930 * ref="#/components/responses/unauthorized"
7934 * ref="#/components/responses/uuidnotfound"
7936 * security={{"openemr_auth":{}}}
7939 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest
$request) {
7940 if ($request->isPatientRequest()) {
7941 // only allow access to data of binded patient
7942 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7944 RestConfig
::authorization_check("patients", "appt");
7945 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7947 RestConfig
::apiLog($return);
7953 * path="/fhir/CarePlan",
7954 * description="Returns a list of CarePlan resources.",
7959 * description="The uuid for the CarePlan resource.",
7966 * name="_lastUpdated",
7968 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
7977 * description="The uuid for the patient.",
7986 * description="The category of the CarePlan resource.",
7994 * description="Standard Response",
7996 * mediaType="application/json",
7999 * property="json object",
8000 * description="FHIR Json object.",
8005 * "lastUpdated": "2021-09-14T09:13:51"
8007 * "resourceType": "Bundle",
8008 * "type": "collection",
8012 * "relation": "self",
8013 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
8022 * ref="#/components/responses/badrequest"
8026 * ref="#/components/responses/unauthorized"
8028 * security={{"openemr_auth":{}}}
8031 "GET /fhir/CarePlan" => function (HttpRestRequest
$request) {
8032 $getParams = $request->getQueryParams();
8033 if ($request->isPatientRequest()) {
8034 // only allow access to data of binded patient
8035 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
8037 RestConfig
::authorization_check("patients", "med");
8038 $return = (new FhirCarePlanRestController())->getAll($getParams);
8040 RestConfig
::apiLog($return);
8046 * path="/fhir/CarePlan/{uuid}",
8047 * description="Returns a single CarePlan resource.",
8052 * description="The uuid for the CarePlan resource.",
8060 * description="Standard Response",
8062 * mediaType="application/json",
8065 * property="json object",
8066 * description="FHIR Json object.",
8070 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
8073 * "lastUpdated": "2021-09-16T00:54:18+00:00"
8075 * "resourceType": "CarePlan",
8077 * "status": "generated",
8078 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
8080 * "status": "active",
8086 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
8087 * "code": "assess-plan"
8092 * "description": "Treat flu.",
8094 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8103 * ref="#/components/responses/badrequest"
8107 * ref="#/components/responses/unauthorized"
8111 * ref="#/components/responses/uuidnotfound"
8113 * security={{"openemr_auth":{}}}
8116 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest
$request) {
8117 if ($request->isPatientRequest()) {
8118 // only allow access to data of binded patient
8119 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
8121 RestConfig
::authorization_check("patients", "med");
8122 $return = (new FhirCarePlanRestController())->getOne($uuid);
8124 RestConfig
::apiLog($return);
8130 * path="/fhir/CareTeam",
8131 * description="Returns a list of CareTeam resources.",
8136 * description="The uuid for the CareTeam resource.",
8143 * name="_lastUpdated",
8145 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8154 * description="The uuid for the patient.",
8163 * description="The status of the CarePlan resource.",
8171 * description="Standard Response",
8173 * mediaType="application/json",
8176 * property="json object",
8177 * description="FHIR Json object.",
8182 * "lastUpdated": "2021-09-14T09:13:51"
8184 * "resourceType": "Bundle",
8185 * "type": "collection",
8189 * "relation": "self",
8190 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
8199 * ref="#/components/responses/badrequest"
8203 * ref="#/components/responses/unauthorized"
8205 * security={{"openemr_auth":{}}}
8208 "GET /fhir/CareTeam" => function (HttpRestRequest
$request) {
8209 $getParams = $request->getQueryParams();
8210 if ($request->isPatientRequest()) {
8211 // only allow access to data of binded patient
8212 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8214 RestConfig
::authorization_check("patients", "med");
8215 $return = (new FhirCareTeamRestController())->getAll($getParams);
8217 RestConfig
::apiLog($return);
8223 * path="/fhir/CareTeam/{uuid}",
8224 * description="Returns a single CareTeam resource.",
8229 * description="The uuid for the CareTeam resource.",
8236 * name="_lastUpdated",
8238 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8246 * description="Standard Response",
8248 * mediaType="application/json",
8251 * property="json object",
8252 * description="FHIR Json object.",
8256 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8259 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8261 * "resourceType": "CareTeam",
8262 * "status": "active",
8264 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8273 * "system": "http://nucc.org/provider-taxonomy",
8274 * "code": "102L00000X",
8275 * "display": "Psychoanalyst"
8281 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8282 * "type": "Practitioner"
8285 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8286 * "type": "Organization"
8294 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8295 * "code": "unknown",
8296 * "display": "Unknown"
8302 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8303 * "type": "Organization"
8313 * ref="#/components/responses/badrequest"
8317 * ref="#/components/responses/unauthorized"
8321 * ref="#/components/responses/uuidnotfound"
8323 * security={{"openemr_auth":{}}}
8326 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest
$request) {
8327 if ($request->isPatientRequest()) {
8328 // only allow access to data of binded patient
8329 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8331 RestConfig
::authorization_check("patients", "med");
8332 $return = (new FhirCareTeamRestController())->getOne($uuid);
8334 RestConfig
::apiLog($return);
8340 * path="/fhir/Condition",
8341 * description="Returns a list of Condition resources.",
8346 * description="The uuid for the Condition resource.",
8353 * name="_lastUpdated",
8355 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8364 * description="The uuid for the patient.",
8372 * description="Standard Response",
8374 * mediaType="application/json",
8377 * property="json object",
8378 * description="FHIR Json object.",
8383 * "lastUpdated": "2021-09-14T09:13:51"
8385 * "resourceType": "Bundle",
8386 * "type": "collection",
8390 * "relation": "self",
8391 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8400 * ref="#/components/responses/badrequest"
8404 * ref="#/components/responses/unauthorized"
8406 * security={{"openemr_auth":{}}}
8409 "GET /fhir/Condition" => function (HttpRestRequest
$request) {
8410 $getParams = $request->getQueryParams();
8411 if ($request->isPatientRequest()) {
8412 // only allow access to data of binded patient
8413 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8415 RestConfig
::authorization_check("patients", "med");
8416 $return = (new FhirConditionRestController())->getAll($getParams);
8418 RestConfig
::apiLog($return);
8424 * path="/fhir/Condition/{uuid}",
8425 * description="Returns a single Condition resource.",
8430 * description="The uuid for the Condition resource.",
8438 * description="Standard Response",
8440 * mediaType="application/json",
8443 * property="json object",
8444 * description="FHIR Json object.",
8448 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8451 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8453 * "resourceType": "Condition",
8454 * "clinicalStatus": {
8457 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8458 * "code": "inactive",
8459 * "display": "Inactive"
8463 * "verificationStatus": {
8466 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8467 * "code": "unconfirmed",
8468 * "display": "Unconfirmed"
8476 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8477 * "code": "problem-list-item",
8478 * "display": "Problem List Item"
8486 * "system": "http://snomed.info/sct",
8487 * "code": "444814009",
8493 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8501 * ref="#/components/responses/badrequest"
8505 * ref="#/components/responses/unauthorized"
8509 * ref="#/components/responses/uuidnotfound"
8511 * security={{"openemr_auth":{}}}
8514 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest
$request) {
8515 if ($request->isPatientRequest()) {
8516 // only allow access to data of binded patient
8517 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8519 RestConfig
::authorization_check("patients", "med");
8520 $return = (new FhirConditionRestController())->getOne($uuid);
8522 RestConfig
::apiLog($return);
8528 * path="/fhir/Coverage",
8529 * description="Returns a list of Coverage resources.",
8534 * description="The uuid for the Coverage resource.",
8541 * name="_lastUpdated",
8543 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8552 * description="The uuid for the patient.",
8561 * description="The payor of the Coverage resource.",
8569 * description="Standard Response",
8571 * mediaType="application/json",
8574 * property="json object",
8575 * description="FHIR Json object.",
8580 * "lastUpdated": "2021-09-14T09:13:51"
8582 * "resourceType": "Bundle",
8583 * "type": "collection",
8587 * "relation": "self",
8588 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8597 * ref="#/components/responses/badrequest"
8601 * ref="#/components/responses/unauthorized"
8603 * security={{"openemr_auth":{}}}
8606 "GET /fhir/Coverage" => function (HttpRestRequest
$request) {
8607 if ($request->isPatientRequest()) {
8608 // only allow access to data of binded patient
8609 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8611 RestConfig
::authorization_check("admin", "super");
8612 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8614 RestConfig
::apiLog($return);
8620 * path="/fhir/Coverage/{uuid}",
8621 * description="Returns a single Coverage resource.",
8626 * description="The uuid for the Coverage resource.",
8634 * description="Standard Response",
8636 * mediaType="application/json",
8639 * property="json object",
8640 * description="FHIR Json object.",
8644 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8647 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8649 * "resourceType": "Coverage",
8650 * "status": "active",
8652 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8657 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8668 * ref="#/components/responses/badrequest"
8672 * ref="#/components/responses/unauthorized"
8676 * ref="#/components/responses/uuidnotfound"
8678 * security={{"openemr_auth":{}}}
8681 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest
$request) {
8682 if ($request->isPatientRequest()) {
8683 // only allow access to data of binded patient
8684 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8686 RestConfig
::authorization_check("admin", "super");
8687 $return = (new FhirCoverageRestController())->getOne($uuid);
8689 RestConfig
::apiLog($return);
8695 * path="/fhir/Device",
8696 * description="Returns a list of Device resources.",
8701 * description="The uuid for the Device resource.",
8708 * name="_lastUpdated",
8710 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8719 * description="The uuid for the patient.",
8727 * description="Standard Response",
8729 * mediaType="application/json",
8732 * property="json object",
8733 * description="FHIR Json object.",
8738 * "lastUpdated": "2021-09-14T09:13:51"
8740 * "resourceType": "Bundle",
8741 * "type": "collection",
8745 * "relation": "self",
8746 * "url": "https://localhost:9300/apis/default/fhir/Device"
8755 * ref="#/components/responses/badrequest"
8759 * ref="#/components/responses/unauthorized"
8761 * security={{"openemr_auth":{}}}
8764 "GET /fhir/Device" => function (HttpRestRequest
$request) {
8765 if ($request->isPatientRequest()) {
8766 // only allow access to data of binded patient
8767 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8769 RestConfig
::authorization_check("admin", "super");
8770 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8772 RestConfig
::apiLog($return);
8778 * path="/fhir/Device/{uuid}",
8779 * description="Returns a single Device resource.",
8784 * description="The uuid for the Device resource.",
8792 * description="Standard Response",
8794 * mediaType="application/json",
8797 * property="json object",
8798 * description="FHIR Json object.",
8802 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8805 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8807 * "resourceType": "Device",
8810 * "deviceIdentifier": "08717648200274",
8811 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8814 * "distinctIdentifier": "A99971312345600",
8815 * "manufactureDate": "2013-02-01",
8816 * "expirationDate": "2014-02-01",
8817 * "lotNumber": "000000000000XYZ123",
8818 * "serialNumber": "000025",
8822 * "valueCode": "unknown",
8823 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8828 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8837 * ref="#/components/responses/badrequest"
8841 * ref="#/components/responses/unauthorized"
8845 * ref="#/components/responses/uuidnotfound"
8847 * security={{"openemr_auth":{}}}
8850 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest
$request) {
8851 if ($request->isPatientRequest()) {
8852 // only allow access to data of binded patient
8853 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8855 RestConfig
::authorization_check("admin", "super");
8856 $return = (new FhirDeviceRestController())->getOne($uuid);
8858 RestConfig
::apiLog($return);
8864 * path="/fhir/DiagnosticReport",
8865 * description="Returns a list of DiagnosticReport resources.",
8870 * description="The uuid for the DiagnosticReport resource.",
8877 * name="_lastUpdated",
8879 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
8888 * description="The uuid for the patient.",
8897 * description="The code of the DiagnosticReport resource.",
8906 * description="The category of the DiagnosticReport resource.",
8915 * description="The datetime of the DiagnosticReport resource.",
8923 * description="Standard Response",
8925 * mediaType="application/json",
8928 * property="json object",
8929 * description="FHIR Json object.",
8934 * "lastUpdated": "2021-09-14T09:13:51"
8936 * "resourceType": "Bundle",
8937 * "type": "collection",
8941 * "relation": "self",
8942 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8951 * ref="#/components/responses/badrequest"
8955 * ref="#/components/responses/unauthorized"
8957 * security={{"openemr_auth":{}}}
8960 "GET /fhir/DiagnosticReport" => function (HttpRestRequest
$request) {
8961 $getParams = $request->getQueryParams();
8962 if ($request->isPatientRequest()) {
8963 // only allow access to data of binded patient
8964 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8966 RestConfig
::authorization_check("admin", "super");
8967 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8969 RestConfig
::apiLog($return);
8975 * path="/fhir/DiagnosticReport/{uuid}",
8976 * description="Returns a single DiagnosticReport resource.",
8981 * description="The uuid for the DiagnosticReport resource.",
8989 * description="Standard Response",
8991 * mediaType="application/json",
8994 * property="json object",
8995 * description="FHIR Json object.",
8999 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
9002 * "lastUpdated": "2021-09-18T20:52:34+00:00"
9004 * "resourceType": "DiagnosticReport",
9005 * "status": "final",
9010 * "system": "http://loinc.org",
9011 * "code": "LP7839-6",
9012 * "display": "Pathology"
9020 * "system": "http://loinc.org",
9021 * "code": "11502-2",
9022 * "display": "Laboratory report"
9027 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
9031 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
9032 * "type": "Encounter"
9034 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
9035 * "issued": "2015-06-22T00:00:00+00:00",
9038 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
9039 * "type": "Organization"
9042 * "presentedForm": {
9044 * "contentType": "text/plain",
9045 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
9054 * ref="#/components/responses/badrequest"
9058 * ref="#/components/responses/unauthorized"
9062 * ref="#/components/responses/uuidnotfound"
9064 * security={{"openemr_auth":{}}}
9067 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest
$request) {
9068 $getParams = $request->getQueryParams();
9069 if ($request->isPatientRequest()) {
9070 // only allow access to data of binded patient
9071 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
9073 RestConfig
::authorization_check("admin", "super");
9074 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
9076 RestConfig
::apiLog($return);
9082 * path="/fhir/DocumentReference",
9083 * description="Returns a list of DocumentReference resources.",
9088 * description="The uuid for the DocumentReference resource.",
9095 * name="_lastUpdated",
9097 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
9106 * description="The uuid for the patient.",
9115 * description="The type of the DocumentReference resource.",
9124 * description="The category of the DocumentReference resource.",
9133 * description="The datetime of the DocumentReference resource.",
9141 * description="Standard Response",
9143 * mediaType="application/json",
9146 * property="json object",
9147 * description="FHIR Json object.",
9152 * "lastUpdated": "2021-09-14T09:13:51"
9154 * "resourceType": "Bundle",
9155 * "type": "collection",
9159 * "relation": "self",
9160 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
9169 * ref="#/components/responses/badrequest"
9173 * ref="#/components/responses/unauthorized"
9175 * security={{"openemr_auth":{}}}
9178 'GET /fhir/DocumentReference' => function (HttpRestRequest
$request) {
9179 $getParams = $request->getQueryParams();
9180 if ($request->isPatientRequest()) {
9181 // only allow access to data of binded patient
9182 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
9184 RestConfig
::authorization_check("admin", "super");
9185 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
9187 RestConfig
::apiLog($return);
9193 * path="/fhir/DocumentReference/$docref",
9194 * description="The $docref operation is used to request the server generates a document based on the specified parameters. If no additional parameters are specified then a DocumentReference to the patient's most current Clinical Summary of Care Document (CCD) is returned. The document itself is retrieved using the DocumentReference.content.attachment.url element. See <a href='http://hl7.org/fhir/us/core/OperationDefinition-docref.html' target='_blank' rel='noopener'>http://hl7.org/fhir/us/core/OperationDefinition-docref.html</a> for more details.",
9196 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
9200 * description="The uuid for the patient.",
9209 * description="The datetime refers to care dates not record currency dates. All records relating to care provided in a certain date range. If no start date is provided then all documents prior to the end date are in scope. If no start and end date are provided, the most recent or current document is in scope.",
9218 * description="The datetime refers to care dates not record currency dates. All records relating to care provided in a certain date range. If no end date is provided then all documents subsequent to the start date are in scope. If no start and end date are provided, the most recent or current document is in scope.",
9227 * description="The type refers to the document type. This is a LOINC code from the valueset of <a href='http://hl7.org/fhir/R4/valueset-c80-doc-typecodes.html' target='_blank' rel='noopener'>http://hl7.org/fhir/R4/valueset-c80-doc-typecodes.html</a>. The server currently only supports the LOINC code of 34133-9 (Summary of episode node).",
9235 * description="A search bundle of DocumentReferences is returned"
9239 * ref="#/components/responses/badrequest"
9243 * ref="#/components/responses/unauthorized"
9245 * security={{"openemr_auth":{}}}
9248 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest
$request) {
9250 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
9251 if ($request->isPatientRequest()) {
9252 // only allow access to data of binded patient
9253 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9255 // TODO: it seems like regular users should be able to grab authorship / provenance information
9256 RestConfig
::authorization_check("patients", "demo");
9257 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
9259 RestConfig
::apiLog($return);
9265 * path="/fhir/DocumentReference/{uuid}",
9266 * description="Returns a single DocumentReference resource.",
9271 * description="The uuid for the DocumentReference resource.",
9279 * description="Standard Response",
9281 * mediaType="application/json",
9284 * property="json object",
9285 * description="FHIR Json object.",
9289 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9292 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9294 * "resourceType": "DocumentReference",
9297 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9300 * "status": "current",
9304 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9306 * "display": "unknown"
9314 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9315 * "code": "openemr-document",
9316 * "display": "OpenEMR Document"
9322 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9325 * "date": "2021-09-19T03:15:56+00:00",
9332 * "contentType": "image/gif",
9333 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9336 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9337 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9338 * "display": "mimeType Sufficient"
9348 * ref="#/components/responses/badrequest"
9352 * ref="#/components/responses/unauthorized"
9356 * ref="#/components/responses/uuidnotfound"
9358 * security={{"openemr_auth":{}}}
9361 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest
$request) {
9362 $getParams = $request->getQueryParams();
9363 if ($request->isPatientRequest()) {
9364 // only allow access to data of binded patient
9365 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9367 RestConfig
::authorization_check("admin", "super");
9368 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9370 RestConfig
::apiLog($return);
9376 * path="/fhir/Binary/{id}",
9377 * description="Used for downloading binary documents generated either with BULK FHIR Export or with the $docref CCD export operation. Documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9382 * description="The id for the Document.",
9390 * description="The documentation for working with BULK FHIR or $docref document exports can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9394 * ref="#/components/responses/badrequest"
9398 * ref="#/components/responses/unauthorized"
9400 * security={{"openemr_auth":{}}}
9403 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest
$request) {
9404 $docController = new \OpenEMR\RestControllers\FHIR\
FhirDocumentRestController($request);
9406 if ($request->isPatientRequest()) {
9407 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9409 RestConfig
::authorization_check("admin", "users");
9410 $response = $docController->downloadDocument($documentId);
9418 * path="/fhir/Encounter",
9419 * description="Returns a list of Encounter resources.",
9424 * description="The uuid for the Encounter resource.",
9431 * name="_lastUpdated",
9433 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
9442 * description="The uuid for the patient.",
9451 * description="The datetime of the Encounter resource.",
9459 * description="Standard Response",
9461 * mediaType="application/json",
9464 * property="json object",
9465 * description="FHIR Json object.",
9470 * "lastUpdated": "2021-09-14T09:13:51"
9472 * "resourceType": "Bundle",
9473 * "type": "collection",
9477 * "relation": "self",
9478 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9487 * ref="#/components/responses/badrequest"
9491 * ref="#/components/responses/unauthorized"
9493 * security={{"openemr_auth":{}}}
9496 "GET /fhir/Encounter" => function (HttpRestRequest
$request) {
9497 $getParams = $request->getQueryParams();
9498 if ($request->isPatientRequest()) {
9499 // only allow access to data of binded patient
9500 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9502 RestConfig
::authorization_check("encounters", "auth_a");
9503 $return = (new FhirEncounterRestController())->getAll($getParams);
9505 RestConfig
::apiLog($return);
9511 * path="/fhir/Encounter/{uuid}",
9512 * description="Returns a single Encounter resource.",
9517 * description="The uuid for the Encounter resource.",
9525 * description="Standard Response",
9527 * mediaType="application/json",
9530 * property="json object",
9531 * description="FHIR Json object.",
9535 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9538 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9540 * "resourceType": "Encounter",
9543 * "system": "urn:ietf:rfc:3986",
9544 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9547 * "status": "finished",
9549 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9551 * "display": "ambulatory"
9557 * "system": "http://snomed.info/sct",
9558 * "code": "185349003",
9559 * "display": "Encounter for check up (procedure)"
9565 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9574 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9576 * "display": "Primary Performer"
9582 * "start": "2012-08-13T00:00:00+00:00"
9585 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9586 * "type": "Practitioner"
9591 * "start": "2012-08-13T00:00:00+00:00"
9599 * ref="#/components/responses/badrequest"
9603 * ref="#/components/responses/unauthorized"
9607 * ref="#/components/responses/uuidnotfound"
9609 * security={{"openemr_auth":{}}}
9612 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest
$request) {
9613 if ($request->isPatientRequest()) {
9614 // only allow access to data of binded patient
9615 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9617 RestConfig
::authorization_check("admin", "super");
9618 $return = (new FhirEncounterRestController())->getOne($uuid);
9620 RestConfig
::apiLog($return);
9626 * path="/fhir/Goal",
9627 * description="Returns a list of Condition resources.",
9632 * description="The uuid for the Goal resource.",
9639 * name="_lastUpdated",
9641 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
9650 * description="The uuid for the patient.",
9658 * description="Standard Response",
9660 * mediaType="application/json",
9663 * property="json object",
9664 * description="FHIR Json object.",
9669 * "lastUpdated": "2021-09-14T09:13:51"
9671 * "resourceType": "Bundle",
9672 * "type": "collection",
9676 * "relation": "self",
9677 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9686 * ref="#/components/responses/badrequest"
9690 * ref="#/components/responses/unauthorized"
9692 * security={{"openemr_auth":{}}}
9695 "GET /fhir/Goal" => function (HttpRestRequest
$request) {
9696 $getParams = $request->getQueryParams();
9697 if ($request->isPatientRequest()) {
9698 // only allow access to data of binded patient
9699 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9701 RestConfig
::authorization_check("admin", "super");
9702 $return = (new FhirGoalRestController())->getAll($getParams);
9704 RestConfig
::apiLog($return);
9710 * path="/fhir/Goal/{uuid}",
9711 * description="Returns a single Goal resource.",
9716 * description="The uuid for the Goal resource.",
9724 * description="Standard Response",
9726 * mediaType="application/json",
9729 * property="json object",
9730 * description="FHIR Json object.",
9734 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9737 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9739 * "resourceType": "Goal",
9740 * "lifecycleStatus": "active",
9742 * "text": "Eating more vegetables."
9745 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9753 * "valueCode": "unknown",
9754 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9758 * "detailString": "Eating more vegetables.",
9759 * "dueDate": "2021-09-09"
9768 * ref="#/components/responses/badrequest"
9772 * ref="#/components/responses/unauthorized"
9776 * ref="#/components/responses/uuidnotfound"
9778 * security={{"openemr_auth":{}}}
9781 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest
$request) {
9782 if ($request->isPatientRequest()) {
9783 // only allow access to data of binded patient
9784 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9786 RestConfig
::authorization_check("admin", "super");
9787 $return = (new FhirGoalRestController())->getOne($uuid);
9789 RestConfig
::apiLog($return);
9795 * path="/fhir/Group",
9796 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9801 * description="The uuid for the Group resource.",
9808 * name="_lastUpdated",
9810 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
9819 * description="The uuid for the patient.",
9827 * description="Standard Response",
9829 * mediaType="application/json",
9832 * property="json object",
9833 * description="FHIR Json object.",
9838 * "lastUpdated": "2021-09-14T09:13:51"
9840 * "resourceType": "Bundle",
9841 * "type": "collection",
9845 * "relation": "self",
9846 * "url": "https://localhost:9300/apis/default/fhir/Group"
9855 * ref="#/components/responses/badrequest"
9859 * ref="#/components/responses/unauthorized"
9861 * security={{"openemr_auth":{}}}
9864 'GET /fhir/Group' => function (HttpRestRequest
$request) {
9865 RestConfig
::authorization_check("admin", "users");
9866 $getParams = $request->getQueryParams();
9867 if ($request->isPatientRequest()) {
9868 // only allow access to data of binded patient
9869 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9871 $return = (new FhirGroupRestController())->getAll($getParams);
9873 RestConfig
::apiLog($return);
9879 * path="/fhir/Group/{uuid}",
9880 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9885 * description="The uuid for the Group resource.",
9893 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9897 * ref="#/components/responses/badrequest"
9901 * ref="#/components/responses/unauthorized"
9905 * ref="#/components/responses/uuidnotfound"
9907 * security={{"openemr_auth":{}}}
9910 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest
$request) {
9911 RestConfig
::authorization_check("admin", "users");
9912 if ($request->isPatientRequest()) {
9913 // only allow access to data of binded patient
9914 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9916 $return = (new FhirGroupRestController())->getOne($uuid);
9918 RestConfig
::apiLog($return);
9924 * path="/fhir/Group/{id}/$export",
9925 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9930 * description="The id for the Group resource.",
9938 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9942 * ref="#/components/responses/badrequest"
9946 * ref="#/components/responses/unauthorized"
9948 * security={{"openemr_auth":{}}}
9951 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest
$request) {
9952 RestConfig
::authorization_check("admin", "users");
9953 $fhirExportService = new FhirOperationExportRestController($request);
9954 $exportParams = $request->getQueryParams();
9955 $exportParams['groupId'] = $groupId;
9956 $return = $fhirExportService->processExport(
9959 $request->getHeader('Accept')[0] ??
'',
9960 $request->getHeader('Prefer')[0] ??
''
9962 RestConfig
::apiLog($return);
9968 * path="/fhir/Immunization",
9969 * description="Returns a list of Immunization resources.",
9974 * description="The uuid for the Immunization resource.",
9981 * name="_lastUpdated",
9983 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
9990 * name="_lastUpdated",
9992 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10001 * description="The uuid for the patient.",
10009 * description="Standard Response",
10011 * mediaType="application/json",
10014 * property="json object",
10015 * description="FHIR Json object.",
10020 * "lastUpdated": "2021-09-14T09:13:51"
10022 * "resourceType": "Bundle",
10023 * "type": "collection",
10027 * "relation": "self",
10028 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
10037 * ref="#/components/responses/badrequest"
10041 * ref="#/components/responses/unauthorized"
10043 * security={{"openemr_auth":{}}}
10046 "GET /fhir/Immunization" => function (HttpRestRequest
$request) {
10047 $getParams = $request->getQueryParams();
10048 if ($request->isPatientRequest()) {
10049 // only allow access to data of binded patient
10050 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
10052 RestConfig
::authorization_check("patients", "med");
10053 $return = (new FhirImmunizationRestController())->getAll($getParams);
10055 RestConfig
::apiLog($return);
10061 * path="/fhir/Immunization/{uuid}",
10062 * description="Returns a single Immunization resource.",
10067 * description="The uuid for the Immunization resource.",
10075 * description="Standard Response",
10077 * mediaType="application/json",
10080 * property="json object",
10081 * description="FHIR Json object.",
10085 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
10087 * "versionId": "1",
10088 * "lastUpdated": "2022-03-26T05:42:59+00:00"
10090 * "resourceType": "Immunization",
10091 * "status": "completed",
10095 * "system": "http://hl7.org/fhir/sid/cvx",
10097 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
10102 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
10104 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
10105 * "recorded": "2022-03-26T05:42:26+00:00",
10106 * "primarySource": false
10113 * ref="#/components/responses/badrequest"
10117 * ref="#/components/responses/unauthorized"
10121 * ref="#/components/responses/uuidnotfound"
10123 * security={{"openemr_auth":{}}}
10126 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest
$request) {
10127 if ($request->isPatientRequest()) {
10128 // only allow access to data of binded patient
10129 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
10131 RestConfig
::authorization_check("patients", "med");
10132 $return = (new FhirImmunizationRestController())->getOne($uuid);
10134 RestConfig
::apiLog($return);
10140 * path="/fhir/Location",
10141 * description="Returns a list of Location resources.",
10146 * description="The uuid for the Location resource.",
10153 * name="_lastUpdated",
10155 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10163 * description="Standard Response",
10165 * mediaType="application/json",
10168 * property="json object",
10169 * description="FHIR Json object.",
10174 * "lastUpdated": "2021-09-14T09:13:51"
10176 * "resourceType": "Bundle",
10177 * "type": "collection",
10181 * "relation": "self",
10182 * "url": "https://localhost:9300/apis/default/fhir/Location"
10191 * ref="#/components/responses/badrequest"
10195 * ref="#/components/responses/unauthorized"
10197 * security={{"openemr_auth":{}}}
10200 "GET /fhir/Location" => function (HttpRestRequest
$request) {
10201 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
10202 RestConfig
::apiLog($return);
10208 * path="/fhir/Location/{uuid}",
10209 * description="Returns a single Location resource.",
10214 * description="The uuid for the Location resource.",
10222 * description="Standard Response",
10224 * mediaType="application/json",
10227 * property="json object",
10228 * description="FHIR Json object.",
10232 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
10234 * "versionId": "1",
10235 * "lastUpdated": "2021-09-19T08:14:58+00:00"
10237 * "resourceType": "Location",
10238 * "status": "active",
10239 * "name": "Your Clinic Name Here",
10242 * "system": "phone",
10243 * "value": "000-000-0000"
10247 * "value": "000-000-0000"
10256 * ref="#/components/responses/badrequest"
10260 * ref="#/components/responses/unauthorized"
10264 * ref="#/components/responses/uuidnotfound"
10266 * security={{"openemr_auth":{}}}
10269 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest
$request) {
10270 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10271 RestConfig
::apiLog($return);
10277 * path="/fhir/Medication",
10278 * description="Returns a list of Medication resources.",
10283 * description="The uuid for the Medication resource.",
10290 * name="_lastUpdated",
10292 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10300 * description="Standard Response",
10302 * mediaType="application/json",
10305 * property="json object",
10306 * description="FHIR Json object.",
10311 * "lastUpdated": "2021-09-14T09:13:51"
10313 * "resourceType": "Bundle",
10314 * "type": "collection",
10318 * "relation": "self",
10319 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10328 * ref="#/components/responses/badrequest"
10332 * ref="#/components/responses/unauthorized"
10334 * security={{"openemr_auth":{}}}
10337 "GET /fhir/Medication" => function (HttpRestRequest
$request) {
10338 RestConfig
::authorization_check("patients", "med");
10339 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10340 RestConfig
::apiLog($return);
10346 * path="/fhir/Medication/{uuid}",
10347 * description="Returns a single Medication resource.",
10352 * description="The uuid for the Medication resource.",
10360 * description="Standard Response",
10362 * mediaType="application/json",
10365 * property="json object",
10366 * description="FHIR Json object.",
10370 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10372 * "versionId": "1",
10373 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10375 * "resourceType": "Medication",
10379 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10384 * "status": "active",
10386 * "lotNumber": "132",
10387 * "expirationDate": "0000-00-00"
10395 * ref="#/components/responses/badrequest"
10399 * ref="#/components/responses/unauthorized"
10403 * ref="#/components/responses/uuidnotfound"
10405 * security={{"openemr_auth":{}}}
10408 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest
$request) {
10409 if ($request->isPatientRequest()) {
10410 // only allow access to data of binded patient
10411 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10413 RestConfig
::authorization_check("patients", "med");
10414 $return = (new FhirMedicationRestController())->getOne($uuid);
10416 RestConfig
::apiLog($return);
10422 * path="/fhir/MedicationRequest",
10423 * description="Returns a list of MedicationRequest resources.",
10428 * description="The uuid for the MedicationRequest resource.",
10435 * name="_lastUpdated",
10437 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10446 * description="The uuid for the patient.",
10455 * description="The intent of the MedicationRequest resource.",
10464 * description="The status of the MedicationRequest resource.",
10472 * description="Standard Response",
10474 * mediaType="application/json",
10477 * property="json object",
10478 * description="FHIR Json object.",
10483 * "lastUpdated": "2021-09-14T09:13:51"
10485 * "resourceType": "Bundle",
10486 * "type": "collection",
10490 * "relation": "self",
10491 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10500 * ref="#/components/responses/badrequest"
10504 * ref="#/components/responses/unauthorized"
10506 * security={{"openemr_auth":{}}}
10509 "GET /fhir/MedicationRequest" => function (HttpRestRequest
$request) {
10510 $getParams = $request->getQueryParams();
10511 if ($request->isPatientRequest()) {
10512 // only allow access to data of binded patient
10513 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10515 RestConfig
::authorization_check("patients", "med");
10516 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10518 RestConfig
::apiLog($return);
10524 * path="/fhir/MedicationRequest/{uuid}",
10525 * description="Returns a single MedicationRequest resource.",
10530 * description="The uuid for the MedicationRequest resource.",
10538 * description="Standard Response",
10540 * mediaType="application/json",
10543 * property="json object",
10544 * description="FHIR Json object.",
10548 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10550 * "versionId": "1",
10551 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10553 * "resourceType": "MedicationRequest",
10554 * "status": "active",
10555 * "intent": "order",
10560 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10561 * "code": "community",
10562 * "display": "Home/Community"
10567 * "reportedBoolean": false,
10568 * "medicationCodeableConcept": {
10571 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10572 * "code": "1738139",
10573 * "display": "Acetaminophen 325 MG Oral Tablet"
10578 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10579 * "type": "Patient"
10581 * "authoredOn": "2021-09-18T00:00:00+00:00",
10583 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10584 * "type": "Practitioner"
10592 * ref="#/components/responses/badrequest"
10596 * ref="#/components/responses/unauthorized"
10600 * ref="#/components/responses/uuidnotfound"
10602 * security={{"openemr_auth":{}}}
10605 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest
$request) {
10606 if ($request->isPatientRequest()) {
10607 // only allow access to data of binded patient
10608 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10610 RestConfig
::authorization_check("patients", "med");
10611 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10613 RestConfig
::apiLog($return);
10619 * path="/fhir/Observation",
10620 * description="Returns a list of Observation resources.",
10625 * description="The uuid for the Observation resource.",
10632 * name="_lastUpdated",
10634 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10643 * description="The uuid for the patient.",
10652 * description="The code of the Observation resource.",
10661 * description="The category of the Observation resource.",
10670 * description="The datetime of the Observation resource.",
10678 * description="Standard Response",
10680 * mediaType="application/json",
10683 * property="json object",
10684 * description="FHIR Json object.",
10689 * "lastUpdated": "2021-09-14T09:13:51"
10691 * "resourceType": "Bundle",
10692 * "type": "collection",
10696 * "relation": "self",
10697 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10706 * ref="#/components/responses/badrequest"
10710 * ref="#/components/responses/unauthorized"
10712 * security={{"openemr_auth":{}}}
10715 "GET /fhir/Observation" => function (HttpRestRequest
$request) {
10716 $getParams = $request->getQueryParams();
10717 if ($request->isPatientRequest()) {
10718 // only allow access to data of binded patient
10719 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10721 RestConfig
::authorization_check("patients", "med");
10722 $return = (new FhirObservationRestController())->getAll($getParams);
10724 RestConfig
::apiLog($return);
10730 * path="/fhir/Observation/{uuid}",
10731 * description="Returns a single Observation resource.",
10736 * description="The uuid for the Observation resource.",
10744 * description="Standard Response",
10746 * mediaType="application/json",
10749 * property="json object",
10750 * description="FHIR Json object.",
10754 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10756 * "versionId": "1",
10757 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10759 * "resourceType": "Observation",
10760 * "status": "final",
10765 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10766 * "code": "vital-signs"
10774 * "system": "http://loinc.org",
10775 * "code": "85354-9",
10776 * "display": "Blood pressure systolic and diastolic"
10781 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10782 * "type": "Patient"
10784 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10790 * "system": "http://loinc.org",
10791 * "code": "8480-6",
10792 * "display": "Systolic blood pressure"
10796 * "valueQuantity": {
10798 * "unit": "mm[Hg]",
10799 * "system": "http://unitsofmeasure.org",
10807 * "system": "http://loinc.org",
10808 * "code": "8462-4",
10809 * "display": "Diastolic blood pressure"
10813 * "valueQuantity": {
10815 * "unit": "mm[Hg]",
10816 * "system": "http://unitsofmeasure.org",
10827 * ref="#/components/responses/badrequest"
10831 * ref="#/components/responses/unauthorized"
10835 * ref="#/components/responses/uuidnotfound"
10837 * security={{"openemr_auth":{}}}
10840 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest
$request) {
10841 if ($request->isPatientRequest()) {
10842 // only allow access to data of binded patient
10843 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10845 RestConfig
::authorization_check("patients", "med");
10846 $return = (new FhirObservationRestController())->getOne($uuid);
10848 RestConfig
::apiLog($return);
10854 * path="/fhir/Organization",
10855 * description="Returns a list of Organization resources.",
10860 * description="The uuid for the Organization resource.",
10867 * name="_lastUpdated",
10869 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
10878 * description="The name of the Organization resource.",
10887 * description="The email of the Organization resource.",
10896 * description="The phone of the Organization resource.",
10905 * description="The telecom of the Organization resource.",
10914 * description="The address of the Organization resource.",
10921 * name="address-city",
10923 * description="The address-city of the Organization resource.",
10930 * name="address-postalcode",
10932 * description="The address-postalcode of the Organization resource.",
10939 * name="address-state",
10941 * description="The address-state of the Organization resource.",
10949 * description="Standard Response",
10951 * mediaType="application/json",
10954 * property="json object",
10955 * description="FHIR Json object.",
10960 * "lastUpdated": "2021-09-14T09:13:51"
10962 * "resourceType": "Bundle",
10963 * "type": "collection",
10967 * "relation": "self",
10968 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10977 * ref="#/components/responses/badrequest"
10981 * ref="#/components/responses/unauthorized"
10983 * security={{"openemr_auth":{}}}
10986 "GET /fhir/Organization" => function (HttpRestRequest
$request) {
10987 if (!$request->isPatientRequest()) {
10988 RestConfig
::authorization_check("admin", "users");
10990 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10991 RestConfig
::apiLog($return);
10997 * path="/fhir/Organization/{uuid}",
10998 * description="Returns a single Organization resource.",
11003 * description="The uuid for the Organization resource.",
11011 * description="Standard Response",
11013 * mediaType="application/json",
11016 * property="json object",
11017 * description="FHIR Json object.",
11021 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
11023 * "versionId": "1",
11024 * "lastUpdated": "2022-03-30T07:43:23+00:00"
11026 * "resourceType": "Organization",
11028 * "status": "generated",
11029 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
11033 * "system": "http://hl7.org/fhir/sid/us-npi",
11034 * "value": "1234567890"
11042 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11044 * "display": "Healthcare Provider"
11049 * "name": "Your Clinic Name Here",
11052 * "system": "phone",
11053 * "value": "000-000-0000",
11058 * "value": "000-000-0000",
11071 * ref="#/components/responses/badrequest"
11075 * ref="#/components/responses/unauthorized"
11079 * ref="#/components/responses/uuidnotfound"
11081 * security={{"openemr_auth":{}}}
11084 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
11085 $patientUUID = null;
11086 if (!$request->isPatientRequest()) {
11087 RestConfig
::authorization_check("admin", "users");
11089 $patientUUID = $request->getPatientUUIDString();
11091 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
11093 RestConfig
::apiLog($return);
11099 * path="/fhir/Organization",
11100 * description="Adds a Organization resource.",
11105 * mediaType="application/json",
11107 * description="The json object for the Organization resource.",
11111 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
11113 * "versionId": "1",
11114 * "lastUpdated": "2022-03-30T07:43:23+00:00"
11116 * "resourceType": "Organization",
11118 * "status": "generated",
11119 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
11123 * "system": "http://hl7.org/fhir/sid/us-npi",
11124 * "value": "1234567890"
11132 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11134 * "display": "Healthcare Provider"
11139 * "name": "Your Clinic Name Here Hey",
11142 * "system": "phone",
11143 * "value": "000-000-0000",
11148 * "value": "000-000-0000",
11160 * description="Standard Response",
11162 * mediaType="application/json",
11165 * property="json object",
11166 * description="FHIR Json object.",
11170 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
11172 * "versionId": "1",
11173 * "lastUpdated": "2022-03-30T07:43:23+00:00"
11175 * "resourceType": "Organization",
11177 * "status": "generated",
11178 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
11182 * "system": "http://hl7.org/fhir/sid/us-npi",
11183 * "value": "1234567890"
11191 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11193 * "display": "Healthcare Provider"
11198 * "name": "Your Clinic Name Here Now",
11201 * "system": "phone",
11202 * "value": "000-000-0000",
11207 * "value": "000-000-0000",
11220 * ref="#/components/responses/badrequest"
11224 * ref="#/components/responses/unauthorized"
11226 * security={{"openemr_auth":{}}}
11229 "POST /fhir/Organization" => function (HttpRestRequest
$request) {
11230 RestConfig
::authorization_check("admin", "super");
11231 $data = (array) (json_decode(file_get_contents("php://input"), true));
11232 $return = (new FhirOrganizationRestController())->post($data);
11233 RestConfig
::apiLog($return, $data);
11239 * path="/fhir/Organization/{uuid}",
11240 * description="Modifies a Organization resource.",
11245 * description="The uuid for the organization.",
11254 * mediaType="application/json",
11256 * description="The json object for the Organization resource.",
11260 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
11262 * "versionId": "1",
11263 * "lastUpdated": "2022-03-30T07:43:23+00:00"
11265 * "resourceType": "Organization",
11267 * "status": "generated",
11268 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
11272 * "system": "http://hl7.org/fhir/sid/us-npi",
11273 * "value": "1234567890"
11281 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
11283 * "display": "Healthcare Provider"
11288 * "name": "Your Clinic Name Here",
11291 * "system": "phone",
11292 * "value": "000-000-0000",
11297 * "value": "000-000-0000",
11309 * description="Standard Response",
11311 * mediaType="application/json",
11315 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11322 * ref="#/components/responses/badrequest"
11326 * ref="#/components/responses/unauthorized"
11328 * security={{"openemr_auth":{}}}
11331 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
11332 RestConfig
::authorization_check("admin", "super");
11333 $data = (array) (json_decode(file_get_contents("php://input"), true));
11334 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11335 RestConfig
::apiLog($return, $data);
11341 * path="/fhir/Patient",
11342 * description="Adds a Patient resource.",
11347 * mediaType="application/json",
11349 * description="The json object for the Patient resource.",
11353 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11355 * "versionId": "1",
11356 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11358 * "resourceType": "Patient",
11360 * "status": "generated",
11361 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11365 * "valueCode": "F",
11366 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11372 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11374 * "display": "Unknown"
11376 * "url": "ombCategory"
11379 * "valueString": "Unknown",
11383 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11388 * "use": "official",
11392 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11397 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11404 * "use": "official",
11405 * "family": "Smith",
11411 * "gender": "female",
11412 * "birthDate": "2017-03-10",
11413 * "communication": {
11418 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11419 * "code": "unknown",
11420 * "display": "Unknown"
11431 * description="Standard Response",
11433 * mediaType="application/json",
11436 * property="json object",
11437 * description="FHIR Json object.",
11441 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11443 * "versionId": "1",
11444 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11446 * "resourceType": "Patient",
11448 * "status": "generated",
11449 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11453 * "valueCode": "F",
11454 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11460 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11462 * "display": "Unknown"
11464 * "url": "ombCategory"
11467 * "valueString": "Unknown",
11471 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11476 * "use": "official",
11480 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11485 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11492 * "use": "official",
11493 * "family": "Smith",
11499 * "gender": "female",
11500 * "birthDate": "2017-03-10",
11501 * "communication": {
11506 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11507 * "code": "unknown",
11508 * "display": "Unknown"
11520 * ref="#/components/responses/badrequest"
11524 * ref="#/components/responses/unauthorized"
11526 * security={{"openemr_auth":{}}}
11529 "POST /fhir/Patient" => function (HttpRestRequest
$request) {
11530 RestConfig
::authorization_check("patients", "demo");
11531 $data = (array) (json_decode(file_get_contents("php://input"), true));
11532 $return = (new FhirPatientRestController())->post($data);
11533 RestConfig
::apiLog($return, $data);
11539 * path="/fhir/Patient/{uuid}",
11540 * description="Modifies a Patient resource.",
11545 * description="The uuid for the Patient resource.",
11554 * mediaType="application/json",
11556 * description="The json object for the Patient resource.",
11560 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11562 * "versionId": "1",
11563 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11565 * "resourceType": "Patient",
11567 * "status": "generated",
11568 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11572 * "valueCode": "F",
11573 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11579 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11581 * "display": "Unknown"
11583 * "url": "ombCategory"
11586 * "valueString": "Unknown",
11590 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11595 * "use": "official",
11599 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11604 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11611 * "use": "official",
11612 * "family": "Smith",
11618 * "gender": "female",
11619 * "birthDate": "2017-03-10",
11620 * "communication": {
11625 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11626 * "code": "unknown",
11627 * "display": "Unknown"
11638 * description="Standard Response",
11640 * mediaType="application/json",
11644 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11651 * ref="#/components/responses/badrequest"
11655 * ref="#/components/responses/unauthorized"
11657 * security={{"openemr_auth":{}}}
11660 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
11661 RestConfig
::authorization_check("patients", "demo");
11662 $data = (array) (json_decode(file_get_contents("php://input"), true));
11663 $return = (new FhirPatientRestController())->put($uuid, $data);
11664 RestConfig
::apiLog($return, $data);
11670 * path="/fhir/Patient",
11671 * description="Returns a list of Patient resources.",
11676 * description="The uuid for the Patient resource.",
11683 * name="_lastUpdated",
11685 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
11692 * name="identifier",
11694 * description="The identifier of the Patient resource.",
11703 * description="The name of the Patient resource.",
11710 * name="birthdate",
11712 * description="The birthdate of the Patient resource.",
11721 * description="The gender of the Patient resource.",
11730 * description="The address of the Patient resource.",
11737 * name="address-city",
11739 * description="The address-city of the Patient resource.",
11746 * name="address-postalcode",
11748 * description="The address-postalcode of the Patient resource.",
11755 * name="address-state",
11757 * description="The address-state of the Patient resource.",
11766 * description="The email of the Patient resource.",
11775 * description="The family name of the Patient resource.",
11784 * description="The given name of the Patient resource.",
11793 * description="The phone number of the Patient resource.",
11802 * description="The fax number of the Patient resource.",
11809 * ref="#/components/parameters/_lastUpdated"
11813 * description="Standard Response",
11815 * mediaType="application/json",
11818 * property="json object",
11819 * description="FHIR Json object.",
11824 * "lastUpdated": "2021-09-14T09:13:51"
11826 * "resourceType": "Bundle",
11827 * "type": "collection",
11831 * "relation": "self",
11832 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11841 * ref="#/components/responses/badrequest"
11845 * ref="#/components/responses/unauthorized"
11847 * security={{"openemr_auth":{}}}
11850 "GET /fhir/Patient" => function (HttpRestRequest
$request) {
11851 $params = $request->getQueryParams();
11852 if ($request->isPatientRequest()) {
11853 // only allow access to data of binded patient
11854 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11855 // need to use getAll rather than getOne)
11856 $params['_id'] = $request->getPatientUUIDString();
11857 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11859 RestConfig
::authorization_check("patients", "demo");
11860 $return = (new FhirPatientRestController())->getAll($params);
11862 RestConfig
::apiLog($return);
11868 * path="/fhir/Patient/$export",
11869 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
11873 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
11877 * ref="#/components/responses/badrequest"
11881 * ref="#/components/responses/unauthorized"
11883 * security={{"openemr_auth":{}}}
11886 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11887 'GET /fhir/Patient/$export' => function (HttpRestRequest
$request) {
11888 RestConfig
::authorization_check("admin", "users");
11889 $fhirExportService = new FhirOperationExportRestController($request);
11890 $return = $fhirExportService->processExport(
11891 $request->getQueryParams(),
11893 $request->getHeader('Accept')[0] ??
'',
11894 $request->getHeader('Prefer')[0] ??
''
11896 RestConfig
::apiLog($return);
11902 * path="/fhir/Patient/{uuid}",
11903 * description="Returns a single Patient resource.",
11908 * description="The uuid for the Patient resource.",
11916 * description="Standard Response",
11918 * mediaType="application/json",
11921 * property="json object",
11922 * description="FHIR Json object.",
11926 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11928 * "versionId": "1",
11929 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11931 * "resourceType": "Patient",
11933 * "status": "generated",
11934 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11938 * "valueCode": "F",
11939 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11945 * "system": "urn:oid:2.16.840.1.113883.6.238",
11946 * "code": "1006-6",
11947 * "display": "Abenaki"
11949 * "url": "ombCategory"
11952 * "valueString": "Abenaki",
11956 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11961 * "valueString": "Declined To Specify",
11965 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11970 * "use": "official",
11974 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11979 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11986 * "use": "official",
11987 * "family": "Von197",
11993 * "gender": "female",
11994 * "birthDate": "1970-07-03",
12000 * "city": "Boston",
12001 * "state": "Massachusetts",
12002 * "postalCode": "02215",
12004 * "start": "2020-09-21T17:08:03.532+00:00"
12008 * "communication": {
12013 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
12014 * "code": "unknown",
12015 * "display": "Unknown"
12027 * ref="#/components/responses/badrequest"
12031 * ref="#/components/responses/unauthorized"
12035 * ref="#/components/responses/uuidnotfound"
12037 * security={{"openemr_auth":{}}}
12040 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
12041 if ($request->isPatientRequest()) {
12042 // only allow access to data of binded patient
12043 if (empty($uuid) ||
($uuid != $request->getPatientUUIDString())) {
12044 throw new AccessDeniedException("patients", "demo", "patient id invalid");
12046 $uuid = $request->getPatientUUIDString();
12048 RestConfig
::authorization_check("patients", "demo");
12050 $return = (new FhirPatientRestController())->getOne($uuid);
12051 RestConfig
::apiLog($return);
12057 * path="/fhir/Person",
12058 * description="Returns a list of Person resources.",
12063 * description="The uuid for the Person resource.",
12070 * name="_lastUpdated",
12072 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
12081 * description="The name of the Person resource.",
12090 * description="The active status of the Person resource.",
12099 * description="The address of the Person resource.",
12106 * name="address-city",
12108 * description="The address-city of the Person resource.",
12115 * name="address-postalcode",
12117 * description="The address-postalcode of the Person resource.",
12124 * name="address-state",
12126 * description="The address-state of the Person resource.",
12135 * description="The email of the Person resource.",
12144 * description="The family name of the Person resource.",
12153 * description="The given name of the Person resource.",
12162 * description="The phone number of the Person resource.",
12171 * description="The fax number of the Person resource.",
12179 * description="Standard Response",
12181 * mediaType="application/json",
12184 * property="json object",
12185 * description="FHIR Json object.",
12190 * "lastUpdated": "2021-09-14T09:13:51"
12192 * "resourceType": "Bundle",
12193 * "type": "collection",
12197 * "relation": "self",
12198 * "url": "https://localhost:9300/apis/default/fhir/Person"
12207 * ref="#/components/responses/badrequest"
12211 * ref="#/components/responses/unauthorized"
12213 * security={{"openemr_auth":{}}}
12216 "GET /fhir/Person" => function (HttpRestRequest
$request) {
12217 RestConfig
::authorization_check("admin", "users");
12218 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
12219 RestConfig
::apiLog($return);
12225 * path="/fhir/Person/{uuid}",
12226 * description="Returns a single Person resource.",
12231 * description="The uuid for the Person resource.",
12239 * description="Standard Response",
12241 * mediaType="application/json",
12244 * property="json object",
12245 * description="FHIR Json object.",
12249 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
12251 * "versionId": "1",
12252 * "lastUpdated": "2022-04-13T08:57:32+00:00"
12254 * "resourceType": "Person",
12256 * "status": "generated",
12257 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
12261 * "use": "official",
12262 * "family": "Administrator",
12271 * "system": "phone",
12272 * "value": "1234567890",
12276 * "system": "phone",
12277 * "value": "1234567890",
12281 * "system": "phone",
12282 * "value": "1234567890",
12286 * "system": "email",
12287 * "value": "hey@hey.com",
12294 * "123 Lane Street"
12296 * "city": "Bellevue",
12299 * "start": "2021-04-13T08:57:32.146+00:00"
12310 * ref="#/components/responses/badrequest"
12314 * ref="#/components/responses/unauthorized"
12318 * ref="#/components/responses/uuidnotfound"
12320 * security={{"openemr_auth":{}}}
12323 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest
$request) {
12324 // if the api user is requesting their own user we need to let it through
12325 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
12326 // for the currently logged in user
12327 if ($request->getRequestUserUUIDString() == $uuid) {
12328 $return = (new FhirPersonRestController())->getOne($uuid);
12329 } elseif (!$request->isPatientRequest()) {
12330 // not a patient ,make sure we have access to the users ACL
12331 RestConfig
::authorization_check("admin", "users");
12332 $return = (new FhirPersonRestController())->getOne($uuid);
12334 // if we are a patient bound request we need to make sure we are only bound to the patient
12335 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
12338 RestConfig
::apiLog($return);
12344 * path="/fhir/Practitioner",
12345 * description="Returns a list of Practitioner resources.",
12350 * description="The uuid for the Practitioner resource.",
12357 * name="_lastUpdated",
12359 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
12368 * description="The name of the Practitioner resource.",
12377 * description="The active status of the Practitioner resource.",
12386 * description="The address of the Practitioner resource.",
12393 * name="address-city",
12395 * description="The address-city of the Practitioner resource.",
12402 * name="address-postalcode",
12404 * description="The address-postalcode of the Practitioner resource.",
12411 * name="address-state",
12413 * description="The address-state of the Practitioner resource.",
12422 * description="The email of the Practitioner resource.",
12431 * description="The family name of the Practitioner resource.",
12440 * description="The given name of the Practitioner resource.",
12449 * description="The phone number of the Practitioner resource.",
12458 * description="The fax number of the Practitioner resource.",
12466 * description="Standard Response",
12468 * mediaType="application/json",
12471 * property="json object",
12472 * description="FHIR Json object.",
12477 * "lastUpdated": "2021-09-14T09:13:51"
12479 * "resourceType": "Bundle",
12480 * "type": "collection",
12484 * "relation": "self",
12485 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12494 * ref="#/components/responses/badrequest"
12498 * ref="#/components/responses/unauthorized"
12500 * security={{"openemr_auth":{}}}
12503 "GET /fhir/Practitioner" => function (HttpRestRequest
$request) {
12505 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12506 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12507 // I don't believe patients are assigned to a particular practitioner
12508 // should we allow just open api access to admin information? Should we restrict particular pieces
12509 // of data in the practitioner side (phone number, address information) based on a permission set?
12510 if (!$request->isPatientRequest()) {
12511 RestConfig
::authorization_check("admin", "users");
12513 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12514 RestConfig
::apiLog($return);
12520 * path="/fhir/Practitioner/{uuid}",
12521 * description="Returns a single Practitioner resource.",
12526 * description="The uuid for the Practitioner resource.",
12534 * description="Standard Response",
12536 * mediaType="application/json",
12539 * property="json object",
12540 * description="FHIR Json object.",
12544 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12546 * "versionId": "1",
12547 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12549 * "resourceType": "Practitioner",
12551 * "status": "generated",
12552 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12556 * "system": "http://hl7.org/fhir/sid/us-npi",
12557 * "value": "11223344554543"
12563 * "use": "official",
12564 * "family": "Smith",
12576 * ref="#/components/responses/badrequest"
12580 * ref="#/components/responses/unauthorized"
12584 * ref="#/components/responses/uuidnotfound"
12586 * security={{"openemr_auth":{}}}
12589 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
12590 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12591 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12592 // I don't believe patients are assigned to a particular practitioner
12593 // should we allow just open api access to admin information? Should we restrict particular pieces
12594 // of data in the practitioner side (phone number, address information) based on a permission set?
12595 if (!$request->isPatientRequest()) {
12596 RestConfig
::authorization_check("admin", "users");
12598 $return = (new FhirPractitionerRestController())->getOne($uuid);
12599 RestConfig
::apiLog($return);
12605 * path="/fhir/Practitioner",
12606 * description="Adds a Practitioner resources.",
12611 * mediaType="application/json",
12613 * description="The json object for the Practitioner resource.",
12617 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12619 * "versionId": "1",
12620 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12622 * "resourceType": "Practitioner",
12624 * "status": "generated",
12625 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12629 * "system": "http://hl7.org/fhir/sid/us-npi",
12630 * "value": "11223344554543"
12636 * "use": "official",
12637 * "family": "Smith",
12648 * description="Standard Response",
12650 * mediaType="application/json",
12653 * property="json object",
12654 * description="FHIR Json object.",
12658 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12660 * "versionId": "1",
12661 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12663 * "resourceType": "Practitioner",
12665 * "status": "generated",
12666 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12670 * "system": "http://hl7.org/fhir/sid/us-npi",
12671 * "value": "11223344554543"
12677 * "use": "official",
12678 * "family": "Smith",
12690 * ref="#/components/responses/badrequest"
12694 * ref="#/components/responses/unauthorized"
12696 * security={{"openemr_auth":{}}}
12699 "POST /fhir/Practitioner" => function (HttpRestRequest
$request) {
12700 RestConfig
::authorization_check("admin", "users");
12701 $data = (array) (json_decode(file_get_contents("php://input"), true));
12702 $return = (new FhirPractitionerRestController())->post($data);
12703 RestConfig
::apiLog($return, $data);
12709 * path="/fhir/Practitioner/{uuid}",
12710 * description="Modify a Practitioner resource.",
12715 * description="The uuid for the Practitioner resource.",
12724 * mediaType="application/json",
12726 * description="The json object for the Practitioner resource.",
12730 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12732 * "versionId": "1",
12733 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12735 * "resourceType": "Practitioner",
12737 * "status": "generated",
12738 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12742 * "system": "http://hl7.org/fhir/sid/us-npi",
12743 * "value": "11223344554543"
12749 * "use": "official",
12750 * "family": "Smith",
12761 * description="Standard Response",
12763 * mediaType="application/json",
12767 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12774 * ref="#/components/responses/badrequest"
12778 * ref="#/components/responses/unauthorized"
12780 * security={{"openemr_auth":{}}}
12783 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
12784 RestConfig
::authorization_check("admin", "users");
12785 $data = (array) (json_decode(file_get_contents("php://input"), true));
12786 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12787 RestConfig
::apiLog($return, $data);
12793 * path="/fhir/PractitionerRole",
12794 * description="Returns a list of PractitionerRole resources.",
12799 * description="The uuid for the PractitionerRole resource.",
12806 * name="_lastUpdated",
12808 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
12815 * name="specialty",
12817 * description="The specialty of the PractitionerRole resource.",
12824 * name="practitioner",
12826 * description="The practitioner of the PractitionerRole resource.",
12834 * description="Standard Response",
12836 * mediaType="application/json",
12839 * property="json object",
12840 * description="FHIR Json object.",
12845 * "lastUpdated": "2021-09-14T09:13:51"
12847 * "resourceType": "Bundle",
12848 * "type": "collection",
12852 * "relation": "self",
12853 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12862 * ref="#/components/responses/badrequest"
12866 * ref="#/components/responses/unauthorized"
12868 * security={{"openemr_auth":{}}}
12871 "GET /fhir/PractitionerRole" => function (HttpRestRequest
$request) {
12872 RestConfig
::authorization_check("admin", "users");
12873 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12874 RestConfig
::apiLog($return);
12880 * path="/fhir/PractitionerRole/{uuid}",
12881 * description="Returns a single PractitionerRole resource.",
12886 * description="The uuid for the PractitionerRole resource.",
12894 * description="Standard Response",
12896 * mediaType="application/json",
12899 * property="json object",
12900 * description="FHIR Json object.",
12904 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12906 * "versionId": "1",
12907 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12909 * "resourceType": "PractitionerRole",
12910 * "practitioner": {
12911 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12912 * "display": "Administrator Administrator"
12914 * "organization": {
12915 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12916 * "display": "Your Clinic Name Here"
12923 * "text": "Psychoanalyst"
12929 * "text": "Counselor"
12938 * ref="#/components/responses/badrequest"
12942 * ref="#/components/responses/unauthorized"
12946 * ref="#/components/responses/uuidnotfound"
12948 * security={{"openemr_auth":{}}}
12951 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest
$request) {
12952 RestConfig
::authorization_check("admin", "users");
12953 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12954 RestConfig
::apiLog($return);
12960 * path="/fhir/Procedure",
12961 * description="Returns a list of Procedure resources.",
12966 * description="The uuid for the Procedure resource.",
12973 * name="_lastUpdated",
12975 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
12984 * description="The uuid for the patient.",
12993 * description="The datetime of the Procedure resource.",
13001 * description="Standard Response",
13003 * mediaType="application/json",
13006 * property="json object",
13007 * description="FHIR Json object.",
13012 * "lastUpdated": "2021-09-14T09:13:51"
13014 * "resourceType": "Bundle",
13015 * "type": "collection",
13019 * "relation": "self",
13020 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
13029 * ref="#/components/responses/badrequest"
13033 * ref="#/components/responses/unauthorized"
13035 * security={{"openemr_auth":{}}}
13038 "GET /fhir/Procedure" => function (HttpRestRequest
$request) {
13039 if ($request->isPatientRequest()) {
13040 // only allow access to data of binded patient
13041 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
13043 RestConfig
::authorization_check("patients", "med");
13044 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
13046 RestConfig
::apiLog($return);
13052 * path="/fhir/Procedure/{uuid}",
13053 * description="Returns a single Procedure resource.",
13058 * description="The uuid for the Procedure resource.",
13066 * description="Standard Response",
13068 * mediaType="application/json",
13071 * property="json object",
13072 * description="FHIR Json object.",
13076 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
13078 * "versionId": "1",
13079 * "lastUpdated": "2022-03-26T17:20:14+00:00"
13081 * "resourceType": "Procedure",
13082 * "status": "in-progress",
13084 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
13085 * "type": "Patient"
13093 * ref="#/components/responses/badrequest"
13097 * ref="#/components/responses/unauthorized"
13101 * ref="#/components/responses/uuidnotfound"
13103 * security={{"openemr_auth":{}}}
13106 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest
$request) {
13107 if ($request->isPatientRequest()) {
13108 // only allow access to data of binded patient
13109 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
13111 RestConfig
::authorization_check("patients", "med");
13112 $return = (new FhirProcedureRestController())->getOne($uuid);
13114 RestConfig
::apiLog($return);
13120 * path="/fhir/Provenance/{uuid}",
13121 * description="Returns a single Provenance resource.",
13126 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
13134 * description="Standard Response",
13136 * mediaType="application/json",
13139 * property="json object",
13140 * description="FHIR Json object.",
13144 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
13145 * "resourceType": "Provenance",
13148 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
13149 * "type": "AllergyIntolerance"
13152 * "recorded": "2022-03-26T22:43:30+00:00",
13158 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
13159 * "code": "author",
13160 * "display": "Author"
13165 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
13166 * "type": "Organization"
13169 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
13170 * "type": "Organization"
13177 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
13178 * "code": "transmitter",
13179 * "display": "Transmitter"
13185 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
13186 * "type": "Organization"
13189 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
13190 * "type": "Organization"
13199 * ref="#/components/responses/badrequest"
13203 * ref="#/components/responses/unauthorized"
13207 * ref="#/components/responses/uuidnotfound"
13209 * security={{"openemr_auth":{}}}
13212 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest
$request) {
13213 if ($request->isPatientRequest()) {
13214 // only allow access to data of binded patient
13215 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
13217 RestConfig
::authorization_check("admin", "super");
13218 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
13220 RestConfig
::apiLog($return);
13226 * path="/fhir/Provenance",
13227 * description="Returns a list of Provenance resources.",
13232 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
13240 * description="Standard Response",
13242 * mediaType="application/json",
13245 * property="json object",
13246 * description="FHIR Json object.",
13251 * "lastUpdated": "2021-09-14T09:13:51"
13253 * "resourceType": "Bundle",
13254 * "type": "collection",
13258 * "relation": "self",
13259 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
13268 * ref="#/components/responses/badrequest"
13272 * ref="#/components/responses/unauthorized"
13274 * security={{"openemr_auth":{}}}
13277 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
13278 // property to support which is why this endpoint exists.
13279 "GET /fhir/Provenance" => function (HttpRestRequest
$request) {
13280 if ($request->isPatientRequest()) {
13281 // only allow access to data of binded patient
13282 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
13284 // TODO: it seems like regular users should be able to grab authorship / provenance information
13285 RestConfig
::authorization_check("admin", "super");
13286 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
13288 RestConfig
::apiLog($return);
13294 * path="/fhir/ValueSet",
13295 * description="Returns a list of ValueSet resources.",
13300 * description="The uuid for the ValueSet resource.",
13307 * name="_lastUpdated",
13309 * description="Allows filtering resources by the _lastUpdated field. A FHIR Instant value in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. See FHIR date/time modifiers for filtering options (ge,gt,le, etc)",
13317 * description="Standard Response",
13319 * mediaType="application/json",
13322 * property="json object",
13323 * description="FHIR Json object.",
13328 * "lastUpdated": "2021-09-14T09:13:51"
13330 * "resourceType": "Bundle",
13331 * "type": "collection",
13335 * "relation": "self",
13336 * "url": "https://localhost:9300/apis/default/fhir/ValueSet"
13345 * ref="#/components/responses/badrequest"
13349 * ref="#/components/responses/unauthorized"
13351 * security={{"openemr_auth":{}}}
13354 "GET /fhir/ValueSet" => function (HttpRestRequest
$request) {
13355 RestConfig
::authorization_check("admin", "super");
13356 $return = (new FhirValueSetRestController())->getAll($request->getQueryParams());
13357 RestConfig
::apiLog($return);
13363 * path="/fhir/ValueSet/{uuid}",
13364 * description="Returns a single ValueSet resource.",
13369 * description="The uuid for the ValueSet resource.",
13377 * description="Standard Response",
13379 * mediaType="application/json",
13382 * property="json object",
13383 * description="FHIR Json object.",
13387 * "resourceType": "ValueSet",
13388 * "id": "appointment-type",
13394 * "code": "no_show",
13395 * "display": "No Show"
13398 * "code": "office_visit",
13399 * "display": "Office Visit"
13402 * "code": "established_patient",
13403 * "display": "Established Patient"
13406 * "code": "new_patient",
13407 * "display": "New Patient"
13410 * "code": "health_and_behavioral_assessment",
13411 * "display": "Health and Behavioral Assessment"
13414 * "code": "preventive_care_services",
13415 * "display": "Preventive Care Services"
13418 * "code": "ophthalmological_services",
13419 * "display": "Ophthalmological Services"
13431 * ref="#/components/responses/badrequest"
13435 * ref="#/components/responses/unauthorized"
13439 * ref="#/components/responses/uuidnotfound"
13441 * security={{"openemr_auth":{}}}
13444 "GET /fhir/ValueSet/:uuid" => function ($uuid, HttpRestRequest
$request) {
13445 RestConfig
::authorization_check("admin", "super");
13446 $return = (new FhirValueSetRestController())->getOne($uuid);
13447 RestConfig
::apiLog($return);
13455 * path="/fhir/metadata",
13456 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
13460 * description="Return CapabilityStatement resource of the fhir server"
13464 "GET /fhir/metadata" => function () {
13465 $return = (new FhirMetaDataRestController())->getMetaData();
13466 RestConfig
::apiLog($return);
13472 * path="/fhir/.well-known/smart-configuration",
13473 * description="Returns smart configuration of the fhir server.",
13477 * description="Return smart configuration of the fhir server"
13481 "GET /fhir/.well-known/smart-configuration" => function () {
13482 $authController = new \OpenEMR\RestControllers\
AuthorizationController();
13483 $return = (new \OpenEMR\RestControllers\SMART\
SMARTConfigurationController($authController))->getConfig();
13484 RestConfig
::apiLog($return);
13490 * path="/fhir/OperationDefinition",
13491 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
13495 * description="Return list of OperationDefinition resources"
13499 "GET /fhir/OperationDefinition" => function (HttpRestRequest
$request) {
13500 // for now we will just hard code the custom resources
13501 $operationDefinitionController = new FhirOperationDefinitionRestController();
13502 $return = $operationDefinitionController->getAll($request->getQueryParams());
13503 RestConfig
::apiLog($return);
13509 * path="/fhir/OperationDefinition/{operation}",
13510 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
13513 * name="operation",
13515 * description="The name of the operation to query. For example $bulkdata-status",
13523 * description="Standard Response",
13525 * mediaType="application/json",
13528 * property="json object",
13529 * description="FHIR Json object.",
13533 * "resourceType": "OperationDefinition",
13534 * "name": "$bulkdata-status",
13535 * "status": "active",
13536 * "kind": "operation",
13544 * "system": "http://hl7.org/fhir/data-types",
13545 * "code": "string",
13546 * "display": "string"
13549 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13550 * "code": "string",
13551 * "display": "string"
13561 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest
$request) {
13562 // for now we will just hard code the custom resources
13563 $operationDefinitionController = new FhirOperationDefinitionRestController();
13564 $return = $operationDefinitionController->getOne($operation);
13565 RestConfig
::apiLog($return);
13569 // FHIR root level operations
13573 * path="/fhir/$export",
13574 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
13578 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
13582 * ref="#/components/responses/badrequest"
13586 * ref="#/components/responses/unauthorized"
13588 * security={{"openemr_auth":{}}}
13591 'GET /fhir/$export' => function (HttpRestRequest
$request) {
13592 RestConfig
::authorization_check("admin", "users");
13593 $fhirExportService = new FhirOperationExportRestController($request);
13594 $return = $fhirExportService->processExport(
13595 $request->getQueryParams(),
13597 $request->getHeader('Accept')[0] ??
'',
13598 $request->getHeader('Prefer')[0] ??
''
13600 RestConfig
::apiLog($return);
13604 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13605 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13606 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13610 * path="/fhir/$bulkdata-status",
13611 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
13615 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
13619 * ref="#/components/responses/badrequest"
13623 * ref="#/components/responses/unauthorized"
13625 * security={{"openemr_auth":{}}}
13628 'GET /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
13629 RestConfig
::authorization_check("admin", "users");
13630 $jobUuidString = $request->getQueryParam('job');
13631 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13632 // since OpenEMR data is so small we just return the JSON from the database
13633 $fhirExportService = new FhirOperationExportRestController($request);
13634 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13635 RestConfig
::apiLog($return);
13641 * path="/fhir/$bulkdata-status",
13642 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
13646 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
13650 * ref="#/components/responses/badrequest"
13654 * ref="#/components/responses/unauthorized"
13656 * security={{"openemr_auth":{}}}
13659 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
13660 RestConfig
::authorization_check("admin", "users");
13661 $job = $request->getQueryParam('job');
13662 $fhirExportService = new FhirOperationExportRestController($request);
13663 $return = $fhirExportService->processDeleteExportForJob($job);
13664 RestConfig
::apiLog($return);
13669 // Note that the portal (api) route is only for patient role
13670 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13671 RestConfig
::$PORTAL_ROUTE_MAP = array(
13674 * path="/portal/patient",
13675 * description="Returns the patient.",
13676 * tags={"standard-patient"},
13679 * description="Standard response",
13681 * mediaType="application/json",
13682 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13687 * ref="#/components/responses/unauthorized"
13689 * security={{"openemr_auth":{}}}
13692 "GET /portal/patient" => function (HttpRestRequest
$request) {
13693 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13694 RestConfig
::apiLog($return);
13700 * path="/portal/patient/encounter",
13701 * description="Returns encounters for the patient.",
13702 * tags={"standard-patient"},
13705 * ref="#/components/responses/standard"
13709 * ref="#/components/responses/badrequest"
13713 * ref="#/components/responses/unauthorized"
13715 * security={{"openemr_auth":{}}}
13718 "GET /portal/patient/encounter" => function (HttpRestRequest
$request) {
13719 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13720 RestConfig
::apiLog($return);
13726 * path="/portal/patient/encounter/{euuid}",
13727 * description="Returns a selected encounter by its uuid.",
13728 * tags={"standard-patient"},
13732 * description="The uuid for the encounter.",
13740 * ref="#/components/responses/standard"
13744 * ref="#/components/responses/badrequest"
13748 * ref="#/components/responses/unauthorized"
13750 * security={{"openemr_auth":{}}}
13753 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest
$request) {
13754 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13755 RestConfig
::apiLog($return);
13761 * path="/portal/patient/appointment",
13762 * description="Retrieves all appointments for a patient",
13763 * tags={"standard-patient"},
13766 * ref="#/components/responses/standard"
13770 * ref="#/components/responses/badrequest"
13774 * ref="#/components/responses/unauthorized"
13776 * security={{"openemr_auth":{}}}
13779 "GET /portal/patient/appointment" => function (HttpRestRequest
$request) {
13780 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13781 RestConfig
::apiLog($return);
13788 * path="/portal/patient/appointment/{auuid}",
13789 * description="Returns a selected appointment by its uuid.",
13790 * tags={"standard-patient"},
13794 * description="The uuid for the appointment.",
13802 * ref="#/components/responses/standard"
13806 * ref="#/components/responses/badrequest"
13810 * ref="#/components/responses/unauthorized"
13812 * security={{"openemr_auth":{}}}
13815 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest
$request) {
13816 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13817 RestConfig
::apiLog($return);